From 643db84b7f718ab5055fa23b651cb718bae689eb Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 30 Dec 2016 13:55:44 -0500 Subject: [PATCH 0001/1222] Include call to new G4 setup file G4_IR_EIC.C --- macros/g4simulations/Fun4All_G4_EICDetector.C | 9 +++++++-- macros/g4simulations/G4Setup_EICDetector.C | 14 +++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 3adc23342..b81033439 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -97,6 +97,11 @@ int Fun4All_G4_EICDetector( bool do_EEMC_twr = true; bool do_EEMC_cluster = true; + + // Extended IR + bool do_ExtendedIR = true; + + // Other options bool do_dst_compress = false; @@ -117,7 +122,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_svtx,do_preshower,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); + G4Init(do_svtx,do_preshower,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,do_ExtendedIR); 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) @@ -217,7 +222,7 @@ int Fun4All_G4_EICDetector( // Detector description //--------------------- - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll,do_svtx,do_preshower,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); + G4Setup(absorberactive, magfield, TPythia6Decayer::kAll,do_svtx,do_preshower,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,do_ExtendedIR,magfield_rescale); } diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 964f65735..30f848f47 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -16,7 +16,8 @@ void G4Init(bool do_svtx = true, bool do_EEMC = true, bool do_DIRC = true, bool do_RICH = true, - bool do_Aerogel = true + bool do_Aerogel = true, + bool do_ExtendedIR = true ) { // load detector/material macros and execute Init() function @@ -109,6 +110,11 @@ void G4Init(bool do_svtx = true, AerogelInit(); } + if (do_ExtendedIR) + { + gROOT->LoadMacro("G4_IR_EIC.C"); + IRInit(); + } } @@ -131,6 +137,7 @@ int G4Setup(const int absorberactive = 0, const bool do_DIRC = true, const bool do_RICH = true, const bool do_Aerogel = true, + const bool do_ExtendedIR = true, const float magfield_rescale = 1.0) { //--------------- @@ -243,6 +250,11 @@ int G4Setup(const int absorberactive = 0, if ( do_Aerogel ) AerogelSetup(g4Reco); + //---------------------------------------- + // Extended IR + if ( do_ExtendedIR ) + IRSetup(g4Reco); + // sPHENIX forward flux return(s) PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); flux_return_plus->set_int_param("lengthviarapidity",0); From 35a983d1b55bc72b50246bd8beb628639ed9c838 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 30 Dec 2016 13:56:23 -0500 Subject: [PATCH 0002/1222] Add setup macro for extended IR- no functionality yet --- macros/g4simulations/G4_IR_EIC.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 macros/g4simulations/G4_IR_EIC.C diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C new file mode 100644 index 000000000..d6aa89509 --- /dev/null +++ b/macros/g4simulations/G4_IR_EIC.C @@ -0,0 +1,12 @@ + +void IRInit() { + cout << "Call IR Init" << endl; +} + +double IRSetup(PHG4Reco* g4Reco, + const int absorberactive = 0, + int verbosity = 0) { + + cout << "Call IR Setup" << endl; + return 0; +} From 091812506ba734bcd3c572d5eb2adf5f0ae1e8ae Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 30 Dec 2016 14:39:43 -0500 Subject: [PATCH 0003/1222] Read magnet positions from ascii file and place them. Need change this to using parameters and root files --- macros/g4simulations/G4_IR_EIC.C | 54 ++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C index d6aa89509..8eb732c9e 100644 --- a/macros/g4simulations/G4_IR_EIC.C +++ b/macros/g4simulations/G4_IR_EIC.C @@ -1,12 +1,62 @@ void IRInit() { - cout << "Call IR Init" << endl; + } double IRSetup(PHG4Reco* g4Reco, const int absorberactive = 0, int verbosity = 0) { - cout << "Call IR Setup" << endl; + /* Increase world size to fit extended IR magnets */ + g4Reco->SetWorldSizeZ(4000); + + /* Define outer radius for all extneded IR magnets */ + double ir_magnet_outer_radius = 50; + + /* Read IR configuration file- this needs to go somewhere else using parameters and a .root file to store them*/ + string irfile = "linac-ring-proton-magnets-Version3.01-21apr2016.dat"; + ifstream irstream(irfile.c_str()); + + while(!irstream.eof()){ + string str; + getline(irstream, str); + if(str[0] == '#') continue; //for comments + stringstream ss(str); + + string name; + double center_x, center_y, center_z, aperture_radius, length, angle, B, gradient; + + ss >> name >> center_x >> center_y >> center_z >> aperture_radius >> length >> angle >> B >> gradient; + + if ( name == "" ) continue; //for empty lines + + /* convert units from m to cm */ + center_x *= 100; + center_y *= 100; + center_z *= 100; + aperture_radius *= 100; + length *= 100; + + /* Place IR component */ + cout << "New IR component: " << name << " at z = " << center_z << endl; + + string volname = "IRMAGNET_"; + volname.append(name); + + PHG4CylinderSubsystem *ir_magnet_i = new PHG4CylinderSubsystem(volname, 0); + ir_magnet_i->set_int_param("lengthviarapidity",0); + ir_magnet_i->set_double_param("length",length); + ir_magnet_i->set_double_param("radius",aperture_radius); + ir_magnet_i->set_double_param("thickness", ir_magnet_outer_radius - aperture_radius); + ir_magnet_i->set_double_param("place_x",center_x); + ir_magnet_i->set_double_param("place_y",center_y); + ir_magnet_i->set_double_param("place_z",center_z); + ir_magnet_i->set_string_param("material","G4_Fe"); + ir_magnet_i->SetActive(false); + //ir_magnet_i->SuperDetector("FLUXRET_ETA_PLUS"); + ir_magnet_i->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(ir_magnet_i); + } + return 0; } From 050e3a3e54e9dc1e7582434bbf42a719ab09fdf2 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 9 Jan 2017 14:15:09 -0500 Subject: [PATCH 0004/1222] Add macros for extended EIC IR --- macros/g4simulations/Fun4All_G4_EICIR.C | 455 ++++++++++++++++++++++++ macros/g4simulations/G4Setup_EICIR.C | 424 ++++++++++++++++++++++ 2 files changed, 879 insertions(+) create mode 100644 macros/g4simulations/Fun4All_G4_EICIR.C create mode 100644 macros/g4simulations/G4Setup_EICIR.C diff --git a/macros/g4simulations/Fun4All_G4_EICIR.C b/macros/g4simulations/Fun4All_G4_EICIR.C new file mode 100644 index 000000000..a98e62a08 --- /dev/null +++ b/macros/g4simulations/Fun4All_G4_EICIR.C @@ -0,0 +1,455 @@ + +int Fun4All_G4_EICIR( + const int nEvents = 10, + const char * inputFile = "/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal1d/fieldmap/G4Hits_sPHENIX_e-_eta0_16GeV.root", + const char * outputFile = "G4EICIR.root" + ) +{ + //=============== + // 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; + + //====================== + // What to run + //====================== + + bool do_bbc = false; + + bool do_pipe = false; + + bool do_svtx = false; + bool do_svtx_cell = false; + bool do_svtx_track = false; + bool do_svtx_eval = false; + + bool do_preshower = false; + + bool do_cemc = false; + bool do_cemc_cell = false; + bool do_cemc_twr = false; + bool do_cemc_cluster = false; + bool do_cemc_eval = false; + + bool do_hcalin = false; + bool do_hcalin_cell = false; + bool do_hcalin_twr = false; + bool do_hcalin_cluster = false; + bool do_hcalin_eval = false; + + bool do_magnet = false; + + bool do_hcalout = false; + bool do_hcalout_cell = false; + bool do_hcalout_twr = false; + bool do_hcalout_cluster = false; + bool do_hcalout_eval = false; + + bool do_global = false; + bool do_global_fastsim = false; + + bool do_jet_reco = false; + bool do_jet_eval = false; + + bool do_fwd_jet_reco = false; + bool do_fwd_jet_eval = false; + + // EICDetector geometry - barrel + + bool do_DIRC = false; + + // EICDetector geometry - 'hadron' direction + + bool do_FGEM = false; + + bool do_RICH = false; + bool do_Aerogel = false; + + bool do_FEMC = false; + bool do_FEMC_cell = false; + bool do_FEMC_twr = false; + bool do_FEMC_cluster = false; + + bool do_FHCAL = false; + bool do_FHCAL_cell = false; + bool do_FHCAL_twr = false; + bool do_FHCAL_cluster = false; + + + // EICDetector geometry - 'hadron' direction + + bool do_EGEM = false; + + bool do_EEMC = false; + bool do_EEMC_cell = false; + bool do_EEMC_twr = false; + bool do_EEMC_cluster = false; + + bool do_eemc_eval = false; + + // Extended IR + bool do_ExtendedIR = false; + + + // Other options + + 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_EICIR.C"); + G4Init(do_svtx,do_preshower,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,do_ExtendedIR); + + 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 (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-",1); // mu+,e+,proton,pi+,Upsilon + //gen->add_particles("e+",5); // mu-,e-,anti_proton,pi- + gen->add_particles("proton",1); // mu-,e-,anti_proton,pi- + 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,5.0); + } + gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); + gen->set_vertex_size_parameters(0.0,0.0); + gen->set_eta_range(6.0, 6.0); + //gen->set_eta_range(3.0, 3.0); //EICDetector 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(250.0, 250.0); + gen->Embed(1); + gen->Verbosity(0); + se->registerSubsystem(gen); + } + + if (!readhits) + { + //--------------------- + // Detector description + //--------------------- + + G4Setup(absorberactive, magfield, TPythia6Decayer::kAll,do_svtx,do_preshower,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,do_ExtendedIR,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(); + + //----------------- + // 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_eemc_eval) EEMC_Eval("g4eemc_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 (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_preshower , + /*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); + + 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/G4Setup_EICIR.C b/macros/g4simulations/G4Setup_EICIR.C new file mode 100644 index 000000000..02381f9a9 --- /dev/null +++ b/macros/g4simulations/G4Setup_EICIR.C @@ -0,0 +1,424 @@ + +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_preshower = false, + 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, + bool do_ExtendedIR = true + ) { + + // 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+tpc.C"); + SvtxInit(); + } + + if (do_preshower) + { + gROOT->LoadMacro("G4_PreShower.C"); + PreShowerInit(); + } + + 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(); + } + + if (do_ExtendedIR) + { + gROOT->LoadMacro("G4_IR_EIC.C"); + IRInit(); + } + +} + + +int G4Setup(const int absorberactive = 0, + const string &field ="1.5", + const EDecayType decayType = TPythia6Decayer::kAll, + const bool do_svtx = true, + const bool do_preshower = false, + 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 bool do_ExtendedIR = 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 + + 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); + + //---------------------------------------- + // PRESHOWER + + if (do_preshower) radius = PreShower(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); + + //---------------------------------------- + // Extended IR + if ( do_ExtendedIR ) + IRSetup(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"); + } +} From 074517d69c58bcdf13d04120eeea977ab3802d4d Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 10 Jan 2017 16:17:34 -0500 Subject: [PATCH 0005/1222] Add setting if magnet parameters --- macros/g4simulations/G4_IR_EIC.C | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C index 8eb732c9e..50ef593b2 100644 --- a/macros/g4simulations/G4_IR_EIC.C +++ b/macros/g4simulations/G4_IR_EIC.C @@ -43,7 +43,7 @@ double IRSetup(PHG4Reco* g4Reco, string volname = "IRMAGNET_"; volname.append(name); - PHG4CylinderSubsystem *ir_magnet_i = new PHG4CylinderSubsystem(volname, 0); + PHG4BeamlineMagnetSubsystem *ir_magnet_i = new PHG4BeamlineMagnetSubsystem(volname, 0); ir_magnet_i->set_int_param("lengthviarapidity",0); ir_magnet_i->set_double_param("length",length); ir_magnet_i->set_double_param("radius",aperture_radius); @@ -51,7 +51,31 @@ double IRSetup(PHG4Reco* g4Reco, ir_magnet_i->set_double_param("place_x",center_x); ir_magnet_i->set_double_param("place_y",center_y); ir_magnet_i->set_double_param("place_z",center_z); - ir_magnet_i->set_string_param("material","G4_Fe"); + ir_magnet_i->set_string_param("material","G4_Galactic"); + //ir_magnet_i->set_string_param("material","G4_Fe"); + + if ( B != 0 && gradient == 0.0 ) + { + ir_magnet_i->set_string_param("magtype","dipole"); + ir_magnet_i->set_double_param("field_y",B); + + // debug: change field + ir_magnet_i->set_double_param("field_y",B*0.5); + } + else if ( B == 0 && gradient != 0.0 ) + { + ir_magnet_i->set_string_param("magtype","quadrupole"); + ir_magnet_i->set_double_param("fieldgradient",gradient); + + // debug: set gradient to 0 + ir_magnet_i->set_double_param("fieldgradient",0); + } + else + { + cout << "Error in G4_IR_EIC: Could not identify magnet type. Abort." << endl; + return 1; + } + ir_magnet_i->SetActive(false); //ir_magnet_i->SuperDetector("FLUXRET_ETA_PLUS"); ir_magnet_i->OverlapCheck(overlapcheck); From 5d1e882d1b58f70499d0884067aea0839c89070e Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 10 Jan 2017 16:18:09 -0500 Subject: [PATCH 0006/1222] Use PHG4ParticleGun to generate particles parallel to the beam line --- macros/g4simulations/Fun4All_G4_EICIR.C | 174 +++--------------------- 1 file changed, 20 insertions(+), 154 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICIR.C b/macros/g4simulations/Fun4All_G4_EICIR.C index a98e62a08..05d0b4f3e 100644 --- a/macros/g4simulations/Fun4All_G4_EICIR.C +++ b/macros/g4simulations/Fun4All_G4_EICIR.C @@ -22,6 +22,9 @@ int Fun4All_G4_EICIR( const bool runpythia8 = false; const bool runpythia6 = false; + // USe particle gun + const bool pgun = true; + //====================== // What to run //====================== @@ -30,39 +33,37 @@ int Fun4All_G4_EICIR( bool do_pipe = false; + bool do_magnet = true; + + // Extended IR + bool do_ExtendedIR = true; + + //================ + bool do_svtx = false; bool do_svtx_cell = false; bool do_svtx_track = false; bool do_svtx_eval = false; - bool do_preshower = false; - bool do_cemc = false; bool do_cemc_cell = false; bool do_cemc_twr = false; bool do_cemc_cluster = false; bool do_cemc_eval = false; - bool do_hcalin = false; bool do_hcalin_cell = false; bool do_hcalin_twr = false; bool do_hcalin_cluster = false; bool do_hcalin_eval = false; - - bool do_magnet = false; - bool do_hcalout = false; bool do_hcalout_cell = false; bool do_hcalout_twr = false; bool do_hcalout_cluster = false; bool do_hcalout_eval = false; - bool do_global = false; bool do_global_fastsim = false; - bool do_jet_reco = false; bool do_jet_eval = false; - bool do_fwd_jet_reco = false; bool do_fwd_jet_eval = false; @@ -97,18 +98,7 @@ int Fun4All_G4_EICIR( bool do_EEMC_twr = false; bool do_EEMC_cluster = false; - bool do_eemc_eval = false; - - // Extended IR - bool do_ExtendedIR = false; - - - // Other options - - 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 //--------------- @@ -135,7 +125,7 @@ int Fun4All_G4_EICIR( //--------------- Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(0); // uncomment for batch production running with minimal output messages + //se->Verbosity(100); // 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(); @@ -188,6 +178,14 @@ int Fun4All_G4_EICIR( HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); } + else if (pgun) + { + PHG4ParticleGun*gun = new PHG4ParticleGun(); + //gun->set_name("gamma"); + gun->set_name("proton"); + gun->set_mom(0,0,250); + se->registerSubsystem(gun); + } else { // toss low multiplicity dummy events @@ -207,7 +205,7 @@ int Fun4All_G4_EICIR( } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0,0.0); - gen->set_eta_range(6.0, 6.0); + gen->set_eta_range(100.0, 100.0); //gen->set_eta_range(3.0, 3.0); //EICDetector 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); @@ -238,110 +236,6 @@ int Fun4All_G4_EICIR( 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(); - - //----------------- - // 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_eemc_eval) EEMC_Eval("g4eemc_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 //-------------- @@ -367,34 +261,6 @@ int Fun4All_G4_EICIR( 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_preshower , - /*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); From 3d908f5f530a9140626939853982031217fe0fbb Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 10 Jan 2017 16:23:20 -0500 Subject: [PATCH 0007/1222] Skip quadrupoles for debugging --- macros/g4simulations/G4_IR_EIC.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C index 50ef593b2..b392f23f5 100644 --- a/macros/g4simulations/G4_IR_EIC.C +++ b/macros/g4simulations/G4_IR_EIC.C @@ -58,9 +58,6 @@ double IRSetup(PHG4Reco* g4Reco, { ir_magnet_i->set_string_param("magtype","dipole"); ir_magnet_i->set_double_param("field_y",B); - - // debug: change field - ir_magnet_i->set_double_param("field_y",B*0.5); } else if ( B == 0 && gradient != 0.0 ) { @@ -69,6 +66,9 @@ double IRSetup(PHG4Reco* g4Reco, // debug: set gradient to 0 ir_magnet_i->set_double_param("fieldgradient",0); + + // debug: skip quadrupoles + continue; } else { From 82165fc8ac799aa36e93c6f53c3c912455161587 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 15:31:48 -0500 Subject: [PATCH 0008/1222] Add DSTReader and parameter for beam angle --- macros/g4simulations/Fun4All_G4_EICIR.C | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICIR.C b/macros/g4simulations/Fun4All_G4_EICIR.C index 05d0b4f3e..224dff530 100644 --- a/macros/g4simulations/Fun4All_G4_EICIR.C +++ b/macros/g4simulations/Fun4All_G4_EICIR.C @@ -180,10 +180,20 @@ int Fun4All_G4_EICIR( } else if (pgun) { + /* angle of particle phi: + pz = p * cos(psi) + px = p * sin(psi) */ + double psi_mrad = 0; + double ptot = 250*1; + + double px = ptot * sin(psi_mrad / 1000.); + double py = 0; + double pz = ptot * cos(psi_mrad / 1000.); + PHG4ParticleGun*gun = new PHG4ParticleGun(); //gun->set_name("gamma"); gun->set_name("proton"); - gun->set_mom(0,0,250); + gun->set_mom(px,py,pz); se->registerSubsystem(gun); } else @@ -261,6 +271,12 @@ int Fun4All_G4_EICIR( se->registerInputManager( in ); } + //Convert DST to human command readable TTree for quick poke around the outputs + gROOT->LoadMacro("G4_DSTReader_EICIR.C"); + + G4DSTreader_EICIR( outputFile, // + /*int*/ absorberactive ); + //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); //if (do_dst_compress) DstCompress(out); //se->registerOutputManager(out); From 7f13f52bb2fba433c16301017262ec2d3a2afdcf Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 16:07:06 -0500 Subject: [PATCH 0009/1222] Add additional parameters for magnets --- macros/g4simulations/G4_IR_EIC.C | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C index b392f23f5..b0a9459d6 100644 --- a/macros/g4simulations/G4_IR_EIC.C +++ b/macros/g4simulations/G4_IR_EIC.C @@ -4,11 +4,11 @@ void IRInit() { } double IRSetup(PHG4Reco* g4Reco, - const int absorberactive = 0, + const int absorberactive = 1, int verbosity = 0) { /* Increase world size to fit extended IR magnets */ - g4Reco->SetWorldSizeZ(4000); + g4Reco->SetWorldSizeZ(6500); /* Define outer radius for all extneded IR magnets */ double ir_magnet_outer_radius = 50; @@ -37,6 +37,9 @@ double IRSetup(PHG4Reco* g4Reco, aperture_radius *= 100; length *= 100; + /* convert angle from millirad to degrees */ + angle = (angle / 1000.) * (180./TMath::Pi()); + /* Place IR component */ cout << "New IR component: " << name << " at z = " << center_z << endl; @@ -51,8 +54,9 @@ double IRSetup(PHG4Reco* g4Reco, ir_magnet_i->set_double_param("place_x",center_x); ir_magnet_i->set_double_param("place_y",center_y); ir_magnet_i->set_double_param("place_z",center_z); - ir_magnet_i->set_string_param("material","G4_Galactic"); - //ir_magnet_i->set_string_param("material","G4_Fe"); + ir_magnet_i->set_double_param("rot_y",angle); + //ir_magnet_i->set_string_param("material","G4_Galactic"); + ir_magnet_i->set_string_param("material","G4_Fe"); if ( B != 0 && gradient == 0.0 ) { @@ -63,12 +67,6 @@ double IRSetup(PHG4Reco* g4Reco, { ir_magnet_i->set_string_param("magtype","quadrupole"); ir_magnet_i->set_double_param("fieldgradient",gradient); - - // debug: set gradient to 0 - ir_magnet_i->set_double_param("fieldgradient",0); - - // debug: skip quadrupoles - continue; } else { From ace85da862bb999022a26e4a067174702ec2b292 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 16:07:28 -0500 Subject: [PATCH 0010/1222] Switch on black hole in +z direction --- macros/g4simulations/G4Setup_EICIR.C | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICIR.C b/macros/g4simulations/G4Setup_EICIR.C index 02381f9a9..424915519 100644 --- a/macros/g4simulations/G4Setup_EICIR.C +++ b/macros/g4simulations/G4Setup_EICIR.C @@ -295,21 +295,22 @@ int G4Setup(const int absorberactive = 0, // 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); -// + //---------------------------------------- + // 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->set_double_param("place_z",3000); + 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 From 7d5ab1f1f321d3832c3730cb37c29ec2d720da0d Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 16:07:51 -0500 Subject: [PATCH 0011/1222] Add DSTreader --- macros/g4simulations/G4_DSTReader_EICIR.C | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 macros/g4simulations/G4_DSTReader_EICIR.C diff --git a/macros/g4simulations/G4_DSTReader_EICIR.C b/macros/g4simulations/G4_DSTReader_EICIR.C new file mode 100644 index 000000000..d36cbe18d --- /dev/null +++ b/macros/g4simulations/G4_DSTReader_EICIR.C @@ -0,0 +1,44 @@ +////////////////////////////////////////////////////////////////// +/*! + \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_EICIR( const char * outputFile = "G4sPHENIXCells.root",// + int absorberactive = 1 ) +{ + + //! 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) + { + ana->AddNode("BH_FORWARD_PLUS"); + } + + Fun4AllServer *se = Fun4AllServer::instance(); + se->registerSubsystem(ana); +} From de1300e4b58b311e5c8da2d59aac40e00308d02f Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 16:08:28 -0500 Subject: [PATCH 0012/1222] Add example beam line magnet configuration file --- ...nac-ring-proton-magnets-Version3.01-21apr2016.dat | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat diff --git a/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat b/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat new file mode 100644 index 000000000..c95d784c4 --- /dev/null +++ b/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat @@ -0,0 +1,12 @@ +## protons, Draft linac-ring lattice V3.00, E_e = n/a, E_p=249.358GeV +## Source: 21-Apr-2016 from Brett Parker +## +## Notes: this is still a draft version with only the first few forward side magnets +## +## magnet_name1 center_x[m] center_y[m] center_z[m] aperture_radius[m] length[m] angle[mrad] B[T] gradient[T/m] + + Q0HF 0.00500 0.00 5.70 0.041 1.600 -14.0 0.000 129.00 + Q1HF 0.00900 0.00 8.55 0.060 3.000 -14.0 0.000 -86.00 + B0HF 0.00500 0.00 11.40 0.066 1.600 -14.0 4.055 0.00 + Q2HF 0.00955 0.00 13.65 0.077 1.800 7.8 0.000 59.50 + B1HF 0.02261 0.00 16.35 0.092 2.500 -4.0 4.059 0.00 From 454c2cf7385c001862ae80ab932a979c23eb9e72 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 11 Jan 2017 21:51:46 -0500 Subject: [PATCH 0013/1222] Flip sign of mangetic field from input file to Geant4 --- macros/g4simulations/G4_IR_EIC.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C index b0a9459d6..393f7e244 100644 --- a/macros/g4simulations/G4_IR_EIC.C +++ b/macros/g4simulations/G4_IR_EIC.C @@ -37,6 +37,11 @@ double IRSetup(PHG4Reco* g4Reco, aperture_radius *= 100; length *= 100; + /* flip sign of dipole field component- positive y axis in Geant4 is defined as 'up', + * positive z axis as the hadron-going direction + * in a right-handed coordinate system x,y,z */ + B *= -1; + /* convert angle from millirad to degrees */ angle = (angle / 1000.) * (180./TMath::Pi()); From 0bf9bf7082daeb9de47fc1616f6d47db45323e01 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 31 Jan 2017 13:49:00 -0500 Subject: [PATCH 0014/1222] Switch on flux return --- macros/g4simulations/G4Setup_EICIR.C | 50 ++++++++++++++-------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICIR.C b/macros/g4simulations/G4Setup_EICIR.C index 424915519..98ebffe91 100644 --- a/macros/g4simulations/G4Setup_EICIR.C +++ b/macros/g4simulations/G4Setup_EICIR.C @@ -255,31 +255,31 @@ int G4Setup(const int absorberactive = 0, if ( do_ExtendedIR ) IRSetup(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); -// + // 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 // From 6bb469bda142095f53e7703ebe32ac928b5b4337 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 6 Sep 2017 11:21:57 -0400 Subject: [PATCH 0015/1222] add meta-lib that link to other necessary libs containing objects used DST files --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 7d4b221a7..3a80bf797 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -400,6 +400,9 @@ int Fun4All_G4_sPHENIX( if (readhits) { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + // Hits file Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); hitsin->fileopen(inputFile); @@ -413,6 +416,9 @@ int Fun4All_G4_sPHENIX( exit(3); } + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + 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 @@ -420,6 +426,9 @@ int Fun4All_G4_sPHENIX( } if (readhepmc) { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); se->registerInputManager( in ); se->fileopen( in->Name().c_str(), inputFile ); From 74b5698e2769acbea97bf5e37507fe8a8d584c15 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 14 Sep 2017 12:37:22 -0400 Subject: [PATCH 0016/1222] Revert "Merge branch 'eRhicIR' into master" This reverts commit b155ac713578ae4f440519fac45c7a3746e80cf4, reversing changes made to f9c916f4b273a68da827b8d08361461432d3dcc0. --- macros/g4simulations/Fun4All_G4_EICDetector.C | 10 +- macros/g4simulations/Fun4All_G4_EICIR.C | 337 -------------- macros/g4simulations/G4Setup_EICDetector.C | 16 +- macros/g4simulations/G4Setup_EICIR.C | 425 ------------------ macros/g4simulations/G4_DSTReader_EICIR.C | 44 -- macros/g4simulations/G4_IR_EIC.C | 89 ---- ...g-proton-magnets-Version3.01-21apr2016.dat | 12 - 7 files changed, 5 insertions(+), 928 deletions(-) delete mode 100644 macros/g4simulations/Fun4All_G4_EICIR.C delete mode 100644 macros/g4simulations/G4Setup_EICIR.C delete mode 100644 macros/g4simulations/G4_DSTReader_EICIR.C delete mode 100644 macros/g4simulations/G4_IR_EIC.C delete mode 100644 macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 4ab469720..66df27db1 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -116,11 +116,6 @@ int Fun4All_G4_EICDetector( bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; - - // Extended IR - bool do_ExtendedIR = true; - - // Other options bool do_global = true; bool do_global_fastsim = false; @@ -158,7 +153,7 @@ int Fun4All_G4_EICDetector( // 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,do_ExtendedIR); + 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) @@ -385,7 +380,8 @@ int Fun4All_G4_EICDetector( 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, - do_ExtendedIR,magfield_rescale); + magfield_rescale); + } //--------- diff --git a/macros/g4simulations/Fun4All_G4_EICIR.C b/macros/g4simulations/Fun4All_G4_EICIR.C deleted file mode 100644 index 224dff530..000000000 --- a/macros/g4simulations/Fun4All_G4_EICIR.C +++ /dev/null @@ -1,337 +0,0 @@ - -int Fun4All_G4_EICIR( - const int nEvents = 10, - const char * inputFile = "/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal1d/fieldmap/G4Hits_sPHENIX_e-_eta0_16GeV.root", - const char * outputFile = "G4EICIR.root" - ) -{ - //=============== - // 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; - - // USe particle gun - const bool pgun = true; - - //====================== - // What to run - //====================== - - bool do_bbc = false; - - bool do_pipe = false; - - bool do_magnet = true; - - // Extended IR - bool do_ExtendedIR = true; - - //================ - - bool do_svtx = false; - bool do_svtx_cell = false; - bool do_svtx_track = false; - bool do_svtx_eval = false; - bool do_preshower = false; - bool do_cemc = false; - bool do_cemc_cell = false; - bool do_cemc_twr = false; - bool do_cemc_cluster = false; - bool do_cemc_eval = false; - bool do_hcalin = false; - bool do_hcalin_cell = false; - bool do_hcalin_twr = false; - bool do_hcalin_cluster = false; - bool do_hcalin_eval = false; - bool do_hcalout = false; - bool do_hcalout_cell = false; - bool do_hcalout_twr = false; - bool do_hcalout_cluster = false; - bool do_hcalout_eval = false; - bool do_global = false; - bool do_global_fastsim = false; - bool do_jet_reco = false; - bool do_jet_eval = false; - bool do_fwd_jet_reco = false; - bool do_fwd_jet_eval = false; - - // EICDetector geometry - barrel - - bool do_DIRC = false; - - // EICDetector geometry - 'hadron' direction - - bool do_FGEM = false; - - bool do_RICH = false; - bool do_Aerogel = false; - - bool do_FEMC = false; - bool do_FEMC_cell = false; - bool do_FEMC_twr = false; - bool do_FEMC_cluster = false; - - bool do_FHCAL = false; - bool do_FHCAL_cell = false; - bool do_FHCAL_twr = false; - bool do_FHCAL_cluster = false; - - - // EICDetector geometry - 'hadron' direction - - bool do_EGEM = false; - - bool do_EEMC = false; - bool do_EEMC_cell = false; - bool do_EEMC_twr = false; - bool do_EEMC_cluster = 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_EICIR.C"); - G4Init(do_svtx,do_preshower,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,do_ExtendedIR); - - 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(100); // 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 (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 if (pgun) - { - /* angle of particle phi: - pz = p * cos(psi) - px = p * sin(psi) */ - double psi_mrad = 0; - double ptot = 250*1; - - double px = ptot * sin(psi_mrad / 1000.); - double py = 0; - double pz = ptot * cos(psi_mrad / 1000.); - - PHG4ParticleGun*gun = new PHG4ParticleGun(); - //gun->set_name("gamma"); - gun->set_name("proton"); - gun->set_mom(px,py,pz); - se->registerSubsystem(gun); - } - else - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - //gen->add_particles("e-",1); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("e+",5); // mu-,e-,anti_proton,pi- - gen->add_particles("proton",1); // mu-,e-,anti_proton,pi- - 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,5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0,0.0); - gen->set_eta_range(100.0, 100.0); - //gen->set_eta_range(3.0, 3.0); //EICDetector 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(250.0, 250.0); - gen->Embed(1); - gen->Verbosity(0); - se->registerSubsystem(gen); - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll,do_svtx,do_preshower,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,do_ExtendedIR,magfield_rescale); - - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - - //-------------- - // 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 ); - } - - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader_EICIR.C"); - - G4DSTreader_EICIR( outputFile, // - /*int*/ absorberactive ); - - //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/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 6e04217c4..e6453f717 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -16,9 +16,8 @@ void G4Init(bool do_svtx = true, bool do_DIRC = true, bool do_RICH = true, bool do_Aerogel = true, - int n_TPC_layers = 40, - bool do_ExtendedIR = true - ) { + int n_TPC_layers = 40) +{ // load detector/material macros and execute Init() function @@ -104,11 +103,6 @@ void G4Init(bool do_svtx = true, AerogelInit(); } - if (do_ExtendedIR) - { - gROOT->LoadMacro("G4_IR_EIC.C"); - IRInit(); - } } @@ -130,7 +124,6 @@ int G4Setup(const int absorberactive = 0, const bool do_DIRC = true, const bool do_RICH = true, const bool do_Aerogel = true, - const bool do_ExtendedIR = true, const float magfield_rescale = 1.0) { //--------------- @@ -241,11 +234,6 @@ int G4Setup(const int absorberactive = 0, if ( do_Aerogel ) AerogelSetup(g4Reco); - //---------------------------------------- - // Extended IR - if ( do_ExtendedIR ) - IRSetup(g4Reco); - // sPHENIX forward flux return(s) PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); flux_return_plus->set_int_param("lengthviarapidity",0); diff --git a/macros/g4simulations/G4Setup_EICIR.C b/macros/g4simulations/G4Setup_EICIR.C deleted file mode 100644 index 98ebffe91..000000000 --- a/macros/g4simulations/G4Setup_EICIR.C +++ /dev/null @@ -1,425 +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_preshower = false, - 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, - bool do_ExtendedIR = true - ) { - - // 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+tpc.C"); - SvtxInit(); - } - - if (do_preshower) - { - gROOT->LoadMacro("G4_PreShower.C"); - PreShowerInit(); - } - - 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(); - } - - if (do_ExtendedIR) - { - gROOT->LoadMacro("G4_IR_EIC.C"); - IRInit(); - } - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_preshower = false, - 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 bool do_ExtendedIR = 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 - - 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); - - //---------------------------------------- - // PRESHOWER - - if (do_preshower) radius = PreShower(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); - - //---------------------------------------- - // Extended IR - if ( do_ExtendedIR ) - IRSetup(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->set_double_param("place_z",3000); - 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/G4_DSTReader_EICIR.C b/macros/g4simulations/G4_DSTReader_EICIR.C deleted file mode 100644 index d36cbe18d..000000000 --- a/macros/g4simulations/G4_DSTReader_EICIR.C +++ /dev/null @@ -1,44 +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_EICIR( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1 ) -{ - - //! 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) - { - ana->AddNode("BH_FORWARD_PLUS"); - } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_IR_EIC.C b/macros/g4simulations/G4_IR_EIC.C deleted file mode 100644 index 393f7e244..000000000 --- a/macros/g4simulations/G4_IR_EIC.C +++ /dev/null @@ -1,89 +0,0 @@ - -void IRInit() { - -} - -double IRSetup(PHG4Reco* g4Reco, - const int absorberactive = 1, - int verbosity = 0) { - - /* Increase world size to fit extended IR magnets */ - g4Reco->SetWorldSizeZ(6500); - - /* Define outer radius for all extneded IR magnets */ - double ir_magnet_outer_radius = 50; - - /* Read IR configuration file- this needs to go somewhere else using parameters and a .root file to store them*/ - string irfile = "linac-ring-proton-magnets-Version3.01-21apr2016.dat"; - ifstream irstream(irfile.c_str()); - - while(!irstream.eof()){ - string str; - getline(irstream, str); - if(str[0] == '#') continue; //for comments - stringstream ss(str); - - string name; - double center_x, center_y, center_z, aperture_radius, length, angle, B, gradient; - - ss >> name >> center_x >> center_y >> center_z >> aperture_radius >> length >> angle >> B >> gradient; - - if ( name == "" ) continue; //for empty lines - - /* convert units from m to cm */ - center_x *= 100; - center_y *= 100; - center_z *= 100; - aperture_radius *= 100; - length *= 100; - - /* flip sign of dipole field component- positive y axis in Geant4 is defined as 'up', - * positive z axis as the hadron-going direction - * in a right-handed coordinate system x,y,z */ - B *= -1; - - /* convert angle from millirad to degrees */ - angle = (angle / 1000.) * (180./TMath::Pi()); - - /* Place IR component */ - cout << "New IR component: " << name << " at z = " << center_z << endl; - - string volname = "IRMAGNET_"; - volname.append(name); - - PHG4BeamlineMagnetSubsystem *ir_magnet_i = new PHG4BeamlineMagnetSubsystem(volname, 0); - ir_magnet_i->set_int_param("lengthviarapidity",0); - ir_magnet_i->set_double_param("length",length); - ir_magnet_i->set_double_param("radius",aperture_radius); - ir_magnet_i->set_double_param("thickness", ir_magnet_outer_radius - aperture_radius); - ir_magnet_i->set_double_param("place_x",center_x); - ir_magnet_i->set_double_param("place_y",center_y); - ir_magnet_i->set_double_param("place_z",center_z); - ir_magnet_i->set_double_param("rot_y",angle); - //ir_magnet_i->set_string_param("material","G4_Galactic"); - ir_magnet_i->set_string_param("material","G4_Fe"); - - if ( B != 0 && gradient == 0.0 ) - { - ir_magnet_i->set_string_param("magtype","dipole"); - ir_magnet_i->set_double_param("field_y",B); - } - else if ( B == 0 && gradient != 0.0 ) - { - ir_magnet_i->set_string_param("magtype","quadrupole"); - ir_magnet_i->set_double_param("fieldgradient",gradient); - } - else - { - cout << "Error in G4_IR_EIC: Could not identify magnet type. Abort." << endl; - return 1; - } - - ir_magnet_i->SetActive(false); - //ir_magnet_i->SuperDetector("FLUXRET_ETA_PLUS"); - ir_magnet_i->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(ir_magnet_i); - } - - return 0; -} diff --git a/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat b/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat deleted file mode 100644 index c95d784c4..000000000 --- a/macros/g4simulations/linac-ring-proton-magnets-Version3.01-21apr2016.dat +++ /dev/null @@ -1,12 +0,0 @@ -## protons, Draft linac-ring lattice V3.00, E_e = n/a, E_p=249.358GeV -## Source: 21-Apr-2016 from Brett Parker -## -## Notes: this is still a draft version with only the first few forward side magnets -## -## magnet_name1 center_x[m] center_y[m] center_z[m] aperture_radius[m] length[m] angle[mrad] B[T] gradient[T/m] - - Q0HF 0.00500 0.00 5.70 0.041 1.600 -14.0 0.000 129.00 - Q1HF 0.00900 0.00 8.55 0.060 3.000 -14.0 0.000 -86.00 - B0HF 0.00500 0.00 11.40 0.066 1.600 -14.0 4.055 0.00 - Q2HF 0.00955 0.00 13.65 0.077 1.800 7.8 0.000 59.50 - B1HF 0.02261 0.00 16.35 0.092 2.500 -4.0 4.059 0.00 From 8195b03614eb2e2124baa9c0ef67dfec649c6b5b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 Sep 2017 16:34:11 -0400 Subject: [PATCH 0017/1222] remove duplicate cyl declaration - root6 barfs --- macros/g4simulations/G4_Pipe.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index 195902057..f129903ba 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -34,7 +34,7 @@ double Pipe(PHG4Reco* g4Reco, if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem( cyl ); - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); + 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); From 229ca0b9a50e949087cacf326f63b3d3508f5611 Mon Sep 17 00:00:00 2001 From: HaiwangYu Date: Mon, 18 Sep 2017 10:01:20 -0400 Subject: [PATCH 0018/1222] substitute PHG4SvtxTrackProjection with PHG4GenFitTrackProjection --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index 527ec13d6..e55a9c33a 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -487,9 +487,9 @@ void Svtx_Reco(int verbosity = 0) //------------------ // Track Projections //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); + PHG4GenFitTrackProjection *projection = new PHG4GenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem( projection ); /* //---------------------- From 0c6d552ab63a2ad1de1cdf14c990096daace1d34 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 19 Sep 2017 22:35:56 -0400 Subject: [PATCH 0019/1222] Change TPC gas to Ne:CF4 (90:10) --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 index e55a9c33a..bf20201a5 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -151,8 +151,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, double inner_readout_radius = 30.; if (inner_readout_radius 0) { From a1cacf548dcf761ce191cab89062f93a25476c69 Mon Sep 17 00:00:00 2001 From: pinkenburg Date: Wed, 20 Sep 2017 10:46:04 -0400 Subject: [PATCH 0020/1222] Update G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C fixing typo - the material is defined in g4main/PHG4Reco.cc in DefineMaterials() --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index bf20201a5..721228303 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -151,7 +151,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, double inner_readout_radius = 30.; if (inner_readout_radius 0) { From 4dcfcee1dab4c9be7a3d14d428b8a20b61e1d38c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 Sep 2017 23:06:01 -0400 Subject: [PATCH 0021/1222] update with new default parameter settings in hcals --- macros/g4simulations/G4_HcalIn_ref.C | 55 +++++++++++++--------- macros/g4simulations/G4_HcalOut_ref.C | 66 +++++++++++++++------------ 2 files changed, 70 insertions(+), 51 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index ae2ca3d0e..cb8f89bfc 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -27,29 +27,40 @@ double HCalInner(PHG4Reco* g4Reco, 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->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("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->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", NAN); // default is 4 crossinge, angle is calculated from this + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("ncross", 4); + // 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) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 1ed5be01a..b0ca750e9 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -11,35 +11,43 @@ double HCalOuter(PHG4Reco* g4Reco, 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->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", 264.71); + // 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", 304.91 * 2); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", NAN); // default is 5 crossings + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("magnet_cutout_first_scinti", 8); // tile start at 0, drawing tile starts at 1 + // hcal->set_int_param("ncross", -5); + // 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"); From 920cf90287b322154851cc10000622beaa0b4685 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 Sep 2017 15:38:32 -0400 Subject: [PATCH 0022/1222] update commented out default for ncross and tilt angle --- macros/g4simulations/G4_HcalIn_ref.C | 4 ++-- macros/g4simulations/G4_HcalOut_ref.C | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index cb8f89bfc..6bb819174 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -51,10 +51,10 @@ double HCalInner(PHG4Reco* g4Reco, // 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", NAN); // default is 4 crossinge, angle is calculated from this + // hcal->set_double_param("tilt_angle", 36.15); // hcal->set_int_param("light_scint_model", 1); - // hcal->set_int_param("ncross", 4); + // 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); diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index b0ca750e9..e3f5d4575 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -37,11 +37,11 @@ double HCalOuter(PHG4Reco* g4Reco, // hcal->set_double_param("scinti_tile_thickness", 0.7); // hcal->set_double_param("size_z", 304.91 * 2); // hcal->set_double_param("steplimits", NAN); - // hcal->set_double_param("tilt_angle", NAN); // default is 5 crossings + // 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); // tile start at 0, drawing tile starts at 1 - // hcal->set_int_param("ncross", -5); + // 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); From 09911626783327ad957eff165f09cfb3c049c843 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 Sep 2017 22:58:53 -0400 Subject: [PATCH 0023/1222] implement new tpc --- macros/g4simulations/G4_TPC.C | 310 ++++++++-------------------------- 1 file changed, 72 insertions(+), 238 deletions(-) diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index 352645bee..0999f3a58 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -1,247 +1,81 @@ -//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; - } +void TPCInit() {} - //=== 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; - } +double TPC(PHG4Reco* g4Reco, + double radius, + const int absorberactive = 0, + int verbosity = 0) { - //=== 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; + overlappcheck = 1; + if (radius > 21-1.17) { + cout << "inconsistency: radius: " << radius + << " larger than tpc inner radius: " << 21-1.17 << endl; + gSystem->Exit(-1); } - - //=== 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); + + gSystem->Load("libg4tpc.so"); + gSystem->Load("libg4testbench.so"); + + PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("TPC"); + // tpc_set_double_param("gas_inner_radius",21.); + // tpc_set_double_param("gas_outer_radius",77.); + // tpc_set_double_param("place_x", 0.); + // tpc_set_double_param("place_y", 0.); + // tpc_set_double_param("place_z", 0.); + // tpc_set_double_param("rot_x", 0.); + // tpc_set_double_param("rot_y", 0.); + // tpc_set_double_param("rot_z", 0.); + // tpc_set_double_param("tpc_length",211.); + + // tpc_set_double_param("steplimits", NAN); + + // tpc_set_string_param("tpc_gas", "sPHENIX_TPC_Gas"); + +// material budget: +// Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2. +// Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286 +// 250 um FR4 (Substrate for Cu layers) +// HoneyComb (nomex) 1/2 inch=0.5*2.54 cm + // tpc_set_string_param("cage_layer_1_material","G4_Cu"); + // tpc_set_double_param("cage_layer_1_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_2_material","FR4"); + // tpc_set_double_param("cage_layer_2_thickness",0.025); + + // tpc_set_string_param("cage_layer_3_material","NOMEX"); + // tpc_set_double_param("cage_layer_3_thickness",0.5*2.54); + + // tpc_set_string_param("cage_layer_4_material","G4_Cu"); + // tpc_set_double_param("cage_layer_4_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_5_material","FR4"); + // tpc_set_double_param("cage_layer_5_thickness",0.025); + + // tpc_set_string_param("cage_layer_6_material","G4_KAPTON"); + // tpc_set_double_param("cage_layer_6_thickness",0.2286); + + // tpc_set_string_param("cage_layer_7_material","G4_Cu"); + // tpc_set_double_param("cage_layer_7_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_8_material","G4_KAPTON"); + // tpc_set_double_param("cage_layer_8_thickness",0.05); // 50 um + + // tpc_set_string_param("cage_layer_9_material","G4_Cu"); + // tpc_set_double_param("cage_layer_9_thickness",0.00347/2.); + if (absorberactive) + { + tpc->SetAbsorberActive(); } - 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); + tpc->OverlapCheck(overlapcheck); - if(verbosity>0) { - for(int i=0; i!=TPC_GAS_LAYERS; ++i) - cout << "Added TPC layer " << i << " starting at " << TPC_RI[i] << " cm." << endl; - } + g4Reco->registerSubsystem( tpc ); - 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; -} + radius = 77.+1.17; + -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; + radius += no_overlapp; + + return radius; } From fa4868a3d2166962fdd627ebc62212276218dd34 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 15 Oct 2017 23:07:07 -0400 Subject: [PATCH 0024/1222] use the default timing window --- macros/g4simulations/G4_CEmc_Spacal.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 412b7de72..e920c5980 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -257,8 +257,7 @@ void CEMC_Cells(int verbosity = 0) // 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); } @@ -267,7 +266,6 @@ void CEMC_Cells(int verbosity = 0) 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"); From bbc8b0532ffeb4bc261069f0b55a9199f012ba33 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 16 Oct 2017 15:27:31 -0400 Subject: [PATCH 0025/1222] always run HepMCNodeReader to simulate all available HepMC events in a Geant4 cycle --- macros/g4simulations/Fun4All_G4_EICDetector.C | 20 +------------------ macros/g4simulations/Fun4All_G4_fsPHENIX.C | 11 +--------- macros/g4simulations/Fun4All_G4_sPHENIX.C | 11 +--------- macros/g4simulations/G4Setup_EICDetector.C | 4 ++++ macros/g4simulations/G4Setup_fsPHENIX.C | 4 ++++ macros/g4simulations/G4Setup_sPHENIX.C | 4 ++++ 6 files changed, 15 insertions(+), 39 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 66df27db1..0a42ee8b6 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -191,10 +191,7 @@ int Fun4All_G4_EICDetector( } 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); + // action is performed in later stage at the input manager level } else if (readeictree) { @@ -203,9 +200,6 @@ int Fun4All_G4_EICDetector( eicr->OpenInputFile(inputFile); se->registerSubsystem(eicr); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); } else if (runpythia8) { @@ -215,9 +209,6 @@ int Fun4All_G4_EICDetector( // 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) { @@ -227,9 +218,6 @@ int Fun4All_G4_EICDetector( // 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) { @@ -242,9 +230,6 @@ int Fun4All_G4_EICDetector( hepgen->set_momentum_electron(-20); hepgen->set_momentum_hadron(250); se->registerSubsystem(hepgen); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); } else if (runsartre) { @@ -265,9 +250,6 @@ int Fun4All_G4_EICDetector( 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 diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index f87231ce3..065e61e1c 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -148,10 +148,7 @@ int Fun4All_G4_fsPHENIX( } 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); + // action is performed in later stage at the input manager level } else if (runpythia8) { @@ -161,9 +158,6 @@ int Fun4All_G4_fsPHENIX( // 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) { @@ -172,9 +166,6 @@ int Fun4All_G4_fsPHENIX( PHPythia6 *pythia6 = new PHPythia6(); pythia6->set_config_file("phpythia6.cfg"); se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); } else { diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 3a80bf797..11ea75b75 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -152,10 +152,7 @@ int Fun4All_G4_sPHENIX( } 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); + // action is performed in later stage at the input manager level } else if (runpythia8) { @@ -165,9 +162,6 @@ int Fun4All_G4_sPHENIX( // 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) { @@ -176,9 +170,6 @@ int Fun4All_G4_sPHENIX( 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 diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index e6453f717..df0f77553 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -139,6 +139,10 @@ int G4Setup(const int absorberactive = 0, Fun4AllServer *se = Fun4AllServer::instance(); + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + PHG4Reco* g4Reco = new PHG4Reco(); g4Reco->set_rapidity_coverage(1.1); // according to drawings // uncomment to set QGSP_BERT_HP physics list for productions diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 751d7286c..beeaafb25 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -96,6 +96,10 @@ int G4Setup(const int absorberactive = 0, Fun4AllServer *se = Fun4AllServer::instance(); + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + PHG4Reco* g4Reco = new PHG4Reco(); g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST g4Reco->set_rapidity_coverage(1.1); // according to drawings diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 2bd56db20..3f5843a6f 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -82,6 +82,10 @@ int G4Setup(const int absorberactive = 0, Fun4AllServer *se = Fun4AllServer::instance(); + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + PHG4Reco* g4Reco = new PHG4Reco(); g4Reco->set_rapidity_coverage(1.1); // according to drawings // uncomment to set QGSP_BERT_HP physics list for productions From df92a0b6294346d7cbd2def043650f723d326d68 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 16 Oct 2017 23:48:22 -0400 Subject: [PATCH 0026/1222] add example of hepmc input --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 11ea75b75..898ca02f4 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -420,9 +420,16 @@ int Fun4All_G4_sPHENIX( //meta-lib for DST objects used in simulation outputs gSystem->Load("libg4dst.so"); - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); + Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager( "HepMCInput_1"); se->registerInputManager( in ); se->fileopen( in->Name().c_str(), inputFile ); + //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space time + //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space time + //! 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 + in->set_embedding_id(2); } else { From 1a9a90f1a6c04b41a5ca6173aaf11260fd62de45 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 16 Oct 2017 23:55:45 -0400 Subject: [PATCH 0027/1222] use default embedding ID --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 898ca02f4..23d6a9093 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -429,7 +429,7 @@ int Fun4All_G4_sPHENIX( //! 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 - in->set_embedding_id(2); + //in->set_embedding_id(2); } else { From d7cbfbd8ac6dcb0912da74337d0922f40f96f30a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 00:36:51 -0400 Subject: [PATCH 0028/1222] add option for pile up simulation --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 23d6a9093..2884b6e5f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -41,6 +41,9 @@ int Fun4All_G4_sPHENIX( 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; + // Event pile up simulation with collision rate in Hz MB collisions. + // Note please follow up the macro to verify the settings for beam parameters + const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. //====================== // What to run @@ -439,6 +442,21 @@ int Fun4All_G4_sPHENIX( se->registerInputManager( in ); } + if (pileup_collision_rate>0) + { + // pile up simulation. + // add random beam collisions following a collision diamond and rate from a HepMC stream + + + Fun4AllHepMCPileupInputManager *in = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); + se->registerInputManager( in ); + pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// this file will be + //in->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time + //in->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time + //in->set_time_window(-17500.,+17500.); // override timing window in ns + //in->set_collision_rate(100e3); // override collisions rate in Hz + } + if (do_DSTReader) { //Convert DST to human command readable TTree for quick poke around the outputs From b4efeb9005cb7fa9e3c03c50b307316b3c5d4c85 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 11:09:47 -0400 Subject: [PATCH 0029/1222] correct name for pile up manager --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 2884b6e5f..a441085f7 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -448,13 +448,13 @@ int Fun4All_G4_sPHENIX( // add random beam collisions following a collision diamond and rate from a HepMC stream - Fun4AllHepMCPileupInputManager *in = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); - se->registerInputManager( in ); + Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); + se->registerInputManager( pileup ); pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// this file will be - //in->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time - //in->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time - //in->set_time_window(-17500.,+17500.); // override timing window in ns - //in->set_collision_rate(100e3); // override collisions rate in Hz + //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time + //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time + //pileup->set_time_window(-17500.,+17500.); // override timing window in ns + //pileup->set_collision_rate(100e3); // override collisions rate in Hz } if (do_DSTReader) From de3adc411bc2115b993b1e2a11165a2904b223cc Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 11:15:24 -0400 Subject: [PATCH 0030/1222] add comment --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index a441085f7..881d3a74f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -450,7 +450,7 @@ int Fun4All_G4_sPHENIX( Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); se->registerInputManager( pileup ); - pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// this file will be + pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time //pileup->set_time_window(-17500.,+17500.); // override timing window in ns From 58716e0ac61c4e252482c53187a4689113c77c1a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 11:15:50 -0400 Subject: [PATCH 0031/1222] add comment --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 881d3a74f..ca539c76d 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -446,8 +446,6 @@ int Fun4All_G4_sPHENIX( { // pile up simulation. // add random beam collisions following a collision diamond and rate from a HepMC stream - - Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); se->registerInputManager( pileup ); pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. From ecc89d0505bfb67a244ab3af043c06eacf13278c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 11:55:55 -0400 Subject: [PATCH 0032/1222] embedding onto pythia too. Default pythia embedding ID = 1. So additional particles get default ID 2+ --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index ca539c76d..bb9b5f777 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -182,7 +182,7 @@ int Fun4All_G4_sPHENIX( 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) + if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); @@ -201,7 +201,7 @@ int Fun4All_G4_sPHENIX( 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->Embed(2); gen->Verbosity(0); se->registerSubsystem(gen); @@ -235,7 +235,7 @@ int Fun4All_G4_sPHENIX( PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); vgen->add_decay_particles("e+","e-",0); // i = decay id // event vertex - if (readhepmc || do_embedding || particles) + if (readhepmc || do_embedding || particles || runpythia8 || runpythia6) { vgen->set_reuse_existing_vertex(true); } @@ -270,7 +270,7 @@ int Fun4All_G4_sPHENIX( } vgen->Verbosity(0); - vgen->Embed(2); + vgen->Embed(3); se->registerSubsystem(vgen); cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; From 1aed7fe794fde8ddd0eab5d7f9c6f297101b1999 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Oct 2017 12:43:41 -0400 Subject: [PATCH 0033/1222] set pythia to reuse vertex by default is there is already a HepMC stream --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index bb9b5f777..af49e7d2f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -164,6 +164,9 @@ int Fun4All_G4_sPHENIX( PHPythia8* pythia8 = new PHPythia8(); // see coresoftware/generators/PHPythia8 for example config pythia8->set_config_file("phpythia8.cfg"); + if (readhepmc) + pythia8->set_reuse_vertex(0);// reuse vertex of subevent with embedding ID of 0 + // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia8); } else if (runpythia6) @@ -172,6 +175,9 @@ int Fun4All_G4_sPHENIX( PHPythia6 *pythia6 = new PHPythia6(); pythia6->set_config_file("phpythia6.cfg"); + if (readhepmc) + pythia6->set_reuse_vertex(0);// reuse vertex of subevent with embedding ID of 0 + // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia6); } From ad2429148095ea35cf01394dc8b552a773efe733 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 20 Oct 2017 10:33:51 -0400 Subject: [PATCH 0034/1222] allow running hepmc and pythia simutaniously --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index af49e7d2f..d6e166dd0 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -153,11 +153,15 @@ int Fun4All_G4_sPHENIX( } } - else if (readhepmc) + else + { + // running Geant4 stage. First load event generators. + + if (readhepmc) { - // action is performed in later stage at the input manager level + // place holder. Additional action is performed in later stage at the input manager level } - else if (runpythia8) + if (runpythia8) { gSystem->Load("libPHPythia8.so"); @@ -169,7 +173,7 @@ int Fun4All_G4_sPHENIX( // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia8); } - else if (runpythia6) + if (runpythia6) { gSystem->Load("libPHPythia6.so"); @@ -280,7 +284,8 @@ int Fun4All_G4_sPHENIX( se->registerSubsystem(vgen); cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } + } + } if (!readhits) { From c90f2aa118debe90e8d46a48b55a51fdb09a5096 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 20 Oct 2017 10:38:14 -0400 Subject: [PATCH 0035/1222] use sPHENIX code format via clang-format --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 459 +++++++++++----------- 1 file changed, 228 insertions(+), 231 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d6e166dd0..246ce6edb 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,13 +1,12 @@ 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" - ) + 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 //=============== @@ -22,7 +21,7 @@ int Fun4All_G4_sPHENIX( 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 + const bool readhepmc = false; // read HepMC files // Or: // Use pythia const bool runpythia8 = false; @@ -43,16 +42,16 @@ int Fun4All_G4_sPHENIX( const bool upsilons = false && !readhits; // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters - const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. + const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. //====================== // 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; @@ -66,7 +65,6 @@ int Fun4All_G4_sPHENIX( 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; @@ -74,20 +72,20 @@ int Fun4All_G4_sPHENIX( 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; + 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 @@ -112,12 +110,12 @@ int Fun4All_G4_sPHENIX( // 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); + 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 + 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 + 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 @@ -142,19 +140,18 @@ int Fun4All_G4_sPHENIX( //----------------- 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."<Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); + + PHPythia8 *pythia8 = new PHPythia8(); // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); + pythia8->set_config_file("phpythia8.cfg"); if (readhepmc) - pythia8->set_reuse_vertex(0);// reuse vertex of subevent with embedding ID of 0 + pythia8->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia8); } - if (runpythia6) + if (runpythia6) { gSystem->Load("libPHPythia6.so"); PHPythia6 *pythia6 = new PHPythia6(); pythia6->set_config_file("phpythia6.cfg"); if (readhepmc) - pythia6->set_reuse_vertex(0);// reuse vertex of subevent with embedding ID of 0 + pythia6->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia6); } - // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) - { + // 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-", 2); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) - { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); - } + { + 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_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); @@ -216,97 +213,97 @@ int Fun4All_G4_sPHENIX( 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 || runpythia8 || runpythia6) - { - 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(3); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } + 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 (!readhits) + // 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) { - //--------------------- - // Detector description - //--------------------- + // 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 || runpythia8 || runpythia6) + { + 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); + } - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, magfield_rescale); + vgen->Verbosity(0); + vgen->Embed(3); + 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(); - } + + if (do_bbc) + { + gROOT->LoadMacro("G4_Bbc.C"); + BbcInit(); + Bbc_Reco(); + } //------------------ // Detector Division //------------------ @@ -325,11 +322,11 @@ int Fun4All_G4_sPHENIX( 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(); @@ -348,41 +345,42 @@ int Fun4All_G4_sPHENIX( // Global Vertexing //----------------- - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } + if (do_global) + { + gROOT->LoadMacro("G4_Global.C"); + Global_Reco(); + } - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } + 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(); - } + + 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_jet_reco) + { + gROOT->LoadMacro("G4_Jets.C"); + Jet_Reco(); + } - if (do_HIjetreco) { - gROOT->LoadMacro("G4_HIJetReco.C"); - HIJetReco(); + if (do_HIjetreco) + { + gROOT->LoadMacro("G4_HIJetReco.C"); + HIJetReco(); } //---------------------- @@ -399,67 +397,67 @@ int Fun4All_G4_sPHENIX( if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - //-------------- + //-------------- // IO management //-------------- if (readhits) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); + { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } + // Hits file + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); + hitsin->fileopen(inputFile); + se->registerInputManager(hitsin); + } if (do_embedding) + { + if (embed_input_file == NULL) { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - 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); + cout << "Missing embed_input_file! Exit"; + exit(3); } + + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + 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) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager( "HepMCInput_1"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space time - //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space time - //! 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 - //in->set_embedding_id(2); - } + { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager("HepMCInput_1"); + se->registerInputManager(in); + se->fileopen(in->Name().c_str(), inputFile); + //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space time + //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space time + //! 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 + //in->set_embedding_id(2); + } 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 ); - } + { + // 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 (pileup_collision_rate>0) + if (pileup_collision_rate > 0) { // pile up simulation. // add random beam collisions following a collision diamond and rate from a HepMC stream - Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager( "HepMCPileupInput"); - se->registerInputManager( pileup ); - pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat");// HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. + Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + se->registerInputManager(pileup); + pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time //pileup->set_time_window(-17500.,+17500.); // override timing window in ns @@ -467,24 +465,23 @@ int Fun4All_G4_sPHENIX( } 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 - ); - } + { + //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); @@ -494,16 +491,16 @@ int Fun4All_G4_sPHENIX( // Event processing //----------------- if (nEvents < 0) - { - return; - } + { + 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; - } + { + 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); From aea1001cdf32b1f8152a24ff406c2d5c5bcc34e9 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 20 Oct 2017 10:39:15 -0400 Subject: [PATCH 0036/1222] better spacing independent if statements --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 246ce6edb..71b583249 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -158,6 +158,7 @@ int Fun4All_G4_sPHENIX( { // place holder. Additional action is performed in later stage at the input manager level } + if (runpythia8) { gSystem->Load("libPHPythia8.so"); @@ -170,6 +171,7 @@ int Fun4All_G4_sPHENIX( // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available se->registerSubsystem(pythia8); } + if (runpythia6) { gSystem->Load("libPHPythia6.so"); @@ -213,6 +215,7 @@ int Fun4All_G4_sPHENIX( se->registerSubsystem(gen); } + if (usegun) { PHG4ParticleGun *gun = new PHG4ParticleGun(); @@ -411,6 +414,7 @@ int Fun4All_G4_sPHENIX( hitsin->fileopen(inputFile); se->registerInputManager(hitsin); } + if (do_embedding) { if (embed_input_file == NULL) @@ -427,6 +431,7 @@ int Fun4All_G4_sPHENIX( in1->AddListFile(embed_input_file); // RecommendedL: if one use a text list of many input files se->registerInputManager(in1); } + if (readhepmc) { //meta-lib for DST objects used in simulation outputs From 45d43398dde03e1452089778b358add8612b7a65 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 24 Oct 2017 14:56:47 -0400 Subject: [PATCH 0037/1222] Increase of TPC time window to match drift speed used in simulation --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 71b583249..184ee0b14 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -465,7 +465,7 @@ int Fun4All_G4_sPHENIX( pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time - //pileup->set_time_window(-17500.,+17500.); // override timing window in ns + pileup->set_time_window(-35000.,+35000.); // override timing window in ns //pileup->set_collision_rate(100e3); // override collisions rate in Hz } 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 index 721228303..2ffdab00c 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -310,7 +310,7 @@ void Svtx_Cells(int verbosity = 0) // 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); + svtx_cells->set_timing_window(i, -35000.0, +35000.0); } se->registerSubsystem(svtx_cells); From 15b79026be855c8448a2422312bffd6de8c1e33d Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 25 Oct 2017 18:00:40 -0400 Subject: [PATCH 0038/1222] Oops --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 184ee0b14..06870d3f6 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -467,6 +467,7 @@ int Fun4All_G4_sPHENIX( //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time pileup->set_time_window(-35000.,+35000.); // override timing window in ns //pileup->set_collision_rate(100e3); // override collisions rate in Hz + pileup->set_collision_rate(pileup_collision_rate); } if (do_DSTReader) From 8c452744bfc8494d38fb75d1f16cd9e94cea1899 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 30 Nov 2017 12:19:30 -0500 Subject: [PATCH 0039/1222] import from #89 on tracker setup --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 331 ++++++++++++++++-- 1 file changed, 300 insertions(+), 31 deletions(-) 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 index 2ffdab00c..1b52b5876 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -7,27 +7,188 @@ 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; + + +int n_tpc_layer_inner = 8; +double tpc_layer_thick_inner = 1.25; +int tpc_layer_rphi_count_inner = 1920; + + +// make inner layers a factor of 2 thinner +/* +int n_tpc_layer_inner = 8 * 2; +double tpc_layer_thick_inner = 1.25 / 2.0; +int tpc_layer_rphi_count_inner = 1920 / 2; +*/ + +int n_tpc_layer_mid = 16; +double tpc_layer_thick_mid = 1.25; +int tpc_layer_rphi_count_mid = 1536; + +int n_tpc_layer_outer = 16; +double tpc_layer_thick_outer = 1.25; +int tpc_layer_rphi_count_outer = 2304; + +int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double inner_cage_radius = 20.; +double inner_readout_radius = 30.; + + +// TPC gas parameters +// These are set for a variety of gas choices... +//============================================== +enum TPC_Gas{ Ne2K_100, Ne2K_400, NeCF4_100, NeCF4_300, NeCF4_400, ByHand}; +TPC_Gas ether = TPC_Gas::NeCF4_400; +//TPC_Gas ether = TPC_Gas::ByHand; + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm +double iBut_dEdx = 5.93; // keV/cm + +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm +double iBut_NPrimary = 84; // Number/cm + +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm +double iBut_NTotal = 195; // Number/cm + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): +double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... +double TPCDriftVelocity; +double TPC_Trans_Diffusion; +double TPC_Long_Diffusion; +double TPC_dEdx; +double TPC_NPri; +double TPC_NTot; +double TPC_ElectronsPerKeV; // TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... //======================================= - -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 +double TPCADCClock; +double TPCShapingRMSLead; +double TPCShapingRMSTail; +double tpc_cell_z; +double TPC_SmearRPhi; +double TPC_SmearZ; 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; + + switch(ether) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case TPC_Gas::Ne2K_100: + { + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95*Ne_dEdx + 0.03*CF4_dEdx + 0.02*iBut_dEdx; + TPC_NPri = 0.95*Ne_NPrimary + 0.03*CF4_NPrimary + 0.02*iBut_NPrimary; + TPC_NTot = 0.95*Ne_NTotal + 0.03*CF4_NTotal + 0.02*iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95*Ne_dEdx + 0.03*CF4_dEdx + 0.02*iBut_dEdx; + TPC_NPri = 0.95*Ne_NPrimary + 0.03*CF4_NPrimary + 0.02*iBut_NPrimary; + TPC_NTot = 0.95*Ne_NTotal + 0.03*CF4_NTotal + 0.02*iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; + TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; + TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; + break; + } + case TPC_Gas::NeCF4_300: + { + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; + TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; + TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; + break; + } + case TPC_Gas::NeCF4_400: + { + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; + TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; + TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; + break; + } + case TPC_Gas::ByHand: + { + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; + TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; + TPC_NTot = TPC_ElectronsPerKeV*TPC_dEdx ; + break; + } + default: // defaults to NeCF4_400 + { + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; + TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; + TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; + break; + } + + } + + TPC_ElectronsPerKeV = TPC_NTot/TPC_dEdx; + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA + TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA + // TPCADCClock = 27.0; // ns, corresponds to an ADC clock rate of 18.8 MHz * 2 + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // TKH does not understand the physical origin of these parameters. + // however, their impact seems quite small... + TPC_SmearRPhi = 0.10; + TPC_SmearZ = 0.15; + + } double Svtx(PHG4Reco* g4Reco, double radius, @@ -168,30 +329,73 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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 ); + //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) { + // Active layers of the TPC from 30-40 cm (inner layers) + + for(int ilayer=n_maps_layer + n_intt_layer;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner);++ilayer) { + + //if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01 ); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem( cyl ); + + radius += tpc_layer_thick_inner; + } + + // Active layers of the TPC from 40-60 cm (mid layers) + + for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid);++ilayer) { + + //if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_mid - 0.01 << " length " << cage_length << endl; - 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", tpc_layer_thick_mid - 0.01 ); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem( cyl ); + + radius += tpc_layer_thick_mid; + } + + // Active layers of the TPC from 60-80 cm (outer layers) + + for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner+n_tpc_layer_mid;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid+n_tpc_layer_outer);++ilayer) { + + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_outer - 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->set_double_param("thickness", tpc_layer_thick_outer - 0.01 ); cyl->SetActive(); cyl->SuperDetector("SVTX"); g4Reco->registerSubsystem( cyl ); - radius += delta_radius; + radius += tpc_layer_thick_outer; } // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + npoints); + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_layer); cyl->set_double_param("radius",radius); cyl->set_int_param("lengthviarapidity",0); cyl->set_double_param("length",cage_length); @@ -227,6 +431,24 @@ void Svtx_Cells(int verbosity = 0) // SVTX cells //----------- + if (true) + { + cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; + cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; + cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; + cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; + cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; + cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; + cout << " TPC ADC Rate: " << 1000.0/TPCADCClock << " MHZ" << endl; + cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; + cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; + cout << " TPC z cell " << tpc_cell_z << " cm" << endl; + cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; + cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + } + if(n_maps_layer > 0) { // MAPS cells @@ -280,17 +502,19 @@ void Svtx_Cells(int verbosity = 0) 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) + if(n_gas_layer != 60) { - svtx_cells->setDiffusionT(0.0130); - svtx_cells->setDiffusionL(0.0130); + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + 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 + svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane + svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits to give expected cluster rsolution of 240 microns for charge at membrane } else { @@ -302,17 +526,62 @@ void Svtx_Cells(int verbosity = 0) } svtx_cells->set_drift_velocity(TPCDriftVelocity); svtx_cells->setHalfLength( 105.5 ); - svtx_cells->setElectronsPerKeV(28); + svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); 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, -35000.0, +35000.0); - } - + //====================== + + double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns + + // inner layers + double radius_layer = inner_readout_radius + tpc_layer_thick_inner / 2.0; + int counter_layer = 0; + for(int i=n_maps_layer + n_intt_layer; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner;i++) + { + // this calculates the radius at the middle of the layer + if(counter_layer > 0) + radius_layer += tpc_layer_thick_inner; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } + radius_layer += tpc_layer_thick_inner / 2.0; + + // mid layers + radius_layer += tpc_layer_thick_mid / 2.0; + counter_layer = 0; + for(int i=n_maps_layer + n_intt_layer + n_tpc_layer_inner; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid;i++) + { + if(counter_layer > 0) + radius_layer += tpc_layer_thick_mid; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } + radius_layer += tpc_layer_thick_mid / 2.0; + + // outer layers + radius_layer += tpc_layer_thick_outer/ 2.0; + counter_layer = 0; + for(int i=n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer;i++) + { + if(counter_layer > 0) + radius_layer += tpc_layer_thick_outer; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } + se->registerSubsystem(svtx_cells); return; @@ -537,7 +806,7 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); eval->do_cluster_eval(true); eval->do_g4hit_eval(true); - eval->do_hit_eval(false); + eval->do_hit_eval(true); // TKH likes to see the hits...includes the chamber physics... eval->do_gpoint_eval(false); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true eval->Verbosity(verbosity); From 2f4c671cc3b08be0a2560d531b1e7c8d939897bb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 30 Nov 2017 21:48:26 -0500 Subject: [PATCH 0040/1222] put cout under verbosity flag; recover the default eval option to be without hits for non-expert running --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 index 1b52b5876..21dcf9c78 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -90,6 +90,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html case TPC_Gas::Ne2K_100: { + if (verbosity) cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; TPCDriftVelocity = 3.2 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) @@ -101,6 +102,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) } case TPC_Gas::Ne2K_400: { + if (verbosity) cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; TPCDriftVelocity = 5.5 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) @@ -113,6 +115,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html case TPC_Gas::NeCF4_100: { + if (verbosity) cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; TPCDriftVelocity = 4.0 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) @@ -124,6 +127,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) } case TPC_Gas::NeCF4_300: { + if (verbosity) cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; TPCDriftVelocity = 7.0 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) @@ -135,6 +139,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) } case TPC_Gas::NeCF4_400: { + if (verbosity) cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; TPCDriftVelocity = 8.0 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) @@ -146,6 +151,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) } case TPC_Gas::ByHand: { + if (verbosity) cout << "Gas Choice: TPC_Gas::ByHand" << endl; TPCDriftVelocity = 6.0 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) @@ -158,6 +164,7 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) } default: // defaults to NeCF4_400 { + if (verbosity) cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; TPCDriftVelocity = 8.0 / 1000.0; // cm/ns TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) @@ -336,7 +343,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, for(int ilayer=n_maps_layer + n_intt_layer;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner);++ilayer) { - //if (verbosity) + if (verbosity) cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_inner - 0.01 << " length " << cage_length << endl; @@ -357,7 +364,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid);++ilayer) { - //if (verbosity) + if (verbosity) cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_mid - 0.01 << " length " << cage_length << endl; @@ -378,6 +385,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner+n_tpc_layer_mid;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid+n_tpc_layer_outer);++ilayer) { + if (verbosity) cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_outer - 0.01 << " length " << cage_length << endl; @@ -431,7 +439,7 @@ void Svtx_Cells(int verbosity = 0) // SVTX cells //----------- - if (true) + if (verbosity) { cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; @@ -548,6 +556,7 @@ void Svtx_Cells(int verbosity = 0) double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; counter_layer++; } @@ -563,6 +572,7 @@ void Svtx_Cells(int verbosity = 0) double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; counter_layer++; } @@ -578,6 +588,7 @@ void Svtx_Cells(int verbosity = 0) double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; counter_layer++; } @@ -806,7 +817,7 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); eval->do_cluster_eval(true); eval->do_g4hit_eval(true); - eval->do_hit_eval(true); // TKH likes to see the hits...includes the chamber physics... + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true eval->Verbosity(verbosity); From bed4c63b722166c0c152b4e9938a549997ecaa4f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 30 Nov 2017 21:52:13 -0500 Subject: [PATCH 0041/1222] clang-format to sphenix style; https://wiki.bnl.gov/sPHENIX/index.php/Codingconventions#Style_reformatting_tools --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 957 +++++++++--------- 1 file changed, 481 insertions(+), 476 deletions(-) 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 index 21dcf9c78..1184cc44b 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -3,17 +3,15 @@ // 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; +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 - +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_tpc_layer_inner = 8; double tpc_layer_thick_inner = 1.25; int tpc_layer_rphi_count_inner = 1920; - // make inner layers a factor of 2 thinner /* int n_tpc_layer_inner = 8 * 2; @@ -34,26 +32,33 @@ int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double inner_cage_radius = 20.; double inner_readout_radius = 30.; - // TPC gas parameters // These are set for a variety of gas choices... //============================================== -enum TPC_Gas{ Ne2K_100, Ne2K_400, NeCF4_100, NeCF4_300, NeCF4_400, ByHand}; +enum TPC_Gas +{ + Ne2K_100, + Ne2K_400, + NeCF4_100, + NeCF4_300, + NeCF4_400, + ByHand +}; TPC_Gas ether = TPC_Gas::NeCF4_400; //TPC_Gas ether = TPC_Gas::ByHand; // Data on gasses @20 C and 760 Torr from the following source: // http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm double iBut_dEdx = 5.93; // keV/cm -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm double iBut_NPrimary = 84; // Number/cm -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm double iBut_NTotal = 195; // Number/cm // TPC Performance Parameter (applies extra smear to mimic the avalanche): @@ -85,128 +90,125 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) { Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; - switch(ether) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case TPC_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95*Ne_dEdx + 0.03*CF4_dEdx + 0.02*iBut_dEdx; - TPC_NPri = 0.95*Ne_NPrimary + 0.03*CF4_NPrimary + 0.02*iBut_NPrimary; - TPC_NTot = 0.95*Ne_NTotal + 0.03*CF4_NTotal + 0.02*iBut_NTotal; - break; - } - case TPC_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95*Ne_dEdx + 0.03*CF4_dEdx + 0.02*iBut_dEdx; - TPC_NPri = 0.95*Ne_NPrimary + 0.03*CF4_NPrimary + 0.02*iBut_NPrimary; - TPC_NTot = 0.95*Ne_NTotal + 0.03*CF4_NTotal + 0.02*iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; - TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; - TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; - break; - } - case TPC_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; - TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; - TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; - break; - } - case TPC_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; - TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; - TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; - break; - } - case TPC_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; - TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; - TPC_NTot = TPC_ElectronsPerKeV*TPC_dEdx ; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90*Ne_dEdx + 0.10*CF4_dEdx ; - TPC_NPri = 0.90*Ne_NPrimary + 0.10*CF4_NPrimary ; - TPC_NTot = 0.90*Ne_NTotal + 0.10*CF4_NTotal ; - break; - } - - } - - TPC_ElectronsPerKeV = TPC_NTot/TPC_dEdx; + switch (ether) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case TPC_Gas::Ne2K_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_300: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::ByHand: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + break; + } + default: // defaults to NeCF4_400 + { + if (verbosity) + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + } + + TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; // TPC readout shaping time and ADC clock parameters // these set the Z size of the TPC cells //======================================= // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA - TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA - // TPCADCClock = 27.0; // ns, corresponds to an ADC clock rate of 18.8 MHz * 2 - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // TKH does not understand the physical origin of these parameters. - // however, their impact seems quite small... - TPC_SmearRPhi = 0.10; - TPC_SmearZ = 0.15; - - + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA + TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA + // TPCADCClock = 27.0; // ns, corresponds to an ADC clock rate of 18.8 MHz * 2 + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // TKH does not understand the physical origin of these parameters. + // however, their impact seems quite small... + TPC_SmearRPhi = 0.10; + TPC_SmearZ = 0.15; } -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { +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 - 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 @@ -217,200 +219,202 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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]; - } + // 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 + //------------------- - if(n_intt_layer > 0) + 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; i < n_intt_layer; i++) { - //------------------- - // 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; + // 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(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; } + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(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; + PHG4CylinderSubsystem* cyl; radius = inner_cage_radius; - - double cage_length = 211.0; // From TPC group, gives eta = 1.1 at 78 cm + + 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 + double cage_thickness = 28.6 * n_rad_length_cage; // Kapton X_0 = 28.6 cm // mocks up Kapton + carbon fiber structure - // inner field cage + // 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->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 ); + g4Reco->registerSubsystem(cyl); radius += cage_thickness; double inner_readout_radius = 30.; - if (inner_readout_radius 0) { + if (inner_readout_radius - 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->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 ); + 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 ); - - // Active layers of the TPC from 30-40 cm (inner layers) - - for(int ilayer=n_maps_layer + n_intt_layer;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner);++ilayer) { + // Active layers of the TPC from 30-40 cm (inner layers) + + for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) + { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_inner - 0.01 << " length " << cage_length << endl; + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01 ); + 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", tpc_layer_thick_inner - 0.01); cyl->SetActive(); cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - + g4Reco->registerSubsystem(cyl); + radius += tpc_layer_thick_inner; } // Active layers of the TPC from 40-60 cm (mid layers) - for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid);++ilayer) { - + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) + { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_mid - 0.01 << " length " << cage_length << endl; + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01 ); + 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", tpc_layer_thick_mid - 0.01); cyl->SetActive(); cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - + g4Reco->registerSubsystem(cyl); + radius += tpc_layer_thick_mid; } // Active layers of the TPC from 60-80 cm (outer layers) - for(int ilayer=n_maps_layer + n_intt_layer+n_tpc_layer_inner+n_tpc_layer_mid;ilayer<(n_maps_layer + n_intt_layer + n_tpc_layer_inner+n_tpc_layer_mid+n_tpc_layer_outer);++ilayer) { - + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) + { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_outer - 0.01 << " length " << cage_length << endl; + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01 ); + 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", tpc_layer_thick_outer - 0.01); cyl->SetActive(); cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - + g4Reco->registerSubsystem(cyl); + radius += tpc_layer_thick_outer; } // outer field cage cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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 ); // Kapton X_0 = 28.6 cm + 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 ); + g4Reco->registerSubsystem(cyl); radius += cage_thickness; @@ -419,7 +423,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, void Svtx_Cells(int verbosity = 0) { - // runs the cellularization of the energy deposits (g4hits) + // runs the cellularization of the energy deposits (g4hits) // into detector hits (g4cells) //--------------- @@ -433,107 +437,108 @@ void Svtx_Cells(int verbosity = 0) // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); + Fun4AllServer* se = Fun4AllServer::instance(); //----------- // SVTX cells //----------- if (verbosity) - { - cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; - cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; - cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; - cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; - cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; - cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; - cout << " TPC ADC Rate: " << 1000.0/TPCADCClock << " MHZ" << endl; - cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; - cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; - cout << " TPC z cell " << tpc_cell_z << " cm" << endl; - cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; - cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; - } + { + cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; + cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; + cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; + cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; + cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; + cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; + cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; + cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; + cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; + cout << " TPC z cell " << tpc_cell_z << " cm" << endl; + cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; + cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + } - if(n_maps_layer > 0) + 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 - 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); + 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); - } + 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; - } + 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.) { + 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"); + 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); + PHG4CylinderCellTPCReco* svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer + n_intt_layer); svtx_cells->Detector("SVTX"); svtx_cells->setDistortion(tpc_distortion); - if(n_gas_layer != 60) - { - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - - 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(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane - svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits to give expected cluster rsolution of 240 microns for charge at membrane - } + if (n_gas_layer != 60) + { + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + + 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(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane + svtx_cells->setSmearZ(TPC_SmearZ); // 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 - } + { + // 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->setHalfLength(105.5); svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); svtx_cells->Verbosity(0); @@ -548,50 +553,50 @@ void Svtx_Cells(int verbosity = 0) // inner layers double radius_layer = inner_readout_radius + tpc_layer_thick_inner / 2.0; int counter_layer = 0; - for(int i=n_maps_layer + n_intt_layer; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner;i++) - { - // this calculates the radius at the middle of the layer - if(counter_layer > 0) - radius_layer += tpc_layer_thick_inner; - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; - } - radius_layer += tpc_layer_thick_inner / 2.0; + for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) + { + // this calculates the radius at the middle of the layer + if (counter_layer > 0) + radius_layer += tpc_layer_thick_inner; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } + radius_layer += tpc_layer_thick_inner / 2.0; // mid layers radius_layer += tpc_layer_thick_mid / 2.0; counter_layer = 0; - for(int i=n_maps_layer + n_intt_layer + n_tpc_layer_inner; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid;i++) - { - if(counter_layer > 0) - radius_layer += tpc_layer_thick_mid; - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; - } - radius_layer += tpc_layer_thick_mid / 2.0; + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) + { + if (counter_layer > 0) + radius_layer += tpc_layer_thick_mid; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } + radius_layer += tpc_layer_thick_mid / 2.0; // outer layers - radius_layer += tpc_layer_thick_outer/ 2.0; + radius_layer += tpc_layer_thick_outer / 2.0; counter_layer = 0; - for(int i=n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i< n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer;i++) - { - if(counter_layer > 0) - radius_layer += tpc_layer_thick_outer; - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; - } + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) + { + if (counter_layer > 0) + radius_layer += tpc_layer_thick_outer; + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + counter_layer++; + } se->registerSubsystem(svtx_cells); @@ -611,65 +616,67 @@ void Svtx_Reco(int verbosity = 0) // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); + 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 + for (int i = 0; i < n_maps_layer; ++i) + { + digi->set_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) + 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; i < n_intt_layer; i++) { - // 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 ); + digiintt->set_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 ); - + 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 ); + for (int i = 0; i < n_maps_layer; i++) + { + deadarea->Verbosity(verbosity); + //deadarea->set_hit_efficiency(i,0.99); + deadarea->set_hit_efficiency(i, 1.0); + } + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + //deadarea->set_hit_efficiency(i,0.99); + deadarea->set_hit_efficiency(i, 1.0); + } + se->registerSubsystem(deadarea); //----------------------------- // Apply MIP thresholds to Hits @@ -677,98 +684,97 @@ void Svtx_Reco(int verbosity = 0) PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); thresholds->Verbosity(verbosity); - - // maps - for(int i = 0;iset_threshold(i,0.1); - } + + // maps + for (int i = 0; i < n_maps_layer; i++) + { + // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness + // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss + thresholds->set_threshold(i, 0.1); + } // INTT - for(int i=n_maps_layer;iset_threshold(i,0.1); - thresholds->set_use_thickness_mip(i, true); + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + thresholds->set_threshold(i, 0.1); + thresholds->set_use_thickness_mip(i, true); + } - } - - se->registerSubsystem( thresholds ); + se->registerSubsystem(thresholds); //------------- // Cluster Hits //------------- - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer",0, n_maps_layer + n_intt_layer-1); + 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 + 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); - } + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + clusterizer->set_z_clustering(i, false); + } - se->registerSubsystem( clusterizer ); + 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*/ ); - } + 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 ); - + { + // 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) { + 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 { + } + 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 + 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 //------------------ - PHG4GenFitTrackProjection *projection = new PHG4GenFitTrackProjection(); + PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); projection->Verbosity(verbosity); - se->registerSubsystem( projection ); + se->registerSubsystem(projection); /* //---------------------- @@ -807,40 +813,39 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); + Fun4AllServer* se = Fun4AllServer::instance(); //---------------- // SVTX evaluation //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); eval->do_cluster_eval(true); eval->do_g4hit_eval(true); - eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + 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 ); - } + 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; } From 0d5497feca0faac69b43a6cfca0e82cbaf1ee963 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 30 Nov 2017 22:01:26 -0500 Subject: [PATCH 0042/1222] use TPC drift window setting from the tracking macros --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 06870d3f6..3b0d1a536 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,3 +1,6 @@ +#include +using namespace std; + 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", @@ -462,12 +465,25 @@ int Fun4All_G4_sPHENIX( // add random beam collisions following a collision diamond and rate from a HepMC stream Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); se->registerInputManager(pileup); - pileup->AddFile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. + + const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); + pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time - pileup->set_time_window(-35000.,+35000.); // override timing window in ns - //pileup->set_collision_rate(100e3); // override collisions rate in Hz pileup->set_collision_rate(pileup_collision_rate); + + double time_window_minus = -35000; + double time_window_plus = 35000; + + if (do_svtx) + { + // double TPCDriftVelocity = 6.0 / 1000.0; // cm/ns, which is loaded from G4_SVTX*.C macros + time_window_minus = -105.5 / TPCDriftVelocity; // ns + time_window_plus = 105.5 / TPCDriftVelocity; // ns; + } + pileup->set_time_window(time_window_minus, time_window_plus); // override timing window in ns + cout << "Collision pileup enabled using file " << pileupfile << " with collision rate " << pileup_collision_rate + << " and time window " << time_window_minus << " to " << time_window_plus << endl; } if (do_DSTReader) From ce27798ef4b83cd20adbe99514cd2a4899189609 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 30 Nov 2017 22:27:20 -0500 Subject: [PATCH 0043/1222] adjust outter radius thickness so that outter radius of active region is at R=78 cm --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 1184cc44b..59d7ef502 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -24,7 +24,7 @@ double tpc_layer_thick_mid = 1.25; int tpc_layer_rphi_count_mid = 1536; int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.25; +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm int tpc_layer_rphi_count_outer = 2304; int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; From 368ceecb524aeda28d4d9286e39e9c6aa33ce891 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Mon, 4 Dec 2017 01:23:37 -0500 Subject: [PATCH 0044/1222] Updated macros for 2-iteration UE determination, subtraction and HI jet reco --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 8 ++++---- macros/g4simulations/G4_HIJetReco.C | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 3b0d1a536..17530a914 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -90,10 +90,10 @@ int Fun4All_G4_sPHENIX( 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; + // 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) + bool do_HIjetreco = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; bool do_dst_compress = false; diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index f15a0722d..74c38a182 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -16,11 +16,31 @@ void HIJetReco(int verbosity = 0) { 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->SetSeedType( 1 ); + dtb->SetSeedType( 0 ); dtb->Verbosity( verbosity ); se->registerSubsystem( dtb ); + + CopyAndSubtractJets *casj = new CopyAndSubtractJets(); + casj->Verbosity( verbosity ); + se->registerSubsystem( casj ); + + DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); + dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); + dtb2->SetSeedType( 1 ); + dtb2->Verbosity( verbosity ); + se->registerSubsystem( dtb2 ); SubtractTowers *st = new SubtractTowers(); st->Verbosity( verbosity ); From 675f5bdb03f4bdb652560f3017b99a2f1558d890 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 13 Dec 2017 10:42:35 -0500 Subject: [PATCH 0045/1222] Comment of optional vertex distribution in hepmc inputs --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 17530a914..b00c4e279 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -443,8 +443,10 @@ int Fun4All_G4_sPHENIX( Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager("HepMCInput_1"); se->registerInputManager(in); se->fileopen(in->Name().c_str(), inputFile); - //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space time - //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space time + //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space, time + //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space, time + // //optional choice of vertex distribution function in space, time + //in->set_vertex_distribution_function(PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Uniform,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 From a9e8a6c684ce690c4cf70794eeb54e098915d902 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 19 Dec 2017 16:13:26 -0500 Subject: [PATCH 0046/1222] switch to RawClusterBuilderv1 by default --- macros/g4simulations/G4_CEmc_Spacal.C | 36 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index e920c5980..dd7c44181 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -8,6 +8,18 @@ int Max_cemc_layer = 1; // 2D azimuthal projective SPACAL (slow) int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; +enum enu_Cemc_clusterizer +{ + kCemcGraphClusterizer, + + kCemcTemplateClusterizer +}; + +//! template clusterizer, RawClusterBuilderv1, as developed by Sasha Bazilevsky +enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; +//! graph clusterizer, RawClusterBuilder +//enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + #include // just a dummy parameter used by the tilted plate geom @@ -369,10 +381,26 @@ void CEMC_Clusters(int verbosity = 0) gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilder"); - ClusterBuilder->Detector("CEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); + if (Cemc_clusterizer == kCemcTemplateClusterizer) + { + RawClusterBuilderv1 *ClusterBuilder = new RawClusterBuilderv1("EmcRawClusterBuilder"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (Cemc_clusterizer == kCemcGraphClusterizer) + { + RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilder"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout <<"CEMC_Clusters - unkonwn clusterizer setting!"<GetCalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, From 5e959629de8e2e31bea3bee01477b41685fc3b35 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 19 Dec 2017 16:51:27 -0500 Subject: [PATCH 0047/1222] switch to RawClusterBuilderv1 by default for HCals --- macros/g4simulations/G4_HcalIn_ref.C | 40 +++++++++++++++++++++++---- macros/g4simulations/G4_HcalOut_ref.C | 39 +++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 6bb819174..1b359a2ca 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -5,6 +5,20 @@ //true - Choose if you want Aluminum const bool inner_hcal_material_Al = false; + +enum enu_HCalIn_clusterizer +{ + kHCalInGraphClusterizer, + + kHCalInTemplateClusterizer +}; + +//! template clusterizer, RawClusterBuilderv1, as developed by Sasha Bazilevsky +enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; +//! graph clusterizer, RawClusterBuilder +//enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; + + // Init is called by G4Setup.C void HCalInnerInit() {} @@ -189,11 +203,27 @@ void HCALInner_Clusters(int verbosity = 0) { gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilder"); - ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - + if (HCalIn_clusterizer == kHCalInTemplateClusterizer) + { + RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalInRawClusterBuilder"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + + } + else if (HCalIn_clusterizer == kHCalInGraphClusterizer) + { + RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilder"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + + } + else + { + cout <<"HCalIn_Clusters - unknown clusterizer setting!"<Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilder"); - ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); + + if (HCalOut_clusterizer == kHCalOutTemplateClusterizer) + { + RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalOutRawClusterBuilder"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + } + else if (HCalOut_clusterizer == kHCalOutGraphClusterizer) + { + RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilder"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + } + else + { + cout <<"HCALOuter_Clusters - unknown clusterizer setting!"< Date: Tue, 19 Dec 2017 16:54:25 -0500 Subject: [PATCH 0048/1222] typo --- macros/g4simulations/G4_CEmc_Spacal.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index dd7c44181..86603e105 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -397,7 +397,7 @@ void CEMC_Clusters(int verbosity = 0) } else { - cout <<"CEMC_Clusters - unkonwn clusterizer setting!"< Date: Tue, 19 Dec 2017 16:56:12 -0500 Subject: [PATCH 0049/1222] make naming explicit --- macros/g4simulations/G4_CEmc_Spacal.C | 4 ++-- macros/g4simulations/G4_HcalIn_ref.C | 4 ++-- macros/g4simulations/G4_HcalOut_ref.C | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 86603e105..f64eedcd8 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -383,14 +383,14 @@ void CEMC_Clusters(int verbosity = 0) if (Cemc_clusterizer == kCemcTemplateClusterizer) { - RawClusterBuilderv1 *ClusterBuilder = new RawClusterBuilderv1("EmcRawClusterBuilder"); + RawClusterBuilderv1 *ClusterBuilder = new RawClusterBuilderv1("EmcRawClusterBuilderTemplate"); ClusterBuilder->Detector("CEMC"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } else if (Cemc_clusterizer == kCemcGraphClusterizer) { - RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilder"); + RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilderGraph"); ClusterBuilder->Detector("CEMC"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 1b359a2ca..93dc9b768 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -205,7 +205,7 @@ void HCALInner_Clusters(int verbosity = 0) { if (HCalIn_clusterizer == kHCalInTemplateClusterizer) { - RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalInRawClusterBuilder"); + RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); @@ -213,7 +213,7 @@ void HCALInner_Clusters(int verbosity = 0) { } else if (HCalIn_clusterizer == kHCalInGraphClusterizer) { - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilder"); + RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index ad51c64dc..17b59c8cc 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -150,14 +150,14 @@ void HCALOuter_Clusters(int verbosity = 0) { if (HCalOut_clusterizer == kHCalOutTemplateClusterizer) { - RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalOutRawClusterBuilder"); + RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); } else if (HCalOut_clusterizer == kHCalOutGraphClusterizer) { - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilder"); + RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); From 757aedadc0c3db9e63e780d4652a3c8fb460a6d1 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Thu, 21 Dec 2017 14:19:10 -0500 Subject: [PATCH 0050/1222] fixed conflicts --- macros/g4simulations/G4_CEmc_Spacal.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index f64eedcd8..3ec418134 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -403,9 +403,14 @@ void CEMC_Clusters(int verbosity = 0) RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); - clusterCorrection->GetCalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, + + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, //raw location string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration/")); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB","xml",0,0, + //raw location + string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration")); + clusterCorrection->Verbosity(verbosity); se->registerSubsystem(clusterCorrection); From f004078ffb631a10bfa2f7e392932ddb3d59b924 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 10 Jan 2018 12:20:37 -0500 Subject: [PATCH 0051/1222] use new lib and classes as in https://github.com/sPHENIX-Collaboration/coresoftware/pull/403 --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 2 +- macros/g4simulations/Fun4All_G4_sPHENIX.C | 1 - macros/g4simulations/G4_CEmc_Spacal.C | 15 +++++++-------- macros/g4simulations/G4_HcalIn_ref.C | 15 +++++++-------- macros/g4simulations/G4_HcalOut_ref.C | 15 +++++++-------- 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 0a42ee8b6..bfd0fc64f 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -148,7 +148,7 @@ int Fun4All_G4_EICDetector( gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); + gSystem->Load("libg4calo.so"); gSystem->Load("libg4eval.so"); // establish the geometry and reconstruction setup diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 065e61e1c..29a0ce89b 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -101,7 +101,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); + gSystem->Load("libg4calo.so"); gSystem->Load("libg4eval.so"); // establish the geometry and reconstruction setup diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index b00c4e279..e8d5c4265 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -108,7 +108,6 @@ int Fun4All_G4_sPHENIX( 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 diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 3ec418134..d7265f35f 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -15,9 +15,9 @@ enum enu_Cemc_clusterizer kCemcTemplateClusterizer }; -//! template clusterizer, RawClusterBuilderv1, as developed by Sasha Bazilevsky +//! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; -//! graph clusterizer, RawClusterBuilder +//! graph clusterizer, RawClusterBuilderGraph //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; #include @@ -297,8 +297,8 @@ void CEMC_Cells(int verbosity = 0) void CEMC_Towers(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); @@ -377,20 +377,19 @@ void CEMC_Towers(int verbosity = 0) void CEMC_Clusters(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); if (Cemc_clusterizer == kCemcTemplateClusterizer) { - RawClusterBuilderv1 *ClusterBuilder = new RawClusterBuilderv1("EmcRawClusterBuilderTemplate"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); ClusterBuilder->Detector("CEMC"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } else if (Cemc_clusterizer == kCemcGraphClusterizer) { - RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilderGraph"); + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); ClusterBuilder->Detector("CEMC"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 93dc9b768..c3aaeed75 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -13,9 +13,9 @@ enum enu_HCalIn_clusterizer kHCalInTemplateClusterizer }; -//! template clusterizer, RawClusterBuilderv1, as developed by Sasha Bazilevsky +//! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; -//! graph clusterizer, RawClusterBuilder +//! graph clusterizer, RawClusterBuilderGraph //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; @@ -156,8 +156,8 @@ void HCALInner_Cells(int verbosity = 0) { void HCALInner_Towers(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); @@ -198,14 +198,13 @@ void HCALInner_Towers(int verbosity = 0) { } void HCALInner_Clusters(int verbosity = 0) { + gSystem->Load("libcalo_reco.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); if (HCalIn_clusterizer == kHCalInTemplateClusterizer) { - RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalInRawClusterBuilderTemplate"); + RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); @@ -213,7 +212,7 @@ void HCALInner_Clusters(int verbosity = 0) { } else if (HCalIn_clusterizer == kHCalInGraphClusterizer) { - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilderGraph"); + RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 17b59c8cc..8b44a830d 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -7,9 +7,9 @@ enum enu_HCalOut_clusterizer kHCalOutTemplateClusterizer }; -//! template clusterizer, RawClusterBuilderv1, as developed by Sasha Bazilevsky +//! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; -//! graph clusterizer, RawClusterBuilder +//! graph clusterizer, RawClusterBuilderGraph //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; // Init is called by G4Setup.C @@ -103,8 +103,8 @@ void HCALOuter_Cells(int verbosity = 0) { void HCALOuter_Towers(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder* TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); @@ -142,22 +142,21 @@ void HCALOuter_Towers(int verbosity = 0) { } void HCALOuter_Clusters(int verbosity = 0) { + gSystem->Load("libcalo_reco.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); if (HCalOut_clusterizer == kHCalOutTemplateClusterizer) { - RawClusterBuilderv1* ClusterBuilder = new RawClusterBuilderv1("HcalOutRawClusterBuilderTemplate"); + RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); } else if (HCalOut_clusterizer == kHCalOutGraphClusterizer) { - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilderGraph"); + RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); From ef058a748a06674b7689e6430367a3d030a1e4ad Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 10 Jan 2018 12:32:27 -0500 Subject: [PATCH 0052/1222] load calorimeter lib in calorimeter macros --- macros/g4simulations/Fun4All_G4_EICDetector.C | 1 - macros/g4simulations/Fun4All_G4_fsPHENIX.C | 1 - 2 files changed, 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index bfd0fc64f..8d8d7a1d1 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -148,7 +148,6 @@ int Fun4All_G4_EICDetector( gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libg4calo.so"); gSystem->Load("libg4eval.so"); // establish the geometry and reconstruction setup diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 29a0ce89b..67ff1d048 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -101,7 +101,6 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libg4calo.so"); gSystem->Load("libg4eval.so"); // establish the geometry and reconstruction setup From 36293d1761701bfd18981ff766a7cc2d1852ee02 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 11 Jan 2018 15:15:53 -0500 Subject: [PATCH 0053/1222] CINT has trouble to handle static double --- macros/g4simulations/G4_CEmc_Spacal.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index d7265f35f..d3ed1de6d 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -328,7 +328,7 @@ void CEMC_Towers(int verbosity = 0) return; } - static const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); TowerDigitizer->Detector("CEMC"); From 7d563bcc416286db7e89ab29cf43900c7b0dcd65 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 13 Jan 2018 13:38:38 -0500 Subject: [PATCH 0054/1222] Minor fix for EIC macros --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_EGEM_EIC.C | 16 +- macros/g4simulations/G4_FGEM_EIC.C | 295 +++++++++++++++++++++ 3 files changed, 306 insertions(+), 7 deletions(-) create mode 100644 macros/g4simulations/G4_FGEM_EIC.C diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index df0f77553..452fae125 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -57,7 +57,7 @@ void G4Init(bool do_svtx = true, if (do_FGEM) { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); + gROOT->LoadMacro("G4_FGEM_EIC.C"); FGEM_Init(); } diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C index 5eb2220c6..97badd9a0 100644 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ b/macros/g4simulations/G4_EGEM_EIC.C @@ -19,9 +19,16 @@ EGEM_Init() void EGEMSetup(PHG4Reco* g4Reco) { - make_GEM_station("EGEM_0", g4Reco, -32., -1.6, -3.4); + /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be + * drawn in event display but will NOT register any hits. + * + * Geometric constraints: + * TPC length = 211 cm --> from z = -105.5 to z = +105.5 + */ + make_GEM_station("EGEM_0", g4Reco, -32., -1.72, -3.4); // increase min eta from -1.6 to -1.72 to fit into barrel tracker geometry 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); + make_GEM_station("EGEM_2", g4Reco, -106., -1.2, -4.5); // move station from z = -101. to z= -106. because of increased TPC length + } int @@ -94,16 +101,13 @@ void EGEM_FastSim_Reco(int verbosity = 0) { 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"); + kalman->set_trackmap_out_name("SvtxTrackMap_FastSimEtaMinus"); // Saved track states (projections) std::string state_names[] = {"EEMC"}; diff --git a/macros/g4simulations/G4_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C new file mode 100644 index 000000000..da41baedb --- /dev/null +++ b/macros/g4simulations/G4_FGEM_EIC.C @@ -0,0 +1,295 @@ +/*! + * \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_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_FastSimEtaPlus"); + + // 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); + +} From e2aec8fbfd862655a59008d28afa89df7ad3476b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 21 Jan 2018 22:07:09 -0500 Subject: [PATCH 0055/1222] add plug door for tests --- macros/g4simulations/G4Setup_sPHENIX.C | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 3f5843a6f..0d99d8b6c 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -67,6 +67,7 @@ int G4Setup(const int absorberactive = 0, const bool do_magnet = true, const bool do_hcalout = true, const bool do_pipe = true, +// const bool do_plugdoor = true, const float magfield_rescale = 1.0) { //--------------- @@ -146,6 +147,42 @@ int G4Setup(const int absorberactive = 0, if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); + + + + //---------------------------------------- + // sPHENIX forward flux return(s) + // define via four cornors in the engineering drawing + const double z_1 = 330.81; + const double z_2 = 360.81; + const double r_1 = 30; + const double r_2 = 263.5; + + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); + flux_return_plus->set_int_param("lengthviarapidity",0); + flux_return_minus->set_double_param("length",360.81 - 330.81); + flux_return_minus->set_double_param("radius",30); + flux_return_minus->set_double_param("place_z",(330.81 + 360.81)/2.); + flux_return_minus->set_double_param("thickness",263.5 - 30); + 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",360.81 - 330.81); + flux_return_minus->set_double_param("radius",30); + flux_return_minus->set_double_param("place_z",-(330.81 + 360.81)/2.); + flux_return_minus->set_double_param("thickness",263.5 - 30); + 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 From ad32d80388e2aca75c1f5f2ada773fdbdc228307 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 21 Jan 2018 22:44:32 -0500 Subject: [PATCH 0056/1222] Fix var names --- macros/g4simulations/G4Setup_sPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 0d99d8b6c..4625ededa 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -160,10 +160,10 @@ int G4Setup(const int absorberactive = 0, PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_minus->set_double_param("length",360.81 - 330.81); - flux_return_minus->set_double_param("radius",30); - flux_return_minus->set_double_param("place_z",(330.81 + 360.81)/2.); - flux_return_minus->set_double_param("thickness",263.5 - 30); + flux_return_plus->set_double_param("length",360.81 - 330.81); + flux_return_plus->set_double_param("radius",30); + flux_return_plus->set_double_param("place_z",(330.81 + 360.81)/2.); + flux_return_plus->set_double_param("thickness",263.5 - 30); flux_return_plus->set_string_param("material","G4_Fe"); flux_return_plus->SetActive(false); flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); From 44b2da33c8f50be57f1edfd19b78534ad2db5a4a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 21 Jan 2018 22:48:17 -0500 Subject: [PATCH 0057/1222] refine material --- macros/g4simulations/G4Setup_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 4625ededa..4e9f93508 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -164,7 +164,7 @@ int G4Setup(const int absorberactive = 0, flux_return_plus->set_double_param("radius",30); flux_return_plus->set_double_param("place_z",(330.81 + 360.81)/2.); flux_return_plus->set_double_param("thickness",263.5 - 30); - flux_return_plus->set_string_param("material","G4_Fe"); + flux_return_plus->set_string_param("material","Steel_1006"); flux_return_plus->SetActive(false); flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); flux_return_plus->OverlapCheck(overlapcheck); @@ -176,7 +176,7 @@ int G4Setup(const int absorberactive = 0, flux_return_minus->set_double_param("radius",30); flux_return_minus->set_double_param("place_z",-(330.81 + 360.81)/2.); flux_return_minus->set_double_param("thickness",263.5 - 30); - flux_return_minus->set_string_param("material","G4_Fe"); + flux_return_minus->set_string_param("material","Steel_1006"); flux_return_minus->SetActive(false); flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); flux_return_minus->OverlapCheck(overlapcheck); From cdcdc25a8e531ee13e2d84c84be6b0a69630707a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 23 Jan 2018 12:44:21 -0500 Subject: [PATCH 0058/1222] mv flux return to separted macro and flag --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 7 ++- macros/g4simulations/G4Setup_sPHENIX.C | 61 +++++++---------------- macros/g4simulations/G4_PlugDoor.C | 41 +++++++++++++++ 3 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 macros/g4simulations/G4_PlugDoor.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index e8d5c4265..26352cf47 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -82,6 +82,9 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_cluster = do_hcalout_twr && true; bool do_hcalout_eval = do_hcalout_cluster && true; + //! forward flux return plug door. Out of acceptance and off by default. + bool do_plugdoor = false; + bool do_global = true; bool do_global_fastsim = true; @@ -112,7 +115,7 @@ int Fun4All_G4_sPHENIX( // 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); + G4Init(do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, 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) @@ -296,7 +299,7 @@ int Fun4All_G4_sPHENIX( //--------------------- G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, magfield_rescale); + do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); } //--------- diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 4e9f93508..610de6b23 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -2,14 +2,15 @@ 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) +void G4Init(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 bool do_plugdoor = false, + const int n_TPC_layers = 40) { // load detector/material macros and execute Init() function @@ -54,6 +55,11 @@ void G4Init(bool do_svtx = true, HCalOuterInit(); } + if (do_pipe) + { + gROOT->LoadMacro("G4_PlugDoor.C"); + PlugDoorInit(); + } } @@ -66,7 +72,8 @@ int G4Setup(const int absorberactive = 0, const bool do_hcalin = true, const bool do_magnet = true, const bool do_hcalout = true, - const bool do_pipe = true, + const bool do_pipe = true, + const bool do_plugdoor = false, // const bool do_plugdoor = true, const float magfield_rescale = 1.0) { @@ -147,41 +154,9 @@ int G4Setup(const int absorberactive = 0, if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - - //---------------------------------------- - // sPHENIX forward flux return(s) - // define via four cornors in the engineering drawing - const double z_1 = 330.81; - const double z_2 = 360.81; - const double r_1 = 30; - const double r_2 = 263.5; - - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_plus->set_double_param("length",360.81 - 330.81); - flux_return_plus->set_double_param("radius",30); - flux_return_plus->set_double_param("place_z",(330.81 + 360.81)/2.); - flux_return_plus->set_double_param("thickness",263.5 - 30); - flux_return_plus->set_string_param("material","Steel_1006"); - 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",360.81 - 330.81); - flux_return_minus->set_double_param("radius",30); - flux_return_minus->set_double_param("place_z",-(330.81 + 360.81)/2.); - flux_return_minus->set_double_param("thickness",263.5 - 30); - flux_return_minus->set_string_param("material","Steel_1006"); - flux_return_minus->SetActive(false); - flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); - flux_return_minus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_minus); - + // sPHENIX forward flux return door + if (do_plugdoor) PlugDoor(g4Reco, absorberactive); //---------------------------------------- // BLACKHOLE diff --git a/macros/g4simulations/G4_PlugDoor.C b/macros/g4simulations/G4_PlugDoor.C new file mode 100644 index 000000000..8ac06b972 --- /dev/null +++ b/macros/g4simulations/G4_PlugDoor.C @@ -0,0 +1,41 @@ + +void PlugDoorInit() {} +void PlugDoor(PHG4Reco *g4Reco, + const int absorberactive = 0, + int verbosity = 0) +{ + //---------------------------------------- + // sPHENIX forward flux return(s) + // define via four cornors in the engineering drawing + const double z_1 = z_1; + const double z_2 = z_2; + const double r_1 = r_1; + const double r_2 = r_2; + const string material("Steel_1006"); + + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); + flux_return_plus->set_int_param("lengthviarapidity", 0); + flux_return_plus->set_double_param("length", z_2 - z_1); + flux_return_plus->set_double_param("radius", r_1); + flux_return_plus->set_double_param("place_z", (z_1 + z_2) / 2.); + flux_return_plus->set_double_param("thickness", r_2 - r_1); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(absorberactive); +// flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + flux_return_minus->set_int_param("lengthviarapidity", 0); + flux_return_minus->set_double_param("length", z_2 - z_1); + flux_return_minus->set_double_param("radius", r_1); + flux_return_minus->set_double_param("place_z", -(z_1 + z_2) / 2.); + flux_return_minus->set_double_param("thickness", r_2 - r_1); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(absorberactive); +// flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} From 58ad8076469a01fa0d4b1000c8d37eba7c299cb7 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 23 Jan 2018 15:50:45 -0500 Subject: [PATCH 0059/1222] correct pareameters and set flux return door inactive by default (even if enabled in simulation) --- macros/g4simulations/G4_PlugDoor.C | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor.C b/macros/g4simulations/G4_PlugDoor.C index 8ac06b972..fcd613e83 100644 --- a/macros/g4simulations/G4_PlugDoor.C +++ b/macros/g4simulations/G4_PlugDoor.C @@ -7,11 +7,13 @@ void PlugDoor(PHG4Reco *g4Reco, //---------------------------------------- // sPHENIX forward flux return(s) // define via four cornors in the engineering drawing - const double z_1 = z_1; - const double z_2 = z_2; - const double r_1 = r_1; - const double r_2 = r_2; + const double z_1 = 330.81; + const double z_2 = 360.81; + const double r_1 = 30; + const double r_2 = 263.5; const string material("Steel_1006"); + const int flux_door_active = false; + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); flux_return_plus->set_int_param("lengthviarapidity", 0); @@ -20,7 +22,7 @@ void PlugDoor(PHG4Reco *g4Reco, flux_return_plus->set_double_param("place_z", (z_1 + z_2) / 2.); flux_return_plus->set_double_param("thickness", r_2 - r_1); flux_return_plus->set_string_param("material", material); - flux_return_plus->SetActive(absorberactive); + flux_return_plus->SetActive(flux_door_active); // flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); flux_return_plus->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(flux_return_plus); @@ -32,7 +34,7 @@ void PlugDoor(PHG4Reco *g4Reco, flux_return_minus->set_double_param("place_z", -(z_1 + z_2) / 2.); flux_return_minus->set_double_param("thickness", r_2 - r_1); flux_return_minus->set_string_param("material", material); - flux_return_minus->SetActive(absorberactive); + flux_return_minus->SetActive(flux_door_active); // flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); flux_return_minus->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(flux_return_minus); From 40a803e1ea53dbfd72cb3b0c5b85f7cead17aa35 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 25 Jan 2018 08:50:10 -0500 Subject: [PATCH 0060/1222] now automatic loading magnetic field. See https://github.com/sPHENIX-Collaboration/coresoftware/pull/349 --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 3 --- 1 file changed, 3 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 70ea650c1..24e9efc33 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -276,9 +276,6 @@ void FGEM_FastSim_Reco(int verbosity = 0) { 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.); From e64855c3951d3caf23dd2f07ec674f9d32da1cd4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 25 Jan 2018 08:58:41 -0500 Subject: [PATCH 0061/1222] update lib chain following https://github.com/sPHENIX-Collaboration/coresoftware/pull/403 --- macros/prototype2/Fun4All_G4_Prototype2.C | 4 +++- macros/prototype3/Fun4All_G4_Prototype3.C | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/macros/prototype2/Fun4All_G4_Prototype2.C b/macros/prototype2/Fun4All_G4_Prototype2.C index d2217c76d..97471107b 100644 --- a/macros/prototype2/Fun4All_G4_Prototype2.C +++ b/macros/prototype2/Fun4All_G4_Prototype2.C @@ -5,8 +5,10 @@ int Fun4All_G4_Prototype2(int nEvents = 1) gSystem->Load("libg4detectors"); gSystem->Load("libg4testbench"); gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); + gSystem->Load("libg4eval"); gSystem->Load("libqa_modules"); + gSystem->Load("libg4calo"); + gSystem->Load("libcalo_reco"); bool cemc_on = true; bool cemc_cell = cemc_on && true; diff --git a/macros/prototype3/Fun4All_G4_Prototype3.C b/macros/prototype3/Fun4All_G4_Prototype3.C index 850af560b..968581815 100644 --- a/macros/prototype3/Fun4All_G4_Prototype3.C +++ b/macros/prototype3/Fun4All_G4_Prototype3.C @@ -7,6 +7,8 @@ int Fun4All_G4_Prototype3(int nEvents = 1) gSystem->Load("libg4histos"); gSystem->Load("libg4eval.so"); gSystem->Load("libqa_modules"); + gSystem->Load("libg4calo"); + gSystem->Load("libcalo_reco"); bool cemc_on = true; bool cemc_cell = cemc_on && true; From 79a705af72277fcae71207ecbd24c212e94c6f15 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 30 Jan 2018 11:55:51 -0500 Subject: [PATCH 0062/1222] Fixed error in TPC setup that caused cells to be slightly off itn phi --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) 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 index 59d7ef502..f3223f4e0 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -551,51 +551,40 @@ void Svtx_Cells(int verbosity = 0) double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns // inner layers - double radius_layer = inner_readout_radius + tpc_layer_thick_inner / 2.0; - int counter_layer = 0; + double radius_layer = inner_readout_radius ; for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) { // this calculates the radius at the middle of the layer - if (counter_layer > 0) - radius_layer += tpc_layer_thick_inner; double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; + radius_layer += tpc_layer_thick_inner; } - radius_layer += tpc_layer_thick_inner / 2.0; + // mid layers - radius_layer += tpc_layer_thick_mid / 2.0; - counter_layer = 0; for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) { - if (counter_layer > 0) - radius_layer += tpc_layer_thick_mid; double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; + radius_layer += tpc_layer_thick_mid; } - radius_layer += tpc_layer_thick_mid / 2.0; // outer layers - radius_layer += tpc_layer_thick_outer / 2.0; - counter_layer = 0; for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) { - if (counter_layer > 0) - radius_layer += tpc_layer_thick_outer; double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - counter_layer++; + + radius_layer += tpc_layer_thick_outer; } se->registerSubsystem(svtx_cells); @@ -823,7 +812,7 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); eval->do_cluster_eval(true); eval->do_g4hit_eval(true); - eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true eval->Verbosity(verbosity); From 4edf068aa5f3f76ea6bfb718676f9d512e2a4516 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 16 Feb 2018 11:22:16 -0500 Subject: [PATCH 0063/1222] naming changes --- macros/prototype4/DisplayOn.C | 34 ++ macros/prototype4/Fun4All_G4_Prototype4.C | 588 ++++++++++++++++++++++ macros/prototype4/Fun4All_TestBeam.C | 334 ++++++++++++ macros/prototype4/vis_prototype3.mac | 82 +++ 4 files changed, 1038 insertions(+) create mode 100644 macros/prototype4/DisplayOn.C create mode 100644 macros/prototype4/Fun4All_G4_Prototype4.C create mode 100644 macros/prototype4/Fun4All_TestBeam.C create mode 100644 macros/prototype4/vis_prototype3.mac diff --git a/macros/prototype4/DisplayOn.C b/macros/prototype4/DisplayOn.C new file mode 100644 index 000000000..cb75b1cbc --- /dev/null +++ b/macros/prototype4/DisplayOn.C @@ -0,0 +1,34 @@ +// 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_prototype3.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/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C new file mode 100644 index 000000000..55e1f88ca --- /dev/null +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -0,0 +1,588 @@ +int Fun4All_G4_Prototype4(int nEvents = 1) +{ + + gSystem->Load("libfun4all"); + gSystem->Load("libg4detectors"); + gSystem->Load("libg4testbench"); + gSystem->Load("libg4histos"); + gSystem->Load("libg4eval.so"); + gSystem->Load("libqa_modules"); + gSystem->Load("libg4calo"); + gSystem->Load("libcalo_reco"); + + 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/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C new file mode 100644 index 000000000..124e65ece --- /dev/null +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -0,0 +1,334 @@ +#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("libPrototype4.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 = PROTOTYPE4_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: + Prototype4DSTReader *reader = new Prototype4DSTReader( + 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/prototype4/vis_prototype3.mac b/macros/prototype4/vis_prototype3.mac new file mode 100644 index 000000000..12adcc651 --- /dev/null +++ b/macros/prototype4/vis_prototype3.mac @@ -0,0 +1,82 @@ +# $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. From 745e72852b3cc1178dc4d3786946e9c708d7c201 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 21 Feb 2018 23:46:25 -0500 Subject: [PATCH 0064/1222] update calo decoder part --- macros/prototype4/Fun4All_TestBeam.C | 499 +++++++++++++-------------- 1 file changed, 249 insertions(+), 250 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 124e65ece..205a85428 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,11 +2,11 @@ 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") +void Fun4All_TestBeam(int nEvents = 1000, + const char *input_file = + // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", + "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", + const char *output_file = "data/led_00000254.root") { gSystem->Load("libfun4all"); gSystem->Load("libPrototype4.so"); @@ -19,260 +19,260 @@ Fun4All_TestBeam(int nEvents = 1000, // ------------------- Run info -> RUN node ------------------- RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF(); -// unpack_run->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); + // 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 - + // // 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); - + // + // // ------------------- 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); + // unpack->Verbosity(1); se->registerSubsystem(unpack); - CaloCalibration * calib = NULL; + CaloCalibration *calib = NULL; calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database + 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 + 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 + 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 + 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 = PROTOTYPE4_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); + calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database 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()); + // + // // ------------------- Hodoscpes ------------------- + // + // const int first_packet_id = PROTOTYPE4_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); + output_file); se->registerOutputManager(out_Manager); //alternatively, fast check on DST using DST Reader: Prototype4DSTReader *reader = new Prototype4DSTReader( 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->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"); @@ -285,41 +285,41 @@ Fun4All_TestBeam(int nEvents = 1000, 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"); + // + // 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); @@ -330,5 +330,4 @@ Fun4All_TestBeam(int nEvents = 1000, se->run(nEvents); se->End(); - } From a2684c3f6afd36894c8b2201114836d52671707b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 15:33:44 -0500 Subject: [PATCH 0065/1222] Peripharal detector mapping --- macros/prototype4/Fun4All_TestBeam.C | 202 ++++++++++++++------------- 1 file changed, 108 insertions(+), 94 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 205a85428..7a83e0b04 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,7 +2,7 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 1000, +void Fun4All_TestBeam(int nEvents = 10000000, const char *input_file = // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", @@ -86,13 +86,13 @@ void Fun4All_TestBeam(int nEvents = 1000, 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("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"); @@ -112,66 +112,78 @@ void Fun4All_TestBeam(int nEvents = 1000, // // // ------------------- Hodoscpes ------------------- // - // const int first_packet_id = PROTOTYPE4_FEM::PACKET_ID; // 21101 + const int first_packet_id = PROTOTYPE4_FEM::PACKET_ID; // 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); + GenericUnpackPRDF *gunpack = NULL; + + const int N_hodo = 8; + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); + gunpack->add_channel(first_packet_id, 101, 0); + gunpack->add_channel(first_packet_id, 100, 1); + gunpack->add_channel(first_packet_id, 103, 2); + gunpack->add_channel(first_packet_id, 102, 3); + gunpack->add_channel(first_packet_id, 97, 4); + gunpack->add_channel(first_packet_id, 96, 5); + gunpack->add_channel(first_packet_id, 99, 6); + gunpack->add_channel(first_packet_id, 98, 7); + se->registerSubsystem(gunpack); + // + gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); + gunpack->add_channel(first_packet_id, 109, 0); + gunpack->add_channel(first_packet_id, 108, 1); + gunpack->add_channel(first_packet_id, 111, 2); + gunpack->add_channel(first_packet_id, 110, 3); /// TODO: fix map here + gunpack->add_channel(first_packet_id, 105, 4); + gunpack->add_channel(first_packet_id, 104, 5); + gunpack->add_channel(first_packet_id, 107, 6); + gunpack->add_channel(first_packet_id, 106, 7); + 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); + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("C1"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 165, 0); // 24 Cerenkov 1 + se->registerSubsystem(gunpack); // - // // 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("C1"); + se->registerSubsystem(calib); // - // 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); + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("C2"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 166, 0); // C2 inner fast + gunpack->add_channel(first_packet_id, 160, 1); // C2 outer fast + gunpack->add_channel(first_packet_id, 167, 10); // C2 inner slow + 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"); @@ -184,32 +196,34 @@ void Fun4All_TestBeam(int nEvents = 1000, // 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); + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("PbGL"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 171, 0); // PbGl (612AM-3) + se->registerSubsystem(gunpack); + + calib = new CaloCalibration("PbGL"); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); + se->registerSubsystem(calib); // - // // 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); + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 172, 0); // 172 Counters Bottom veto + gunpack->add_channel(first_packet_id, 173, 1); // 173 Counters Top veto + gunpack->add_channel(first_packet_id, 174, 2); // 174 Counters Right veto + gunpack->add_channel(first_packet_id, 175, 3); // 175 Counters Left 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; // @@ -221,15 +235,15 @@ void Fun4All_TestBeam(int nEvents = 1000, // 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); + // mapping based on SPHENIX-doc-121-v6 + gunpack = new GenericUnpackPRDF("SC3"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 169, 0); // MT6SC3 (612AM-2) + se->registerSubsystem(gunpack); // - // calib = new CaloCalibration("SC3"); - // calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - // se->registerSubsystem(calib); + calib = new CaloCalibration("SC3"); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); + se->registerSubsystem(calib); // // gunpack = new GenericUnpackPRDF("SC_MWPC4"); //// unpack->Verbosity(1); From 06b4e960661404ea200f5cb9f00abac75951fae7 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 15:35:24 -0500 Subject: [PATCH 0066/1222] Confirm mapping --- macros/prototype4/Fun4All_TestBeam.C | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 7a83e0b04..49d476119 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -119,6 +119,18 @@ void Fun4All_TestBeam(int nEvents = 10000000, const int N_hodo = 8; // mapping based on SPHENIX-doc-121-v6 +// 1 2 3 4 5 6 7 8 +// 101 100 103 102 97 96 99 98 +// +//9 109 +//10 108 +//11 111 +//12 110 +//13 105 +//14 104 +//15 107 +//16 106 + gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); gunpack->add_channel(first_packet_id, 101, 0); gunpack->add_channel(first_packet_id, 100, 1); @@ -134,7 +146,7 @@ void Fun4All_TestBeam(int nEvents = 10000000, gunpack->add_channel(first_packet_id, 109, 0); gunpack->add_channel(first_packet_id, 108, 1); gunpack->add_channel(first_packet_id, 111, 2); - gunpack->add_channel(first_packet_id, 110, 3); /// TODO: fix map here + gunpack->add_channel(first_packet_id, 110, 3); gunpack->add_channel(first_packet_id, 105, 4); gunpack->add_channel(first_packet_id, 104, 5); gunpack->add_channel(first_packet_id, 107, 6); From da68c9429d1d3c355cf3e8fc329587d69b5406df Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 16:11:20 -0500 Subject: [PATCH 0067/1222] adjust production setttings --- macros/prototype4/Fun4All_TestBeam.C | 162 ++++++++++++++------------- 1 file changed, 84 insertions(+), 78 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 49d476119..15a1d62ca 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,11 +2,15 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 10000000, - const char *input_file = - // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", - "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", - const char *output_file = "data/led_00000254.root") +void Fun4All_TestBeam(int nEvents = 100, + + // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", + // + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", + const char *output_file = "data/beam_00000332.root" + // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", + // const char *output_file = "data/led_00000254.root"// + ) { gSystem->Load("libfun4all"); gSystem->Load("libPrototype4.so"); @@ -23,49 +27,49 @@ void Fun4All_TestBeam(int nEvents = 10000000, 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 + // 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 ------------------- + // ------------------- 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); @@ -119,17 +123,17 @@ void Fun4All_TestBeam(int nEvents = 10000000, const int N_hodo = 8; // mapping based on SPHENIX-doc-121-v6 -// 1 2 3 4 5 6 7 8 -// 101 100 103 102 97 96 99 98 -// -//9 109 -//10 108 -//11 111 -//12 110 -//13 105 -//14 104 -//15 107 -//16 106 + // 1 2 3 4 5 6 7 8 + // 101 100 103 102 97 96 99 98 + // + //9 109 + //10 108 + //11 111 + //12 110 + //13 105 + //14 104 + //15 107 + //16 106 gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); gunpack->add_channel(first_packet_id, 101, 0); @@ -273,7 +277,9 @@ void Fun4All_TestBeam(int nEvents = 10000000, // // // ------------------- Event summary ------------------- // - // se->registerSubsystem(new EventInfoSummary()); + // EventInfoSummary * es = new EventInfoSummary(); + // es->Verbosity(EventInfoSummary::VERBOSITY_MORE); + // se->registerSubsystem(es); // ------------------- Output ------------------- //main DST output @@ -285,13 +291,13 @@ void Fun4All_TestBeam(int nEvents = 10000000, Prototype4DSTReader *reader = new Prototype4DSTReader( 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->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"); @@ -300,43 +306,43 @@ void Fun4All_TestBeam(int nEvents = 10000000, // reader->AddEventInfo("CALIB_LG_HCALOUT_Sum"); // reader->AddTower("RAW_LG_HCALIN"); - reader->AddTower("RAW_HG_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_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_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_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_PbGL"); + reader->AddTower("CALIB_PbGL"); // - // reader->AddTower("RAW_TRIGGER_VETO"); - // reader->AddTower("CALIB_TRIGGER_VETO"); + 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_SC3"); + reader->AddTower("CALIB_SC3"); // // reader->AddTower("RAW_SC_MWPC4"); // reader->AddTower("CALIB_SC_MWPC4"); From 4af03943fa19fde5ff20f3fb30d976c1465ed576 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 16:34:01 -0500 Subject: [PATCH 0068/1222] adjust production setttings --- macros/prototype4/Fun4All_TestBeam.C | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 15a1d62ca..6eb668f7d 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -159,10 +159,9 @@ void Fun4All_TestBeam(int nEvents = 100, // 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)); + Form("calib_const_column0_row%d", i), 1 / 23.24); // normalize to 1.0 se->registerSubsystem(calib); calib = new CaloCalibration("HODO_HORIZONTAL"); @@ -170,7 +169,7 @@ void Fun4All_TestBeam(int nEvents = 100, // 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)); + Form("calib_const_column0_row%d", i), 1 / 23.24); // normalize to 1.0 se->registerSubsystem(calib); // // // ------------------- Other detectors ------------------- @@ -195,10 +194,10 @@ void Fun4All_TestBeam(int nEvents = 100, 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); + 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 @@ -235,10 +234,10 @@ void Fun4All_TestBeam(int nEvents = 100, 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); + 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; From ef8a18ae64f24359e113e3f0d2cd28a5b5d879bb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 21:19:59 -0500 Subject: [PATCH 0069/1222] Update scintillator calibration --- macros/prototype4/Fun4All_TestBeam.C | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 6eb668f7d..1affb4e32 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,12 +2,14 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 100, +void Fun4All_TestBeam(int nEvents = 300, // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", // - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", - const char *output_file = "data/beam_00000332.root" +// const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", +// const char *output_file = "data/beam_00000332.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000393-0000.prdf", + const char *output_file = "data/beam_00000393.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -161,7 +163,7 @@ void Fun4All_TestBeam(int nEvents = 100, calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); for (int i = 0; i < N_hodo; ++i) calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), 1 / 23.24); // normalize to 1.0 + Form("calib_const_column0_row%d", i), 1 / 1.38253e+02); // normalize to 1.0 se->registerSubsystem(calib); calib = new CaloCalibration("HODO_HORIZONTAL"); @@ -169,7 +171,7 @@ void Fun4All_TestBeam(int nEvents = 100, // 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), 1 / 23.24); // normalize to 1.0 + Form("calib_const_column0_row%d", i), 1 / 1.38253e+02); // normalize to 1.0 se->registerSubsystem(calib); // // // ------------------- Other detectors ------------------- @@ -234,10 +236,10 @@ void Fun4All_TestBeam(int nEvents = 100, 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); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", 1. / 3.17209e+02); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", 1. / 3.27850e+02); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", 1. / 4.51055e+02); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", 1. / 5.82206e+02); se->registerSubsystem(calib); // // const int N_TileMapper = 16; From a05e2ca000c014bc923552fb566a239ec5ebb275 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 21:49:09 -0500 Subject: [PATCH 0070/1222] Rought zero-th order calibration --- macros/prototype4/Fun4All_TestBeam.C | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 1affb4e32..1f652edf4 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -80,16 +80,20 @@ void Fun4All_TestBeam(int nEvents = 300, CaloCalibration *calib = NULL; calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); +// 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 + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); +// calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, +// string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); // calib = new CaloCalibration("HCALIN"); @@ -104,16 +108,20 @@ void Fun4All_TestBeam(int nEvents = 300, 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 + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); +// 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 + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); +// calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, +// string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); // // // ------------------- Hodoscpes ------------------- From 84406eef0f855ea8f42efc41072407868d07c5d8 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 26 Feb 2018 22:14:32 -0500 Subject: [PATCH 0071/1222] Rought zero-th order calibration --- macros/prototype4/Fun4All_TestBeam.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 1f652edf4..511e2cee5 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,14 +2,14 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 300, +void Fun4All_TestBeam(int nEvents = 100, // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", // // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", // const char *output_file = "data/beam_00000332.root" - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000393-0000.prdf", - const char *output_file = "data/beam_00000393.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000402-0000.prdf", + const char *output_file = "data/beam_00000402.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -81,7 +81,7 @@ void Fun4All_TestBeam(int nEvents = 300, calib = new CaloCalibration("CEMC"); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); @@ -91,7 +91,7 @@ void Fun4All_TestBeam(int nEvents = 300, calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalin_lg"); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); @@ -109,7 +109,7 @@ void Fun4All_TestBeam(int nEvents = 300, calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalout_lg"); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); @@ -119,7 +119,7 @@ void Fun4All_TestBeam(int nEvents = 300, calib->set_raw_tower_node_prefix("RAW_HG"); calib->GetCalibrationParameters().set_name("hcalout_hg"); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); From 9005efa1daa81f518ed168d80456096a408e96e8 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 28 Feb 2018 14:13:20 -0500 Subject: [PATCH 0072/1222] Add finger counter and switch to furn on/off calorimeters --- macros/prototype4/Fun4All_TestBeam.C | 158 ++++++++++++++++----------- 1 file changed, 94 insertions(+), 64 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 511e2cee5..14027393e 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,14 +2,14 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 100, +void Fun4All_TestBeam(int nEvents = 10, // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", // -// const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", -// const char *output_file = "data/beam_00000332.root" - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000402-0000.prdf", - const char *output_file = "data/beam_00000402.root" + // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", + // const char *output_file = "data/beam_00000332.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000499-0000.prdf", + const char *output_file = "data/beam_00000499.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -17,6 +17,9 @@ void Fun4All_TestBeam(int nEvents = 100, gSystem->Load("libfun4all"); gSystem->Load("libPrototype4.so"); + const bool do_cemc = true; + const bool do_hcal = true; + Fun4AllServer *se = Fun4AllServer::instance(); se->Verbosity(Fun4AllServer::VERBOSITY_SOME); @@ -73,56 +76,63 @@ void Fun4All_TestBeam(int nEvents = 100, // 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().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); -// 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().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); -// 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().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); -// 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().set_double_param("calib_const_scale", 8./3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); -// calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, -// string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); + if (do_cemc) + { + SubsysReco *unpack = new CaloUnpackPRDF(); + // unpack->Verbosity(1); + se->registerSubsystem(unpack); + + CaloCalibration *calib = NULL; + + calib = new CaloCalibration("CEMC"); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database + se->registerSubsystem(calib); + } + + if (do_hcal) + { + 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().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + // 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().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + // 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().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + // calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, + // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database + se->registerSubsystem(calib); + } // // // ------------------- Hodoscpes ------------------- // @@ -269,6 +279,15 @@ void Fun4All_TestBeam(int nEvents = 100, calib = new CaloCalibration("SC3"); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); se->registerSubsystem(calib); + + gunpack = new GenericUnpackPRDF("FINGER_COUNTER"); + // unpack->Verbosity(1); + gunpack->add_channel(first_packet_id, 168, 0); // 168 Counters Finger counter + se->registerSubsystem(gunpack); + // + calib = new CaloCalibration("FINGER_COUNTER"); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); + se->registerSubsystem(calib); // // gunpack = new GenericUnpackPRDF("SC_MWPC4"); //// unpack->Verbosity(1); @@ -314,18 +333,25 @@ void Fun4All_TestBeam(int nEvents = 100, // 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"); + if (do_hcal) + { + 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("CALIB_LG_HCALIN"); - // reader->AddTower("CALIB_HG_HCALIN"); - reader->AddTower("CALIB_LG_HCALOUT"); - reader->AddTower("CALIB_HG_HCALOUT"); + if (do_cemc) + { + reader->AddTower("RAW_CEMC"); + reader->AddTower("CALIB_CEMC"); + } - reader->AddTower("RAW_CEMC"); - reader->AddTower("CALIB_CEMC"); // reader->AddTower("RAW_HODO_VERTICAL"); reader->AddTower("RAW_HODO_HORIZONTAL"); @@ -352,6 +378,10 @@ void Fun4All_TestBeam(int nEvents = 100, // reader->AddTower("RAW_SC3"); reader->AddTower("CALIB_SC3"); + + reader->AddTower("RAW_FINGER_COUNTER"); + reader->AddTower("CALIB_FINGER_COUNTER"); + // // reader->AddTower("RAW_SC_MWPC4"); // reader->AddTower("CALIB_SC_MWPC4"); From 970d00a78895057f74e82c1e5e8df17e9162cdc3 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Mar 2018 20:37:38 -0500 Subject: [PATCH 0073/1222] Updated to use 16 inner layers with 1152 pads each, use zigzag pads, additional smearing in phi and Z tuned to give 150 microns in outer layer --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) 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 index f3223f4e0..dda5e29d4 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -8,16 +8,11 @@ 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_tpc_layer_inner = 8; -double tpc_layer_thick_inner = 1.25; -int tpc_layer_rphi_count_inner = 1920; +bool use_zigzag_pads = true; // set to false to revert to rectangular pads -// make inner layers a factor of 2 thinner -/* -int n_tpc_layer_inner = 8 * 2; +int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; -int tpc_layer_rphi_count_inner = 1920 / 2; -*/ +int tpc_layer_rphi_count_inner = 1152; int n_tpc_layer_mid = 16; double tpc_layer_thick_mid = 1.25; @@ -196,8 +191,8 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) // TKH does not understand the physical origin of these parameters. // however, their impact seems quite small... - TPC_SmearRPhi = 0.10; - TPC_SmearZ = 0.15; + TPC_SmearRPhi = 0.215; + TPC_SmearZ = 0.20; } double Svtx(PHG4Reco* g4Reco, double radius, @@ -515,6 +510,7 @@ void Svtx_Cells(int verbosity = 0) PHG4CylinderCellTPCReco* svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer + n_intt_layer); svtx_cells->Detector("SVTX"); svtx_cells->setDistortion(tpc_distortion); + svtx_cells->setZigzags(use_zigzag_pads); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). if (n_gas_layer != 60) { svtx_cells->setDiffusionT(TPC_Trans_Diffusion); @@ -643,7 +639,7 @@ void Svtx_Reco(int verbosity = 0) // TPC layers for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) { - digi->set_adc_scale(i, 30000, 1.0); + digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range } se->registerSubsystem(digi); @@ -712,6 +708,7 @@ void Svtx_Reco(int verbosity = 0) tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); if (n_gas_layer == 40) { + // obsolete 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*/); @@ -719,10 +716,10 @@ void Svtx_Reco(int verbosity = 0) } else { - // 60 layer tune + // current 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->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); tpcclusterizer->setFitEnergyThreshold(0.05 /*fraction*/); } se->registerSubsystem(tpcclusterizer); From 888fe5a2db130296f85454a8fd9fe91bb751649d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Mar 2018 21:47:38 -0500 Subject: [PATCH 0074/1222] Removed references to 60 layer TPC setup. The macro now sets up the TPC as we intend to build it (16 inner, 16 mid and 16 outer layers). Cleaned up commented out lines in tracking macro. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 +- macros/g4simulations/G4Setup_sPHENIX.C | 6 +- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 70 +++++-------------- 3 files changed, 21 insertions(+), 59 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 26352cf47..45e8fc045 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -7,8 +7,6 @@ int Fun4All_G4_sPHENIX( 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 @@ -115,7 +113,7 @@ int Fun4All_G4_sPHENIX( // 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, do_plugdoor, n_TPC_layers); + G4Init(do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); 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) diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 610de6b23..32515b2a5 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -9,8 +9,8 @@ void G4Init(const bool do_svtx = true, const bool do_magnet = true, const bool do_hcalout = true, const bool do_pipe = true, - const bool do_plugdoor = false, - const int n_TPC_layers = 40) + const bool do_plugdoor = false + ) { // load detector/material macros and execute Init() function @@ -23,7 +23,7 @@ void G4Init(const bool do_svtx = true, if (do_svtx) { gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); + SvtxInit(); } if (do_pstof) 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 index dda5e29d4..a204cba7a 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -8,8 +8,6 @@ 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 -bool use_zigzag_pads = true; // set to false to revert to rectangular pads - int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; int tpc_layer_rphi_count_inner = 1152; @@ -81,7 +79,7 @@ double TPC_SmearZ; int Max_si_layer; -void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) +void SvtxInit(int verbosity = 0) { Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; @@ -186,11 +184,11 @@ void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA - // TPCADCClock = 27.0; // ns, corresponds to an ADC clock rate of 18.8 MHz * 2 tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm // TKH does not understand the physical origin of these parameters. // however, their impact seems quite small... + // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here TPC_SmearRPhi = 0.215; TPC_SmearZ = 0.20; } @@ -335,8 +333,6 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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 ); // Active layers of the TPC from 30-40 cm (inner layers) @@ -477,14 +473,6 @@ void Svtx_Cells(int verbosity = 0) 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; @@ -510,29 +498,17 @@ void Svtx_Cells(int verbosity = 0) PHG4CylinderCellTPCReco* svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer + n_intt_layer); svtx_cells->Detector("SVTX"); svtx_cells->setDistortion(tpc_distortion); - svtx_cells->setZigzags(use_zigzag_pads); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - if (n_gas_layer != 60) - { - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - - 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(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane - svtx_cells->setSmearZ(TPC_SmearZ); // 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->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + 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 + // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers + svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits + svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits svtx_cells->set_drift_velocity(TPCDriftVelocity); svtx_cells->setHalfLength(105.5); svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); @@ -706,22 +682,10 @@ void Svtx_Reco(int verbosity = 0) PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); tpcclusterizer->Verbosity(0); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); - if (n_gas_layer == 40) - { - // obsolete - 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 - { - // current - tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); - tpcclusterizer->setFitEnergyThreshold(0.05 /*fraction*/); - } + tpcclusterizer->setEnergyCut(15 /*adc*/); + tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes + tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); + tpcclusterizer->setFitEnergyThreshold(0.05 /*fraction*/); se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! From 8906c44437d225052c708ee6e82d9e1881639589 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Mar 2018 22:57:49 -0500 Subject: [PATCH 0075/1222] Added switch at top of macro for backward compatibility with 40 layer hits files --- ...tx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 index a204cba7a..9f429ca49 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -1,5 +1,8 @@ #include +// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +bool tpc_layers_40 = false; + // 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 @@ -289,8 +292,19 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = intt_radius_max * 0.1; } + int verbosity = 1; + // time projection chamber layers -------------------------------------------- + // switch ONLY for backward compatibility with 40 layer hits files! + if (tpc_layers_40) + { + n_tpc_layer_inner = 8; + tpc_layer_thick_inner = 1.25; + tpc_layer_rphi_count_inner = 1152; + cout << "Using 8 inner_layers for backward comatibility" << endl; + } + PHG4CylinderSubsystem* cyl; radius = inner_cage_radius; From 21d599b18d3d1c9c37425ecd26e24bf2bc84fd30 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 3 Mar 2018 12:14:30 -0500 Subject: [PATCH 0076/1222] add Nicole's hodoscope calibraiton --- macros/prototype4/Fun4All_TestBeam.C | 76 ++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 14027393e..771943a05 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,14 +2,14 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 10, +void Fun4All_TestBeam(int nEvents = 2000, // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", // // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", // const char *output_file = "data/beam_00000332.root" - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000499-0000.prdf", - const char *output_file = "data/beam_00000499.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000581-0000.prdf", + const char *output_file = "data/beam_00000581.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -19,6 +19,8 @@ void Fun4All_TestBeam(int nEvents = 10, const bool do_cemc = true; const bool do_hcal = true; + // const bool do_cemc = false; + // const bool do_hcal = false; Fun4AllServer *se = Fun4AllServer::instance(); se->Verbosity(Fun4AllServer::VERBOSITY_SOME); @@ -77,15 +79,16 @@ void Fun4All_TestBeam(int nEvents = 10, // ------------------- HCal and EMcal ------------------- + CaloCalibration *calib = NULL; + if (do_cemc) { SubsysReco *unpack = new CaloUnpackPRDF(); // unpack->Verbosity(1); se->registerSubsystem(unpack); - CaloCalibration *calib = NULL; - calib = new CaloCalibration("CEMC"); + // calib->Verbosity(1); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, @@ -177,19 +180,50 @@ void Fun4All_TestBeam(int nEvents = 10, gunpack->add_channel(first_packet_id, 106, 7); se->registerSubsystem(gunpack); // + + // Nicole Lewis [7:12 PM] + // added and commented on this Plain Text snippet: Run 545 MPV and Other Values + // Collumns: Height, MPV, Sigma, chi2, NDF + // Run 545 + // HODO_HORIZONTAL[0] 18.0525 319.879 83.4359 139.487 199 + // HODO_HORIZONTAL[1] 26.6811 262.209 65.1704 159.059 171 + // HODO_HORIZONTAL[2] 27.5885 296.343 61.0538 171.291 205 + // HODO_HORIZONTAL[3] 24.4132 299.135 72.4796 205.008 214 + // HODO_HORIZONTAL[4] 28.6331 290.498 66.9209 177.386 205 + // HODO_HORIZONTAL[5] 29.3528 263.781 61.5052 202.933 195 + // HODO_HORIZONTAL[6] 21.5175 336.446 78.8985 170.031 206 + // HODO_HORIZONTAL[7] 17.7948 336.247 91.8477 146.352 201 + // HODO_VERTICAL[0] 15.3648 238.473 94.6679 111.272 166 + // HODO_VERTICAL[1] 23.2368 225.202 54.8611 117.209 145 + // HODO_VERTICAL[2] 25.3442 209.827 66.168 134.383 171 + // HODO_VERTICAL[3] 36.8254 217.544 44.1445 122.811 167 + // HODO_VERTICAL[4] 38.0982 210.6 44.9922 160.269 165 + // HODO_VERTICAL[5] 38.1045 252.022 49.4073 165.239 200 + // HODO_VERTICAL[6] 42.1052 223.528 44.5291 113.343 171 + // HODO_VERTICAL[7] 31.1721 244.299 55.974 160.476 186 + calib = new CaloCalibration("HODO_VERTICAL"); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), 1 / 1.38253e+02); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 0), 1 / 238.473); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 1), 1 / 225.202); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 2), 1 / 209.827); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 3), 1 / 217.544); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 4), 1 / 210.6); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 5), 1 / 252.022); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 6), 1 / 223.528); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 7), 1 / 244.299); // normalize to 1.0 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), 1 / 1.38253e+02); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 0), 1 / 319.879); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 1), 1 / 262.209); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 2), 1 / 296.343); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 3), 1 / 299.135); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 4), 1 / 290.498); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 5), 1 / 263.781); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 6), 1 / 336.446); // normalize to 1.0 + calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 7), 1 / 336.247); // normalize to 1.0 se->registerSubsystem(calib); // // // ------------------- Other detectors ------------------- @@ -251,13 +285,23 @@ void Fun4All_TestBeam(int nEvents = 10, se->registerSubsystem(gunpack); // Calibrate the MIP peak to an relative energy of +1.0 + + // Nicole Lewis [7:12 PM] + // added and commented on this Plain Text snippet: Run 545 MPV and Other Values + // Collumns: Height, MPV, Sigma, chi2, NDF + // Run 545 + // TRIGGER_VETO[0] 501.958 295.811 51.6134 223.972 194 + // TRIGGER_VETO[1] 262.321 305.247 52.5851 138.403 158 + // TRIGGER_VETO[2] 238.726 451.48 99.6016 274.339 245 + // TRIGGER_VETO[3] 135.541 624.076 132.313 284.532 240 + 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. / 3.17209e+02); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", 1. / 3.27850e+02); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", 1. / 4.51055e+02); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", 1. / 5.82206e+02); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", 1. / 295.811); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", 1. / 305.247); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", 1. / 451.48); + calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", 1. / 624.076); se->registerSubsystem(calib); // // const int N_TileMapper = 16; From 7058af2e87cd8443720fec522df14864a50241a5 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 3 Mar 2018 12:44:48 -0500 Subject: [PATCH 0077/1222] Use verbosity setting as in the function parameters --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 9f429ca49..fed3cd0bc 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -292,7 +292,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = intt_radius_max * 0.1; } - int verbosity = 1; +// int verbosity = 1; // time projection chamber layers -------------------------------------------- From 9d3e13e37649e3a84c7562ff0dcae1d69e5e8cae Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 3 Mar 2018 22:21:17 -0500 Subject: [PATCH 0078/1222] global fit on VETO counter did not work well --- macros/prototype4/Fun4All_TestBeam.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 771943a05..a8086c45c 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -296,6 +296,7 @@ void Fun4All_TestBeam(int nEvents = 2000, // TRIGGER_VETO[3] 135.541 624.076 132.313 284.532 240 calib = new CaloCalibration("TRIGGER_VETO"); + calib->SetFitType(CaloCalibration::kPowerLawExp); 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. / 295.811); From aeb81d1e65545c18f5774338ef5cb698b471591a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 5 Mar 2018 00:34:24 -0500 Subject: [PATCH 0079/1222] 1. Use simple max finder for non-shaped signals. 2. Add tile mappers --- macros/prototype4/Fun4All_TestBeam.C | 45 +++++++++++++++------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index a8086c45c..53336217c 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,14 +2,14 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 2000, +void Fun4All_TestBeam(int nEvents = 1000, // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", // // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", // const char *output_file = "data/beam_00000332.root" - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000581-0000.prdf", - const char *output_file = "data/beam_00000581.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", + const char *output_file = "data/beam_00000406.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -88,7 +88,7 @@ void Fun4All_TestBeam(int nEvents = 2000, se->registerSubsystem(unpack); calib = new CaloCalibration("CEMC"); - // calib->Verbosity(1); +// calib->Verbosity(4); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, @@ -235,6 +235,7 @@ void Fun4All_TestBeam(int nEvents = 2000, se->registerSubsystem(gunpack); // calib = new CaloCalibration("C1"); + calib->SetFitType(CaloCalibration::kPeakSample); se->registerSubsystem(calib); // // mapping based on SPHENIX-doc-121-v6 @@ -246,6 +247,7 @@ void Fun4All_TestBeam(int nEvents = 2000, se->registerSubsystem(gunpack); // calib = new CaloCalibration("C2"); + calib->SetFitType(CaloCalibration::kPeakSample); 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); @@ -296,7 +298,7 @@ void Fun4All_TestBeam(int nEvents = 2000, // TRIGGER_VETO[3] 135.541 624.076 132.313 284.532 240 calib = new CaloCalibration("TRIGGER_VETO"); - calib->SetFitType(CaloCalibration::kPowerLawExp); + calib->SetFitType(CaloCalibration::kPeakSample); 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. / 295.811); @@ -305,15 +307,16 @@ void Fun4All_TestBeam(int nEvents = 2000, calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", 1. / 624.076); se->registerSubsystem(calib); // - // const int N_TileMapper = 16; + 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); + gunpack = new GenericUnpackPRDF("TILE_MAPPER"); + for (int i = 0; i < N_TileMapper; ++i) + gunpack->add_channel(first_packet_id, 176 + i, i); // 24 Cerenkov 1 + se->registerSubsystem(gunpack); // - // calib = new CaloCalibration("TILE_MAPPER"); - // se->registerSubsystem(calib); + calib = new CaloCalibration("TILE_MAPPER"); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); + se->registerSubsystem(calib); // // mapping based on SPHENIX-doc-121-v6 gunpack = new GenericUnpackPRDF("SC3"); @@ -364,13 +367,13 @@ void Fun4All_TestBeam(int nEvents = 2000, Prototype4DSTReader *reader = new Prototype4DSTReader( 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->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"); @@ -418,8 +421,8 @@ void Fun4All_TestBeam(int nEvents = 2000, reader->AddTower("RAW_TRIGGER_VETO"); reader->AddTower("CALIB_TRIGGER_VETO"); // - // reader->AddTower("RAW_TILE_MAPPER"); - // reader->AddTower("CALIB_TILE_MAPPER"); + reader->AddTower("RAW_TILE_MAPPER"); + reader->AddTower("CALIB_TILE_MAPPER"); // reader->AddTower("RAW_SC3"); reader->AddTower("CALIB_SC3"); From 56cde92d38df2e712310415a8030770726e3d940 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 18 Mar 2018 15:58:51 -0400 Subject: [PATCH 0080/1222] add HCal leading order calibration from Xu Sun --- macros/prototype4/Fun4All_TestBeam.C | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 53336217c..cb7ed3fd1 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -88,7 +88,7 @@ void Fun4All_TestBeam(int nEvents = 1000, se->registerSubsystem(unpack); calib = new CaloCalibration("CEMC"); -// calib->Verbosity(4); + // calib->Verbosity(4); calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, @@ -98,11 +98,14 @@ void Fun4All_TestBeam(int nEvents = 1000, if (do_hcal) { - calib = new CaloCalibration("HCALIN"); + const double cin_cali = 0.00297968; + const double cout_cali = 0.000215485 + + 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().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); // leading order energy scale from Xu Sun calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database @@ -120,7 +123,7 @@ void Fun4All_TestBeam(int nEvents = 1000, calib->set_calib_tower_node_prefix("CALIB_LG"); calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalout_lg"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database @@ -130,7 +133,7 @@ void Fun4All_TestBeam(int nEvents = 1000, calib->set_calib_tower_node_prefix("CALIB_HG"); calib->set_raw_tower_node_prefix("RAW_HG"); calib->GetCalibrationParameters().set_name("hcalout_hg"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali / 32); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database @@ -367,13 +370,13 @@ void Fun4All_TestBeam(int nEvents = 1000, Prototype4DSTReader *reader = new Prototype4DSTReader( 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->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"); From d74ccb40de8049c533997998adc75f94c246cd6f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 18 Mar 2018 16:04:06 -0400 Subject: [PATCH 0081/1222] add HCal leading order calibration from Xu Sun --- macros/prototype4/Fun4All_TestBeam.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index cb7ed3fd1..0325ee8ac 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -98,6 +98,7 @@ void Fun4All_TestBeam(int nEvents = 1000, if (do_hcal) { + // leading order energy scale from Xu Sun const double cin_cali = 0.00297968; const double cout_cali = 0.000215485 @@ -105,7 +106,7 @@ void Fun4All_TestBeam(int nEvents = 1000, calib->set_calib_tower_node_prefix("CALIB_LG"); calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); // leading order energy scale from Xu Sun + calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database From ea8f36d3b8a28f6b3a0a3cb32b6ccd26ec6aec1f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 18 Mar 2018 16:48:45 -0400 Subject: [PATCH 0082/1222] Oops. missed ; --- macros/prototype4/Fun4All_TestBeam.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 0325ee8ac..8d9c1e1e6 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -100,13 +100,13 @@ void Fun4All_TestBeam(int nEvents = 1000, { // leading order energy scale from Xu Sun const double cin_cali = 0.00297968; - const double cout_cali = 0.000215485 + const double cout_cali = 0.000215485; - calib = new CaloCalibration("HCALIN"); + 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().set_double_param("calib_const_scale", cin_cali); + calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database From d5d7f0732ade512cb4c5f682cbd133b6a6d10a06 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 22 Mar 2018 12:37:20 -0400 Subject: [PATCH 0083/1222] use tower-by-tower calibration for EMCal --- macros/prototype4/Fun4All_TestBeam.C | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 8d9c1e1e6..8d9067b13 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -2,17 +2,9 @@ using namespace std; -void Fun4All_TestBeam(int nEvents = 1000, - - // "/sphenix/data/data03/phnxreco/sphenix/caladc/hcallab/ihcal_2018-01-15__08_00_58.prdf", - // - // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", - // const char *output_file = "data/beam_00000332.root" +void Fun4All_TestBeam(int nEvents = 100, const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", - const char *output_file = "data/beam_00000406.root" - // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", - // const char *output_file = "data/led_00000254.root"// - ) + const char *output_file = "data/beam_00000406.root") { gSystem->Load("libfun4all"); gSystem->Load("libPrototype4.so"); @@ -89,10 +81,10 @@ void Fun4All_TestBeam(int nEvents = 1000, calib = new CaloCalibration("CEMC"); // calib->Verbosity(4); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database + // calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); + // calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database se->registerSubsystem(calib); } From 5bea309eea01578eb06f2630f583cbe5ce5dbeb9 Mon Sep 17 00:00:00 2001 From: Xu Sun Date: Thu, 22 Mar 2018 15:38:29 -0400 Subject: [PATCH 0084/1222] update leading order calibration constant --- macros/prototype4/Fun4All_TestBeam.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 8d9c1e1e6..4b60c5160 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -8,8 +8,8 @@ void Fun4All_TestBeam(int nEvents = 1000, // // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000332-0000.prdf", // const char *output_file = "data/beam_00000332.root" - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", - const char *output_file = "data/beam_00000406.root" + const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000422-0000.prdf", + const char *output_file = "data/beam_00000422.root" // const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/led/led_00000254-0000.prdf", // const char *output_file = "data/led_00000254.root"// ) @@ -99,8 +99,8 @@ void Fun4All_TestBeam(int nEvents = 1000, if (do_hcal) { // leading order energy scale from Xu Sun - const double cin_cali = 0.00297968; - const double cout_cali = 0.000215485; + const double cin_cali = 0.00270145; + const double cout_cali = 0.0065718; calib = new CaloCalibration("HCALIN"); calib->set_calib_tower_node_prefix("CALIB_LG"); From 9f4f59ff0b05e51361c2dae1dd8226bd6e6a9b95 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 22 Apr 2018 23:45:16 -0400 Subject: [PATCH 0085/1222] increase display limit for more complex detectors --- macros/g4simulations/vis.mac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index a26de7a81..539d58b5d 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -27,6 +27,8 @@ # list of available graphics systems at some point. #/vis/open OGLIX /vis/open OGLSX 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 From 466badcccdf5d22e3c8437baa83e5b1124a87a73 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 24 Apr 2018 15:28:26 -0400 Subject: [PATCH 0086/1222] Change to prototype3 for inner hcal, add Al option for Al plates only --- macros/prototype4/Fun4All_G4_Prototype4.C | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/macros/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C index 55e1f88ca..f6f6769e1 100644 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -16,6 +16,7 @@ int Fun4All_G4_Prototype4(int nEvents = 1) bool cemc_digi = cemc_twr && true; bool cemc_twrcal = cemc_digi && true; bool ihcal_on = true; + bool ihcal_al = false; bool ihcal_cell = ihcal_on && false; bool ihcal_twr = ihcal_cell && false; bool ihcal_digi = ihcal_twr && false; @@ -118,11 +119,20 @@ int Fun4All_G4_Prototype4(int nEvents = 1) //---------------------------------------- if (ihcal_on) { - PHG4Prototype2InnerHcalSubsystem *innerhcal = new PHG4Prototype2InnerHcalSubsystem("HCalIn"); + PHG4Prototype3InnerHcalSubsystem *innerhcal = new PHG4Prototype3InnerHcalSubsystem("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(); + if (ihcal_al) + { + innerhcal->set_int_param("scintillators",0); + innerhcal->SetActive(0); + innerhcal->set_string_param("material","Al4046"); + } + else + { + innerhcal->SetActive(); + } innerhcal->SetAbsorberActive(); innerhcal->SetAbsorberTruth(1); innerhcal->OverlapCheck(true); From 0e993161caecc9d408e30aad2681925bcd46b67c Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Thu, 17 May 2018 23:37:13 -0400 Subject: [PATCH 0087/1222] Update GEM tracking stations --- macros/g4simulations/G4_DSTReader_EICDetector.C | 1 + macros/g4simulations/G4_EGEM_EIC.C | 13 +++++++------ macros/g4simulations/G4_FGEM_EIC.C | 16 ++++++++-------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index e8e83f3ae..1a738e4a6 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -125,6 +125,7 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("EGEM_0"); ana->AddNode("EGEM_1"); ana->AddNode("EGEM_2"); + ana->AddNode("EGEM_3"); } ana->AddNode("BH_1"); diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C index 97badd9a0..6544ea259 100644 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ b/macros/g4simulations/G4_EGEM_EIC.C @@ -25,9 +25,10 @@ EGEMSetup(PHG4Reco* g4Reco) * Geometric constraints: * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ - make_GEM_station("EGEM_0", g4Reco, -32., -1.72, -3.4); // increase min eta from -1.6 to -1.72 to fit into barrel tracker geometry - 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, -106., -1.2, -4.5); // move station from z = -101. to z= -106. because of increased TPC length + make_GEM_station("EGEM_0", g4Reco, -19.00, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -60.00, -1.95, -3.08); + make_GEM_station("EGEM_2", g4Reco, -134.35, -1.31, -3.89); + make_GEM_station("EGEM_3", g4Reco, -150.00, -1.40, -4.00); } @@ -104,14 +105,14 @@ void EGEM_FastSim_Reco(int verbosity = 0) { 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"}; + std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3"}; kalman->set_phg4hits_names(phg4hits_names, 3); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap_FastSimEtaMinus"); // Saved track states (projections) - std::string state_names[] = {"EEMC"}; - kalman->set_state_names(state_names, 1); + // 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- diff --git a/macros/g4simulations/G4_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C index da41baedb..41bca4a18 100644 --- a/macros/g4simulations/G4_FGEM_EIC.C +++ b/macros/g4simulations/G4_FGEM_EIC.C @@ -16,7 +16,7 @@ FGEM_Init() void FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // + const double min_eta = 1.245 // ) { @@ -28,15 +28,15 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // 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); + make_GEM_station("FGEM_0", g4Reco, 19.00, 0.94, 2.73, N_Sector); + make_GEM_station("FGEM_1", g4Reco, 68.00, 2.07, 4.00, N_Sector); /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; etamax = 4; etamin = min_eta; - zpos = 1.2e2; + zpos = 126.00; gem = new PHG4SectorSubsystem(name.c_str()); @@ -61,7 +61,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_3"; etamax = 4; etamin = min_eta; - zpos = 1.6e2; + zpos = 161.35; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); @@ -115,7 +115,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_4"; etamax = 4; etamin = min_eta; - zpos = 2.75e2; + zpos = 271.35; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); @@ -283,8 +283,8 @@ void FGEM_FastSim_Reco(int verbosity = 0) { kalman->set_trackmap_out_name("SvtxTrackMap_FastSimEtaPlus"); // Saved track states (projections) - std::string state_names[] = {"FEMC","FHCAL"}; - kalman->set_state_names(state_names, 2); + // 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); From 061881ee6e44b78a352c6492a1eea691a9c128ba Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Thu, 17 May 2018 23:39:51 -0400 Subject: [PATCH 0088/1222] Add temporary macro with magnetic field off and only few detectors turned on --- .../Fun4All_G4_EICDetector_Debug.C | 598 ++++++++++++++++++ 1 file changed, 598 insertions(+) create mode 100644 macros/g4simulations/Fun4All_G4_EICDetector_Debug.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C new file mode 100644 index 000000000..32666910b --- /dev/null +++ b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C @@ -0,0 +1,598 @@ +int Fun4All_G4_EICDetector_Debug( + const int nEvents = 100, + 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 = false; + 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 = false; + 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 = false; + 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 = false; + 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 = false; + + // EICDetector geometry - 'hadron' direction + bool do_FGEM = true; + bool do_FGEM_track = do_FGEM && true; + + bool do_RICH = false; + bool do_Aerogel = false; + + bool do_FEMC = false; + 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 = false; + 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 = false; + 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("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 = "0.0"; + // 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) + { + // action is performed in later stage at the input manager level + } + 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); + } + 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); + } + 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); + } + 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); + } + 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); + } + + // 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("mu-"); + pgen->set_z_range(0,0); + pgen->set_eta_range(-4.0,0.0); + pgen->set_mom_range(30,30); + 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); +} From 5a85d7603a65493ed3a6ffb6e6c8be9a3a52ddfc Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 13:52:49 -0400 Subject: [PATCH 0089/1222] Update GEM positions --- macros/g4simulations/G4_EGEM_EIC.C | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C index 6544ea259..718a8d134 100644 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ b/macros/g4simulations/G4_EGEM_EIC.C @@ -25,10 +25,11 @@ EGEMSetup(PHG4Reco* g4Reco) * Geometric constraints: * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ - make_GEM_station("EGEM_0", g4Reco, -19.00, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -60.00, -1.95, -3.08); - make_GEM_station("EGEM_2", g4Reco, -134.35, -1.31, -3.89); - make_GEM_station("EGEM_3", g4Reco, -150.00, -1.40, -4.00); + float thickness=3.; + make_GEM_station("EGEM_0", g4Reco, -19.00 + 0.5*thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -60.00 + 0.5*thickness, -1.95, -3.08); + make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.31, -3.89); + make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.40, -4.00); } @@ -59,6 +60,8 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, PHG4SectorSubsystem *gem; gem = new PHG4SectorSubsystem(name.c_str()); + gem->get_geometry().set_normal_polar_a(polar_angle); + gem->get_geometry().set_normal_polar_angle(polar_angle); gem->get_geometry().set_normal_start( zpos * PHG4Sector::Sector_Geometry::Unit_cm()); @@ -72,6 +75,8 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, gem->get_geometry().AddLayers_DriftVol_COMPASS(); gem->get_geometry().AddLayers_HBD_GEM(); + + cout << "GEM total thickness: " << gem->get_geometry().get_total_thickness() << endl; g4Reco->registerSubsystem(gem); } From 2fe1c6b759986025e95a49906c2401a0f78d2acc Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 16:56:18 -0400 Subject: [PATCH 0090/1222] Update dimensions --- macros/g4simulations/G4_Aerogel.C | 6 +++--- macros/g4simulations/G4_RICH.C | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index c56b45d2c..063f17d59 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -16,7 +16,7 @@ AerogelInit() void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.1 // 1.45 + const double min_eta = 1.242 ) { @@ -30,7 +30,7 @@ AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // 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)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(1.85)); ag->get_geometry().set_max_polar_angle( PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); ag->get_geometry().set_min_polar_edge( @@ -41,7 +41,7 @@ AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // // Aerogel dimensions ins cm double radiator_length = 2.; - double expansion_length = 10.; + double expansion_length = 18.;// 10.; ag->get_geometry().AddLayers_AeroGel_ePHENIX( radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), expansion_length * PHG4Sector::Sector_Geometry::Unit_cm() ); diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 87da615a1..2ba3b3270 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -24,7 +24,7 @@ RICHInit() void RICHSetup(PHG4Reco* g4Reco, // const int N_RICH_Sector = 8, // - const double min_eta = 1.45, // + const double min_eta = 1.3, // const double R_mirror_ref = 195, //cm const double z_shift = 75, // cm const double R_shift = 18.5 // cm From 04bfde27dbe2bc085ea8ed994655b28aab0a12f2 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 16:57:27 -0400 Subject: [PATCH 0091/1222] Update dimensions- avoid overlap --- macros/g4simulations/G4_EGEM_EIC.C | 7 +++---- macros/g4simulations/G4_FGEM_EIC.C | 11 +++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C index 718a8d134..95a5223b7 100644 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ b/macros/g4simulations/G4_EGEM_EIC.C @@ -27,10 +27,9 @@ EGEMSetup(PHG4Reco* g4Reco) */ float thickness=3.; make_GEM_station("EGEM_0", g4Reco, -19.00 + 0.5*thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -60.00 + 0.5*thickness, -1.95, -3.08); - make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.31, -3.89); - make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.40, -4.00); - + make_GEM_station("EGEM_1", g4Reco, -68.00 + 0.5*thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.4, -3.9); + make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.5, -4.00); } int diff --git a/macros/g4simulations/G4_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C index 41bca4a18..293ef9170 100644 --- a/macros/g4simulations/G4_FGEM_EIC.C +++ b/macros/g4simulations/G4_FGEM_EIC.C @@ -19,7 +19,6 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // const double min_eta = 1.245 // ) { - const double tilt = .1; string name; @@ -28,15 +27,15 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // double zpos; PHG4SectorSubsystem *gem; - make_GEM_station("FGEM_0", g4Reco, 19.00, 0.94, 2.73, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 68.00, 2.07, 4.00, N_Sector); + make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 2.73, N_Sector); + make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 4.00, N_Sector); /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; etamax = 4; etamin = min_eta; - zpos = 126.00; + zpos = 134.0; gem = new PHG4SectorSubsystem(name.c_str()); @@ -61,7 +60,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_3"; etamax = 4; etamin = min_eta; - zpos = 161.35; + zpos = 161.0; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); @@ -115,7 +114,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_4"; etamax = 4; etamin = min_eta; - zpos = 271.35; + zpos = 275.0; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); From 178077b8e2b920c48bb58614ff0ee8b444433eb2 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 17:02:29 -0400 Subject: [PATCH 0092/1222] Remove flux return in hadron going direction --- macros/g4simulations/G4Setup_EICDetector.C | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 452fae125..477a2cdb2 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -28,7 +28,8 @@ void G4Init(bool do_svtx = true, } if (do_svtx) { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); + //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); + gROOT->LoadMacro("G4_Tracking_EIC.C"); SvtxInit(n_TPC_layers); } @@ -239,18 +240,6 @@ int G4Setup(const int absorberactive = 0, 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); From d011ebfbf30d2f1c316312391caf425f30965e24 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 17:02:53 -0400 Subject: [PATCH 0093/1222] Move EEMC --- macros/g4simulations/G4_EEMC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 37ce6c09d..d13b3bb3e 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -31,7 +31,7 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_eemc; /* Use non-projective geometry */ - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v005.txt"; cout << mapping_eemc.str() << endl; eemc->SetTowerMappingFile( mapping_eemc.str() ); From 2bc2c19e96483ac2a589052b71f95d2b9231a326 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 17:03:32 -0400 Subject: [PATCH 0094/1222] Switch on more detectors --- .../g4simulations/Fun4All_G4_EICDetector_Debug.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C index 32666910b..6e5fe635c 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C @@ -57,7 +57,7 @@ int Fun4All_G4_EICDetector_Debug( bool do_pipe = true; - bool do_svtx = false; + 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; @@ -85,17 +85,17 @@ int Fun4All_G4_EICDetector_Debug( bool do_hcalout_eval = do_hcalout_cluster && true; // EICDetector geometry - barrel - bool do_DIRC = false; + bool do_DIRC = true; // EICDetector geometry - 'hadron' direction bool do_FGEM = true; bool do_FGEM_track = do_FGEM && true; - bool do_RICH = false; - bool do_Aerogel = false; + bool do_RICH = true; + bool do_Aerogel = true; - bool do_FEMC = false; - bool do_FEMC_cell = do_FEMC && true; + bool do_FEMC = true; + bool do_FEMC_cell = do_FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; bool do_FEMC_eval = do_FEMC_cluster && true; @@ -111,7 +111,7 @@ int Fun4All_G4_EICDetector_Debug( bool do_EGEM_track = do_EGEM && true; bool do_EEMC = false; - bool do_EEMC_cell = do_EEMC && true; + bool do_EEMC_cell = do_EEMC && false; bool do_EEMC_twr = do_EEMC_cell && true; bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; From 8fa719a9eae3d075cb9e646542c3344729bd7c5b Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 17:58:40 -0400 Subject: [PATCH 0095/1222] Combine all detectors for FastSim --- macros/g4simulations/G4_Tracking_EIC.C | 852 +++++++++++++++++++++++++ 1 file changed, 852 insertions(+) create mode 100644 macros/g4simulations/G4_Tracking_EIC.C diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C new file mode 100644 index 000000000..633ca3d0b --- /dev/null +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -0,0 +1,852 @@ +#include + +//#include "G4_GEM_EIC.C" + +// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +bool tpc_layers_40 = false; + +// 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 = 0; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers + +int n_tpc_layer_inner = 16; +double tpc_layer_thick_inner = 1.25 / 2.0; +int tpc_layer_rphi_count_inner = 1152; + +int n_tpc_layer_mid = 16; +double tpc_layer_thick_mid = 1.25; +int tpc_layer_rphi_count_mid = 1536; + +int n_tpc_layer_outer = 16; +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm +int tpc_layer_rphi_count_outer = 2304; + +int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + +double inner_cage_radius = 20.; +double inner_readout_radius = 30.; + +// TPC gas parameters +// These are set for a variety of gas choices... +//============================================== +enum TPC_Gas + { + Ne2K_100, + Ne2K_400, + NeCF4_100, + NeCF4_300, + NeCF4_400, + ByHand + }; + +TPC_Gas ether = TPC_Gas::NeCF4_400; +//TPC_Gas ether = TPC_Gas::ByHand; + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm +double iBut_dEdx = 5.93; // keV/cm + +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm +double iBut_NPrimary = 84; // Number/cm + +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm +double iBut_NTotal = 195; // Number/cm + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): +double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... +double TPCDriftVelocity; +double TPC_Trans_Diffusion; +double TPC_Long_Diffusion; +double TPC_dEdx; +double TPC_NPri; +double TPC_NTot; +double TPC_ElectronsPerKeV; + +// TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... +//======================================= +double TPCADCClock; +double TPCShapingRMSLead; +double TPCShapingRMSTail; +double tpc_cell_z; +double TPC_SmearRPhi; +double TPC_SmearZ; + +int Max_si_layer; + +void SvtxInit(int verbosity = 0) +{ + Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; + + switch (ether) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case TPC_Gas::Ne2K_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_300: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::ByHand: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + break; + } + default: // defaults to NeCF4_400 + { + if (verbosity) + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + } + + TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA + TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // TKH does not understand the physical origin of these parameters. + // however, their impact seems quite small... + // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here + TPC_SmearRPhi = 0.215; + TPC_SmearZ = 0.20; +} + + +double Svtx(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + + /* Place electron-going side tracking detectors */ + // EGEMSetup(g4Reco); + + /* Place hadron-going side tracking detectors */ + // FGEMSetup(g4Reco); + + /* Place central tracking detectors */ + 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; i < 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(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; + } + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } + + // int verbosity = 1; + + // time projection chamber layers -------------------------------------------- + + // switch ONLY for backward compatibility with 40 layer hits files! + if (tpc_layers_40) + { + n_tpc_layer_inner = 8; + tpc_layer_thick_inner = 1.25; + tpc_layer_rphi_count_inner = 1152; + cout << "Using 8 inner_layers for backward comatibility" << endl; + } + + 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 < radius) inner_readout_radius = radius; + + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc + + // Layer of inert TPC gas from 20-30 cm + if (inner_readout_radius - 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.; + + // Active layers of the TPC from 30-40 cm (inner layers) + + for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_inner; + } + + // Active layers of the TPC from 40-60 cm (mid layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_mid; + } + + // Active layers of the TPC from 60-80 cm (outer layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_outer; + } + + // outer field cage + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // 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 (verbosity) + { + cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; + cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; + cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; + cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; + cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; + cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; + cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; + cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; + cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; + cout << " TPC z cell " << tpc_cell_z << " cm" << endl; + cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; + cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + } + + 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); + } + + // 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); + //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + 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 + // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers + svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits + svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits + svtx_cells->set_drift_velocity(TPCDriftVelocity); + svtx_cells->setHalfLength(105.5); + svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); + 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 + //====================== + + double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns + + // inner layers + double radius_layer = inner_readout_radius ; + for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) + { + // this calculates the radius at the middle of the layer + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + radius_layer += tpc_layer_thick_inner; + } + + + // mid layers + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) + { + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + radius_layer += tpc_layer_thick_mid; + } + + // outer layers + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) + { + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + + radius_layer += tpc_layer_thick_outer; + } + + 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; i < n_maps_layer; ++i) +// { +// digi->set_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; i < n_intt_layer; i++) +// { +// digiintt->set_adc_scale(n_maps_layer + i, userrange); +// } +// se->registerSubsystem(digiintt); +// } +// +// // TPC layers +// for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) +// { +// digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range +// } +// se->registerSubsystem(digi); +// +// //------------------------------------- +// // Apply Live Area Inefficiency to Hits +// //------------------------------------- +// // defaults to 1.0 (fully active) +// +// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); +// +// for (int i = 0; i < n_maps_layer; i++) +// { +// deadarea->Verbosity(verbosity); +// //deadarea->set_hit_efficiency(i,0.99); +// deadarea->set_hit_efficiency(i, 1.0); +// } +// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) +// { +// //deadarea->set_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; i < n_maps_layer; i++) +// { +// // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness +// // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss +// thresholds->set_threshold(i, 0.1); +// } +// // INTT +// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) +// { +// thresholds->set_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; i < n_maps_layer + n_intt_layer; i++) +// { +// clusterizer->set_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); +// tpcclusterizer->setEnergyCut(15 /*adc*/); +// tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes +// tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*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); + + PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + kalman->Verbosity(10); + + 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_pat_rec_hit_finding_eff(1.); + kalman->set_pat_rec_noise_prob(0.); + + std::string phg4hits_names[] = {"G4HIT_MAPS","G4HIT_SVTX","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; + kalman->set_phg4hits_names(phg4hits_names, 11); + kalman->set_sub_top_node_name("SVTX"); + kalman->set_trackmap_out_name("SvtxTrackMap"); + + kalman->set_fit_alg_name("KalmanFitterRefTrack");// + kalman->set_primary_assumption_pid(13); + kalman->set_do_evt_display(false); + + se->registerSubsystem(kalman); + +// //------------------ +// // Track Projections +// //------------------ +// PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); +// 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(true); // enable to see the hits that includes the chamber physics... + 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; +} From 1434f860cb463b5475175f73db1ecbff6292a590 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Fri, 18 May 2018 19:02:27 -0400 Subject: [PATCH 0096/1222] use simpler TPC for debugging --- .../Fun4All_G4_EICDetector_Debug.C | 24 +- macros/g4simulations/G4Setup_EICDetector.C | 25 - .../g4simulations/G4_DSTReader_EICDetector.C | 28 +- macros/g4simulations/G4_GEM_EIC.C | 250 ++++++ macros/g4simulations/G4_TPC_EIC.C | 81 ++ macros/g4simulations/G4_Tracking_EIC.C | 761 +----------------- 6 files changed, 359 insertions(+), 810 deletions(-) create mode 100644 macros/g4simulations/G4_GEM_EIC.C create mode 100644 macros/g4simulations/G4_TPC_EIC.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C index 6e5fe635c..2316cd1c5 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C @@ -88,9 +88,6 @@ int Fun4All_G4_EICDetector_Debug( 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; @@ -107,9 +104,6 @@ int Fun4All_G4_EICDetector_Debug( 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 = false; bool do_EEMC_cell = do_EEMC && false; bool do_EEMC_twr = do_EEMC_cell && true; @@ -152,7 +146,7 @@ int Fun4All_G4_EICDetector_Debug( // 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); + G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,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) @@ -361,7 +355,7 @@ int Fun4All_G4_EICDetector_Debug( 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, + do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); } @@ -433,18 +427,6 @@ int Fun4All_G4_EICDetector_Debug( 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 //----------------- @@ -555,8 +537,6 @@ int Fun4All_G4_EICDetector_Debug( /*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, diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 477a2cdb2..83529dfac 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -8,8 +8,6 @@ void G4Init(bool do_svtx = 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, @@ -56,18 +54,6 @@ void G4Init(bool do_svtx = true, HCalOuterInit(); } - if (do_FGEM) - { - gROOT->LoadMacro("G4_FGEM_EIC.C"); - FGEM_Init(); - } - - if (do_EGEM) - { - gROOT->LoadMacro("G4_EGEM_EIC.C"); - EGEM_Init(); - } - if (do_FEMC) { gROOT->LoadMacro("G4_FEMC.C"); @@ -117,8 +103,6 @@ int G4Setup(const int absorberactive = 0, 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, @@ -200,15 +184,6 @@ int G4Setup(const int absorberactive = 0, if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - //---------------------------------------- - // Forward tracking - - if ( do_FGEM ) - FGEMSetup(g4Reco); - - if ( do_EGEM ) - EGEMSetup(g4Reco); - //---------------------------------------- // FEMC diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index 1a738e4a6..4159a2060 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -22,8 +22,6 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// 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, // @@ -57,6 +55,15 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// if (do_svtx) { ana->AddNode("SVTX"); + ana->AddNode("EGEM_0"); + ana->AddNode("EGEM_1"); + ana->AddNode("EGEM_2"); + ana->AddNode("EGEM_3"); + ana->AddNode("FGEM_0"); + ana->AddNode("FGEM_1"); + ana->AddNode("FGEM_2"); + ana->AddNode("FGEM_3"); + ana->AddNode("FGEM_4"); } if (do_cemc) @@ -111,23 +118,6 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// 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("EGEM_3"); - } - ana->AddNode("BH_1"); ana->AddNode("BH_FORWARD_PLUS"); ana->AddNode("BH_FORWARD_NEG"); diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C new file mode 100644 index 000000000..6906979e8 --- /dev/null +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -0,0 +1,250 @@ +using namespace std; + +void +EGEMSetup(PHG4Reco* g4Reco) +{ + /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be + * drawn in event display but will NOT register any hits. + * + * Geometric constraints: + * TPC length = 211 cm --> from z = -105.5 to z = +105.5 + */ + float thickness=3.; + make_GEM_station("EGEM_0", g4Reco, -19.00 + 0.5*thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -68.00 + 0.5*thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.4, -3.9); + make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.5, -4.00); +} + +void +FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // + const double min_eta = 1.245 // + ) +{ + const double tilt = .1; + + string name; + double etamax; + double etamin; + double zpos; + PHG4SectorSubsystem *gem; + + make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 2.73, N_Sector); + make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 4.00, N_Sector); + + /////////////////////////////////////////////////////////////////////////// + + name = "FGEM_2"; + etamax = 4; + etamin = min_eta; + zpos = 134.0; + + 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 = 161.0; + 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 = 275.0; + 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); + +} diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C new file mode 100644 index 000000000..5fc3c60e8 --- /dev/null +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -0,0 +1,81 @@ + +void TPCInit() {} + +double TPC(PHG4Reco* g4Reco, + double radius, + const int absorberactive = 0, + int verbosity = 0) { + + overlappcheck = 1; + if (radius > 21-1.17) { + cout << "inconsistency: radius: " << radius + << " larger than tpc inner radius: " << 21-1.17 << endl; + gSystem->Exit(-1); + } + + gSystem->Load("libg4tpc.so"); + gSystem->Load("libg4testbench.so"); + + PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("SVTX"); + // tpc_set_double_param("gas_inner_radius",21.); + // tpc_set_double_param("gas_outer_radius",77.); + // tpc_set_double_param("place_x", 0.); + // tpc_set_double_param("place_y", 0.); + // tpc_set_double_param("place_z", 0.); + // tpc_set_double_param("rot_x", 0.); + // tpc_set_double_param("rot_y", 0.); + // tpc_set_double_param("rot_z", 0.); + // tpc_set_double_param("tpc_length",211.); + + // tpc_set_double_param("steplimits", NAN); + + // tpc_set_string_param("tpc_gas", "sPHENIX_TPC_Gas"); + +// material budget: +// Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2. +// Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286 +// 250 um FR4 (Substrate for Cu layers) +// HoneyComb (nomex) 1/2 inch=0.5*2.54 cm + // tpc_set_string_param("cage_layer_1_material","G4_Cu"); + // tpc_set_double_param("cage_layer_1_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_2_material","FR4"); + // tpc_set_double_param("cage_layer_2_thickness",0.025); + + // tpc_set_string_param("cage_layer_3_material","NOMEX"); + // tpc_set_double_param("cage_layer_3_thickness",0.5*2.54); + + // tpc_set_string_param("cage_layer_4_material","G4_Cu"); + // tpc_set_double_param("cage_layer_4_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_5_material","FR4"); + // tpc_set_double_param("cage_layer_5_thickness",0.025); + + // tpc_set_string_param("cage_layer_6_material","G4_KAPTON"); + // tpc_set_double_param("cage_layer_6_thickness",0.2286); + + // tpc_set_string_param("cage_layer_7_material","G4_Cu"); + // tpc_set_double_param("cage_layer_7_thickness",0.00347/2.); + + // tpc_set_string_param("cage_layer_8_material","G4_KAPTON"); + // tpc_set_double_param("cage_layer_8_thickness",0.05); // 50 um + + // tpc_set_string_param("cage_layer_9_material","G4_Cu"); + // tpc_set_double_param("cage_layer_9_thickness",0.00347/2.); + if (absorberactive) + { + tpc->SetAbsorberActive(); + } + tpc->OverlapCheck(overlapcheck); + + g4Reco->registerSubsystem( tpc ); + + radius = 77.+1.17; + + + radius += no_overlapp; + + return radius; +} diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 633ca3d0b..dca33e515 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -1,591 +1,25 @@ #include -//#include "G4_GEM_EIC.C" - -// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; - -// 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 = 0; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers - -int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25 / 2.0; -int tpc_layer_rphi_count_inner = 1152; - -int n_tpc_layer_mid = 16; -double tpc_layer_thick_mid = 1.25; -int tpc_layer_rphi_count_mid = 1536; - -int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm -int tpc_layer_rphi_count_outer = 2304; - -int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; - -double inner_cage_radius = 20.; -double inner_readout_radius = 30.; - -// TPC gas parameters -// These are set for a variety of gas choices... -//============================================== -enum TPC_Gas - { - Ne2K_100, - Ne2K_400, - NeCF4_100, - NeCF4_300, - NeCF4_400, - ByHand - }; - -TPC_Gas ether = TPC_Gas::NeCF4_400; -//TPC_Gas ether = TPC_Gas::ByHand; - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm -double iBut_dEdx = 5.93; // keV/cm - -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm -double iBut_NPrimary = 84; // Number/cm - -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm -double iBut_NTotal = 195; // Number/cm - -// TPC Performance Parameter (applies extra smear to mimic the avalanche): -double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... -double TPCDriftVelocity; -double TPC_Trans_Diffusion; -double TPC_Long_Diffusion; -double TPC_dEdx; -double TPC_NPri; -double TPC_NTot; -double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= -double TPCADCClock; -double TPCShapingRMSLead; -double TPCShapingRMSTail; -double tpc_cell_z; -double TPC_SmearRPhi; -double TPC_SmearZ; - -int Max_si_layer; +#include "G4_GEM_EIC.C" +#include "G4_TPC_EIC.C" void SvtxInit(int verbosity = 0) { - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; - - switch (ether) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case TPC_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - case TPC_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - } - - TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; - - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells - //======================================= - // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA - TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // TKH does not understand the physical origin of these parameters. - // however, their impact seems quite small... - // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here - TPC_SmearRPhi = 0.215; - TPC_SmearZ = 0.20; -} +} double Svtx(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { - /* Place electron-going side tracking detectors */ - // EGEMSetup(g4Reco); + EGEMSetup(g4Reco); /* Place hadron-going side tracking detectors */ - // FGEMSetup(g4Reco); + FGEMSetup(g4Reco); /* Place central tracking detectors */ - 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; i < 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(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; - } - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } - - // int verbosity = 1; - - // time projection chamber layers -------------------------------------------- - - // switch ONLY for backward compatibility with 40 layer hits files! - if (tpc_layers_40) - { - n_tpc_layer_inner = 8; - tpc_layer_thick_inner = 1.25; - tpc_layer_rphi_count_inner = 1152; - cout << "Using 8 inner_layers for backward comatibility" << endl; - } - - 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 < radius) inner_readout_radius = radius; - - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - - // Layer of inert TPC gas from 20-30 cm - if (inner_readout_radius - 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.; - - // Active layers of the TPC from 30-40 cm (inner layers) - - for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_inner; - } - - // Active layers of the TPC from 40-60 cm (mid layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_mid; - } - - // Active layers of the TPC from 60-80 cm (outer layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_outer; - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // 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 (verbosity) - { - cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; - cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; - cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; - cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; - cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; - cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; - cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; - cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; - cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; - cout << " TPC z cell " << tpc_cell_z << " cm" << endl; - cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; - cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; - } - - 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); - } - - // 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); - //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - 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 - // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers - svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits - svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits - svtx_cells->set_drift_velocity(TPCDriftVelocity); - svtx_cells->setHalfLength(105.5); - svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); - 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 - //====================== - - double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns - - // inner layers - double radius_layer = inner_readout_radius ; - for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) - { - // this calculates the radius at the middle of the layer - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_inner; - } - - - // mid layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_mid; - } - - // outer layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - - radius_layer += tpc_layer_thick_outer; - } - - se->registerSubsystem(svtx_cells); + TPC(g4Reco, radius); return; } @@ -605,146 +39,10 @@ void Svtx_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); -// //---------------------------------- -// // Digitize the cell energy into ADC -// //---------------------------------- -// PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); -// digi->Verbosity(0); -// for (int i = 0; i < n_maps_layer; ++i) -// { -// digi->set_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; i < n_intt_layer; i++) -// { -// digiintt->set_adc_scale(n_maps_layer + i, userrange); -// } -// se->registerSubsystem(digiintt); -// } -// -// // TPC layers -// for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) -// { -// digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range -// } -// se->registerSubsystem(digi); -// -// //------------------------------------- -// // Apply Live Area Inefficiency to Hits -// //------------------------------------- -// // defaults to 1.0 (fully active) -// -// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); -// -// for (int i = 0; i < n_maps_layer; i++) -// { -// deadarea->Verbosity(verbosity); -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) -// { -// //deadarea->set_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; i < n_maps_layer; i++) -// { -// // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness -// // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss -// thresholds->set_threshold(i, 0.1); -// } -// // INTT -// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) -// { -// thresholds->set_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; i < n_maps_layer + n_intt_layer; i++) -// { -// clusterizer->set_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); -// tpcclusterizer->setEnergyCut(15 /*adc*/); -// tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes -// tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*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); - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); kalman->Verbosity(10); @@ -759,8 +57,8 @@ void Svtx_Reco(int verbosity = 0) kalman->set_pat_rec_hit_finding_eff(1.); kalman->set_pat_rec_noise_prob(0.); - std::string phg4hits_names[] = {"G4HIT_MAPS","G4HIT_SVTX","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - kalman->set_phg4hits_names(phg4hits_names, 11); + std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; + kalman->set_phg4hits_names(phg4hits_names, 10); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); @@ -770,25 +68,15 @@ void Svtx_Reco(int verbosity = 0) se->registerSubsystem(kalman); -// //------------------ -// // Track Projections -// //------------------ -// PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); -// projection->Verbosity(verbosity); -// se->registerSubsystem(projection); -// -// /* -// //---------------------- -// // Beam Spot Calculation -// //---------------------- -// PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); -// beamspot->Verbosity(verbosity); -// se->registerSubsystem( beamspot ); -// */ - return; } + +void Svtx_Cells(int verbosity = 0) +{ +} + + void G4_Svtx_Reco() { cout << "\033[31;1m" @@ -822,29 +110,14 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) SvtxEvaluator* eval; eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - 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_cluster_eval(false); + eval->do_g4hit_eval(false); + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... 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 ); From e1e45ca9cf0c10aa53613d77be0b5348f801a036 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 19 May 2018 07:53:27 -0400 Subject: [PATCH 0097/1222] Make copy with INTT layers = 0 for EIC --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 815 ++++++++++++++++++ 1 file changed, 815 insertions(+) create mode 100644 macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C new file mode 100644 index 000000000..5a6a5dfe1 --- /dev/null +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -0,0 +1,815 @@ +#include + +// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +bool tpc_layers_40 = false; + +// 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 = 0; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers + +int n_tpc_layer_inner = 16; +double tpc_layer_thick_inner = 1.25 / 2.0; +int tpc_layer_rphi_count_inner = 1152; + +int n_tpc_layer_mid = 16; +double tpc_layer_thick_mid = 1.25; +int tpc_layer_rphi_count_mid = 1536; + +int n_tpc_layer_outer = 16; +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm +int tpc_layer_rphi_count_outer = 2304; + +int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + +double inner_cage_radius = 20.; +double inner_readout_radius = 30.; + +// TPC gas parameters +// These are set for a variety of gas choices... +//============================================== +enum TPC_Gas +{ + Ne2K_100, + Ne2K_400, + NeCF4_100, + NeCF4_300, + NeCF4_400, + ByHand +}; +TPC_Gas ether = TPC_Gas::NeCF4_400; +//TPC_Gas ether = TPC_Gas::ByHand; + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm +double iBut_dEdx = 5.93; // keV/cm + +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm +double iBut_NPrimary = 84; // Number/cm + +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm +double iBut_NTotal = 195; // Number/cm + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): +double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... +double TPCDriftVelocity; +double TPC_Trans_Diffusion; +double TPC_Long_Diffusion; +double TPC_dEdx; +double TPC_NPri; +double TPC_NTot; +double TPC_ElectronsPerKeV; + +// TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... +//======================================= +double TPCADCClock; +double TPCShapingRMSLead; +double TPCShapingRMSTail; +double tpc_cell_z; +double TPC_SmearRPhi; +double TPC_SmearZ; + +int Max_si_layer; + +void SvtxInit(int verbosity = 0) +{ + Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; + + switch (ether) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case TPC_Gas::Ne2K_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_300: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::ByHand: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + break; + } + default: // defaults to NeCF4_400 + { + if (verbosity) + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + } + + TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA + TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // TKH does not understand the physical origin of these parameters. + // however, their impact seems quite small... + // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here + TPC_SmearRPhi = 0.215; + TPC_SmearZ = 0.20; +} + +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; i < 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(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; + } + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } + +// int verbosity = 1; + + // time projection chamber layers -------------------------------------------- + + // switch ONLY for backward compatibility with 40 layer hits files! + if (tpc_layers_40) + { + n_tpc_layer_inner = 8; + tpc_layer_thick_inner = 1.25; + tpc_layer_rphi_count_inner = 1152; + cout << "Using 8 inner_layers for backward comatibility" << endl; + } + + 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 < radius) inner_readout_radius = radius; + + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc + + // Layer of inert TPC gas from 20-30 cm + if (inner_readout_radius - 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.; + + // Active layers of the TPC from 30-40 cm (inner layers) + + for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_inner; + } + + // Active layers of the TPC from 40-60 cm (mid layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_mid; + } + + // Active layers of the TPC from 60-80 cm (outer layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_outer; + } + + // outer field cage + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // 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 (verbosity) + { + cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; + cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; + cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; + cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; + cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; + cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; + cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; + cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; + cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; + cout << " TPC z cell " << tpc_cell_z << " cm" << endl; + cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; + cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + } + + 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); + } + + // 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); + //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + 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 + // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers + svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits + svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits + svtx_cells->set_drift_velocity(TPCDriftVelocity); + svtx_cells->setHalfLength(105.5); + svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); + 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 + //====================== + + double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns + + // inner layers + double radius_layer = inner_readout_radius ; + for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) + { + // this calculates the radius at the middle of the layer + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + radius_layer += tpc_layer_thick_inner; + } + + + // mid layers + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) + { + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + radius_layer += tpc_layer_thick_mid; + } + + // outer layers + for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) + { + double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; + svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); + svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); + if (verbosity) + cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + + radius_layer += tpc_layer_thick_outer; + } + + 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; i < n_maps_layer; ++i) + { + digi->set_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; i < n_intt_layer; i++) + { + digiintt->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + } + + // TPC layers + for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) + { + digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range + } + se->registerSubsystem(digi); + + //------------------------------------- + // Apply Live Area Inefficiency to Hits + //------------------------------------- + // defaults to 1.0 (fully active) + + PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); + + for (int i = 0; i < n_maps_layer; i++) + { + deadarea->Verbosity(verbosity); + //deadarea->set_hit_efficiency(i,0.99); + deadarea->set_hit_efficiency(i, 1.0); + } + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + //deadarea->set_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; i < n_maps_layer; i++) + { + // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness + // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss + thresholds->set_threshold(i, 0.1); + } + // INTT + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + thresholds->set_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; i < n_maps_layer + n_intt_layer; i++) + { + clusterizer->set_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); + tpcclusterizer->setEnergyCut(15 /*adc*/); + tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes + tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*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 + //------------------ + PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); + 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(true); // enable to see the hits that includes the chamber physics... + 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; +} From e8b51d6596677d768ae646fc2c5e97e868be49c9 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 19 May 2018 07:54:25 -0400 Subject: [PATCH 0098/1222] Switch to full TPC+MAPS simulation (sPHENI defaultX) --- .../Fun4All_G4_EICDetector_Debug.C | 2 +- macros/g4simulations/G4Setup_EICDetector.C | 4 +- macros/g4simulations/G4_Tracking_EIC.C | 37 +++++++------------ 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C index 2316cd1c5..1076fe52a 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C @@ -91,7 +91,7 @@ int Fun4All_G4_EICDetector_Debug( bool do_RICH = true; bool do_Aerogel = true; - bool do_FEMC = true; + bool do_FEMC = false; bool do_FEMC_cell = do_FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 83529dfac..4079f5d5a 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -28,7 +28,7 @@ void G4Init(bool do_svtx = true, { //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); gROOT->LoadMacro("G4_Tracking_EIC.C"); - SvtxInit(n_TPC_layers); + TrackingInit(n_TPC_layers); } if (do_cemc) @@ -161,7 +161,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); + if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); //---------------------------------------- // CEMC diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index dca33e515..670b04aa3 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -1,14 +1,21 @@ #include #include "G4_GEM_EIC.C" -#include "G4_TPC_EIC.C" +#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" -void SvtxInit(int verbosity = 0) +void TrackingInit(int verbosity = 0) { + /* electron-going side detectors */ + EGEM_Init(); + /* hadron-going side detectors */ + FGEM_Init(); + + /* central detectors */ + SvtxInit(); } -double Svtx(PHG4Reco* g4Reco, double radius, +double Tracking(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { @@ -19,12 +26,12 @@ double Svtx(PHG4Reco* g4Reco, double radius, FGEMSetup(g4Reco); /* Place central tracking detectors */ - TPC(g4Reco, radius); + Svtx(g4Reco, radius); return; } -void Svtx_Reco(int verbosity = 0) +void Tracking_Reco(int verbosity = 0) { //--------------- // Load libraries @@ -57,7 +64,7 @@ void Svtx_Reco(int verbosity = 0) kalman->set_pat_rec_hit_finding_eff(1.); kalman->set_pat_rec_noise_prob(0.); - std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; + std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_MAPS","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; kalman->set_phg4hits_names(phg4hits_names, 10); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); @@ -71,23 +78,7 @@ void Svtx_Reco(int verbosity = 0) return; } - -void Svtx_Cells(int verbosity = 0) -{ -} - - -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) +void Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- // Load libraries From fc222ecc3eb6bf932ed3c8a0da82f414965ef085 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 19 May 2018 07:54:41 -0400 Subject: [PATCH 0099/1222] Add Init() functions --- macros/g4simulations/G4_GEM_EIC.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 6906979e8..cc953cf63 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,5 +1,17 @@ using namespace std; +void +EGEM_Init() +{ + +} + +void +FGEM_Init() +{ + +} + void EGEMSetup(PHG4Reco* g4Reco) { From 885aef00a72c6cb4919e549ba87f91073ec0766a Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 19 May 2018 08:10:12 -0400 Subject: [PATCH 0100/1222] Update to merged tracking macros --- macros/g4simulations/Fun4All_G4_EICDetector.C | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 8d8d7a1d1..1ac6527ce 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -88,14 +88,11 @@ int Fun4All_G4_EICDetector( 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_cell = do_FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; bool do_FEMC_eval = do_FEMC_cluster && true; @@ -107,11 +104,8 @@ int Fun4All_G4_EICDetector( 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 = false; + bool do_EEMC_cell = do_EEMC && false; bool do_EEMC_twr = do_EEMC_cell && true; bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; @@ -152,7 +146,7 @@ int Fun4All_G4_EICDetector( // 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); + G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,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) @@ -295,10 +289,10 @@ int Fun4All_G4_EICDetector( // gun->AddParticle("geantino",1.8121,0.253,0.); // se->registerSubsystem(gun); PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("e-"); + pgen->set_name("mu-"); pgen->set_z_range(0,0); - pgen->set_eta_range(0.01,0.01); - pgen->set_mom_range(10,10); + pgen->set_eta_range(-4.0,0.0); + pgen->set_mom_range(30,30); pgen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); se->registerSubsystem(pgen); } @@ -360,7 +354,7 @@ int Fun4All_G4_EICDetector( 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, + do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); } @@ -432,18 +426,6 @@ int Fun4All_G4_EICDetector( 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 //----------------- @@ -554,8 +536,6 @@ int Fun4All_G4_EICDetector( /*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, From a8f91fd2b7067a08fe721e1eceb690df9f289beb Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Sat, 19 May 2018 09:41:15 -0400 Subject: [PATCH 0101/1222] Correct number of hit collections --- macros/g4simulations/G4_Tracking_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 670b04aa3..fbded27e3 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -65,7 +65,7 @@ void Tracking_Reco(int verbosity = 0) kalman->set_pat_rec_noise_prob(0.); std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_MAPS","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - kalman->set_phg4hits_names(phg4hits_names, 10); + kalman->set_phg4hits_names(phg4hits_names, 11); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); From a5853b91a898d04ad7c0b2a3ea57699accc2b9a1 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 21 May 2018 10:41:55 -0400 Subject: [PATCH 0102/1222] Fix typo in position --- macros/g4simulations/G4_EGEM_EIC.C | 8 ++++---- macros/g4simulations/G4_FGEM_EIC.C | 2 +- macros/g4simulations/G4_GEM_EIC.C | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C index 95a5223b7..dd355291a 100644 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ b/macros/g4simulations/G4_EGEM_EIC.C @@ -26,10 +26,10 @@ EGEMSetup(PHG4Reco* g4Reco) * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ float thickness=3.; - make_GEM_station("EGEM_0", g4Reco, -19.00 + 0.5*thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -68.00 + 0.5*thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.4, -3.9); - make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.5, -4.00); + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.9); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -4.00); } int diff --git a/macros/g4simulations/G4_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C index 293ef9170..54fbbfa01 100644 --- a/macros/g4simulations/G4_FGEM_EIC.C +++ b/macros/g4simulations/G4_FGEM_EIC.C @@ -60,7 +60,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_3"; etamax = 4; etamin = min_eta; - zpos = 161.0; + zpos = 157.0; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index cc953cf63..80549117d 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -22,10 +22,10 @@ EGEMSetup(PHG4Reco* g4Reco) * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ float thickness=3.; - make_GEM_station("EGEM_0", g4Reco, -19.00 + 0.5*thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -68.00 + 0.5*thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -135.5 + 0.5*thickness, -1.4, -3.9); - make_GEM_station("EGEM_3", g4Reco, -158.8 + 0.5*thickness, -1.5, -4.00); + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.9); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -4.00); } void @@ -74,7 +74,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_3"; etamax = 4; etamin = min_eta; - zpos = 161.0; + zpos = 157.0; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); From c9c817db3f1be08bc74413799f30dc5652f76bcf Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 21 May 2018 11:17:11 -0400 Subject: [PATCH 0103/1222] Add comments --- macros/g4simulations/G4_FGEM_EIC.C | 2 +- macros/g4simulations/G4_GEM_EIC.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C index 54fbbfa01..b53f028c9 100644 --- a/macros/g4simulations/G4_FGEM_EIC.C +++ b/macros/g4simulations/G4_FGEM_EIC.C @@ -114,7 +114,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_4"; etamax = 4; etamin = min_eta; - zpos = 275.0; + zpos = 271.0 + 4.0; // needs offset w.r.t. AutoCAD drawing to not overlap with RICH- why? gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 80549117d..69b9df0e1 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -128,7 +128,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_4"; etamax = 4; etamin = min_eta; - zpos = 275.0; + zpos = 271.0 + 4.0; // needs offset w.r.t. AutoCAD drawing to not overlap with RICH- why? gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); From 5e7e6621180591707cec8ec084715bec8695dfd3 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 21 May 2018 12:43:32 -0400 Subject: [PATCH 0104/1222] Merged into G4_GEM_EIC.C --- macros/g4simulations/G4_EGEM_EIC.C | 128 ------------- macros/g4simulations/G4_FGEM_EIC.C | 294 ----------------------------- 2 files changed, 422 deletions(-) delete mode 100644 macros/g4simulations/G4_EGEM_EIC.C delete mode 100644 macros/g4simulations/G4_FGEM_EIC.C diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C deleted file mode 100644 index dd355291a..000000000 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ /dev/null @@ -1,128 +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) -{ - /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be - * drawn in event display but will NOT register any hits. - * - * Geometric constraints: - * TPC length = 211 cm --> from z = -105.5 to z = +105.5 - */ - float thickness=3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.9); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -4.00); -} - -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_a(polar_angle); - - 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(); - - cout << "GEM total thickness: " << gem->get_geometry().get_total_thickness() << endl; - 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_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","G4HIT_EGEM_3"}; - kalman->set_phg4hits_names(phg4hits_names, 3); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap_FastSimEtaMinus"); - - // 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_FGEM_EIC.C b/macros/g4simulations/G4_FGEM_EIC.C deleted file mode 100644 index b53f028c9..000000000 --- a/macros/g4simulations/G4_FGEM_EIC.C +++ /dev/null @@ -1,294 +0,0 @@ -/*! - * \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.245 // - ) -{ - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 2.73, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 4.00, N_Sector); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - etamax = 4; - etamin = min_eta; - zpos = 134.0; - - 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 = 157.0; - 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 = 271.0 + 4.0; // needs offset w.r.t. AutoCAD drawing to not overlap with RICH- why? - 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_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_FastSimEtaPlus"); - - // 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); - -} From 732d7f5586d5468337ae5bcc04faf31868f9ebf6 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 21 May 2018 13:00:07 -0400 Subject: [PATCH 0105/1222] remove obsolete file --- .../Fun4All_G4_EICDetector_Debug.C | 578 ------------------ macros/g4simulations/G4_TPC_EIC.C | 81 --- 2 files changed, 659 deletions(-) delete mode 100644 macros/g4simulations/Fun4All_G4_EICDetector_Debug.C delete mode 100644 macros/g4simulations/G4_TPC_EIC.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C b/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C deleted file mode 100644 index 1076fe52a..000000000 --- a/macros/g4simulations/Fun4All_G4_EICDetector_Debug.C +++ /dev/null @@ -1,578 +0,0 @@ -int Fun4All_G4_EICDetector_Debug( - const int nEvents = 100, - 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 = false; - 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 = false; - 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 = false; - 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_RICH = true; - bool do_Aerogel = true; - - bool do_FEMC = false; - bool do_FEMC_cell = do_FEMC && false; - 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 = false; - 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_EEMC = false; - bool do_EEMC_cell = do_EEMC && false; - 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("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_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 = "0.0"; - // 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) - { - // action is performed in later stage at the input manager level - } - 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); - } - 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); - } - 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); - } - 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); - } - 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); - } - - // 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("mu-"); - pgen->set_z_range(0,0); - pgen->set_eta_range(-4.0,0.0); - pgen->set_mom_range(30,30); - 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_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(); - - //----------------- - // 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_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/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C deleted file mode 100644 index 5fc3c60e8..000000000 --- a/macros/g4simulations/G4_TPC_EIC.C +++ /dev/null @@ -1,81 +0,0 @@ - -void TPCInit() {} - -double TPC(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { - - overlappcheck = 1; - if (radius > 21-1.17) { - cout << "inconsistency: radius: " << radius - << " larger than tpc inner radius: " << 21-1.17 << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4tpc.so"); - gSystem->Load("libg4testbench.so"); - - PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); - tpc->SetActive(); - tpc->SuperDetector("SVTX"); - // tpc_set_double_param("gas_inner_radius",21.); - // tpc_set_double_param("gas_outer_radius",77.); - // tpc_set_double_param("place_x", 0.); - // tpc_set_double_param("place_y", 0.); - // tpc_set_double_param("place_z", 0.); - // tpc_set_double_param("rot_x", 0.); - // tpc_set_double_param("rot_y", 0.); - // tpc_set_double_param("rot_z", 0.); - // tpc_set_double_param("tpc_length",211.); - - // tpc_set_double_param("steplimits", NAN); - - // tpc_set_string_param("tpc_gas", "sPHENIX_TPC_Gas"); - -// material budget: -// Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2. -// Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286 -// 250 um FR4 (Substrate for Cu layers) -// HoneyComb (nomex) 1/2 inch=0.5*2.54 cm - // tpc_set_string_param("cage_layer_1_material","G4_Cu"); - // tpc_set_double_param("cage_layer_1_thickness",0.00347/2.); - - // tpc_set_string_param("cage_layer_2_material","FR4"); - // tpc_set_double_param("cage_layer_2_thickness",0.025); - - // tpc_set_string_param("cage_layer_3_material","NOMEX"); - // tpc_set_double_param("cage_layer_3_thickness",0.5*2.54); - - // tpc_set_string_param("cage_layer_4_material","G4_Cu"); - // tpc_set_double_param("cage_layer_4_thickness",0.00347/2.); - - // tpc_set_string_param("cage_layer_5_material","FR4"); - // tpc_set_double_param("cage_layer_5_thickness",0.025); - - // tpc_set_string_param("cage_layer_6_material","G4_KAPTON"); - // tpc_set_double_param("cage_layer_6_thickness",0.2286); - - // tpc_set_string_param("cage_layer_7_material","G4_Cu"); - // tpc_set_double_param("cage_layer_7_thickness",0.00347/2.); - - // tpc_set_string_param("cage_layer_8_material","G4_KAPTON"); - // tpc_set_double_param("cage_layer_8_thickness",0.05); // 50 um - - // tpc_set_string_param("cage_layer_9_material","G4_Cu"); - // tpc_set_double_param("cage_layer_9_thickness",0.00347/2.); - if (absorberactive) - { - tpc->SetAbsorberActive(); - } - tpc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem( tpc ); - - radius = 77.+1.17; - - - radius += no_overlapp; - - return radius; -} From ab93287be281f3e46c6d9259f71ea73412539956 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Mon, 21 May 2018 13:00:34 -0400 Subject: [PATCH 0106/1222] switch off BBC; turn on EEMC --- macros/g4simulations/Fun4All_G4_EICDetector.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 1ac6527ce..922ef3b33 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -53,7 +53,7 @@ int Fun4All_G4_EICDetector( //====================== // sPHENIX barrel - bool do_bbc = true; + bool do_bbc = false; bool do_pipe = true; @@ -92,7 +92,7 @@ int Fun4All_G4_EICDetector( bool do_Aerogel = true; bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && false; + 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; @@ -104,8 +104,8 @@ int Fun4All_G4_EICDetector( bool do_FHCAL_eval = do_FHCAL_cluster && true; // EICDetector geometry - 'electron' direction - bool do_EEMC = false; - bool do_EEMC_cell = do_EEMC && false; + 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; From 606242def0858a5b66df937fb84e6bf2330a3e6a Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 22 May 2018 08:17:17 -0400 Subject: [PATCH 0107/1222] Move FGEM_4 to position from AutoCAD drawing --- macros/g4simulations/G4_GEM_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 69b9df0e1..4241dbfbb 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -128,7 +128,7 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // name = "FGEM_4"; etamax = 4; etamin = min_eta; - zpos = 271.0 + 4.0; // needs offset w.r.t. AutoCAD drawing to not overlap with RICH- why? + zpos = 271.0; gem = new PHG4SectorSubsystem(name.c_str()); gem->SuperDetector(name); From 77f3b5b9491f9e2cd7c1ca428e41bd0d071a2a8a Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Tue, 22 May 2018 08:17:48 -0400 Subject: [PATCH 0108/1222] Reduce RICH length (radius 195->190) to avoid overlap with FGEM_4 --- macros/g4simulations/G4_RICH.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 2ba3b3270..81070bfd0 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -25,7 +25,7 @@ void RICHSetup(PHG4Reco* g4Reco, // const int N_RICH_Sector = 8, // const double min_eta = 1.3, // - const double R_mirror_ref = 195, //cm + const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) const double z_shift = 75, // cm const double R_shift = 18.5 // cm ) From efb39489a1eda53cd817ed3fa07397d9cfa775df Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 23 May 2018 12:18:15 -0400 Subject: [PATCH 0109/1222] Change size of inner HCAL support ring in EIC hadron going directions --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_HcalIn_EIC.C | 215 +++++++++++++++++++++ 2 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 macros/g4simulations/G4_HcalIn_EIC.C diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 4079f5d5a..f569189c5 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -39,7 +39,7 @@ void G4Init(bool do_svtx = true, if (do_hcalin) { - gROOT->LoadMacro("G4_HcalIn_ref.C"); + gROOT->LoadMacro("G4_HcalIn_EIC.C"); HCalInnerInit(); } diff --git a/macros/g4simulations/G4_HcalIn_EIC.C b/macros/g4simulations/G4_HcalIn_EIC.C new file mode 100644 index 000000000..165d5b449 --- /dev/null +++ b/macros/g4simulations/G4_HcalIn_EIC.C @@ -0,0 +1,215 @@ +//Inner HCal construction macro + +//EIC modification: Make support ring in h-going side smaller (larger inner ring diameter) to +//give room for PID detectors + +//Inner HCal absorber material selector: +//false - Default, absorber material is SS310 +//true - Choose if you want Aluminum +const bool inner_hcal_material_Al = false; + + +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; + + +// 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->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_e = 116.; + const double innerradius_h = 138.; + 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++) + { + double innerradius = innerradius_e; + if ( z_rings[i] > 0 ) + innerradius = innerradius_h; + + 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("libg4calo.so"); + gSystem->Load("libcalo_reco.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("libcalo_reco.so"); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (HCalIn_clusterizer == kHCalInTemplateClusterizer) + { + RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + + } + else if (HCalIn_clusterizer == kHCalInGraphClusterizer) + { + RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem( ClusterBuilder ); + + } + else + { + cout <<"HCalIn_Clusters - unknown clusterizer setting!"<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; +} From ff837b61b6573dd38c5e26fcbef7b0b83a9b037c Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 23 May 2018 15:00:57 -0400 Subject: [PATCH 0110/1222] Shorten DIRC --- macros/g4simulations/G4_DIRC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index 032e4fae9..2b5486733 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -23,8 +23,8 @@ double DIRCSetup(PHG4Reco* g4Reco) { const double radiator_R = 83.65; - const double length = 470; - const double z_shift = -115; + const double length = 400; + const double z_shift = -75; //115 const double z_start = z_shift + length / 2.; const double z_end = z_shift - length / 2.; From 4ecfcd9d2def41f7e5d1c417a014df69c5100b1e Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 23 May 2018 15:03:07 -0400 Subject: [PATCH 0111/1222] Update plug door --- macros/g4simulations/Fun4All_G4_EICDetector.C | 13 ++++---- macros/g4simulations/G4Setup_EICDetector.C | 29 +++++++++--------- macros/g4simulations/G4_PlugDoor_EIC.C | 30 +++++++++++++++++++ 3 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 macros/g4simulations/G4_PlugDoor_EIC.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 922ef3b33..bb518383c 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -4,9 +4,6 @@ int Fun4All_G4_EICDetector( 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 //=============== @@ -110,13 +107,17 @@ int Fun4All_G4_EICDetector( bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; + bool do_plugdoor = 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; + // Select only one jet reconstruction- they currently use the same + // output collections on the node tree! + bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; bool do_fwd_jet_reco = true; @@ -146,7 +147,7 @@ int Fun4All_G4_EICDetector( // 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_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel,n_TPC_layers); + G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); 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) @@ -353,7 +354,7 @@ int Fun4All_G4_EICDetector( //--------------------- G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, + do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index f569189c5..ebf74adff 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -8,13 +8,13 @@ void G4Init(bool do_svtx = true, bool do_magnet = true, bool do_hcalout = true, bool do_pipe = true, + bool do_plugdoor = 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) + bool do_Aerogel = true) { // load detector/material macros and execute Init() function @@ -24,11 +24,18 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_Pipe.C"); PipeInit(); } + + if (do_plugdoor) + { + gROOT->LoadMacro("G4_PlugDoor_EIC.C"); + PlugDoorInit(); + } + if (do_svtx) { //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); gROOT->LoadMacro("G4_Tracking_EIC.C"); - TrackingInit(n_TPC_layers); + TrackingInit(); } if (do_cemc) @@ -103,6 +110,7 @@ int G4Setup(const int absorberactive = 0, const bool do_magnet = true, const bool do_hcalout = true, const bool do_pipe = true, + const bool do_plugdoor = true, const bool do_FEMC = false, const bool do_FHCAL = false, const bool do_EEMC = true, @@ -214,18 +222,9 @@ int G4Setup(const int absorberactive = 0, if ( do_Aerogel ) AerogelSetup(g4Reco); - // sPHENIX forward flux return(s) - 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); + //---------------------------------------- + // sPHENIX forward flux return door + if (do_plugdoor) PlugDoor(g4Reco, absorberactive); //---------------------------------------- // BLACKHOLE diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C new file mode 100644 index 000000000..0c86e47d4 --- /dev/null +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -0,0 +1,30 @@ + +void PlugDoorInit() {} +void PlugDoor(PHG4Reco *g4Reco, + const int absorberactive = 0, + int verbosity = 0) +{ + //---------------------------------------- + // sPHENIX forward flux return(s) + // define via four cornors in the engineering drawing + const double z_1 = 330.81; + const double z_2 = 360.81; + const double r_1 = 30; + const double r_2 = 263.5; + const string material("Steel_1006"); + const int flux_door_active = false; + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + flux_return_minus->set_int_param("lengthviarapidity", 0); + flux_return_minus->set_double_param("length", z_2 - z_1); + flux_return_minus->set_double_param("radius", r_1); + flux_return_minus->set_double_param("place_z", -(z_1 + z_2) / 2.); + flux_return_minus->set_double_param("thickness", r_2 - 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); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} From eb5ade926aa7e74546f729bf377a724ebec4b6b2 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Tue, 5 Jun 2018 12:42:03 -0400 Subject: [PATCH 0112/1222] added switch to use projective geometry, off by default --- macros/g4simulations/G4_EEMC.C | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index d13b3bb3e..063f43eb9 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -1,5 +1,5 @@ using namespace std; - +const int use_projective_geometry = 1; void EEMCInit() { @@ -24,17 +24,29 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) gSystem->Load("libg4detectors.so"); - /** Use dedicated EEMC module */ + /** 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_v005.txt"; - cout << mapping_eemc.str() << endl; + if(!use_projective_geometry) + { + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v005.txt"; + eemc->SetTowerMappingFile( mapping_eemc.str() ); + } + + /* use projective geometry */ + else + { + ostringstream mapping_eemc_4x4construct; + + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; + mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; + eemc->SetProjectiveGeometry ( mapping_eemc.str() , mapping_eemc_4x4construct.str() ); + } - eemc->SetTowerMappingFile( mapping_eemc.str() ); eemc->OverlapCheck(overlapcheck); if (absorberactive) eemc->SetAbsorberActive(); From 4d901a4a7a6ee371b37c4507aca395d842e4e34c Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Wed, 6 Jun 2018 13:56:27 -0400 Subject: [PATCH 0113/1222] use projective geometry off by default --- macros/g4simulations/G4_EEMC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 063f43eb9..b84b375bb 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -1,5 +1,5 @@ using namespace std; -const int use_projective_geometry = 1; +const int use_projective_geometry = 0; void EEMCInit() { From a85ff821b0e2af27374cec55dfbcb005466fb40d Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Thu, 14 Jun 2018 09:12:53 -0400 Subject: [PATCH 0114/1222] first commit of shashlik central EMCal --- macros/g4simulations/G4_CEmc_EIC.C | 291 +++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 macros/g4simulations/G4_CEmc_EIC.C diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C new file mode 100644 index 000000000..792e9bcea --- /dev/null +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -0,0 +1,291 @@ + +double cemcdepth = 9; +//tungs to scint width ratio must be ~10:1 +//for approx 2% sampling fraction + +//18 radiation lengths +double scint_width = 0.049; +double tungs_width = 0.49; + +//fits in 95-104cm but only 15 X_0 +//double scint_width = 0.041; +//double tungs_width = 0.41; + + +int min_cemc_layer = 1; +int max_cemc_layer = 21; + +double topradius = 104; //cm +double bottomradius = 95; //cm +double negrapidity = -1.4; +double posrapidity = 1.1; +//this is default set to -1.4 95) + { + cout << "inconsistency, radius: "<Exit(-1); + } + + radius = 95; + + + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + + PHG4CylinderSubsystem *cemc; + + + + //determine the length of the calorimeter + //can adjust length coverage by just adjusting these values + //rapidity coverage will be determined by z shift of EMCAl + //as indicated in the loop below + + + //eta = -ln(tan(theta/2)) + double theta1 = 2.*TMath::ATan(TMath::Exp(-1 * posrapidity)); + double theta2 = 2. * TMath::ATan( TMath::Exp(-1 * negrapidity)); + //get the angle between the beam pipe and negative pseudorapidity axis + theta2 = TMath::Pi() - theta2; + + double z1 = topradius / TMath::Tan(theta1); + double z2 = topradius / TMath::Tan(theta2); + + double z3 = bottomradius / TMath::Tan(theta1); + double z4 = bottomradius / TMath::Tan(theta2); + + //this is the top layer length + double totaltoplength = z1 + z2; + //this is the bottom layer length + double totalbottomlength = z3 + z4; + + double height = 0; + for(int thislayer = min_cemc_layer; + thislayer <= max_cemc_layer; + thislayer++) + { + + //the length for a particular layer is determined from the bottom length + double thislength = totalbottomlength + + height / TMath::Tan(theta1) + + height / TMath::Tan(theta2); + + + cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); + cemc->set_double_param("radius",radius); + cemc->set_string_param("material","Spacal_W_Epoxy"); + cemc->set_double_param("thickness", tungs_width); + cemc->set_double_param("length",thislength); + cemc->set_int_param("lengthviarapidity",0); + + //starts centered around IP + //shift backwards 30 cm for total 340 cm length to cover -1.4set_double_param("place_z",-30); + cemc->SuperDetector("ABSORBER_CEMC"); + if(absorberactive) + cemc->SetActive(); + bool ov1 = cemc->OverlapCheck(overlapcheck); + if(ov1) + cout<<"THERE IS AN OVERLAP IN THE SHASHLIK EMC:SPACAL_W_EPOXY"<registerSubsystem(cemc); + + radius += tungs_width; + radius += no_overlapp; + + height += tungs_width; + + cemc = new PHG4CylinderSubsystem("CEMC", thislayer); + cemc->set_double_param("radius",radius); + cemc->set_string_param("material","PMMA"); + cemc->set_double_param("thickness", scint_width); + cemc->set_int_param("lightyield", 1); + cemc->set_int_param("lengthviarapidity",0); + cemc->set_double_param("length",thislength); + + //shift back -30 cm to cover -1.4set_double_param("place_z",-30); + cemc->SuperDetector("CEMC"); + + cemc->SetActive(); + bool ov2 = cemc->OverlapCheck(overlapcheck); + + if(ov2) + cout<<"THERE IS AN OVERLAP IN THE SHASHLIK EMC:PMMA"<registerSubsystem(cemc); + + radius += scint_width; + radius += no_overlapp; + + height += scint_width; + + + } + + + + PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS",0); + cemc_cyl->set_double_param("radius",radius); + cemc_cyl->set_string_param("material","G4_TEFLON"); + cemc_cyl->set_double_param("thickness",0.5); + + double l1 = (radius + 0.5) / TMath::Tan(theta1); + double l2 = (radius + 0.5) / TMath::Tan(theta2); + cemc_cyl->set_int_param("lengthviarapidity",0); + cemc_cyl->set_double_param("length",l1 + l2); + //shift back -30 cm to cover -1.4set_double_param("place_z",-30); + if(absorberactive) + cemc_cyl->SetActive(); + cemc_cyl->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(cemc_cyl); + + + + + +} + + + + +void CEMC_Cells(int verbosity = 0) +{ + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4detectors.so"); + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + double radius = 95; + for(int i = min_cemc_layer; i <= max_cemc_layer; i++) + { + cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, + 2. * TMath::Pi() / 256. * radius); + radius += (scint_width + tungs_width); + } + se->registerSubsystem(cemc_cells); + + return; + +} + + + +void CEMC_Towers(int verbosity = 0) +{ + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); + Fun4AllServer *se = Fun4AllServer::instance(); + + + RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + CemcTowerBuilder->Detector("CEMC"); + CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); + CemcTowerBuilder->Verbosity(verbosity); + se->registerSubsystem(CemcTowerBuilder); + + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + //just set a 2% sampling fraction - already tuned by tungs/scint width ratio + double sampling_fraction = 2e-02; + RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + CemcTowerDigitizer->Detector("CEMC"); + CemcTowerDigitizer->Verbosity(verbosity); + CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); + CemcTowerDigitizer->set_pedstal_central_ADC(0); + CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + CemcTowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error + CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + se->registerSubsystem(CemcTowerDigitizer); + + + RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + CemcTowerCalibration->Detector("CEMC"); + CemcTowerCalibration->Verbosity(verbosity); + CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV/0.9715); + CemcTowerCalibration->set_pedstal_ADC(0); + + se->registerSubsystem(CemcTowerCalibration); + + + return; +} + + + +void CEMC_Clusters(int verbosity = 0) +{ + + + gSystem->Load("libcalo_reco.so"); + Fun4AllServer *se = Fun4AllServer::instance(); + + if (Cemc_clusterizer == kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + cemc_clusterbuilder->Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + + se->registerSubsystem(cemc_clusterbuilder); + } + else if (Cemc_clusterizer == kCemcGraphClusterizer) + { + RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + cemc_clusterbuilder->Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + + se->registerSubsystem(cemc_clusterbuilder); + } + else + { + cout<<"CEMC_Clusters - unknown clusterizer setting!! "<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; +} From 3158376ecf0e4a274ab98e5e4a39a5716a243b98 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Thu, 14 Jun 2018 13:55:12 -0400 Subject: [PATCH 0115/1222] make the -1.4LoadMacro("G4_CEmc_Spacal.C"); + gROOT->LoadMacro("G4_CEmc_EIC.C"); CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations } From 310b3319ab2d568bbdb090c56d18fcefc1e34372 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Fri, 15 Jun 2018 00:05:18 -0400 Subject: [PATCH 0116/1222] Seed configuration in HI Jet reco macro, also truth jet reco for when pp reco is turned off --- macros/g4simulations/G4_HIJetReco.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index 74c38a182..30d96115a 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -12,6 +12,19 @@ void HIJetReco(int verbosity = 0) { 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(0); + se->registerSubsystem(truthjetreco); + RetowerCEMC *rcemc = new RetowerCEMC(); rcemc->Verbosity( verbosity ); se->registerSubsystem( rcemc ); @@ -29,6 +42,7 @@ void HIJetReco(int verbosity = 0) { DetermineTowerBackground *dtb = new DetermineTowerBackground(); dtb->SetBackgroundOutputName("TowerBackground_Sub1"); dtb->SetSeedType( 0 ); + dtb->set_seed_jet_D( 3 ); dtb->Verbosity( verbosity ); se->registerSubsystem( dtb ); @@ -39,6 +53,7 @@ void HIJetReco(int verbosity = 0) { DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); dtb2->SetSeedType( 1 ); + dtb2->set_seed_jet_pt( 7 ); dtb2->Verbosity( verbosity ); se->registerSubsystem( dtb2 ); From 57615c388cc317c9682a04f09338cda18ae486ea Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Mon, 18 Jun 2018 12:13:19 -0400 Subject: [PATCH 0117/1222] fixed some properties to better match actual SPACAL resolution --- macros/g4simulations/G4_CEmc_EIC.C | 34 ++++++++++++------------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 792e9bcea..820b51483 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -1,27 +1,24 @@ double cemcdepth = 9; -//tungs to scint width ratio must be ~10:1 -//for approx 2% sampling fraction +//tungs to scint width ratio of ~10:1 +//corresponds to approx 2% sampling fraction -//18 radiation lengths -double scint_width = 0.049; -double tungs_width = 0.49; +//18 radiation lengths for 40 layers +double scint_width = 0.05; +double tungs_width = 0.245; -//fits in 95-104cm but only 15 X_0 -//double scint_width = 0.041; -//double tungs_width = 0.41; int min_cemc_layer = 1; -int max_cemc_layer = 21; +int max_cemc_layer = 41; -double topradius = 104; //cm +double topradius = 106.8; //cm double bottomradius = 95; //cm double negrapidity = -1.4; double posrapidity = 1.1; //this is default set to -1.4SuperDetector("ABSORBER_CEMC"); if(absorberactive) cemc->SetActive(); - bool ov1 = cemc->OverlapCheck(overlapcheck); - if(ov1) - cout<<"THERE IS AN OVERLAP IN THE SHASHLIK EMC:SPACAL_W_EPOXY"<OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(cemc); radius += tungs_width; @@ -137,11 +133,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->SuperDetector("CEMC"); cemc->SetActive(); - bool ov2 = cemc->OverlapCheck(overlapcheck); - - if(ov2) - cout<<"THERE IS AN OVERLAP IN THE SHASHLIK EMC:PMMA"<OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc); radius += scint_width; @@ -217,8 +209,8 @@ void CEMC_Towers(int verbosity = 0) se->registerSubsystem(CemcTowerBuilder); const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - //just set a 2% sampling fraction - already tuned by tungs/scint width ratio - double sampling_fraction = 2e-02; + //just set a 4% sampling fraction - already tuned by tungs/scint width ratio + double sampling_fraction = 4e-02; RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); CemcTowerDigitizer->Detector("CEMC"); CemcTowerDigitizer->Verbosity(verbosity); From 2c4c5f5270dbe0443bd117b7d399352d231de5e1 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Mon, 18 Jun 2018 12:28:25 -0400 Subject: [PATCH 0118/1222] clang style --- macros/g4simulations/G4_CEmc_EIC.C | 333 +++++++++++++---------------- 1 file changed, 147 insertions(+), 186 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 820b51483..af774f3ad 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -1,79 +1,63 @@ -double cemcdepth = 9; -//tungs to scint width ratio of ~10:1 -//corresponds to approx 2% sampling fraction +double cemcdepth = 9; +// tungs to scint width ratio of ~10:1 +// corresponds to approx 2% sampling fraction -//18 radiation lengths for 40 layers +// 18 radiation lengths for 40 layers double scint_width = 0.05; double tungs_width = 0.245; - - int min_cemc_layer = 1; int max_cemc_layer = 41; -double topradius = 106.8; //cm -double bottomradius = 95; //cm +double topradius = 106.8; // cm +double bottomradius = 95; // cm double negrapidity = -1.4; double posrapidity = 1.1; -//this is default set to -1.4 95) - { - cout << "inconsistency, radius: "<Exit(-1); - } - - radius = 95; + const int absorberactive = 0) { + if (radius > 95) { + cout << "inconsistency, radius: " << radius + << " larger than allowed inner radius for CEMC = 95 cm" << endl; + gSystem->Exit(-1); + } + radius = 95; gSystem->Load("libg4detectors.so"); gSystem->Load("libg4testbench.so"); - PHG4CylinderSubsystem *cemc; - - - //determine the length of the calorimeter - //can adjust length coverage by just adjusting these values - //rapidity coverage will be determined by z shift of EMCAl - //as indicated in the loop below - + // determine the length of the calorimeter + // can adjust length coverage by just adjusting these values + // rapidity coverage will be determined by z shift of EMCAl + // as indicated in the loop below - //eta = -ln(tan(theta/2)) - double theta1 = 2.*TMath::ATan(TMath::Exp(-1 * posrapidity)); - double theta2 = 2. * TMath::ATan( TMath::Exp(-1 * negrapidity)); - //get the angle between the beam pipe and negative pseudorapidity axis - theta2 = TMath::Pi() - theta2; + // eta = -ln(tan(theta/2)) + double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * posrapidity)); + double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * negrapidity)); + // get the angle between the beam pipe and negative pseudorapidity axis + theta2 = TMath::Pi() - theta2; double z1 = topradius / TMath::Tan(theta1); double z2 = topradius / TMath::Tan(theta2); @@ -81,201 +65,178 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double z3 = bottomradius / TMath::Tan(theta1); double z4 = bottomradius / TMath::Tan(theta2); - //this is the top layer length + // this is the top layer length double totaltoplength = z1 + z2; - //this is the bottom layer length + // this is the bottom layer length double totalbottomlength = z3 + z4; - + double height = 0; - for(int thislayer = min_cemc_layer; - thislayer <= max_cemc_layer; - thislayer++) - { - - //the length for a particular layer is determined from the bottom length - double thislength = totalbottomlength - + height / TMath::Tan(theta1) - + height / TMath::Tan(theta2); - - - cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); - cemc->set_double_param("radius",radius); - cemc->set_string_param("material","Spacal_W_Epoxy"); - cemc->set_double_param("thickness", tungs_width); - cemc->set_double_param("length",thislength); - cemc->set_int_param("lengthviarapidity",0); - - //starts centered around IP - //shift backwards 30 cm for total 340 cm length to cover -1.4set_double_param("place_z",-30); - cemc->SuperDetector("ABSORBER_CEMC"); - if(absorberactive) - cemc->SetActive(); - cemc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cemc); - - radius += tungs_width; - radius += no_overlapp; - - height += tungs_width; - - cemc = new PHG4CylinderSubsystem("CEMC", thislayer); - cemc->set_double_param("radius",radius); - cemc->set_string_param("material","PMMA"); - cemc->set_double_param("thickness", scint_width); - cemc->set_int_param("lightyield", 1); - cemc->set_int_param("lengthviarapidity",0); - cemc->set_double_param("length",thislength); - - //shift back -30 cm to cover -1.4set_double_param("place_z",-30); - cemc->SuperDetector("CEMC"); - + for (int thislayer = min_cemc_layer; thislayer <= max_cemc_layer; + thislayer++) { + + // the length for a particular layer is determined from the bottom length + double thislength = totalbottomlength + height / TMath::Tan(theta1) + + height / TMath::Tan(theta2); + + cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); + cemc->set_double_param("radius", radius); + cemc->set_string_param("material", "Spacal_W_Epoxy"); + cemc->set_double_param("thickness", tungs_width); + cemc->set_double_param("length", thislength); + cemc->set_int_param("lengthviarapidity", 0); + + // starts centered around IP + // shift backwards 30 cm for total 340 cm length to cover -1.4set_double_param("place_z", -30); + cemc->SuperDetector("ABSORBER_CEMC"); + if (absorberactive) cemc->SetActive(); - cemc->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(cemc); - - radius += scint_width; - radius += no_overlapp; - - height += scint_width; - + cemc->OverlapCheck(overlapcheck); - } + g4Reco->registerSubsystem(cemc); + radius += tungs_width; + radius += no_overlapp; + height += tungs_width; - PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS",0); - cemc_cyl->set_double_param("radius",radius); - cemc_cyl->set_string_param("material","G4_TEFLON"); - cemc_cyl->set_double_param("thickness",0.5); - - double l1 = (radius + 0.5) / TMath::Tan(theta1); - double l2 = (radius + 0.5) / TMath::Tan(theta2); - cemc_cyl->set_int_param("lengthviarapidity",0); - cemc_cyl->set_double_param("length",l1 + l2); - //shift back -30 cm to cover -1.4set_double_param("place_z",-30); - if(absorberactive) - cemc_cyl->SetActive(); - cemc_cyl->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(cemc_cyl); - - + cemc = new PHG4CylinderSubsystem("CEMC", thislayer); + cemc->set_double_param("radius", radius); + cemc->set_string_param("material", "PMMA"); + cemc->set_double_param("thickness", scint_width); + cemc->set_int_param("lightyield", 1); + cemc->set_int_param("lengthviarapidity", 0); + cemc->set_double_param("length", thislength); + // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + cemc->SuperDetector("CEMC"); + cemc->SetActive(); + cemc->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(cemc); -} + radius += scint_width; + radius += no_overlapp; + height += scint_width; + } + PHG4CylinderSubsystem *cemc_cyl = + new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cemc_cyl->set_double_param("radius", radius); + cemc_cyl->set_string_param("material", "G4_TEFLON"); + cemc_cyl->set_double_param("thickness", 0.5); + double l1 = (radius + 0.5) / TMath::Tan(theta1); + double l2 = (radius + 0.5) / TMath::Tan(theta2); + cemc_cyl->set_int_param("lengthviarapidity", 0); + cemc_cyl->set_double_param("length", l1 + l2); + // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + if (absorberactive) + cemc_cyl->SetActive(); + cemc_cyl->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(cemc_cyl); +} -void CEMC_Cells(int verbosity = 0) -{ +void CEMC_Cells(int verbosity = 0) { gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + + PHG4CylinderCellReco *cemc_cells = + new PHG4CylinderCellReco("CEMCCYLCELLRECO"); cemc_cells->Detector("CEMC"); cemc_cells->Verbosity(verbosity); double radius = 95; - for(int i = min_cemc_layer; i <= max_cemc_layer; i++) - { - cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, - 2. * TMath::Pi() / 256. * radius); - radius += (scint_width + tungs_width); - } + for (int i = min_cemc_layer; i <= max_cemc_layer; i++) { + cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, + 2. * TMath::Pi() / 256. * radius); + radius += (scint_width + tungs_width); + } se->registerSubsystem(cemc_cells); - - return; + return; } - - -void CEMC_Towers(int verbosity = 0) -{ +void CEMC_Towers(int verbosity = 0) { gSystem->Load("libg4calo.so"); gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); CemcTowerBuilder->Detector("CEMC"); CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); CemcTowerBuilder->Verbosity(verbosity); se->registerSubsystem(CemcTowerBuilder); - - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - //just set a 4% sampling fraction - already tuned by tungs/scint width ratio - double sampling_fraction = 4e-02; - RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + + const double photoelectron_per_GeV = + 500; // 500 photon per total GeV deposition + // just set a 4% sampling fraction - already tuned by tungs/scint width ratio + double sampling_fraction = 4e-02; + RawTowerDigitizer *CemcTowerDigitizer = + new RawTowerDigitizer("EmcRawTowerDigitizer"); CemcTowerDigitizer->Detector("CEMC"); CemcTowerDigitizer->Verbosity(verbosity); - CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); + CemcTowerDigitizer->set_digi_algorithm( + RawTowerDigitizer::kSimple_photon_digitization); CemcTowerDigitizer->set_pedstal_central_ADC(0); - CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - CemcTowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error - CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + CemcTowerDigitizer->set_photonelec_ADC( + 1); // not simulating ADC discretization error + CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / + sampling_fraction); + CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting se->registerSubsystem(CemcTowerDigitizer); - - - RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + + RawTowerCalibration *CemcTowerCalibration = + new RawTowerCalibration("EmcRawTowerCalibration"); CemcTowerCalibration->Detector("CEMC"); CemcTowerCalibration->Verbosity(verbosity); - CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV/0.9715); + CemcTowerCalibration->set_calib_algorithm( + RawTowerCalibration::kSimple_linear_calibration); + CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / + 0.9715); CemcTowerCalibration->set_pedstal_ADC(0); - + se->registerSubsystem(CemcTowerCalibration); - return; } - - -void CEMC_Clusters(int verbosity = 0) -{ - +void CEMC_Clusters(int verbosity = 0) { gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - - if (Cemc_clusterizer == kCemcTemplateClusterizer) - { - RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - - se->registerSubsystem(cemc_clusterbuilder); - } - else if (Cemc_clusterizer == kCemcGraphClusterizer) - { - RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - - se->registerSubsystem(cemc_clusterbuilder); - } - else - { - cout<<"CEMC_Clusters - unknown clusterizer setting!! "<Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + + se->registerSubsystem(cemc_clusterbuilder); + } else if (Cemc_clusterizer == kCemcGraphClusterizer) { + RawClusterBuilderGraph *cemc_clusterbuilder = + new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + cemc_clusterbuilder->Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + + se->registerSubsystem(cemc_clusterbuilder); + } else { + cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; + exit(1); + } return; } -void CEMC_Eval(std::string outputfile, int verbosity = 0) -{ +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()); + CaloEvaluator *eval = + new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile.c_str()); eval->Verbosity(verbosity); se->registerSubsystem(eval); From b61e816e34c2827e5a921ce11b9d0baf708623ad Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Mon, 18 Jun 2018 17:19:14 -0400 Subject: [PATCH 0119/1222] Updating method names. --- macros/g4simulations/G4_HIJetReco.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index 30d96115a..dc995e3f9 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -42,7 +42,7 @@ void HIJetReco(int verbosity = 0) { DetermineTowerBackground *dtb = new DetermineTowerBackground(); dtb->SetBackgroundOutputName("TowerBackground_Sub1"); dtb->SetSeedType( 0 ); - dtb->set_seed_jet_D( 3 ); + dtb->SetSeedJetD( 3 ); dtb->Verbosity( verbosity ); se->registerSubsystem( dtb ); @@ -53,7 +53,7 @@ void HIJetReco(int verbosity = 0) { DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); dtb2->SetSeedType( 1 ); - dtb2->set_seed_jet_pt( 7 ); + dtb2->SetSeedJetPt( 7 ); dtb2->Verbosity( verbosity ); se->registerSubsystem( dtb2 ); From 4ec7a3549101564be9b9708f70092dadf445daa1 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Mon, 18 Jun 2018 19:24:33 -0400 Subject: [PATCH 0120/1222] Add R=0.5 HI Jet reco by default --- macros/g4simulations/G4_HIJetReco.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index dc995e3f9..af641b0ab 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -68,6 +68,7 @@ void HIJetReco(int verbosity = 0) { 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 ); From b8df7f6db71d2e89dc6322612ec24ba4a828c2fb Mon Sep 17 00:00:00 2001 From: carlosperezlara Date: Thu, 21 Jun 2018 16:30:33 -0400 Subject: [PATCH 0121/1222] updating macros for EIC tracking --- macros/g4simulations/G4_FEMC.C | 2 ++ macros/g4simulations/G4_Tracking_EIC.C | 47 +++++++++++++++++++++----- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 6e55cce39..bd0a7b2d3 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -23,6 +23,8 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) { gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index fbded27e3..0da8d20f5 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -57,18 +57,38 @@ void Tracking_Reco(int verbosity = 0) 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_pat_rec_hit_finding_eff(1.); - kalman->set_pat_rec_noise_prob(0.); - + //kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder + //kalman->set_phi_resolution(50E-4); + //kalman->set_r_resolution(1.); + //kalman->set_pat_rec_hit_finding_eff(1.); + //kalman->set_pat_rec_noise_prob(0.); std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_MAPS","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - kalman->set_phg4hits_names(phg4hits_names, 11); + int dettypes[] = {PHG4TrackFastSim::Cylinder,PHG4TrackFastSim::Cylinder, + PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, + PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, + PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, + PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, + PHG4TrackFastSim::Vertical_Plane }; + float rad[] = {1e4, 1e4, 100, 100, 100, 100, 100, 100, 100, 100, 100}; + float phi[] = {5.0, 150, 100, 100, 100, 100, 100, 100, 100, 100, 100}; + float lon[] = {5.0, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100}; + for(int i=0; i!=11; ++i) { // from um to cm + rad[i] *= 1e-4; + phi[i] *= 1e-4; + lon[i] *= 1e-4; + } + float eff[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; + float noi[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + kalman->set_phg4hits_names(phg4hits_names, dettypes, rad, phi, lon, eff, noi, 11); + + //std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; + //kalman->set_phg4hits_names(phg4hits_names, 9); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); + //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); @@ -112,5 +132,16 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); // se->registerSubsystem( eval ); +} +void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) +{ + gSystem->Load("libFastTrackingEval.so"); + + Fun4AllServer *se = Fun4AllServer::instance(); + + FastTrackingEval *fast_sim_eval = new FastTrackingEval("FastTrackingEval"); + fast_sim_eval->set_filename( outputfile.c_str() ); + se->registerSubsystem( fast_sim_eval ); + return; } From a0553675e697fc2157ee103eace8a9d73a44b9db Mon Sep 17 00:00:00 2001 From: carlosperezlara Date: Fri, 22 Jun 2018 10:58:16 -0400 Subject: [PATCH 0122/1222] fixing rad res --- macros/g4simulations/G4_Tracking_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 0da8d20f5..2ddacf756 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -69,7 +69,7 @@ void Tracking_Reco(int verbosity = 0) PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, PHG4TrackFastSim::Vertical_Plane }; - float rad[] = {1e4, 1e4, 100, 100, 100, 100, 100, 100, 100, 100, 100}; + float rad[] = {5.0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; float phi[] = {5.0, 150, 100, 100, 100, 100, 100, 100, 100, 100, 100}; float lon[] = {5.0, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100}; for(int i=0; i!=11; ++i) { // from um to cm From a857a5674a00a5e9fdfc67dab6fe5cb4c75e2ba0 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Sat, 23 Jun 2018 17:22:35 -0400 Subject: [PATCH 0123/1222] Options for flow-dependent subtraction in HI jet reco steps. (Turned off by default in macro.) --- macros/g4simulations/G4_HIJetReco.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index af641b0ab..efabbbb70 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -47,6 +47,7 @@ void HIJetReco(int verbosity = 0) { se->registerSubsystem( dtb ); CopyAndSubtractJets *casj = new CopyAndSubtractJets(); + casj->SetFlowModulation( false ); casj->Verbosity( verbosity ); se->registerSubsystem( casj ); @@ -58,6 +59,7 @@ void HIJetReco(int verbosity = 0) { se->registerSubsystem( dtb2 ); SubtractTowers *st = new SubtractTowers(); + st->SetFlowModulation( false ); st->Verbosity( verbosity ); se->registerSubsystem( st ); From 5b4f4d468e824e188d98162286a3aecd2c76108b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 26 Jun 2018 16:45:47 -0400 Subject: [PATCH 0124/1222] Modified to use the new TPC digitizer --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) 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 index fed3cd0bc..138d410af 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -182,18 +182,14 @@ void SvtxInit(int verbosity = 0) // TPC readout shaping time and ADC clock parameters // these set the Z size of the TPC cells //======================================= - // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA - TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - // TKH does not understand the physical origin of these parameters. - // however, their impact seems quite small... - // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here - TPC_SmearRPhi = 0.215; - TPC_SmearZ = 0.20; + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time + TPC_SmearRPhi = 0.25; + TPC_SmearZ = 0.15; } double Svtx(PHG4Reco* g4Reco, double radius, @@ -626,13 +622,17 @@ void Svtx_Reco(int verbosity = 0) se->registerSubsystem(digiintt); } - // TPC layers - for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) - { - digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range - } + // TPC layers use the Svtx digitizer + digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); + double ENC = 670.0; // standard + digi->SetENC(ENC); + double ADC_threshold = 4.0*ENC; + digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; + se->registerSubsystem(digi); - + //------------------------------------- // Apply Live Area Inefficiency to Hits //------------------------------------- @@ -699,7 +699,6 @@ void Svtx_Reco(int verbosity = 0) tpcclusterizer->setEnergyCut(15 /*adc*/); tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); - tpcclusterizer->setFitEnergyThreshold(0.05 /*fraction*/); se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! From ce400194def6444747bf6f1725cfcbbae2fd02fd Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Wed, 27 Jun 2018 17:53:38 -0400 Subject: [PATCH 0125/1222] Add flow option in background determination, and single global option in all sub-steps. --- macros/g4simulations/G4_HIJetReco.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index efabbbb70..29ec9f9d8 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -1,4 +1,4 @@ -void HIJetReco(int verbosity = 0) { +void HIJetReco(int verbosity = 0, bool do_flow = false ) { //--------------- // Load libraries @@ -41,25 +41,27 @@ void HIJetReco(int verbosity = 0) { DetermineTowerBackground *dtb = new DetermineTowerBackground(); dtb->SetBackgroundOutputName("TowerBackground_Sub1"); + dtb->SetFlow( do_flow ); dtb->SetSeedType( 0 ); dtb->SetSeedJetD( 3 ); dtb->Verbosity( verbosity ); se->registerSubsystem( dtb ); CopyAndSubtractJets *casj = new CopyAndSubtractJets(); - casj->SetFlowModulation( false ); + casj->SetFlowModulation( do_flow ); casj->Verbosity( verbosity ); se->registerSubsystem( casj ); DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); + dtb2->SetFlow( do_flow ); dtb2->SetSeedType( 1 ); dtb2->SetSeedJetPt( 7 ); dtb2->Verbosity( verbosity ); se->registerSubsystem( dtb2 ); SubtractTowers *st = new SubtractTowers(); - st->SetFlowModulation( false ); + st->SetFlowModulation( do_flow ); st->Verbosity( verbosity ); se->registerSubsystem( st ); From 8e8a31e7d23694f8bf96ff9b12eb2f14ed4c845b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 2 Jul 2018 10:39:26 -0400 Subject: [PATCH 0126/1222] Create Readme --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..893a2102a --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ + +# 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). + +# Get started + +Please follow [SPHENIX software day-1 checklist](https://wiki.bnl.gov/sPHENIX/index.php/SPHENIX_software_day-1_checklist) to get started. + +== 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/macros/g4simulations/ +[jinhuang@rcas2073 g4simulations]$ # here is all the macros to run fsPHENIX and sPHENIX simulations +``` + +The default sPHENIX simulation + reconstruction macro is [Fun4All_G4_sPHENIX.C](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d5/d2c/macros_2blob_2master_2macros_2g4simulations_2Fun4All__G4__sPHENIX_8C_source.html#l00001), 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 macros]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +[jinhuang@rcas2072 macros]$ 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 macros]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +[jinhuang@rcas2072 macros]$ 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. +* [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://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d1/df4/classJetEvaluator.html), [SvtxEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. From 004dcb2eed7734e32e0d99f7d8ab2f0dc86d578b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 2 Jul 2018 10:39:54 -0400 Subject: [PATCH 0127/1222] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 893a2102a..f0a996aed 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This is the standard macros respository for [sPHENIX collaboration](https://www. Please follow [SPHENIX software day-1 checklist](https://wiki.bnl.gov/sPHENIX/index.php/SPHENIX_software_day-1_checklist) to get started. -== Check out macro repository == +# Check out macro repository Download the newest macro repository from GitHub: From fd0ef667de0c3d039e3cb160c840acaae100b022 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 4 Jul 2018 12:30:33 -0400 Subject: [PATCH 0128/1222] sPHENIX 2018 SPACAL design, 9-degree-tilted approximate projective design --- macros/g4simulations/G4_CEmc_Spacal.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index d3ed1de6d..0bba3c56b 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -228,7 +228,7 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, cemc->Verbosity(0); cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2017ProjTilted/")); + 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 From 516a6a7b0e85b3dd47d7523452faaa1c717e7d54 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Fri, 20 Jul 2018 17:30:09 -0400 Subject: [PATCH 0129/1222] switched position recal files to 9 degree tower tilt --- macros/g4simulations/G4_CEmc_Spacal.C | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 0bba3c56b..b0558a943 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -402,14 +402,15 @@ void CEMC_Clusters(int verbosity = 0) RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); - - clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, + + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, //raw location - string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration/")); + 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")); - + string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection->Verbosity(verbosity); se->registerSubsystem(clusterCorrection); From 4e98650e4fcc2cf943656d582db93d0458e03ea6 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 23 Jul 2018 18:03:08 -0400 Subject: [PATCH 0130/1222] use track reco for EIC detector --- macros/g4simulations/Fun4All_G4_EICDetector.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index bb518383c..332990b6f 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -57,7 +57,7 @@ int Fun4All_G4_EICDetector( 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_svtx_eval = do_svtx_track && false; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ bool do_pstof = false; @@ -111,7 +111,7 @@ int Fun4All_G4_EICDetector( // Other options bool do_global = true; - bool do_global_fastsim = false; + bool do_global_fastsim = true; bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; @@ -425,7 +425,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- - if (do_svtx_track) Svtx_Reco(); + if (do_svtx_track) Tracking_Reco(); //----------------- // Global Vertexing @@ -478,7 +478,7 @@ int Fun4All_G4_EICDetector( // Simulation evaluation //---------------------- - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); + if (do_svtx_eval) Fast_Tracking_Eval(string(outputFile) + "_g4svtx_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); From 3694f2decc63f146f83162a93b1cb6f3e36ddeeb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 23 Jul 2018 20:29:01 -0400 Subject: [PATCH 0131/1222] use field map from the calibration database --- macros/g4simulations/Fun4All_G4_EICDetector.C | 4 ++-- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 4 ++-- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 332990b6f..29da5e744 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -150,8 +150,8 @@ int Fun4All_G4_EICDetector( G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); 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 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) + const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = 1.4/1.5; // scale the map to a 1.4 T field //--------------- diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 67ff1d048..c13fac072 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -108,8 +108,8 @@ int Fun4All_G4_fsPHENIX( 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 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) + const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = 1.0; // already adjusted to 1.4T central field //--------------- diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 45e8fc045..1eccd58a5 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -116,8 +116,8 @@ int Fun4All_G4_sPHENIX( G4Init(do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); 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 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) + const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field //--------------- From e7b784a615698ee895d80b29bf674b4e8ba9641e Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 24 Jul 2018 14:27:07 -0400 Subject: [PATCH 0132/1222] adding / --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 2 +- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 29da5e744..94383caab 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -151,7 +151,7 @@ int Fun4All_G4_EICDetector( int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = 1.4/1.5; // scale the map to a 1.4 T field //--------------- diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index c13fac072..d3f413a84 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -109,7 +109,7 @@ int Fun4All_G4_fsPHENIX( int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = 1.0; // already adjusted to 1.4T central field //--------------- diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1eccd58a5..92f245453 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -117,7 +117,7 @@ int Fun4All_G4_sPHENIX( int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field //--------------- From 28e8fcea652404714c987ce4ed03e36cc553c1c3 Mon Sep 17 00:00:00 2001 From: Nils Feege Date: Wed, 1 Aug 2018 12:25:25 -0400 Subject: [PATCH 0133/1222] Extend CEMC coverage to match preliminary 2018 LOI numbers --- macros/g4simulations/G4_CEmc_EIC.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index af774f3ad..314ce0815 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -12,9 +12,9 @@ int max_cemc_layer = 41; double topradius = 106.8; // cm double bottomradius = 95; // cm -double negrapidity = -1.4; -double posrapidity = 1.1; -// this is default set to -1.4set_int_param("lengthviarapidity", 0); // starts centered around IP - // shift backwards 30 cm for total 340 cm length to cover -1.4set_double_param("place_z", -30); cemc->SuperDetector("ABSORBER_CEMC"); if (absorberactive) From 005d763bc59fed730cb830e9828dac89332e43f0 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 13 Aug 2018 23:11:01 -0400 Subject: [PATCH 0134/1222] Modified to run the new INTT geometry. Lines added to run the new MVTX geometry, but not used yet. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 242 +++++++++++------- 1 file changed, 153 insertions(+), 89 deletions(-) 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 index 138d410af..680e42c33 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -9,7 +9,14 @@ bool tpc_layers_40 = false; 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 + +// default setup for the INTT - configuration can be redone later if desired, but n_intt_layer has to be correctly set here! 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 +// default layer configuration +int laddertype[4] = {0, 1, 1, 1}; // default +int nladder[4] = {34, 30, 36, 42}; // default +double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default +double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; @@ -197,101 +204,158 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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]; + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + + bool new_MVTX = false; + if(new_MVTX) + { + double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 + + 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + + g4Reco->registerSubsystem(lyr); + + radius = maps_layer_radius[ilayer]; + } + } + else + { + 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; i < 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(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; + //------------------- + // 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; i < 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(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; + } + /* + // some suggested values of nladder when changing laddertype from default configuration: + // laddertype 0 in layer 2, nladder = 52 + // laddertype 1 in layer 0, nladder = 22 + //=========================================================================== + // example of optional re-configuration of INTT - make sure that n_intt_layer is set to the correct value above + //=========================================================================== + // Two outer layers, laddertype 0 then 1 + laddertype[0] = 0; laddertype[1] = 1; + nladder[0] = 52; nladder[1] = 42; + sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; + sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; + //================================================= + */ + // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); + //PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // Update the laddertype and ladder spacing configuration + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + // These are set above in the constructor for now, due to a problem with the parameter class + //sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]*10.0); // expecting mm + //sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]*10.0); + } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; } - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } - -// int verbosity = 1; - + + // int verbosity = 1; + // time projection chamber layers -------------------------------------------- - + // switch ONLY for backward compatibility with 40 layer hits files! if (tpc_layers_40) { From 270aaf9b0f4b262a525b58b40e9486af2631629b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 14 Aug 2018 10:52:11 -0400 Subject: [PATCH 0135/1222] Added check to not use Z-clustering of INTT strips only if laddertype = 1. --- ...x_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 index 680e42c33..80729e45c 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -320,10 +320,10 @@ double Svtx(PHG4Reco* g4Reco, double radius, // some suggested values of nladder when changing laddertype from default configuration: // laddertype 0 in layer 2, nladder = 52 // laddertype 1 in layer 0, nladder = 22 - //=========================================================================== - // example of optional re-configuration of INTT - make sure that n_intt_layer is set to the correct value above - //=========================================================================== - // Two outer layers, laddertype 0 then 1 + //============================================================================= + // example of optional re-configuration of INTT - make sure that "n_intt_layer" is set to the correct value above + //============================================================================= + // Two outer layers, laddertype 0 then 1 (set n_intt_layer = 2 at top of macro) laddertype[0] = 0; laddertype[1] = 1; nladder[0] = 52; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; @@ -749,10 +749,13 @@ void Svtx_Reco(int verbosity = 0) // 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) + + // 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { - clusterizer->set_z_clustering(i, false); + if(laddertype[i-n_maps_layer] == 1) + clusterizer->set_z_clustering(i, false); } se->registerSubsystem(clusterizer); From cf600b5825dfecb5a9a5f5338f747a0712d98d1d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 14 Aug 2018 13:35:34 -0400 Subject: [PATCH 0136/1222] Added modification of search windows to match laddertype in each layer. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 index 80729e45c..1e8b77bdb 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -778,6 +778,27 @@ void Svtx_Reco(int verbosity = 0) PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); kalman_pat_rec->Verbosity(0); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // strip length is along theta + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); + } + } + se->registerSubsystem(kalman_pat_rec); } else From d872f858b87b2b78343e1bd75a1f6c965da9e9d1 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 14 Aug 2018 17:27:15 -0400 Subject: [PATCH 0137/1222] Uses new INTT and MVTX geometry code --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) 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 index 1e8b77bdb..8113ead9f 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -210,46 +210,48 @@ double Svtx(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - bool new_MVTX = false; - if(new_MVTX) + //bool new_MVTX = true; + //if(new_MVTX) + //{ + double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 + + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 + 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; - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 + PHG4MapsSubsystem* lyr = new PHG4MapsSubsystem("MAPS", ilayer, stave_type[ilayer]); + lyr->Verbosity(verbosity); - 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); - - g4Reco->registerSubsystem(lyr); - - radius = maps_layer_radius[ilayer]; - } + 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml ")); + + g4Reco->registerSubsystem(lyr); + + radius = maps_layer_radius[ilayer]; } - else + //} + /* + else { 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 @@ -290,6 +292,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = maps_layer_radius[ilayer]; } } + */ } if (n_intt_layer > 0) From b2ef0fca528cdfc70714afb6458e6c3f05a36b67 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 14 Aug 2018 17:30:09 -0400 Subject: [PATCH 0138/1222] Switched back to Darren's private gdml file for now. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 51 +------------------ 1 file changed, 2 insertions(+), 49 deletions(-) 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 index 8113ead9f..216e9c0a2 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -210,9 +210,6 @@ double Svtx(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - //bool new_MVTX = true; - //if(new_MVTX) - //{ double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code @@ -242,57 +239,13 @@ double Svtx(PHG4Reco* g4Reco, double radius, lyr->set_int_param("active", 1); lyr->OverlapCheck(maps_overlapcheck); - //lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); - lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml ")); + lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + //lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml ")); g4Reco->registerSubsystem(lyr); radius = maps_layer_radius[ilayer]; } - //} - /* - else - { - 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) From ddd78794287bf203cad1a71507f8a9759f8e586c Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 14 Aug 2018 17:34:44 -0400 Subject: [PATCH 0139/1222] Final fix from Jin to get reading of gdml file from DB to work. --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 216e9c0a2..29ef1a982 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -239,8 +239,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, lyr->set_int_param("active", 1); lyr->OverlapCheck(maps_overlapcheck); - lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); - //lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml ")); + //lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); g4Reco->registerSubsystem(lyr); From 0bf85d635e2aab7e282747a4c955f616a150ac76 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 15 Aug 2018 15:00:18 -0400 Subject: [PATCH 0140/1222] Increased MVTX timing window to +/- 5 microseconds. Added the 5 alternative INTT layer configurations that we discussed at the task force meeting, commented out, at the start of the macro. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 67 ++++++++++++++----- 1 file changed, 50 insertions(+), 17 deletions(-) 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 index 29ef1a982..ea4746756 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -10,14 +10,60 @@ 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 -// default setup for the INTT - configuration can be redone later if desired, but n_intt_layer has to be correctly set here! -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 +// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired +int n_intt_layer = 4; // default layer configuration int laddertype[4] = {0, 1, 1, 1}; // default int nladder[4] = {34, 30, 36, 42}; // default double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default +// Optionally reconfigure the INTT +//======================================================================== +// example re-configurations of INTT - uncomment one to get the reconfiguration +// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers +//======================================================================== +/* +// Four layers, laddertypes 1-1-0-1 +n_intt_layer = 4; +laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 0; laddertype[3] = 1; +nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; +sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; +sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-0-1 +n_intt_layer = 3; +laddertype[0] = 1; laddertype[1] = 0; laddertype[2] = 1; +nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-1-1 +n_intt_layer = 3; +laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 1; +nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Two outer layers, laddertype 0-1 +n_intt_layer = 2; +laddertype[0] = 0; laddertype[1] = 1; +nladder[0] = 52; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ +/* +// Two outer layers, laddertype 1-1 +n_intt_layer = 2; +laddertype[0] = 1; laddertype[1] = 1; +nladder[0] = 36; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ + int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; int tpc_layer_rphi_count_inner = 1152; @@ -272,20 +318,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, vpair.push_back(std::make_pair(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; } - /* - // some suggested values of nladder when changing laddertype from default configuration: - // laddertype 0 in layer 2, nladder = 52 - // laddertype 1 in layer 0, nladder = 22 - //============================================================================= - // example of optional re-configuration of INTT - make sure that "n_intt_layer" is set to the correct value above - //============================================================================= - // Two outer layers, laddertype 0 then 1 (set n_intt_layer = 2 at top of macro) - laddertype[0] = 0; laddertype[1] = 1; - nladder[0] = 52; nladder[1] = 42; - sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; - sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; - //================================================= - */ + // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); //PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); @@ -489,7 +522,7 @@ void Svtx_Cells(int verbosity = 0) maps_cells->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - maps_cells->set_timing_window(ilayer, -2000, 2000); + maps_cells->set_timing_window(ilayer, -5000, 5000); } se->registerSubsystem(maps_cells); } From 51bac0a5f3869b59f7657f73f9180d14a0f97cc4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Aug 2018 10:14:01 -0400 Subject: [PATCH 0141/1222] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f0a996aed..025ccc932 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ The default sPHENIX simulation + reconstruction macro is [Fun4All_G4_sPHENIX.C]( Then let's see what is implemented by firing up one event: ``` [jinhuang@rcas2072 macros]$ 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 macros]$ 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 @@ -39,6 +40,7 @@ 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: From 0fad2116f79ebdea12f194a8f4c9d7d74f146408 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Aug 2018 15:48:59 -0400 Subject: [PATCH 0142/1222] use deadmap for INTT --- ...x_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 index ea4746756..27e5ee933 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -655,6 +655,19 @@ void Svtx_Reco(int verbosity = 0) if (n_intt_layer > 0) { // INTT + + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); + for (int i = 0; i < n_intt_layer; i++) + { + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", laddertype[i], i); + string DeadMapPath = + string(getenv("CALIBRATIONROOT")) + + string("/Tracking/INTT/DeadMap_4Percent/") + DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + } + se->registerSubsystem(deadMapINTT); + 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); @@ -673,6 +686,8 @@ void Svtx_Reco(int verbosity = 0) digiintt->set_adc_scale(n_maps_layer + i, userrange); } se->registerSubsystem(digiintt); + + digiintt->Verbosity(1); } // TPC layers use the Svtx digitizer From 0e8ac6b631a4a445e7670e303503be7555a1567a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 23 Aug 2018 11:51:21 -0400 Subject: [PATCH 0143/1222] Remove the old deammap module --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) 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 index 27e5ee933..5aaeaac1b 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -661,9 +661,9 @@ void Svtx_Reco(int verbosity = 0) for (int i = 0; i < n_intt_layer; i++) { string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", laddertype[i], i); - string DeadMapPath = - string(getenv("CALIBRATIONROOT")) + - string("/Tracking/INTT/DeadMap_4Percent/") + DeadMapConfigName; + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. +// string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); } se->registerSubsystem(deadMapINTT); @@ -703,23 +703,24 @@ void Svtx_Reco(int verbosity = 0) //------------------------------------- // Apply Live Area Inefficiency to Hits + // This is obsolete, please use PHG4SvtxDeadMapLoader instead for pre-defined deadmap //------------------------------------- // defaults to 1.0 (fully active) - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - - for (int i = 0; i < n_maps_layer; i++) - { - deadarea->Verbosity(verbosity); - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i, 1.0); - } - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i, 1.0); - } - se->registerSubsystem(deadarea); +// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); +// +// for (int i = 0; i < n_maps_layer; i++) +// { +// deadarea->Verbosity(verbosity); +// //deadarea->set_hit_efficiency(i,0.99); +// deadarea->set_hit_efficiency(i, 1.0); +// } +// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) +// { +// //deadarea->set_hit_efficiency(i,0.99); +// deadarea->set_hit_efficiency(i, 1.0); +// } +// se->registerSubsystem(deadarea); //----------------------------- // Apply MIP thresholds to Hits From 1ee3eee18f0159ff25e6f64fe42bc02ad12cdfbf Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 23 Aug 2018 12:21:08 -0400 Subject: [PATCH 0144/1222] Disable verbosity --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 5aaeaac1b..87d8e2249 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -687,7 +687,7 @@ void Svtx_Reco(int verbosity = 0) } se->registerSubsystem(digiintt); - digiintt->Verbosity(1); +// digiintt->Verbosity(1); } // TPC layers use the Svtx digitizer From fd4c24ee02981434a191c99d84c1bab406e9c34a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 25 Aug 2018 15:51:04 -0400 Subject: [PATCH 0145/1222] sync to current tracker settings --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 332 +++++++++++------- 1 file changed, 204 insertions(+), 128 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 5a6a5dfe1..8ee2ca46e 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -9,10 +9,63 @@ bool tpc_layers_40 = false; 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 = 0; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers + +// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired +int n_intt_layer = 0; +// default layer configuration +int laddertype[4] = {0, 1, 1, 1}; // default +int nladder[4] = {34, 30, 36, 42}; // default +double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default +double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default + +// Optionally reconfigure the INTT +//======================================================================== +// example re-configurations of INTT - uncomment one to get the reconfiguration +// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers +//======================================================================== +/* +// Four layers, laddertypes 1-1-0-1 +n_intt_layer = 4; +laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 0; laddertype[3] = 1; +nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; +sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; +sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-0-1 +n_intt_layer = 3; +laddertype[0] = 1; laddertype[1] = 0; laddertype[2] = 1; +nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-1-1 +n_intt_layer = 3; +laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 1; +nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Two outer layers, laddertype 0-1 +n_intt_layer = 2; +laddertype[0] = 0; laddertype[1] = 1; +nladder[0] = 52; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ +/* +// Two outer layers, laddertype 1-1 +n_intt_layer = 2; +laddertype[0] = 1; laddertype[1] = 1; +nladder[0] = 36; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25 / 2.0; +double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. int tpc_layer_rphi_count_inner = 1152; int n_tpc_layer_mid = 16; @@ -182,18 +235,14 @@ void SvtxInit(int verbosity = 0) // TPC readout shaping time and ADC clock parameters // these set the Z size of the TPC cells //======================================= - // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA - TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - // TKH does not understand the physical origin of these parameters. - // however, their impact seems quite small... - // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here - TPC_SmearRPhi = 0.215; - TPC_SmearZ = 0.20; + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time + TPC_SmearRPhi = 0.25; + TPC_SmearZ = 0.15; } double Svtx(PHG4Reco* g4Reco, double radius, @@ -201,101 +250,101 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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]; + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + + double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 + + 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.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; i < 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(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; + //------------------- + // 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; i < 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(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; + } + + // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); + //PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // Update the laddertype and ladder spacing configuration + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + // These are set above in the constructor for now, due to a problem with the parameter class + //sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]*10.0); // expecting mm + //sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]*10.0); + } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; } - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } - -// int verbosity = 1; - + + // int verbosity = 1; + // time projection chamber layers -------------------------------------------- - + // switch ONLY for backward compatibility with 40 layer hits files! if (tpc_layers_40) { @@ -326,25 +375,25 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius += cage_thickness; - double inner_readout_radius = 30.; - if (inner_readout_radius < radius) inner_readout_radius = radius; - + double inner_readout_radius = radius; +// if (inner_readout_radius < radius) inner_readout_radius = radius; +// string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - - // Layer of inert TPC gas from 20-30 cm - if (inner_readout_radius - 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; +// +// // Layer of inert TPC gas from 20-30 cm +// if (inner_readout_radius - 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.; @@ -473,7 +522,7 @@ void Svtx_Cells(int verbosity = 0) maps_cells->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - maps_cells->set_timing_window(ilayer, -2000, 2000); + maps_cells->set_timing_window(ilayer, -5000, 5000); } se->registerSubsystem(maps_cells); } @@ -626,13 +675,17 @@ void Svtx_Reco(int verbosity = 0) se->registerSubsystem(digiintt); } - // TPC layers - for (int i = n_maps_layer + n_intt_layer; i < Max_si_layer; ++i) - { - digi->set_adc_scale(i, 90000, 1.0); // need to set this based on ADC dynamic range - } + // TPC layers use the Svtx digitizer + digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); + double ENC = 670.0; // standard + digi->SetENC(ENC); + double ADC_threshold = 4.0*ENC; + digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; + se->registerSubsystem(digi); - + //------------------------------------- // Apply Live Area Inefficiency to Hits //------------------------------------- @@ -685,10 +738,13 @@ void Svtx_Reco(int verbosity = 0) // 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) + + // 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { - clusterizer->set_z_clustering(i, false); + if(laddertype[i-n_maps_layer] == 1) + clusterizer->set_z_clustering(i, false); } se->registerSubsystem(clusterizer); @@ -699,7 +755,6 @@ void Svtx_Reco(int verbosity = 0) tpcclusterizer->setEnergyCut(15 /*adc*/); tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); - tpcclusterizer->setFitEnergyThreshold(0.05 /*fraction*/); se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! @@ -712,6 +767,27 @@ void Svtx_Reco(int verbosity = 0) PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); kalman_pat_rec->Verbosity(0); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // strip length is along theta + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); + } + } + se->registerSubsystem(kalman_pat_rec); } else From e4125078e266ac518595fcc49f5510115ed14f40 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Aug 2018 17:23:45 -0400 Subject: [PATCH 0146/1222] fix macro to run with new intt setup --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 index ea4746756..5bf748157 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -13,7 +13,10 @@ const int n_maps_layer = 3; // must be 0-3, setting it to zero removes MVTX com // default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired int n_intt_layer = 4; // default layer configuration -int laddertype[4] = {0, 1, 1, 1}; // default +int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default int nladder[4] = {34, 30, 36, 42}; // default double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default @@ -319,9 +322,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, if (verbosity) cout << "Create strip tracker layer " << vpair[i].second << " as sphenix layer " << vpair[i].first << endl; } - // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); - //PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); sitrack->Verbosity(verbosity); sitrack->SetActive(1); sitrack->OverlapCheck(intt_overlapcheck); From a43089f6d5d9abda338709b59ebbfcb9fbf332e5 Mon Sep 17 00:00:00 2001 From: Sanghoon Lim Date: Wed, 29 Aug 2018 17:11:24 -0400 Subject: [PATCH 0147/1222] fix to use the enum to set cluster finding window in INTT --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 5bf748157..bd71d5ee8 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -771,7 +771,7 @@ void Svtx_Reco(int verbosity = 0) for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); From 4e2451f64ae024b3240c0a9ea397eefca79bba84 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 5 Sep 2018 15:02:40 -0400 Subject: [PATCH 0148/1222] Update to Evaluator declaration to properly set the number of layers for each sybsystem, and update to replace laddertype of 0 and 1 with SEGMENTATION_Z and SEGMENTATION_PHI. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) 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 index bd71d5ee8..bf641d462 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -29,7 +29,8 @@ double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer stagge /* // Four layers, laddertypes 1-1-0-1 n_intt_layer = 4; -laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 0; laddertype[3] = 1; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; @@ -37,7 +38,8 @@ sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_ou /* // Three outer layers, laddertypes 1-0-1 n_intt_layer = 3; -laddertype[0] = 1; laddertype[1] = 0; laddertype[2] = 1; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; @@ -45,7 +47,8 @@ sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radiu /* // Three outer layers, laddertypes 1-1-1 n_intt_layer = 3; -laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 1; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; @@ -53,19 +56,19 @@ sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radiu /* // Two outer layers, laddertype 0-1 n_intt_layer = 2; -laddertype[0] = 0; laddertype[1] = 1; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 52; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; */ -/* + // Two outer layers, laddertype 1-1 n_intt_layer = 2; -laddertype[0] = 1; laddertype[1] = 1; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 36; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; -*/ + int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; @@ -333,9 +336,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, { sitrack->set_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); - // These are set above in the constructor for now, due to a problem with the parameter class - //sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]*10.0); // expecting mm - //sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]*10.0); + sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]); // expecting cm + sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]); } // outer radius marker (translation back to cm) @@ -861,7 +863,8 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + //eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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... From 46a2c985656836d0994d0891797d863783442893 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 5 Sep 2018 15:08:46 -0400 Subject: [PATCH 0149/1222] Updated primary vertex version of evaluator also. --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index bf641d462..451360fe6 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -61,14 +61,14 @@ nladder[0] = 52; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; */ - +/* // Two outer layers, laddertype 1-1 n_intt_layer = 2; laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; nladder[0] = 36; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; - +*/ int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25 / 2.0; @@ -878,7 +878,7 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) // 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 = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); From df9520a920baf02bb7373f4e93339294ea9636a7 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 7 Sep 2018 14:57:44 -0400 Subject: [PATCH 0150/1222] Switch to "tracking" from Svtx. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 34 +++++++++++------------ macros/g4simulations/G4Setup_sPHENIX.C | 14 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 45e8fc045..daa5b2156 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -53,28 +53,28 @@ int Fun4All_G4_sPHENIX( 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_tracking = true; + bool do_tracking_cell = do_tracking && true; + bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_eval = do_tracking_track && true; bool do_pstof = false; - bool do_cemc = true; + bool do_cemc = false; 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 = false; 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_magnet = false; - bool do_hcalout = true; + bool do_hcalout = false; bool do_hcalout_cell = do_hcalout && true; bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; @@ -88,7 +88,7 @@ int Fun4All_G4_sPHENIX( bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - bool do_jet_reco = true; + bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -113,7 +113,7 @@ int Fun4All_G4_sPHENIX( // 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, do_plugdoor); + G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); 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) @@ -192,7 +192,7 @@ int Fun4All_G4_sPHENIX( { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 2); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { @@ -297,7 +297,7 @@ int Fun4All_G4_sPHENIX( //--------------------- G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); } //--------- @@ -314,7 +314,7 @@ int Fun4All_G4_sPHENIX( // Detector Division //------------------ - if (do_svtx_cell) Svtx_Cells(); + if (do_tracking_cell) Tracking_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -345,7 +345,7 @@ int Fun4All_G4_sPHENIX( // SVTX tracking //-------------- - if (do_svtx_track) Svtx_Reco(); + if (do_tracking_track) Tracking_Reco(); //----------------- // Global Vertexing @@ -393,7 +393,7 @@ int Fun4All_G4_sPHENIX( // Simulation evaluation //---------------------- - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); + if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4svtx_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); @@ -477,7 +477,7 @@ int Fun4All_G4_sPHENIX( double time_window_minus = -35000; double time_window_plus = 35000; - if (do_svtx) + if (do_tracking) { // double TPCDriftVelocity = 6.0 / 1000.0; // cm/ns, which is loaded from G4_SVTX*.C macros time_window_minus = -105.5 / TPCDriftVelocity; // ns @@ -495,7 +495,7 @@ int Fun4All_G4_sPHENIX( G4DSTreader(outputFile, // /*int*/ absorberactive, - /*bool*/ do_svtx, + /*bool*/ do_tracking, /*bool*/ do_pstof, /*bool*/ do_cemc, /*bool*/ do_hcalin, diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 32515b2a5..b997b621c 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -2,7 +2,7 @@ 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(const bool do_svtx = true, +void G4Init(const bool do_tracking = true, const bool do_pstof = true, const bool do_cemc = true, const bool do_hcalin = true, @@ -20,10 +20,10 @@ void G4Init(const bool do_svtx = true, gROOT->LoadMacro("G4_Pipe.C"); PipeInit(); } - if (do_svtx) + if (do_tracking) { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(); + gROOT->LoadMacro("G4_Tracking.C"); + TrackingInit(); } if (do_pstof) @@ -66,7 +66,7 @@ void G4Init(const bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, + const bool do_tracking = true, const bool do_pstof = true, const bool do_cemc = true, const bool do_hcalin = true, @@ -125,8 +125,8 @@ int G4Setup(const int absorberactive = 0, if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); + // TRACKING + if (do_tracking) radius = Tracking(g4Reco, radius, absorberactive); //---------------------------------------- // PSTOF From 9c7f2bdf34302cb5295652315ba27777df988632 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 7 Sep 2018 15:03:56 -0400 Subject: [PATCH 0151/1222] Renamed tracking macro. --- macros/g4simulations/G4_Tracking.C | 629 +++++++++++++++++++++++++++++ 1 file changed, 629 insertions(+) create mode 100644 macros/g4simulations/G4_Tracking.C diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C new file mode 100644 index 000000000..a5f0d5e44 --- /dev/null +++ b/macros/g4simulations/G4_Tracking.C @@ -0,0 +1,629 @@ +#include + +// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +bool tpc_layers_40 = false; + +// 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_tpc_layer_inner = 16; +double tpc_layer_thick_inner = 1.25 / 2.0; +int tpc_layer_rphi_count_inner = 1152; + +int n_tpc_layer_mid = 16; +double tpc_layer_thick_mid = 1.25; +int tpc_layer_rphi_count_mid = 1536; + +int n_tpc_layer_outer = 16; +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm +int tpc_layer_rphi_count_outer = 2304; + +int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + +//double inner_cage_radius = 20.; +//double inner_readout_radius = 30.; + +/* +// TPC gas parameters +//============================================== + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm +double iBut_dEdx = 5.93; // keV/cm + +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm +double iBut_NPrimary = 84; // Number/cm + +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm +double iBut_NTotal = 195; // Number/cm +*/ + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): +double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... +double TPCDriftVelocity; +double TPC_Trans_Diffusion; +double TPC_Long_Diffusion; +double TPC_dEdx; +double TPC_NPri; +double TPC_NTot; +double TPC_ElectronsPerKeV; + +// TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... +//======================================= +double TPCADCClock; +double TPCShapingRMSLead; +double TPCShapingRMSTail; +double tpc_cell_z; +double TPC_SmearRPhi; +double TPC_SmearZ; + +int Max_si_layer; + +void TrackingInit(int verbosity = 0) +{ + Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; + + /* + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + + TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA + TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // TKH does not understand the physical origin of these parameters. + // however, their impact seems quite small... + // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here + TPC_SmearRPhi = 0.215; + TPC_SmearZ = 0.20; + */ +} + +double Tracking(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + // create the three tracker subsystems + + // MVTX + //======= + 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 + + // 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]; + } + } + + // INTT + //===== + 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; i < 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(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; + } + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } + + // The TPC - always present! + //================================ + gSystem->Load("libg4tpc.so"); + + PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("TPC"); + tpc->set_double_param("steplimits", 1); + // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 + + if (absorberactive) + { + tpc->SetAbsorberActive(); + } + tpc->OverlapCheck(overlapcheck); + + g4Reco->registerSubsystem( tpc ); + + radius = 77.+1.17; + + + radius += no_overlapp; + + return radius; +} + +void Tracking_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"); + gSystem->Load("libg4tpc.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //----------- + // SVTX cells + //----------- + + if (verbosity) + { + cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; + cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; + cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; + cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; + cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; + cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; + cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; + cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; + cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; + cout << " TPC z cell " << tpc_cell_z << " cm" << endl; + cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; + cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + } + + // MVTX 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); + } + + // INTT 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); + } + + // Set up TPC distortion calculation + //======================== + 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 + } + + // TPC cells + //======== + // Move this to new code + /* + PHG4CylinderCellTPCReco* svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer + n_intt_layer); + svtx_cells->Detector("SVTX"); + svtx_cells->setDistortion(tpc_distortion); + //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). + svtx_cells->setDiffusionT(TPC_Trans_Diffusion); + svtx_cells->setDiffusionL(TPC_Long_Diffusion); + svtx_cells->setSigmaT(TPC_SigmaT); + 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 + // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers + svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits + svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits + svtx_cells->set_drift_velocity(TPCDriftVelocity); + svtx_cells->setHalfLength(105.5); + svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); + svtx_cells->Verbosity(0); + */ + + // Set TPC gas transport parameters for primary ionization + //======================================== + + // These default to NeCF4-400 as follows: + //set_default_double_param("diffusion_long",0.015); // cm/SQRT(cm) + //set_default_double_param("diffusion_trans",0.006); // cm/SQRT(cm) + //set_default_double_param("drift_velocity",8.0 / 1000.0); // cm/ns + //set_default_double_param("electrons_per_gev",TPC_ElectronsPerKeV*1000000.); + //set_default_double_param("min_active_radius",30.); // cm + //set_default_double_param("max_active_radius",75.); // cm + //set_default_double_param("min_time",0.); // ns + //set_default_double_param("max_time",14000.); // ns + + // setup TPC readout for filling cells + //======================== + + //Fun4AllServer *se = Fun4AllServer::instance(); + PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); + edrift->Detector("TPC"); + PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); + edrift->registerPadPlane(padplane); + se->registerSubsystem(edrift); + + // We may want to reconfigure the inner layers, use the defaults for the mid and outer readout layers + + padplane->set_int_param("ntpc_layers_inner",16); + padplane->set_int_param("ntpc_minlayer_inner",7); + padplane->set_int_param("ntpc_phibins_inner",1152); + //set_int_param("ntpc_layers_mid",16); + //set_int_param("ntpc_phibins_mid",1536); + //set_int_param("ntpc_layers_outer",16); + //set_int_param("ntpc_phibins_outer",2304); + + return; +} + +void Tracking_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; i < n_maps_layer; ++i) + { + digi->set_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; i < n_intt_layer; i++) + { + digiintt->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + } + + // TPC layers use the Svtx digitizer + digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); + double ENC = 670.0; // standard + digi->SetENC(ENC); + double ADC_threshold = 4.0*ENC; + digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; + + se->registerSubsystem(digi); + + //------------------------------------- + // Apply Live Area Inefficiency to Hits + //------------------------------------- + // defaults to 1.0 (fully active) + + PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); + + for (int i = 0; i < n_maps_layer; i++) + { + deadarea->Verbosity(verbosity); + //deadarea->set_hit_efficiency(i,0.99); + deadarea->set_hit_efficiency(i, 1.0); + } + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + //deadarea->set_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; i < n_maps_layer; i++) + { + // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness + // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss + thresholds->set_threshold(i, 0.1); + } + // INTT + for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + thresholds->set_threshold(i, 0.1); + thresholds->set_use_thickness_mip(i, true); + } + + se->registerSubsystem(thresholds); + + //------------- + // Cluster Hits + //------------- + + // For the silicon layers + 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; i < n_maps_layer + n_intt_layer; i++) + { + clusterizer->set_z_clustering(i, false); + } + + se->registerSubsystem(clusterizer); + + // For the TPC + + PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); + tpcclusterizer->Verbosity(0); + tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); + tpcclusterizer->setEnergyCut(15 /*adc*/); + tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes + tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); + 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 + //------------------ + PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); + 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 Tracking_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(); + + //---------------- + // Tracking evaluation + //---------------- + + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + 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(false); + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(0); + 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; +} From 1bfe05277181e5c6fbd2f1f1253d9285fdf8362b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 7 Sep 2018 22:24:52 -0400 Subject: [PATCH 0152/1222] Fixed Z clustering setup for INTT. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 +- macros/g4simulations/G4_Tracking.C | 354 ++++++++++++---------- 2 files changed, 189 insertions(+), 171 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index ab7252187..c30a9fa16 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 1, + const int nEvents = 10, 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") @@ -192,8 +192,8 @@ int Fun4All_G4_sPHENIX( { // 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 + //gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index a5f0d5e44..d5631bc42 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -9,44 +9,72 @@ bool tpc_layers_40 = false; 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 + +// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired +int n_intt_layer = 4; +int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default +int nladder[4] = {34, 30, 36, 42}; // default - note these have to be changed if laddertype changes for the layer +double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default +double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default + +// Optionally reconfigure the INTT +//======================================================================== +// example re-configurations of INTT - uncomment one to get the reconfiguration +// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers +//======================================================================== +/* +// Four layers, laddertypes 1-1-0-1 +n_intt_layer = 4; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; +sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; +sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-0-1 +n_intt_layer = 3; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Three outer layers, laddertypes 1-1-1 +n_intt_layer = 3; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +*/ +/* +// Two outer layers, laddertype 0-1 +n_intt_layer = 2; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 52; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ +/* +// Two outer layers, laddertype 1-1 +n_intt_layer = 2; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 36; nladder[1] = 42; +sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; +sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +*/ int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25 / 2.0; int tpc_layer_rphi_count_inner = 1152; - int n_tpc_layer_mid = 16; -double tpc_layer_thick_mid = 1.25; -int tpc_layer_rphi_count_mid = 1536; - int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm -int tpc_layer_rphi_count_outer = 2304; - int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; -//double inner_cage_radius = 20.; -//double inner_readout_radius = 30.; - -/* -// TPC gas parameters -//============================================== - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm -double iBut_dEdx = 5.93; // keV/cm - -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm -double iBut_NPrimary = 84; // Number/cm - -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm -double iBut_NTotal = 195; // Number/cm -*/ - // TPC Performance Parameter (applies extra smear to mimic the avalanche): double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... @@ -112,104 +140,98 @@ double Tracking(PHG4Reco* g4Reco, double radius, { // create the three tracker subsystems - // MVTX - //======= 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 - - // 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]; + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + + double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 + + 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + + g4Reco->registerSubsystem(lyr); + + radius = maps_layer_radius[ilayer]; + } } - } - // INTT - //===== 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; i < 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(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; + //------------------- + // 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; i < 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(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; + } + + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); + + // Update the laddertype and ladder spacing configuration + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]); // expecting cm + sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]); + } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; } - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } // The TPC - always present! //================================ + gSystem->Load("libg4tpc.so"); PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); @@ -307,16 +329,6 @@ void Tracking_Cells(int verbosity = 0) 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"); @@ -326,33 +338,8 @@ void Tracking_Cells(int verbosity = 0) //tpc_distortion -> setPrecision(0.001); // option to over write default factors // default is 0.001 } - // TPC cells - //======== - // Move this to new code - /* - PHG4CylinderCellTPCReco* svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer + n_intt_layer); - svtx_cells->Detector("SVTX"); - svtx_cells->setDistortion(tpc_distortion); - //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - 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 - // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers - svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits - svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits - svtx_cells->set_drift_velocity(TPCDriftVelocity); - svtx_cells->setHalfLength(105.5); - svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); - svtx_cells->Verbosity(0); - */ - // Set TPC gas transport parameters for primary ionization //======================================== - // These default to NeCF4-400 as follows: //set_default_double_param("diffusion_long",0.015); // cm/SQRT(cm) //set_default_double_param("diffusion_trans",0.006); // cm/SQRT(cm) @@ -364,24 +351,21 @@ void Tracking_Cells(int verbosity = 0) //set_default_double_param("max_time",14000.); // ns // setup TPC readout for filling cells - //======================== + // g4tpc/PHG4TPCElectronDrift uses + // g4tpc/PHG4TPCPadPlaneReadout + //========================= - //Fun4AllServer *se = Fun4AllServer::instance(); PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); edrift->Detector("TPC"); PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); - // We may want to reconfigure the inner layers, use the defaults for the mid and outer readout layers - - padplane->set_int_param("ntpc_layers_inner",16); - padplane->set_int_param("ntpc_minlayer_inner",7); - padplane->set_int_param("ntpc_phibins_inner",1152); - //set_int_param("ntpc_layers_mid",16); - //set_int_param("ntpc_phibins_mid",1536); - //set_int_param("ntpc_layers_outer",16); - //set_int_param("ntpc_phibins_outer",2304); + // The pad plane readout default is set in PHG4TPCPadPlaneReadout + // We may want to change the number of inner layers here + padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); + padplane->set_int_param("ntpc_minlayer_inner",n_maps_layer+n_intt_layer); + padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); return; } @@ -498,11 +482,23 @@ void Tracking_Reco(int verbosity = 0) // 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 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + if(laddertype[i-n_maps_layer] == PHG4SiliconTrackerDefs::SEGMENTATION_PHI) + clusterizer->set_z_clustering(i, false); + } + + + /* // no Z clustering for INTT layers (only) for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { clusterizer->set_z_clustering(i, false); } + */ se->registerSubsystem(clusterizer); @@ -526,6 +522,27 @@ void Tracking_Reco(int verbosity = 0) PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); kalman_pat_rec->Verbosity(0); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // strip length is along theta + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); + } + } + se->registerSubsystem(kalman_pat_rec); } else @@ -598,7 +615,8 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + //eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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... @@ -612,8 +630,8 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // 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 = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap"); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From 75b3961dde53621cda1643a166bd32dea7f9e19e Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 19 Sep 2018 14:25:48 -0400 Subject: [PATCH 0153/1222] Changes to match new INTT (up to) 8 layer configuration code. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 31 +++++-- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 83 ++++++++----------- macros/g4simulations/vis.mac | 7 +- 3 files changed, 61 insertions(+), 60 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 92f245453..00249873f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 1, + const int nEvents = 10, 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") @@ -60,21 +60,21 @@ int Fun4All_G4_sPHENIX( bool do_pstof = false; - bool do_cemc = true; + bool do_cemc = false; 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 = false; 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_magnet = false; - bool do_hcalout = true; + bool do_hcalout = false; bool do_hcalout_cell = do_hcalout && true; bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; @@ -88,7 +88,7 @@ int Fun4All_G4_sPHENIX( bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - bool do_jet_reco = true; + bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -124,6 +124,12 @@ int Fun4All_G4_sPHENIX( // Fun4All server //--------------- + bool display_on = false; + if(display_on) + { + gROOT->LoadMacro("DisplayOn.C"); + } + Fun4AllServer *se = Fun4AllServer::instance(); se->Verbosity(0); // just if we set some flags somewhere in this macro @@ -192,8 +198,8 @@ int Fun4All_G4_sPHENIX( { // 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 + //gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); @@ -526,12 +532,21 @@ int Fun4All_G4_sPHENIX( return; } + if(display_on) + { + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cin >> i; + } + se->run(nEvents); //----- // Exit //----- + se->End(); std::cout << "All done" << std::endl; delete se; 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 index 451360fe6..3a045286a 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -11,63 +11,48 @@ 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 // default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired -int n_intt_layer = 4; +int n_intt_layer = 8; // default layer configuration -int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, +int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default -int nladder[4] = {34, 30, 36, 42}; // default -double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default -double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default +int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default +double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default +// offsetphi is in deg +double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; // Optionally reconfigure the INTT //======================================================================== -// example re-configurations of INTT - uncomment one to get the reconfiguration -// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers +// example re-configuration of INTT - uncomment to get the reconfiguration +// n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers //======================================================================== -/* -// Four layers, laddertypes 1-1-0-1 + +// Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; -sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; -sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; -*/ -/* -// Three outer layers, laddertypes 1-0-1 -n_intt_layer = 3; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; -*/ -/* -// Three outer layers, laddertypes 1-1-1 -n_intt_layer = 3; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; -*/ -/* -// Two outer layers, laddertype 0-1 -n_intt_layer = 2; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 52; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; -*/ +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +nladder[0] = 17; nladder[1] = 19; +sensor_radius[0] = 6.876; sensor_radius[1] = 7.65; +offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; +// +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[2] = 18; nladder[3] = 20; +sensor_radius[2] = 10.835; sensor_radius[3] = 12.10; +offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; + /* -// Two outer layers, laddertype 1-1 -n_intt_layer = 2; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 36; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +// single layer for testing +n_intt_layer = 1; +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 15; +sensor_radius[0] = 8.987; +offsetphi[0] = 12.0; */ int n_tpc_layer_inner = 16; @@ -336,8 +321,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, { sitrack->set_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]); // expecting cm - sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } // outer radius marker (translation back to cm) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 539d58b5d..87415a626 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -29,11 +29,12 @@ /vis/open OGLSX 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 +/vis/viewer/set/viewpointThetaPhi 0 0 +/vis/viewer/addCutawayPlane 0 0 0 m 0 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/zoom 30 +/vis/viewer/panTo 4 0 cm # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. From 6a4c23b5bdc5ef85202635681b187dcb89f3c2a8 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 19 Sep 2018 23:43:05 -0400 Subject: [PATCH 0154/1222] Tidied up tracking macro, reduced eta thrown to +/- 0.8. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++-- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 00249873f..11130592a 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 10, + 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") @@ -215,7 +215,7 @@ int Fun4All_G4_sPHENIX( } 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_eta_range(-0.8, 0.8); 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); 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 index 3a045286a..cfadd1130 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -23,7 +23,7 @@ int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -// offsetphi is in deg +// offsetphi is in deg, every other layer offset by one half of the phi spacing between ladders double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; // Optionally reconfigure the INTT @@ -31,7 +31,7 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde // example re-configuration of INTT - uncomment to get the reconfiguration // n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers //======================================================================== - +/* // Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; // @@ -44,7 +44,7 @@ laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG nladder[2] = 18; nladder[3] = 20; sensor_radius[2] = 10.835; sensor_radius[3] = 12.10; offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; - +*/ /* // single layer for testing n_intt_layer = 1; From a61cc7b2d17dc490a83917cdfc1b49bf3125be63 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 21 Sep 2018 14:12:32 -0400 Subject: [PATCH 0155/1222] Returned eta range to +/- 1.0. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +++-- ...4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 10 +++++----- macros/g4simulations/vis.mac | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 11130592a..07dff2744 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 1, + const int nEvents = 10, 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") @@ -215,7 +215,7 @@ int Fun4All_G4_sPHENIX( } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-0.8, 0.8); + 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); @@ -537,6 +537,7 @@ int Fun4All_G4_sPHENIX( DisplayOn(); // prevent macro from finishing so can see display int i; + cout << "***** Enter any integer to proceed" << endl; cin >> i; } 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 index cfadd1130..851f960b4 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -23,7 +23,7 @@ int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -// offsetphi is in deg, every other layer offset by one half of the phi spacing between ladders +// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; // Optionally reconfigure the INTT @@ -36,13 +36,13 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde n_intt_layer = 4; // laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -nladder[0] = 17; nladder[1] = 19; -sensor_radius[0] = 6.876; sensor_radius[1] = 7.65; +nladder[0] = 17; nladder[1] = 17; +sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; // laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 18; nladder[3] = 20; -sensor_radius[2] = 10.835; sensor_radius[3] = 12.10; +nladder[2] = 18; nladder[3] = 18; +sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; */ /* diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 87415a626..b228a9397 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -33,8 +33,8 @@ /vis/viewer/addCutawayPlane 0 0 0 m 0 0 0 # our world is 4x4 meters, the detector is about 1m across # zooming by 4 makes it fill the display -/vis/viewer/zoom 30 -/vis/viewer/panTo 4 0 cm +/vis/viewer/zoom 20 +/vis/viewer/panTo 8 0 cm # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. From 095f6a73afb2b6bf15d23cf67c8d39524bbcfb3d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 21 Sep 2018 14:46:18 -0400 Subject: [PATCH 0156/1222] Restored all sybsystem flags in Fun4All_G4_sPHENIX.C. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 07dff2744..d7e15ddac 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 10, + 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") @@ -60,21 +60,21 @@ int Fun4All_G4_sPHENIX( bool do_pstof = false; - bool do_cemc = 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 = 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 && true; - bool do_magnet = false; + bool do_magnet = true; - bool do_hcalout = false; + 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; @@ -88,7 +88,7 @@ int Fun4All_G4_sPHENIX( bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - bool do_jet_reco = false; + bool do_jet_reco = true; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -198,8 +198,8 @@ int Fun4All_G4_sPHENIX( { // 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 + gen->add_particles("pi-", 2); // mu+,e+,proton,pi+,Upsilon + //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); From 1770413fcd9b83954d2bb3435cc5d3446bc03a2b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 21 Sep 2018 15:16:55 -0400 Subject: [PATCH 0157/1222] Added one more reconfiguration example. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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 index 851f960b4..33f408dcc 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -28,9 +28,10 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde // Optionally reconfigure the INTT //======================================================================== -// example re-configuration of INTT - uncomment to get the reconfiguration +// example re-configurations of INTT - uncomment to get the reconfiguration // n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers //======================================================================== + /* // Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; @@ -41,10 +42,26 @@ sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; // laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 18; nladder[3] = 18; +nladder[2] = 21; nladder[3] = 21; sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; */ + +/* +// Four layers, laddertypes 0-0-1-1 +n_intt_layer = 4; +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +nladder[0] = 17; nladder[1] = 17; +sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; +offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; +// +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[2] = 18; nladder[3] = 18; +sensor_radius[2] = 10.835; sensor_radius[3] = 11.361; +offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; +*/ + /* // single layer for testing n_intt_layer = 1; From 896eef8cab330c8a78123803274fdb33bd93de66 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sat, 29 Sep 2018 23:46:59 -0400 Subject: [PATCH 0158/1222] Modified G4_Tracking.C to allow setting of cluster resolution fudge factors (additional smearing). --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 +- macros/g4simulations/G4_Tracking.C | 118 +++------------------- 2 files changed, 19 insertions(+), 105 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index c30a9fa16..6c8916f02 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,8 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int nEvents = 10, + const int proc = 0, + 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") @@ -40,7 +41,7 @@ int Fun4All_G4_sPHENIX( // 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; + const bool upsilons = true && !readhits; // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. @@ -206,6 +207,7 @@ int Fun4All_G4_sPHENIX( 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_distribution_width(0.0, 0.0, 0.0); // testing } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index d5631bc42..112eb120d 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -68,6 +68,14 @@ nladder[0] = 36; nladder[1] = 42; sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; */ +/* +// Two middle layers, laddertype 1-1 +n_intt_layer = 2; +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 30; nladder[1] = 36; +sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; +sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; +*/ int n_tpc_layer_inner = 16; int tpc_layer_rphi_count_inner = 1152; @@ -75,63 +83,11 @@ 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; -// TPC Performance Parameter (applies extra smear to mimic the avalanche): -double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... -double TPCDriftVelocity; -double TPC_Trans_Diffusion; -double TPC_Long_Diffusion; -double TPC_dEdx; -double TPC_NPri; -double TPC_NTot; -double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= -double TPCADCClock; -double TPCShapingRMSLead; -double TPCShapingRMSTail; -double tpc_cell_z; -double TPC_SmearRPhi; -double TPC_SmearZ; - int Max_si_layer; void TrackingInit(int verbosity = 0) { Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; - - /* - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - - TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; - - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells - //======================================= - // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - TPCShapingRMSLead = 16.0; // ns, rising RMS equivalent of shaping amplifier for 40 ns SAMPA - TPCShapingRMSTail = 24.0; // ns, falling RMS equivalent of shaping amplifier for 40 ns SAMPA - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // TKH does not understand the physical origin of these parameters. - // however, their impact seems quite small... - // these are tuned to give 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here - TPC_SmearRPhi = 0.215; - TPC_SmearZ = 0.20; - */ } double Tracking(PHG4Reco* g4Reco, double radius, @@ -176,7 +132,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, lyr->set_int_param("active", 1); lyr->OverlapCheck(maps_overlapcheck); - //lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); g4Reco->registerSubsystem(lyr); @@ -275,28 +230,6 @@ void Tracking_Cells(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - //----------- - // SVTX cells - //----------- - - if (verbosity) - { - cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; - cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; - cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; - cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; - cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; - cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; - cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; - cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; - cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; - cout << " TPC z cell " << tpc_cell_z << " cm" << endl; - cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; - cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; - } - // MVTX cells //========= @@ -338,18 +271,7 @@ void Tracking_Cells(int verbosity = 0) //tpc_distortion -> setPrecision(0.001); // option to over write default factors // default is 0.001 } - // Set TPC gas transport parameters for primary ionization - //======================================== - // These default to NeCF4-400 as follows: - //set_default_double_param("diffusion_long",0.015); // cm/SQRT(cm) - //set_default_double_param("diffusion_trans",0.006); // cm/SQRT(cm) - //set_default_double_param("drift_velocity",8.0 / 1000.0); // cm/ns - //set_default_double_param("electrons_per_gev",TPC_ElectronsPerKeV*1000000.); - //set_default_double_param("min_active_radius",30.); // cm - //set_default_double_param("max_active_radius",75.); // cm - //set_default_double_param("min_time",0.); // ns - //set_default_double_param("max_time",14000.); // ns - + //========================= // setup TPC readout for filling cells // g4tpc/PHG4TPCElectronDrift uses // g4tpc/PHG4TPCPadPlaneReadout @@ -357,12 +279,17 @@ void Tracking_Cells(int verbosity = 0) PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); edrift->Detector("TPC"); + // fudge factors to get 150 microns and 500 microns cluster resolution, respectively + // defaults are 0.10 and 0.15, they can be changed here to get a different resolution + edrift->set_double_param("added_smear_trans",0.11); + edrift->set_double_param("added_smear_long",0.15); PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); 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 here + padplane->set_int_param("tpc_minlayer_inner",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); padplane->set_int_param("ntpc_minlayer_inner",n_maps_layer+n_intt_layer); padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); @@ -490,16 +417,6 @@ void Tracking_Reco(int verbosity = 0) if(laddertype[i-n_maps_layer] == PHG4SiliconTrackerDefs::SEGMENTATION_PHI) clusterizer->set_z_clustering(i, false); } - - - /* - // no Z clustering for INTT layers (only) - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - clusterizer->set_z_clustering(i, false); - } - */ - se->registerSubsystem(clusterizer); // For the TPC @@ -508,7 +425,7 @@ void Tracking_Reco(int verbosity = 0) tpcclusterizer->Verbosity(0); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes + tpcclusterizer->setFitWindowSigmas(0.0150, 0.10); // should be changed when TPC cluster resolution changes tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); se->registerSubsystem(tpcclusterizer); @@ -615,7 +532,6 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) //---------------- SvtxEvaluator* eval; - //eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); eval->do_cluster_eval(true); eval->do_g4hit_eval(true); @@ -630,7 +546,6 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // 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 = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); @@ -640,8 +555,5 @@ void Tracking_Eval(std::string outputfile, int 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; } From 29d8bdbe0aca2bac8f465aac26a07d667d883c4d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sun, 30 Sep 2018 22:35:34 -0400 Subject: [PATCH 0159/1222] Optimized fudge factors to get TPC cluster resolution to about 150 microns. Turned non tracking flags back on. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 19 ++++++++----------- macros/g4simulations/G4_Tracking.C | 9 +++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 6c8916f02..31987ed0f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,6 @@ using namespace std; int Fun4All_G4_sPHENIX( - const int proc = 0, 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", @@ -41,7 +40,7 @@ int Fun4All_G4_sPHENIX( // 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 = true && !readhits; + const bool upsilons = false && !readhits; // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. @@ -61,21 +60,21 @@ int Fun4All_G4_sPHENIX( bool do_pstof = false; - bool do_cemc = 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 = 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 && true; - bool do_magnet = false; + bool do_magnet = true; - bool do_hcalout = false; + 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; @@ -89,7 +88,7 @@ int Fun4All_G4_sPHENIX( bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - bool do_jet_reco = false; + bool do_jet_reco = true; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -193,8 +192,8 @@ int Fun4All_G4_sPHENIX( { // 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 + gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); @@ -207,13 +206,11 @@ int Fun4All_G4_sPHENIX( 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_distribution_width(0.0, 0.0, 0.0); // testing } 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(2); gen->Verbosity(0); diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 112eb120d..ffcee9dbf 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -279,16 +279,17 @@ void Tracking_Cells(int verbosity = 0) PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); edrift->Detector("TPC"); - // fudge factors to get 150 microns and 500 microns cluster resolution, respectively - // defaults are 0.10 and 0.15, they can be changed here to get a different resolution - edrift->set_double_param("added_smear_trans",0.11); + // 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.12 and 0.15, they can be changed here to get a different resolution + edrift->set_double_param("added_smear_trans",0.12); edrift->set_double_param("added_smear_long",0.15); PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); 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 here + // We may want to change the number of inner layers, and can do that here padplane->set_int_param("tpc_minlayer_inner",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); padplane->set_int_param("ntpc_minlayer_inner",n_maps_layer+n_intt_layer); From 189b33b4208ed6d8e99cc58b3ed4eb31a0b356d2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 8 Oct 2018 13:31:11 -0400 Subject: [PATCH 0160/1222] add flow afterburner xml file --- macros/g4simulations/flowAfterburner.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 macros/g4simulations/flowAfterburner.xml diff --git a/macros/g4simulations/flowAfterburner.xml b/macros/g4simulations/flowAfterburner.xml new file mode 100644 index 000000000..83eb260c7 --- /dev/null +++ b/macros/g4simulations/flowAfterburner.xml @@ -0,0 +1,14 @@ + + + + 11793 + + sHijing.dat + flowAfterburner.dat + + -1.0 + 1.0 + 0.0 + + JJNEW + From 459bd5a4ccf6ddc2c96690907c8aae1fadd88a10 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 8 Oct 2018 15:02:15 -0400 Subject: [PATCH 0161/1222] Added commented out lines showing how to override default timing window for INTT - for testing only! --- macros/g4simulations/G4_Tracking.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index ffcee9dbf..786776c66 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -251,7 +251,9 @@ void Tracking_Cells(int verbosity = 0) { // INTT cells PHG4SiliconTrackerCellReco* reco = new PHG4SiliconTrackerCellReco("SILICON_TRACKER"); - // The timing windows are hard-coded in the INTT ladder model + // The timing windows are hard-coded in the INTT ladder model, they can be overridden here + //reco->set_double_param("tmax",80.0); + //reco->set_double_param("tmin",-20.0); reco->Verbosity(verbosity); se->registerSubsystem(reco); } From 9de274b28cdfa971c02f12c7c3957813480fb9ed Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 8 Oct 2018 17:37:37 -0400 Subject: [PATCH 0162/1222] Merged the new INTT changes with the new TPC changes in G4_Tracking.C. --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- macros/g4simulations/G4_Tracking.C | 101 ++++++++---------- 2 files changed, 48 insertions(+), 55 deletions(-) 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 index 33f408dcc..ae33a75b3 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -10,7 +10,7 @@ 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 -// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired +// default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired int n_intt_layer = 8; // default layer configuration int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 786776c66..394488b4a 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -10,71 +10,64 @@ 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 -// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired -int n_intt_layer = 4; -int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, +// default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired +int n_intt_layer = 8; +// default layer configuration +int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI, PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default -int nladder[4] = {34, 30, 36, 42}; // default - note these have to be changed if laddertype changes for the layer -double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default -double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default +int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default +double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default +// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders +double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; // Optionally reconfigure the INTT //======================================================================== -// example re-configurations of INTT - uncomment one to get the reconfiguration -// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers +// example re-configurations of INTT - uncomment to get the reconfiguration +// n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers +// To get hermetic coverage, need to configure these layers in pairs with the same nladder values! //======================================================================== /* -// Four layers, laddertypes 1-1-0-1 +// Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; -sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; -sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; -*/ -/* -// Three outer layers, laddertypes 1-0-1 -n_intt_layer = 3; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +nladder[0] = 17; nladder[1] = 17; +sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; +offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; +// +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[2] = 21; nladder[3] = 21; +sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; +offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; */ /* -// Three outer layers, laddertypes 1-1-1 -n_intt_layer = 3; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; -*/ -/* -// Two outer layers, laddertype 0-1 -n_intt_layer = 2; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 52; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; -*/ -/* -// Two outer layers, laddertype 1-1 -n_intt_layer = 2; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 36; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; +// Four layers, laddertypes 0-0-1-1 +n_intt_layer = 4; +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; +nladder[0] = 17; nladder[1] = 17; +sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; +offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; +// +laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[2] = 18; nladder[3] = 18; +sensor_radius[2] = 10.835; sensor_radius[3] = 11.361; +offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; */ /* -// Two middle layers, laddertype 1-1 -n_intt_layer = 2; -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 30; nladder[1] = 36; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; +// single layer for testing +n_intt_layer = 1; +// +laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; +nladder[0] = 15; +sensor_radius[0] = 8.987; +offsetphi[0] = 12.0; */ int n_tpc_layer_inner = 16; @@ -176,8 +169,8 @@ double Tracking(PHG4Reco* g4Reco, double radius, { sitrack->set_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]); // expecting cm - sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } // outer radius marker (translation back to cm) From 8f00b9ed2001a2ca3e21eed94af948c38c76d2d7 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 8 Oct 2018 21:53:03 -0400 Subject: [PATCH 0163/1222] Fixed a harmless bug (trying to set non existent parameter is ignored). --- macros/g4simulations/G4_Tracking.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 394488b4a..4b3a9aed9 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -32,7 +32,7 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde // n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers // To get hermetic coverage, need to configure these layers in pairs with the same nladder values! //======================================================================== -/* + // Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; // @@ -45,7 +45,7 @@ laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG nladder[2] = 21; nladder[3] = 21; sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; -*/ + /* // Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; @@ -287,8 +287,7 @@ void Tracking_Cells(int verbosity = 0) // We may want to change the number of inner layers, and can do that here padplane->set_int_param("tpc_minlayer_inner",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); - padplane->set_int_param("ntpc_minlayer_inner",n_maps_layer+n_intt_layer); - padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); + padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); return; } From 77159687cf0f71447307a3bed6b0448116264dc8 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 17 Oct 2018 13:41:30 -0400 Subject: [PATCH 0164/1222] new threshold with Vref subtracted --- macros/g4simulations/G4_Tracking.C | 42 +++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 4b3a9aed9..2d61b352a 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -320,16 +320,38 @@ void Tracking_Reco(int verbosity = 0) 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); + /* +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 | +|-----------------------|-----------------|---------------|---------------------|-----------------------------------|-----------|-----------------| +| 3 | Vref | 1 | 210 | 16406 | | 3.84E-01 | +| 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 | +You can now import Markdown table code directly using File/Paste table data... dialog. +DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitizer::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); PHG4SiliconTrackerDigitizer* digiintt = new PHG4SiliconTrackerDigitizer(); digiintt->Verbosity(verbosity); @@ -383,7 +405,7 @@ void Tracking_Reco(int verbosity = 0) { // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss - thresholds->set_threshold(i, 0.1); + thresholds->set_threshold(i, -1); } // INTT for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) From 5bd131ad31228a34f3523a79f48a9165d73dca41 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 22 Oct 2018 11:50:06 -0400 Subject: [PATCH 0165/1222] turn off extra post-digitization threshold settings for INTT --- macros/g4simulations/G4_Tracking.C | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 2d61b352a..91f08a443 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -407,12 +407,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss thresholds->set_threshold(i, -1); } - // INTT - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - thresholds->set_threshold(i, 0.1); - thresholds->set_use_thickness_mip(i, true); - } + // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC se->registerSubsystem(thresholds); From 378338d1226cf0c0fd3d62ea7653a20f59183e94 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 22 Oct 2018 15:31:13 -0400 Subject: [PATCH 0166/1222] improve the comment --- macros/g4simulations/G4_Tracking.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 91f08a443..01a4cb9e5 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -331,7 +331,6 @@ Four part information goes to the threshold calculation: 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 | |-----------------------|-----------------|---------------|---------------------|-----------------------------------|-----------|-----------------| -| 3 | Vref | 1 | 210 | 16406 | | 3.84E-01 | | 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 | @@ -340,7 +339,6 @@ The result threshold table based on FPHX default value is as following | 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 | -You can now import Markdown table code directly using File/Paste table data... dialog. DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitizer::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. From e89a3d79dbc31bb7b243d3eb44f8257462237f16 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Oct 2018 16:25:10 -0400 Subject: [PATCH 0167/1222] Add root6 compliant macros --- macros/g4simulations/G4_Bbc.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C index c3012a589..afbf0b651 100644 --- a/macros/g4simulations/G4_Bbc.C +++ b/macros/g4simulations/G4_Bbc.C @@ -1,3 +1,9 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libg4bbc.so) +#endif void BbcInit() {} From 322f945b4818150982ca87b02932edb45881967d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Oct 2018 16:44:24 -0400 Subject: [PATCH 0168/1222] Add root6 compliant macros --- macros/g4simulations/G4_HcalIn_ref.C | 43 +++++++++++++++++++++++---- macros/g4simulations/G4_HcalOut_ref.C | 19 +++++++++++- macros/g4simulations/G4_Magnet.C | 7 +++++ macros/g4simulations/G4_Pipe.C | 7 +++++ 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index c3aaeed75..537cf2c11 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -1,10 +1,32 @@ -//Inner HCal construction macro +//Inner HCal reconstruction macro +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void HCalInner_SupportRing(PHG4Reco* g4Reco, + const int absorberactive = 0); +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif //Inner HCal absorber material selector: //false - Default, absorber material is SS310 //true - Choose if you want Aluminum const bool inner_hcal_material_Al = false; +static int inner_hcal_eic = 0; enum enu_HCalIn_clusterizer { @@ -20,7 +42,13 @@ enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; // Init is called by G4Setup.C -void HCalInnerInit() {} +void HCalInnerInit(const int iflag = 0) +{ + if (iflag == 1) + { + inner_hcal_eic = 1; + } +} double HCalInner(PHG4Reco* g4Reco, double radius, @@ -103,16 +131,21 @@ void HCalInner_SupportRing(PHG4Reco* g4Reco, 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 innerradius_sphenix = 116.; + const double innerradius_ephenix_hadronside = 138.; 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 }; + { -z_ring2, -z_ring1, z_ring1, z_ring2 }; PHG4CylinderSubsystem *cyl; for (int i = 0; i < 4; i++) { + double innerradius = innerradius_sphenix; + if ( z_rings[i] > 0 && 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"); diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 8b44a830d..41e4e3f49 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -1,4 +1,21 @@ - +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif enum enu_HCalOut_clusterizer { diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index f0c84f3e2..19620dc8f 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif void MagnetInit() {} diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index f129903ba..bd4502910 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif void PipeInit() {} From f5618cd952bd1e313c00a7c1831ba2b5cc0b3892 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Oct 2018 16:57:23 -0400 Subject: [PATCH 0169/1222] Add root6 compliant macros --- macros/g4simulations/G4_CEmc_Spacal.C | 28 ++++++++++++++++++++++++++- macros/g4simulations/G4_Global.C | 9 +++++++++ macros/g4simulations/G4_PlugDoor.C | 7 +++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index b0558a943..2cdcce2d8 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -1,4 +1,30 @@ - +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +double +CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0); +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, + const int absorberactive = 0); +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif int Min_cemc_layer = 1; int Max_cemc_layer = 1; diff --git a/macros/g4simulations/G4_Global.C b/macros/g4simulations/G4_Global.C index 0c512827c..9e9b4b88f 100644 --- a/macros/g4simulations/G4_Global.C +++ b/macros/g4simulations/G4_Global.C @@ -1,3 +1,12 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +R__LOAD_LIBRARY(libg4vertex.so) +#endif + +void GlobalInit() {} void Global_Reco(int verbosity = 0) { diff --git a/macros/g4simulations/G4_PlugDoor.C b/macros/g4simulations/G4_PlugDoor.C index fcd613e83..e37520850 100644 --- a/macros/g4simulations/G4_PlugDoor.C +++ b/macros/g4simulations/G4_PlugDoor.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif void PlugDoorInit() {} void PlugDoor(PHG4Reco *g4Reco, From 0ae80402ec2b10840c4e21b70608bb8230ed9fbb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Oct 2018 23:21:48 -0400 Subject: [PATCH 0170/1222] Add root6 compliant macros --- macros/g4simulations/G4_Tracking.C | 64 ++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 01a4cb9e5..613591f51 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -1,3 +1,34 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.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(libg4tpc.so) +R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif + #include // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" @@ -11,6 +42,7 @@ 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 // default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired +#ifdef INTTLADDER8 int n_intt_layer = 8; // default layer configuration int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, @@ -25,7 +57,7 @@ int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default // offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; - +#else // Optionally reconfigure the INTT //======================================================================== // example re-configurations of INTT - uncomment to get the reconfiguration @@ -34,18 +66,16 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde //======================================================================== // Four layers, laddertypes 0-0-1-1 -n_intt_layer = 4; +int n_intt_layer = 4; // -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -nladder[0] = 17; nladder[1] = 17; -sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; -offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; -// -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 21; nladder[3] = 21; -sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; -offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; - +int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; +int nladder[4] = {17,17, 21,21}; +double sensor_radius[4] = {6.876, 7.462, 12.676, 13.179}; +double offsetphi[4] = {0., 0.5 * 360.0 / nladder[1], 0., 0.5 * 360.0 / nladder[3]}; +#endif /* // Four layers, laddertypes 0-0-1-1 n_intt_layer = 4; @@ -510,16 +540,6 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz 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 Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- From 047c0957084b1b4fb71459aae9d4ea8f9f5722aa Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 1 Nov 2018 23:28:30 -0400 Subject: [PATCH 0171/1222] integrate with new tracking macro and INTT ladder type definitions --- macros/g4simulations/G4_Tracking.C | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 613591f51..3f85f8772 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -349,6 +349,20 @@ void Tracking_Reco(int verbosity = 0) if (n_intt_layer > 0) { + + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); + for (int i = 0; i < n_intt_layer; i++) + { + const int database_strip_type = (laddertype[i] == PHG4SiliconTrackerDefs::SEGMENTATION_Z) ? 0 : 1; + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. +// string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + } + se->registerSubsystem(deadMapINTT); + // INTT // these should be used for the INTT /* From c749e69c8f725a81a343ec068e56db1ea7ff5e1c Mon Sep 17 00:00:00 2001 From: Sanghoon Lim Date: Fri, 2 Nov 2018 14:01:23 -0400 Subject: [PATCH 0172/1222] add a list of background files for p+p pileup simulation and update a method to get TPC drift velocity for setting a timing window --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 296efa58c..2a1a00839 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -474,6 +474,8 @@ int Fun4All_G4_sPHENIX( se->registerInputManager(pileup); const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); + //background files for p+p pileup sim + //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time @@ -485,6 +487,9 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { // double TPCDriftVelocity = 6.0 / 1000.0; // cm/ns, which is loaded from G4_SVTX*.C macros + PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); + assert(dr); + double TPCDriftVelocity = dr->get_double_param("drift_velocity"); time_window_minus = -105.5 / TPCDriftVelocity; // ns time_window_plus = 105.5 / TPCDriftVelocity; // ns; } From a65bfd81aee02ea9a7983e8b5b16a073d400e9c3 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Nov 2018 14:57:23 -0400 Subject: [PATCH 0173/1222] Added INTT configurations for 8, 6, 4 and 0 sublayers, switchable using a #define. --- macros/g4simulations/G4_Tracking.C | 91 +++++++++++++++--------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 613591f51..63e4ad82c 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -30,6 +30,10 @@ R__LOAD_LIBRARY(libg4eval.so) #endif #include +// define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers +// one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter +#define INTTLADDER0 + // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" bool tpc_layers_40 = false; @@ -41,7 +45,8 @@ 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 -// default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired +// Configure the INTT layers +// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders #ifdef INTTLADDER8 int n_intt_layer = 8; // default layer configuration @@ -55,50 +60,43 @@ int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; -#else -// Optionally reconfigure the INTT -//======================================================================== -// example re-configurations of INTT - uncomment to get the reconfiguration -// n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers -// To get hermetic coverage, need to configure these layers in pairs with the same nladder values! -//======================================================================== - -// Four layers, laddertypes 0-0-1-1 +#endif +#ifdef INTTLADDER6 +int n_intt_layer = 6; +int laddertype[6] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI }; +int nladder[6] = {17, 17, 15, 15, 18, 18}; +double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; +#endif +#ifdef INTTLADDER4_ZP int n_intt_layer = 4; -// int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; -int nladder[4] = {17,17, 21,21}; -double sensor_radius[4] = {6.876, 7.462, 12.676, 13.179}; -double offsetphi[4] = {0., 0.5 * 360.0 / nladder[1], 0., 0.5 * 360.0 / nladder[3]}; + PHG4SiliconTrackerDefs::SEGMENTATION_Z, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; +int nladder[4] = {17, 17, 18, 18}; +double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +#endif +#ifdef INTTLADDER4_PP +int n_intt_layer = 4; +int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI, + PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; +int nladder[4] = {15, 15, 18, 18}; +double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +#endif +#ifdef INTTLADDER0 +int n_intt_layer = 0; #endif -/* -// Four layers, laddertypes 0-0-1-1 -n_intt_layer = 4; -// -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -nladder[0] = 17; nladder[1] = 17; -sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; -offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; -// -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 18; nladder[3] = 18; -sensor_radius[2] = 10.835; sensor_radius[3] = 11.361; -offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; -*/ -/* -// single layer for testing -n_intt_layer = 1; -// -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 15; -sensor_radius[0] = 8.987; -offsetphi[0] = 12.0; -*/ int n_tpc_layer_inner = 16; int tpc_layer_rphi_count_inner = 1152; @@ -135,7 +133,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - if (verbosity) +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; @@ -156,13 +154,13 @@ double Tracking(PHG4Reco* g4Reco, double radius, lyr->OverlapCheck(maps_overlapcheck); lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); - + g4Reco->registerSubsystem(lyr); radius = maps_layer_radius[ilayer]; } } - + if (n_intt_layer > 0) { //------------------- @@ -194,9 +192,12 @@ double Tracking(PHG4Reco* g4Reco, double radius, sitrack->OverlapCheck(intt_overlapcheck); g4Reco->registerSubsystem(sitrack); - // Update the laddertype and ladder spacing configuration + // Set the laddertype and ladder spacing configuration + cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm From a7edf0daa423a4a8dc8031d8613d596a939bbc82 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Nov 2018 16:40:58 -0400 Subject: [PATCH 0174/1222] Added option to embed multiple Upsilons per event, each with a unique emed flag. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 95 ++++++++++++----------- macros/g4simulations/G4_Tracking.C | 2 +- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 296efa58c..a520ccd62 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -41,6 +41,7 @@ int Fun4All_G4_sPHENIX( 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; + const int num_upsilons_per_event = 1; // can set more than 1 upsilon per event, each has a unique embed flag // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. @@ -248,50 +249,56 @@ int Fun4All_G4_sPHENIX( // 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 || runpythia8 || runpythia6) - { - 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(3); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; + // run upsilons for momentum, dca performance, alone or embedded in Hijing + for(int iups = 0; iups < num_upsilons_per_event;iups++) + { + PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); + vgen->add_decay_particles("e+", "e-", 0); // i = decay id + // event vertex + if (readhepmc || do_embedding || particles || runpythia8 || runpythia6 || iups > 0) + { + vgen->set_reuse_existing_vertex(true); + } + else + { + vgen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); + vgen->set_vertex_distribution_mean(0.0, 0.0, 0.0); + vgen->set_vertex_distribution_width(0.0, 0.0, 5.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(iups+3); // unique gembed for each upsilon + se->registerSubsystem(vgen); + + cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; + } } } diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 63e4ad82c..11838ef6b 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -32,7 +32,7 @@ R__LOAD_LIBRARY(libg4eval.so) #include // define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers // one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter -#define INTTLADDER0 +#define INTTLADDER4_PP // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" From ef10c9d5d94c450a43c6a181346e44dc6b73935a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Nov 2018 16:47:00 -0400 Subject: [PATCH 0175/1222] Deleted commented out line. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 2050035f9..27465bd0a 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -493,10 +493,9 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { - // double TPCDriftVelocity = 6.0 / 1000.0; // cm/ns, which is loaded from G4_SVTX*.C macros - PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); - assert(dr); - double TPCDriftVelocity = dr->get_double_param("drift_velocity"); + PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); + assert(dr); + double TPCDriftVelocity = dr->get_double_param("drift_velocity"); time_window_minus = -105.5 / TPCDriftVelocity; // ns time_window_plus = 105.5 / TPCDriftVelocity; // ns; } From 5f95596c3d6461fa90f6af068e64394ed771c993 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 2 Nov 2018 21:16:36 -0400 Subject: [PATCH 0176/1222] Formatting changes only. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 27465bd0a..734a6c3f4 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -481,8 +481,8 @@ int Fun4All_G4_sPHENIX( se->registerInputManager(pileup); const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); - //background files for p+p pileup sim - //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); + //background files for p+p pileup sim + //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time @@ -493,6 +493,7 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { + // This gets the default drift velocity only! PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); assert(dr); double TPCDriftVelocity = dr->get_double_param("drift_velocity"); From 4bce170578d49307459b225005defe40a3843585 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 5 Nov 2018 16:49:48 -0500 Subject: [PATCH 0177/1222] Sync to master --- macros/g4simulations/G4_Tracking.C | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 6d4fac039..61f7e56f9 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -418,23 +418,24 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz //------------------------------------- // Apply Live Area Inefficiency to Hits + // This is obsolete, please use PHG4SvtxDeadMapLoader instead for pre-defined deadmap //------------------------------------- // defaults to 1.0 (fully active) - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - - for (int i = 0; i < n_maps_layer; i++) - { - deadarea->Verbosity(verbosity); - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i, 1.0); - } - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i, 1.0); - } - se->registerSubsystem(deadarea); +// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); +// +// for (int i = 0; i < n_maps_layer; i++) +// { +// deadarea->Verbosity(verbosity); +// //deadarea->set_hit_efficiency(i,0.99); +// deadarea->set_hit_efficiency(i, 1.0); +// } +// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) +// { +// //deadarea->set_hit_efficiency(i,0.99); +// deadarea->set_hit_efficiency(i, 1.0); +// } +// se->registerSubsystem(deadarea); //----------------------------- // Apply MIP thresholds to Hits From 5216ae680fe9464e9947422e32c9a71a9ae78254 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 6 Nov 2018 15:17:13 -0500 Subject: [PATCH 0178/1222] root5/6 identical --- macros/g4simulations/G4_CaloTrigger.C | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/macros/g4simulations/G4_CaloTrigger.C b/macros/g4simulations/G4_CaloTrigger.C index d23bd0616..deff5a020 100644 --- a/macros/g4simulations/G4_CaloTrigger.C +++ b/macros/g4simulations/G4_CaloTrigger.C @@ -1,3 +1,11 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libcalotrigger.so) +#endif + +void CaloTriggerInit() {} void CaloTrigger_Sim(int verbosity = 0) { From 0938651205694b225ba41fae1458375e0f5be1ca Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 7 Nov 2018 09:36:47 -0500 Subject: [PATCH 0179/1222] Global switch in tracking macro for INTT dead map options --- macros/g4simulations/G4_Tracking.C | 53 ++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 61f7e56f9..4ed7c1b59 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -34,6 +34,16 @@ R__LOAD_LIBRARY(libg4eval.so) // one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter #define INTTLADDER4_PP +// Dead map options for INTT +enum enu_INTTDeadMapType +{ + kINTTNoDeadMap = 0, // All channel in INTT is alive + kINTT4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kINTT8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational +}; + +// Choose INTT deadmap here +enu_INTTDeadMapType INTTDeadMapOption = kINTT4PercentDeadMap; // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" bool tpc_layers_40 = false; @@ -351,18 +361,41 @@ void Tracking_Reco(int verbosity = 0) if (n_intt_layer > 0) { - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); - for (int i = 0; i < n_intt_layer; i++) + if (INTTDeadMapOption != kINTTNoDeadMap) { - const int database_strip_type = (laddertype[i] == PHG4SiliconTrackerDefs::SEGMENTATION_Z) ? 0 : 1; - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. -// string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); + for (int i = 0; i < n_intt_layer; i++) + { + const int database_strip_type = (laddertype[i] == PHG4SiliconTrackerDefs::SEGMENTATION_Z) ? 0 : 1; + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); + + + if (INTTDeadMapOption == kINTT4PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else if (INTTDeadMapOption == kINTT8PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else + { + cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "< Verbosity(1); + se->registerSubsystem(deadMapINTT); } - se->registerSubsystem(deadMapINTT); // INTT // these should be used for the INTT From cbb7850dc51767d27f42dd716c478da244ea6410 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 7 Nov 2018 09:59:13 -0500 Subject: [PATCH 0180/1222] Well, many plots are simulation right now --- macros/sPHENIXStyle/test_style.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); From 177400b4a9463a38894da843c591c41deff1056c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 7 Nov 2018 10:20:44 -0500 Subject: [PATCH 0181/1222] Default to zero percent dead map --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 4ed7c1b59..e8c3291fd 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -43,7 +43,7 @@ enum enu_INTTDeadMapType }; // Choose INTT deadmap here -enu_INTTDeadMapType INTTDeadMapOption = kINTT4PercentDeadMap; +enu_INTTDeadMapType INTTDeadMapOption = kINTTNoDeadMap; // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" bool tpc_layers_40 = false; From a1057f6ce7d7b02ce474938737fcefeb9e79ef10 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 7 Nov 2018 15:33:56 -0500 Subject: [PATCH 0182/1222] root5/6 almost identical, diffs are numerical problems in our code --- macros/g4simulations/G4_Jets.C | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C index f3bbcc844..cc92b2e62 100644 --- a/macros/g4simulations/G4_Jets.C +++ b/macros/g4simulations/G4_Jets.C @@ -1,3 +1,18 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif + +void JetInit() {} void Jet_Reco(int verbosity = 0) { @@ -6,7 +21,7 @@ void Jet_Reco(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets - JetReco *truthjetreco = new JetReco(); + 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"); @@ -21,7 +36,7 @@ void Jet_Reco(int verbosity = 0) { se->registerSubsystem(truthjetreco); // tower jets - JetReco *towerjetreco = new JetReco(); + 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)); @@ -38,7 +53,7 @@ void Jet_Reco(int verbosity = 0) { se->registerSubsystem(towerjetreco); // cluster jets - JetReco *clusterjetreco = new JetReco(); + 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)); @@ -55,7 +70,7 @@ void Jet_Reco(int verbosity = 0) { se->registerSubsystem(clusterjetreco); // track jets - JetReco *trackjetreco = new JetReco(); + JetReco *trackjetreco = new JetReco("TRACKJETRECO"); 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"); From 600d1343cbcb448ffed3192a242b6a94186f3fb5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 7 Nov 2018 16:16:55 -0500 Subject: [PATCH 0183/1222] root5/6 identical --- macros/g4simulations/G4_HIJetReco.C | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index 29ec9f9d8..dcc871941 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -1,3 +1,21 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libjetbackground.so) +#endif + +void HIJetRecoInit() {} + void HIJetReco(int verbosity = 0, bool do_flow = false ) { //--------------- @@ -65,7 +83,7 @@ void HIJetReco(int verbosity = 0, bool do_flow = false ) { st->Verbosity( verbosity ); se->registerSubsystem( st ); - JetReco *towerjetreco = new 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)); From 5eece140ffac3d46c8cba27b963f801ba129d52c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 7 Nov 2018 16:50:52 -0500 Subject: [PATCH 0184/1222] root5/6 identical --- macros/g4simulations/G4Setup_sPHENIX.C | 49 +++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index b997b621c..a2389ea76 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -1,6 +1,35 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "G4_Pipe.C" +#include "G4_Tracking.C" +#include "G4_PSTOF.C" +#include "G4_CEmc_Spacal.C" +#include "G4_HcalIn_ref.C" +#include "G4_Magnet.C" +#include "G4_HcalOut_ref.C" +#include "G4_PlugDoor.C" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class SubsysReco; +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) +#else bool overlapcheck = false; // set to true if you want to check for overlaps +double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#endif + +// This function is only used to test if we can load this as root6 macro +// without running into unresolved libraries and include files +void RunLoadTest() {} void G4Init(const bool do_tracking = true, const bool do_pstof = true, @@ -65,7 +94,11 @@ void G4Init(const bool do_tracking = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + const EDecayType decayType = EDecayType::kAll, +#else const EDecayType decayType = TPythia6Decayer::kAll, +#endif const bool do_tracking = true, const bool do_pstof = true, const bool do_cemc = true, @@ -99,7 +132,12 @@ int G4Setup(const int absorberactive = 0, // 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) { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + if (decayType != EDecayType::kAll) +#else + if (decayType != TPythia6Decayer::kAll) +#endif + { g4Reco->set_force_decay(decayType); } @@ -109,9 +147,9 @@ int G4Setup(const int absorberactive = 0, if (stringline.fail()) { // conversion to double fails -> we have a string if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); + g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); } else { - g4Reco->set_field_map(field, 2); + g4Reco->set_field_map(field, PHFieldConfig::kField2D); } } else { g4Reco->set_field(fieldstrength); // use const soleniodal field @@ -203,6 +241,7 @@ blackhole->set_double_param("radius",radius + 10); // add 10 cm PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); se->registerSubsystem( g4Reco ); + return 0; } void ShowerCompress(int verbosity = 0) { From 0f781363c57e947514cb9833bc8a754dd344edd2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 7 Nov 2018 17:19:33 -0500 Subject: [PATCH 0185/1222] root5/6 identical --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 141 ++++++++++++++-------- 1 file changed, 90 insertions(+), 51 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 734a6c3f4..b933f8dce 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,6 +1,42 @@ -#include +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4Setup_sPHENIX.C" +#include "G4_Bbc.C" +#include "G4_Global.C" +#include "G4_CaloTrigger.C" +#include "G4_Jets.C" +#include "G4_HIJetReco.C" +#include "G4_DSTReader.C" +#include "DisplayOn.C" +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libphhepmc.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +#endif + using namespace std; + 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", @@ -249,56 +285,49 @@ int Fun4All_G4_sPHENIX( // 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 + // run upsilons for momentum, dca performance, alone or embedded in Hijing + for(int iups = 0; iups < num_upsilons_per_event;iups++) + { + PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); + vgen->add_decay_particles("e+", "e-", 0); // i = decay id + // event vertex + if (readhepmc || do_embedding || particles || runpythia8 || runpythia6) + { + vgen->set_reuse_existing_vertex(true); + } + + // 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 { - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+", "e-", 0); // i = decay id - // event vertex - if (readhepmc || do_embedding || particles || runpythia8 || runpythia6 || iups > 0) - { - vgen->set_reuse_existing_vertex(true); - } - else - { - vgen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - vgen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - vgen->set_vertex_distribution_width(0.0, 0.0, 5.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(iups+3); // unique gembed for each upsilon - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; + // Upsilon(3S) + vgen->set_mass(10.3552); + vgen->set_width(20.32e-6); } + + vgen->Verbosity(0); + vgen->Embed(3); + se->registerSubsystem(vgen); + + cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; + } } } @@ -308,8 +337,13 @@ int Fun4All_G4_sPHENIX( // Detector description //--------------------- +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + G4Setup(absorberactive, magfield, EDecayType::kAll, + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); +#else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); +#endif } //--------- @@ -520,7 +554,6 @@ int Fun4All_G4_sPHENIX( /*bool*/ do_hcalout, /*bool*/ do_cemc_twr, /*bool*/ do_hcalin_twr, - /*bool*/ do_magnet, /*bool*/ do_hcalout_twr); } @@ -533,14 +566,14 @@ int Fun4All_G4_sPHENIX( //----------------- if (nEvents < 0) { - return; + return 0; } // 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; + return 0; } if(display_on) @@ -563,4 +596,10 @@ int Fun4All_G4_sPHENIX( std::cout << "All done" << std::endl; delete se; gSystem->Exit(0); + return 0; } + + +// This function is only used to test if we can load this as root6 macro +// without running into unresolved libraries and include files +void RunFFALoadTest() {} From 83cb4a9bad2ce8129617107c8055c6f9d777294b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 7 Nov 2018 17:21:32 -0500 Subject: [PATCH 0186/1222] root5/6, fix duplicate parameter --- macros/g4simulations/G4_DSTReader.C | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C index 79624588c..b2eb6bb50 100644 --- a/macros/g4simulations/G4_DSTReader.C +++ b/macros/g4simulations/G4_DSTReader.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libg4eval.so) +#endif + ////////////////////////////////////////////////////////////////// /*! \file G4_DSTReader.C @@ -10,6 +17,8 @@ #include +void G4DSTreaderInit() {} + void G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// int absorberactive = 1, // @@ -21,7 +30,6 @@ G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// bool do_hcalout = true, // bool do_cemc_twr = true, // bool do_hcalin_twr = true, // - bool do_magnet = true, // bool do_hcalout_twr = true // ) { From 5dc4d143c1f665b42b79d40301eeb81dfbea0605 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Nov 2018 12:20:19 -0500 Subject: [PATCH 0187/1222] root5/6 identical --- macros/g4simulations/G4_FEMC.C | 18 +++++++++++++++++- macros/g4simulations/G4_FHCAL.C | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index bd0a7b2d3..8e6923279 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -1,4 +1,20 @@ -using namespace std; +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif void FEMCInit() diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index aac6bf737..88be4d5a1 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -1,3 +1,21 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif + using namespace std; void From 74e2d743a045f8dcc5af0aa85dc1b7763224a8df Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Nov 2018 12:24:41 -0500 Subject: [PATCH 0188/1222] root5/6 almost identical, diffs from numerical issues in the trackign code --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 24e9efc33..b3f8b11e2 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -1,3 +1,22 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4hough.so) +int +make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, + double etamax, const int N_Sector = 8); +void +AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); +#endif // $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $ /*! @@ -247,7 +266,7 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); - + return 0; } void FGEM_FastSim_Reco(int verbosity = 0) { From 2c4446325ac3c2444aaba6e8a39df3578e242dd1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 9 Nov 2018 16:12:38 -0500 Subject: [PATCH 0189/1222] root5/6 identical except numerical issues in code --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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 index ba1d58a17..82e1307de 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -1,3 +1,31 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif + #include // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" @@ -538,6 +566,7 @@ void Svtx_Cells(int verbosity = 0) PHG4SiliconTrackerCellReco* reco = new PHG4SiliconTrackerCellReco("SILICON_TRACKER"); // The timing windows are hard-coded in the INTT ladder model reco->Verbosity(verbosity); + reco->checkenergy(1); se->registerSubsystem(reco); } @@ -671,7 +700,7 @@ void Svtx_Reco(int verbosity = 0) DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); } - se->registerSubsystem(deadMapINTT); +// se->registerSubsystem(deadMapINTT); std::vector userrange; // 3-bit ADC threshold relative to the mip_e at each layer. // these should be used for the INTT From ebed3ed0b003e46cf71e5bbc04638d07286be770 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 9 Nov 2018 18:09:50 -0500 Subject: [PATCH 0190/1222] tpc_distortion went out of scope in cling (as it should be), so distortion was not applied for root6 which led to small but non negligible diffs --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 82e1307de..dde989a2d 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -586,7 +586,7 @@ void Svtx_Cells(int verbosity = 0) string TPC_distortion_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - PHG4TPCSpaceChargeDistortion* tpc_distortion = + 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 From a345cf70a9da73966c6431a0b3f5f938775e3675 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:15:14 -0500 Subject: [PATCH 0191/1222] macro to hold global variables in root6 --- macros/g4simulations/GlobalVariables.C | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 macros/g4simulations/GlobalVariables.C diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C new file mode 100644 index 000000000..85226a4b8 --- /dev/null +++ b/macros/g4simulations/GlobalVariables.C @@ -0,0 +1,5 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +static bool overlapcheck = false; +static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#endif From 548135bd3aac78d30e11f955078614395ff5333f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:43:57 -0500 Subject: [PATCH 0192/1222] root5/6 identical --- macros/g4simulations/G4Setup_fsPHENIX.C | 44 ++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index beeaafb25..11f741e4f 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -1,6 +1,31 @@ - +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include "G4_Pipe.C" +#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C" +#include "G4_CEmc_Spacal.C" +#include "G4_HcalIn_ref.C" +#include "G4_Magnet.C" +#include "G4_HcalOut_ref.C" +#include "G4_FGEM_fsPHENIX.C" +#include "G4_FEMC.C" +#include "G4_FHCAL.C" +#include +#include +#include +#include +#include +#include +class SubsysReco; +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) +int make_piston(string name, PHG4Reco* g4Reco); +#else 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 +#endif + +void RunLoadTest() {} void G4Init(bool do_svtx = true, bool do_cemc = true, @@ -71,7 +96,11 @@ void G4Init(bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + const EDecayType decayType = EDecayType::kAll, +#else const EDecayType decayType = TPythia6Decayer::kAll, +#endif const bool do_svtx = true, const bool do_cemc = true, const bool do_hcalin = true, @@ -106,8 +135,12 @@ int G4Setup(const int absorberactive = 0, // 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) { + #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + if (decayType != EDecayType::kAll) +#else + if (decayType != TPythia6Decayer::kAll) +#endif + { g4Reco->set_force_decay(decayType); } @@ -117,9 +150,9 @@ int G4Setup(const int absorberactive = 0, if (stringline.fail()) { // conversion to double fails -> we have a string if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); + g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); } else { - g4Reco->set_field_map(field, 2); + g4Reco->set_field_map(field, PHFieldConfig::kField2D); } } else { g4Reco->set_field(fieldstrength); // use const soleniodal field @@ -249,6 +282,7 @@ blackhole->set_double_param("radius",radius + 10); // add 10 cm PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); se->registerSubsystem( g4Reco ); + return 0; } From a3ad5a11de5a87b70bde5f7d49aa95cbdd7ca3c0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:46:11 -0500 Subject: [PATCH 0193/1222] adjust for root6, remove duplicate parameter --- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C index 5edfc6282..1ba2f613e 100644 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ b/macros/g4simulations/G4_DSTReader_fsPHENIX.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libg4eval.so) +#endif + ////////////////////////////////////////////////////////////////// /*! \file G4_DSTReader.C @@ -10,6 +17,8 @@ #include +void G4DSTreader_fsPHENIXInit() {} + void G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// int absorberactive = 1, // @@ -20,7 +29,6 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// 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, // From fd634e8d46ecafb261ca0931cb3c8fb99bc9fe55 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:52:39 -0500 Subject: [PATCH 0194/1222] adjust for root6, remove duplicate parameter --- macros/g4simulations/G4_FwdJets.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C index 4e9195e60..3eef1d79a 100644 --- a/macros/g4simulations/G4_FwdJets.C +++ b/macros/g4simulations/G4_FwdJets.C @@ -1,3 +1,15 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif + +void Jet_FwdRecoInit() {} void Jet_FwdReco(int verbosity = 0) { From 0d6b1ef02151cc00d779641dd3eb749827892912 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:55:59 -0500 Subject: [PATCH 0195/1222] adjust for root6, identical results with root5 --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 47 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index d3f413a84..506a6306e 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -1,3 +1,34 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4Setup_fsPHENIX.C" +#include "G4_Bbc.C" +#include "G4_Global.C" +#include "G4_CaloTrigger.C" +#include "G4_Jets.C" +#include "G4_FwdJets.C" +#include "G4_DSTReader_fsPHENIX.C" +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +#endif int Fun4All_G4_fsPHENIX( const int nEvents = 2, @@ -201,11 +232,17 @@ int Fun4All_G4_fsPHENIX( // Detector description //--------------------- +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + G4Setup(absorberactive, magfield, EDecayType::kAll, + do_svtx, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, + do_FGEM, do_FEMC, do_FHCAL, + magfield_rescale); +#else 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); - +#endif } //--------- @@ -370,7 +407,6 @@ int Fun4All_G4_fsPHENIX( /*bool*/ do_hcalout , /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , /*bool*/ do_hcalout_twr, /*bool*/ do_FGEM, /*bool*/ do_FHCAL, @@ -388,7 +424,7 @@ int Fun4All_G4_fsPHENIX( { 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; + return 0; } if (nEvents < 0) @@ -426,8 +462,9 @@ int Fun4All_G4_fsPHENIX( std::cout << "All done" << std::endl; delete se; gSystem->Exit(0); + return 0; } - + return 0; } @@ -438,3 +475,5 @@ G4Cmd(const char * cmd) PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->ApplyCommand(cmd); } + +void RunFFALoadTest() {} From 023b153b77f5e90b76954790e4ddfe1dbf80ca40 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 10 Nov 2018 10:56:40 -0500 Subject: [PATCH 0196/1222] adjust for root6 --- macros/g4simulations/DisplayOn.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C index be968b6ef..6781839e6 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/macros/g4simulations/DisplayOn.C @@ -1,3 +1,9 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#endif + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the From cd51a03a94380a55d752f36e5ecfd8ae0b794920 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 11 Nov 2018 16:05:00 -0500 Subject: [PATCH 0197/1222] adjust for root6 --- macros/prototype4/DisplayOn.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/prototype4/DisplayOn.C b/macros/prototype4/DisplayOn.C index cb75b1cbc..8295a6700 100644 --- a/macros/prototype4/DisplayOn.C +++ b/macros/prototype4/DisplayOn.C @@ -1,3 +1,9 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#endif + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the From 6c80703e63537d0d0d9a6c3a2b46cbe97dd9b2ba Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 11 Nov 2018 16:07:05 -0500 Subject: [PATCH 0198/1222] adjust for root6, results identical with root5 --- macros/prototype4/Fun4All_G4_Prototype4.C | 49 +++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/macros/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C index f6f6769e1..cdce34007 100644 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -1,3 +1,35 @@ +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#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(libg4calo.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4histos.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libqa_modules.so) +#endif + int Fun4All_G4_Prototype4(int nEvents = 1) { @@ -40,7 +72,7 @@ int Fun4All_G4_Prototype4(int nEvents = 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); + // rc->set_IntFlag("RANDOMSEED",12345678); // simulated setup sits at eta=1, theta=40.395 degrees double theta = 90-46.4; @@ -67,8 +99,8 @@ int Fun4All_G4_Prototype4(int nEvents = 1) //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.)); + angle = theta*TMath::Pi()/180.; + 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()); @@ -83,7 +115,7 @@ int Fun4All_G4_Prototype4(int nEvents = 1) gun->set_name("geantino"); // gun->set_name("proton"); gun->set_vtx(0, 0, 0); - double angle = theta*TMath::Pi()/180.; + angle = theta*TMath::Pi()/180.; gun->set_mom(sin(angle),0.,cos(angle)); // se->registerSubsystem(gun); @@ -336,13 +368,13 @@ int Fun4All_G4_Prototype4(int nEvents = 1) if (ohcal_cell) { - hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); + PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); hccell->Detector("HCALOUT"); se->registerSubsystem(hccell); } if (ohcal_twr) { - hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); + Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); hcaltwr->Detector("HCALOUT"); hcaltwr->set_sim_tower_node_prefix("SIM"); se->registerSubsystem(hcaltwr); @@ -594,5 +626,8 @@ int Fun4All_G4_Prototype4(int nEvents = 1) delete se; // return 0; gSystem->Exit(0); - + return 0; } + +// for using QuickTest to check if macro loads +void RunLoadTest() {} From fb90244848ec0a2c84b5c6e62b15edb1bd11443c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:14:17 -0500 Subject: [PATCH 0199/1222] root6 compatible, root5/6 identical results --- macros/g4simulations/G4Setup_EICDetector.C | 61 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 2c96cb22a..af291d0f2 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -1,6 +1,37 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include "G4_Pipe.C" +#include "G4_Tracking_EIC.C" +#include "G4_PSTOF.C" +#include "G4_CEmc_EIC.C" +#include "G4_HcalIn_ref.C" +#include "G4_Magnet.C" +#include "G4_HcalOut_ref.C" +#include "G4_PlugDoor_EIC.C" +#include "G4_FEMC.C" +#include "G4_FHCAL.C" +#include "G4_EEMC.C" +#include "G4_DIRC.C" +#include "G4_RICH.C" +#include "G4_Aerogel.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) +#else bool overlapcheck = false; // set to true if you want to check for overlaps +double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#endif +void RunLoadTest() {} void G4Init(bool do_svtx = true, bool do_cemc = true, @@ -30,14 +61,12 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_PlugDoor_EIC.C"); PlugDoorInit(); } - if (do_svtx) { //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); gROOT->LoadMacro("G4_Tracking_EIC.C"); TrackingInit(); } - if (do_cemc) { gROOT->LoadMacro("G4_CEmc_EIC.C"); @@ -46,8 +75,8 @@ void G4Init(bool do_svtx = true, if (do_hcalin) { - gROOT->LoadMacro("G4_HcalIn_EIC.C"); - HCalInnerInit(); + gROOT->LoadMacro("G4_HcalIn_ref.C"); + HCalInnerInit(1); } if (do_magnet) @@ -103,7 +132,11 @@ void G4Init(bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + const EDecayType decayType = EDecayType::kAll, +#else + const EDecayType decayType = TPythia6Decayer::kAll, +#endif const bool do_svtx = true, const bool do_cemc = true, const bool do_hcalin = true, @@ -142,7 +175,12 @@ int G4Setup(const int absorberactive = 0, // (default is QGSP_BERT for speed) // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - if (decayType != TPythia6Decayer::kAll) { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + if (decayType != EDecayType::kAll) +#else + if (decayType != TPythia6Decayer::kAll) +#endif + { g4Reco->set_force_decay(decayType); } @@ -152,9 +190,9 @@ int G4Setup(const int absorberactive = 0, if (stringline.fail()) { // conversion to double fails -> we have a string if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); + g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); } else { - g4Reco->set_field_map(field, 2); + g4Reco->set_field_map(field, PHFieldConfig::kField2D); } } else { g4Reco->set_field(fieldstrength); // use const soleniodal field @@ -169,7 +207,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // SVTX - if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); + if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); //---------------------------------------- // CEMC @@ -271,6 +309,7 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); se->registerSubsystem( g4Reco ); + return 0; } From f0fec908339318d7992252b73f40131c022824bb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:15:10 -0500 Subject: [PATCH 0200/1222] root6 compatible, root5/6 identical results --- macros/g4simulations/G4_Aerogel.C | 7 +++++++ macros/g4simulations/G4_CEmc_EIC.C | 19 +++++++++++++++++++ macros/g4simulations/G4_DIRC.C | 8 ++++++++ 3 files changed, 34 insertions(+) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index 063f17d59..e55c035b4 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif // $Id: G4_Aerogel.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ /*! diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 314ce0815..d63d90303 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -1,3 +1,21 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif double cemcdepth = 9; // tungs to scint width ratio of ~10:1 @@ -138,6 +156,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc_cyl->SetActive(); cemc_cyl->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc_cyl); + return radius; } void CEMC_Cells(int verbosity = 0) { diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index 2b5486733..f46b7f9c6 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -1,3 +1,11 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif // $Id: G4_DIRC.C,v 1.3 2013/10/09 01:08:17 jinhuang Exp $ /*! From 88020b78fdb70056ea9a41d7877e14e1fbed3416 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:15:57 -0500 Subject: [PATCH 0201/1222] root6 compatible, root5/6 identical results --- .../g4simulations/G4_DSTReader_EICDetector.C | 9 +++++++- macros/g4simulations/G4_EEMC.C | 21 ++++++++++++++++++- macros/g4simulations/G4_GEM_EIC.C | 13 ++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index 4159a2060..19d5df9ba 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libg4eval.so) +#endif + ////////////////////////////////////////////////////////////////// /*! \file G4_DSTReader.C @@ -10,6 +17,7 @@ #include +void G4DSTreader_EICDetectorInit() {} void G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// int absorberactive = 1, // @@ -20,7 +28,6 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// 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_FHCAL = true, // bool do_FHCAL_twr = true, // diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index b84b375bb..4947a8cc7 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -1,3 +1,21 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif + using namespace std; const int use_projective_geometry = 0; void @@ -49,7 +67,8 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) eemc->OverlapCheck(overlapcheck); - if (absorberactive) eemc->SetAbsorberActive(); +// SetAbsorberActive method not implemented +// if (absorberactive) eemc->SetAbsorberActive(); /* register Ecal module */ g4Reco->registerSubsystem( eemc ); diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 4241dbfbb..70556a3bf 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,4 +1,13 @@ -using namespace std; +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +int make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, + double etamax, const int N_Sector = 8); +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); +R__LOAD_LIBRARY(libg4detectors.so) +#endif void EGEM_Init() @@ -258,5 +267,5 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); - + return 0; } From 23c77641e5854270d74f7e7b0a1e911cce5b867f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:16:51 -0500 Subject: [PATCH 0202/1222] root6 compatible, root5/6 identical results --- macros/g4simulations/G4_PSTOF.C | 6 ++++ macros/g4simulations/G4_PlugDoor_EIC.C | 7 ++++ macros/g4simulations/G4_RICH.C | 8 +++++ ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 35 +++++++++++++++++-- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C index d7f9acd06..703bee08b 100644 --- a/macros/g4simulations/G4_PSTOF.C +++ b/macros/g4simulations/G4_PSTOF.C @@ -1,3 +1,9 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif // $Id$ /*! diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 0c86e47d4..732fdd6c2 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -1,3 +1,10 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif void PlugDoorInit() {} void PlugDoor(PHG4Reco *g4Reco, diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 81070bfd0..f95e53194 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -1,3 +1,11 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + // $Id: G4_RICH.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ /*! diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 8ee2ca46e..ca9ee978f 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -1,3 +1,32 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4eval.so) +#endif + + #include // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" @@ -320,8 +349,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, } // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); - //PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); +// PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); + PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); sitrack->Verbosity(verbosity); sitrack->SetActive(1); sitrack->OverlapCheck(intt_overlapcheck); @@ -552,7 +581,7 @@ void Svtx_Cells(int verbosity = 0) string TPC_distortion_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - PHG4TPCSpaceChargeDistortion* tpc_distortion = + 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 From 27b1037d552a35fa71552a3255464f67443ad150 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:17:30 -0500 Subject: [PATCH 0203/1222] root6 compatible, root5/6 identical results --- macros/g4simulations/G4_Tracking_EIC.C | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 2ddacf756..d6a4ff386 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -1,3 +1,12 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +class SubsysReco; +R__LOAD_LIBRARY(libg4eval.so) +#endif + #include #include "G4_GEM_EIC.C" @@ -28,7 +37,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, /* Place central tracking detectors */ Svtx(g4Reco, radius); - return; + return radius; } void Tracking_Reco(int verbosity = 0) @@ -63,7 +72,7 @@ void Tracking_Reco(int verbosity = 0) //kalman->set_pat_rec_hit_finding_eff(1.); //kalman->set_pat_rec_noise_prob(0.); std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_MAPS","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - int dettypes[] = {PHG4TrackFastSim::Cylinder,PHG4TrackFastSim::Cylinder, + const PHG4TrackFastSim::DETECTOR_TYPE dettypes[] = {PHG4TrackFastSim::Cylinder,PHG4TrackFastSim::Cylinder, PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, @@ -133,6 +142,8 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // se->registerSubsystem( eval ); } +// this uses a library which is not in our build +/* void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) { gSystem->Load("libFastTrackingEval.so"); @@ -145,3 +156,4 @@ void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) return; } +*/ From 4be2c27433813fed713b9b3ce1ecd74cd85cf63d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 12 Nov 2018 23:21:56 -0500 Subject: [PATCH 0204/1222] root6 compatible, root5/6 identical results --- macros/g4simulations/Fun4All_G4_EICDetector.C | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 94383caab..b0c04b938 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -1,3 +1,44 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4Setup_EICDetector.C" +#include "G4_Bbc.C" +#include "G4_Global.C" +#include "G4_CaloTrigger.C" +#include "G4_Jets.C" +#include "G4_HIJetReco.C" +#include "G4_FwdJets.C" +#include "G4_DSTReader_EICDetector.C" +#include "DisplayOn.C" +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +#endif + +using namespace std; + 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", @@ -213,6 +254,7 @@ int Fun4All_G4_EICDetector( pythia6->set_config_file("phpythia6_ep.cfg"); se->registerSubsystem(pythia6); } +/* else if (runhepgen) { gSystem->Load("libsHEPGen.so"); @@ -225,6 +267,7 @@ int Fun4All_G4_EICDetector( hepgen->set_momentum_hadron(250); se->registerSubsystem(hepgen); } +*/ else if (runsartre) { // see coresoftware/generators/PHSartre/README for setup instructions @@ -310,10 +353,6 @@ int Fun4All_G4_EICDetector( { 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); @@ -353,10 +392,17 @@ int Fun4All_G4_EICDetector( // Detector description //--------------------- +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + G4Setup(absorberactive, magfield, EDecayType::kAll, + do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, + do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, + magfield_rescale); +#else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); +#endif } @@ -477,8 +523,9 @@ int Fun4All_G4_EICDetector( //---------------------- // Simulation evaluation //---------------------- - - if (do_svtx_eval) Fast_Tracking_Eval(string(outputFile) + "_g4svtx_eval.root"); +// commented out because +// Fast_Tracking_Eval function uses a library which is not part of our build +// if (do_svtx_eval) Fast_Tracking_Eval(string(outputFile) + "_g4svtx_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); @@ -535,7 +582,6 @@ int Fun4All_G4_EICDetector( /*bool*/ do_hcalout , /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , /*bool*/ do_hcalout_twr, /*bool*/ do_FHCAL, /*bool*/ do_FHCAL_twr, @@ -555,14 +601,14 @@ int Fun4All_G4_EICDetector( //----------------- if (nEvents < 0) { - return; + return 0; } // 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; + return 0; } se->run(nEvents); @@ -575,4 +621,9 @@ int Fun4All_G4_EICDetector( std::cout << "All done" << std::endl; delete se; gSystem->Exit(0); + return 0; } + +// This function is only used to test if we can load this as root6 macro +// without running into unresolved libraries and include files +void RunFFALoadTest() {} From f5297305e8da4896c3506744ff020bebef394d7f Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sun, 18 Nov 2018 00:31:24 -0500 Subject: [PATCH 0205/1222] MVTX sims code moved to g4mvtx and renamed - corresponding changes to tracking macro. --- macros/g4simulations/G4_Tracking.C | 131 ++++++++++++++++------------- 1 file changed, 73 insertions(+), 58 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index e8c3291fd..ecb7c653d 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -2,21 +2,20 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.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 @@ -24,7 +23,11 @@ #include #include #include +#include +#include R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) #endif @@ -60,46 +63,46 @@ const int n_maps_layer = 3; // must be 0-3, setting it to zero removes MVTX com #ifdef INTTLADDER8 int n_intt_layer = 8; // default layer configuration -int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default +int laddertype[8] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; // default int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; #endif #ifdef INTTLADDER6 int n_intt_layer = 6; -int laddertype[6] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI }; +int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI }; int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; #endif #ifdef INTTLADDER4_ZP int n_intt_layer = 4; -int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER4_PP int n_intt_layer = 4; -int laddertype[4] = {PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -143,12 +146,12 @@ double Tracking(PHG4Reco* g4Reco, double radius, for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { -if (verbosity) + 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]); + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", ilayer, stave_type[ilayer]); lyr->Verbosity(verbosity); lyr->set_double_param("layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm @@ -179,11 +182,11 @@ if (verbosity) 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 + // 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 - // PHG4SiliconTrackerSubsystem creates the detetor layer using PHG4SiliconTrackerDetector + // PHG4INTTSubsystem creates the detetor layer using PHG4INTTDetector // and instantiates the appropriate PHG4SteppingAction const double intt_radius_max = 140.; // including stagger radius (mm) @@ -196,7 +199,7 @@ if (verbosity) if (verbosity) cout << "Create strip tracker layer " << vpair[i].second << " as sphenix layer " << vpair[i].first << endl; } - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); + PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); sitrack->Verbosity(verbosity); sitrack->SetActive(1); sitrack->OverlapCheck(intt_overlapcheck); @@ -257,6 +260,10 @@ void Tracking_Cells(int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4tpc.so"); + gSystem->Load("libg4mvtx.so"); + gSystem->Load("libtpc.so"); + gSystem->Load("libintt.so"); + //--------------- // Fun4All server @@ -270,7 +277,7 @@ void Tracking_Cells(int verbosity = 0) if (n_maps_layer > 0) { // MAPS cells - PHG4MapsCellReco* maps_cells = new PHG4MapsCellReco("MAPS"); + PHG4MVTXCellReco* maps_cells = new PHG4MVTXCellReco("MVTX"); maps_cells->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { @@ -284,7 +291,7 @@ void Tracking_Cells(int verbosity = 0) if (n_intt_layer > 0) { // INTT cells - PHG4SiliconTrackerCellReco* reco = new PHG4SiliconTrackerCellReco("SILICON_TRACKER"); + PHG4INTTCellReco* reco = new PHG4INTTCellReco("INTT"); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here //reco->set_double_param("tmax",80.0); //reco->set_double_param("tmin",-20.0); @@ -351,12 +358,15 @@ void Tracking_Reco(int verbosity = 0) //---------------------------------- // Digitize the cell energy into ADC //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); + + // MVTX + PHG4SvtxDigitizer* digimvtx = new PHG4SvtxDigitizer(); + digimvtx->Verbosity(0); for (int i = 0; i < n_maps_layer; ++i) { - digi->set_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 + digimvtx->set_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 } + se->registerSubsystem(digimvtx); if (n_intt_layer > 0) { @@ -364,10 +374,10 @@ void Tracking_Reco(int verbosity = 0) if (INTTDeadMapOption != kINTTNoDeadMap) { // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); for (int i = 0; i < n_intt_layer; i++) { - const int database_strip_type = (laddertype[i] == PHG4SiliconTrackerDefs::SEGMENTATION_Z) ? 0 : 1; + const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); @@ -417,7 +427,7 @@ The result threshold table based on FPHX default value is as following | 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 PHG4SiliconTrackerDigitizer::set_adc_scale as 3-bit ADC threshold as fractions to MIP energy deposition. +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); @@ -429,7 +439,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz userrange.push_back(1.05232558139535); userrange.push_back(1.28617571059432); - PHG4SiliconTrackerDigitizer* digiintt = new PHG4SiliconTrackerDigitizer(); + PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); digiintt->Verbosity(verbosity); for (int i = 0; i < n_intt_layer; i++) { @@ -438,16 +448,17 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz se->registerSubsystem(digiintt); } - // TPC layers use the Svtx digitizer - digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); + // TPC + PHG4TPCDigitizer* digitpc = new PHG4TPCDigitizer(); + digitpc->SetTPCMinLayer(n_maps_layer + n_intt_layer); double ENC = 670.0; // standard - digi->SetENC(ENC); + digitpc->SetENC(ENC); double ADC_threshold = 4.0*ENC; - digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; - se->registerSubsystem(digi); + se->registerSubsystem(digitpc); //------------------------------------- // Apply Live Area Inefficiency to Hits @@ -492,25 +503,29 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz // Cluster Hits //------------- - // For the silicon layers - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer + n_intt_layer - 1); - clusterizer->Verbosity(verbosity); + // For the MVTX layers + PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); + mvtxclusterizer->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 + mvtxclusterizer->set_threshold(0.1); // fraction of a mip + se->registerSubsystem(mvtxclusterizer); + // For the INTT layers + INTTClusterizer* inttclusterizer = new INTTClusterizer("INTTClusterizer", n_maps_layer, n_maps_layer + 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { - if(laddertype[i-n_maps_layer] == PHG4SiliconTrackerDefs::SEGMENTATION_PHI) - clusterizer->set_z_clustering(i, false); + if(laddertype[i-n_maps_layer] == PHG4INTTDefs::SEGMENTATION_PHI) + inttclusterizer->set_z_clustering(i, false); } - se->registerSubsystem(clusterizer); + se->registerSubsystem(inttclusterizer); // For the TPC - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); + TPCClusterizer* tpcclusterizer = new TPCClusterizer(); tpcclusterizer->Verbosity(0); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); tpcclusterizer->setEnergyCut(15 /*adc*/); @@ -531,7 +546,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4SiliconTrackerDigitiz for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); From 333468e2979663f9a99ac4bd83cfe71fff09f835 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 21 Nov 2018 21:58:07 -0500 Subject: [PATCH 0206/1222] Switched to the MVTX clusterizer in offline/packages/mvtx. --- macros/g4simulations/G4_Tracking.C | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index ecb7c653d..4eb82750f 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -2,19 +2,14 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" #include -#include -#include #include #include #include -#include #include #include #include #include -#include #include -#include #include #include #include @@ -23,7 +18,13 @@ #include #include #include +#include +#include +#include +#include #include +#include +#include #include R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) @@ -263,6 +264,7 @@ void Tracking_Cells(int verbosity = 0) gSystem->Load("libg4mvtx.so"); gSystem->Load("libtpc.so"); gSystem->Load("libintt.so"); + gSystem->Load("libmvtx.so"); //--------------- @@ -360,7 +362,7 @@ void Tracking_Reco(int verbosity = 0) //---------------------------------- // MVTX - PHG4SvtxDigitizer* digimvtx = new PHG4SvtxDigitizer(); + PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); digimvtx->Verbosity(0); for (int i = 0; i < n_maps_layer; ++i) { @@ -504,7 +506,8 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad //------------- // For the MVTX layers - PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); + //PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); + MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); mvtxclusterizer->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 From 3fa2ee65e027ee01a4bac581b5101b441afff474 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 8 Dec 2018 10:32:50 -0500 Subject: [PATCH 0207/1222] Recover the default vis.mac to whole detector view --- macros/g4simulations/vis.mac | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index b228a9397..7cb605309 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -1,3 +1,18 @@ +Skip to content + +Search or jump to… + +Pull requests +Issues +Marketplace +Explore + @blackcathj Sign out +15 +4 45 sPHENIX-Collaboration/macros + Code Issues 1 Pull requests 2 Projects 0 Wiki Insights Settings +macros/macros/g4simulations/vis.mac +Newer Older + 100644 83 lines (82 sloc) 2.89 KB # $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ # # Macro file for the initialization phase of "exampleN03.cc" @@ -29,12 +44,11 @@ /vis/open OGLSX 1200x900-0+0 # increase display limit for more complex detectors /vis/ogl/set/displayListLimit 500000 -/vis/viewer/set/viewpointThetaPhi 0 0 -/vis/viewer/addCutawayPlane 0 0 0 m 0 0 0 +/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 # zooming by 4 makes it fill the display -/vis/viewer/zoom 20 -/vis/viewer/panTo 8 0 cm +/vis/viewer/zoom 1.5 # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. @@ -81,3 +95,16 @@ # 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. +© 2018 GitHub, Inc. +Terms +Privacy +Security +Status +Help +Contact GitHub +Pricing +API +Training +Blog +About +Press h to open a hovercard with more details. From d6934f8d6aea3904b55a4364b65f28ef5f26f19c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 8 Dec 2018 10:33:46 -0500 Subject: [PATCH 0208/1222] Strip copy errors --- macros/g4simulations/vis.mac | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 7cb605309..87415a626 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -1,18 +1,3 @@ -Skip to content - -Search or jump to… - -Pull requests -Issues -Marketplace -Explore - @blackcathj Sign out -15 -4 45 sPHENIX-Collaboration/macros - Code Issues 1 Pull requests 2 Projects 0 Wiki Insights Settings -macros/macros/g4simulations/vis.mac -Newer Older - 100644 83 lines (82 sloc) 2.89 KB # $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ # # Macro file for the initialization phase of "exampleN03.cc" @@ -44,11 +29,12 @@ Newer Older /vis/open OGLSX 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 +/vis/viewer/set/viewpointThetaPhi 0 0 +/vis/viewer/addCutawayPlane 0 0 0 m 0 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/zoom 30 +/vis/viewer/panTo 4 0 cm # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. @@ -95,16 +81,3 @@ Newer Older # 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. -© 2018 GitHub, Inc. -Terms -Privacy -Security -Status -Help -Contact GitHub -Pricing -API -Training -Blog -About -Press h to open a hovercard with more details. From 9aaa2e00fca3969874a1fcb34c897eb88888e593 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 8 Dec 2018 10:35:39 -0500 Subject: [PATCH 0209/1222] Recover the default vis.mac to whole detector view --- macros/g4simulations/vis.mac | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 87415a626..539d58b5d 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -29,12 +29,11 @@ /vis/open OGLSX 1200x900-0+0 # increase display limit for more complex detectors /vis/ogl/set/displayListLimit 500000 -/vis/viewer/set/viewpointThetaPhi 0 0 -/vis/viewer/addCutawayPlane 0 0 0 m 0 0 0 +/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 # zooming by 4 makes it fill the display -/vis/viewer/zoom 30 -/vis/viewer/panTo 4 0 cm +/vis/viewer/zoom 1.5 # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. From 8e838f595cfa22b3d85c9cd6efeb07c22cb6b2cd Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 9 Dec 2018 10:03:10 -0500 Subject: [PATCH 0210/1222] Update Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index b933f8dce..36363c17b 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -211,7 +211,7 @@ int Fun4All_G4_sPHENIX( PHPythia8 *pythia8 = new PHPythia8(); // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); + pythia8->set_config_file("phpythia8.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia8 if (readhepmc) pythia8->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available @@ -223,7 +223,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libPHPythia6.so"); PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); + pythia6->set_config_file("phpythia6.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia6 if (readhepmc) pythia6->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available From a66ffc6bff9f2a9d42319c66ef43cd62c39c6198 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Mon, 10 Dec 2018 15:48:24 -0500 Subject: [PATCH 0211/1222] Macros for configuring an Constituent Subtraction version of HI jet reconstruction. CS subtraction & the following jet reconstruction run in parallel to the ``default'' HI subtraction and reconstruction and do not interfere with it. --- macros/g4simulations/G4_HIJetReco.C | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index dcc871941..9d2099a97 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -16,7 +16,7 @@ R__LOAD_LIBRARY(libjetbackground.so) void HIJetRecoInit() {} -void HIJetReco(int verbosity = 0, bool do_flow = false ) { +void HIJetReco(int verbosity = 0, bool do_flow = false, bool do_CS = false ) { //--------------- // Load libraries @@ -83,7 +83,7 @@ void HIJetReco(int verbosity = 0, bool do_flow = false ) { st->Verbosity( verbosity ); se->registerSubsystem( st ); - towerjetreco = new JetReco(); + 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)); @@ -96,6 +96,31 @@ void HIJetReco(int verbosity = 0, bool do_flow = false ) { towerjetreco->Verbosity( verbosity ); se->registerSubsystem(towerjetreco); + if ( do_CS ) { + + SubtractTowersCS *stCS = new SubtractTowersCS(); + stCS->SetFlowModulation( 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; } From 33fe7b0b8ae2dbc63f1b8d33771db44da8f7bd87 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 11 Dec 2018 11:34:31 -0500 Subject: [PATCH 0212/1222] Modified MVTX timing window from +/- 2000 ns to +/- 5000 ns (also changed the default in the code to 5000 ns). --- macros/g4simulations/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 4eb82750f..42ae0829b 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -283,7 +283,8 @@ void Tracking_Cells(int verbosity = 0) maps_cells->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - maps_cells->set_timing_window(ilayer, -2000, 2000); + // override the default timing window for this layer - default is +/- 5000 ns + maps_cells->set_timing_window(ilayer, -5000, 5000); } se->registerSubsystem(maps_cells); } From 53d4d9b5f1a9ee7aeb5ae233bda6b49567631f04 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 20 Dec 2018 07:59:00 -0500 Subject: [PATCH 0213/1222] Update G4_Tracking.C This macro reintroduced the bug where the tpc distortion is declared twice which is okay with root5 but in root6 it went out of scope leaving a null ptr for the distortion --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 42ae0829b..e3d0f8138 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -311,7 +311,7 @@ void Tracking_Cells(int verbosity = 0) string TPC_distortion_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - PHG4TPCSpaceChargeDistortion* tpc_distortion = + 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 From 2b7439bb292dec0a42f852bca2a1836cc4331df5 Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Sat, 22 Dec 2018 14:48:03 -0500 Subject: [PATCH 0214/1222] added E864 cut module forward EMCal --- macros/g4simulations/G4_FEMC.C | 113 ++++++++++++++++++++++++--------- 1 file changed, 82 insertions(+), 31 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 8e6923279..8e6a3741c 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -16,6 +16,7 @@ R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) #endif + void FEMCInit() { @@ -51,7 +52,7 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) // fsPHENIX ECAL femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v003.txt"; cout << mapping_femc.str() << endl; @@ -74,7 +75,7 @@ void FEMC_Towers(int verbosity = 0) { // fsPHENIX ECAL mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; + "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v003.txt"; RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -84,40 +85,90 @@ void FEMC_Towers(int verbosity = 0) { 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 ); + //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 ); + //RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); + //TowerDigitizer2->Detector("FEMC"); + //TowerDigitizer2->TowerType(2); + //TowerDigitizer2->Verbosity(verbosity); + //TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + //se->registerSubsystem( TowerDigitizer2 ); + + // E864 towers (three types for three sizes) + RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); + TowerDigitizer3->Detector("FEMC"); + TowerDigitizer3->TowerType(3); + TowerDigitizer3->Verbosity(verbosity); + TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer3 ); + + RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); + TowerDigitizer4->Detector("FEMC"); + TowerDigitizer4->TowerType(4); + TowerDigitizer4->Verbosity(verbosity); + TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer4 ); + + RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); + TowerDigitizer5->Detector("FEMC"); + TowerDigitizer5->TowerType(5); + TowerDigitizer5->Verbosity(verbosity); + TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer5 ); // 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 ); + //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 ); + //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 ); + + // E864 towers (three types for three sizes) + RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); + TowerCalibration3->Detector("FEMC"); + TowerCalibration3->TowerType(3); + TowerCalibration3->Verbosity(verbosity); + TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration3->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration3 ); + + RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); + TowerCalibration4->Detector("FEMC"); + TowerCalibration4->TowerType(4); + TowerCalibration4->Verbosity(verbosity); + TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration4->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration4 ); + + RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); + TowerCalibration5->Detector("FEMC"); + TowerCalibration5->TowerType(5); + TowerCalibration5->Verbosity(verbosity); + TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration5->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration5 ); } @@ -130,7 +181,7 @@ void FEMC_Clusters(int verbosity = 0) { RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); ClusterBuilder->Detector("FEMC"); ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); + ClusterBuilder->set_threshold_energy(0.010); se->registerSubsystem( ClusterBuilder ); return; From bbf208589662841ea3b09abed8dbf2a7ad3dcb56 Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Sun, 23 Dec 2018 07:43:04 -0500 Subject: [PATCH 0215/1222] tuned sampling fraction --- macros/g4simulations/G4_FEMC.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 8e6a3741c..bd64f2a0a 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -148,7 +148,7 @@ void FEMC_Towers(int verbosity = 0) { TowerCalibration3->TowerType(3); TowerCalibration3->Verbosity(verbosity); TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 TowerCalibration3->set_pedstal_ADC(0); se->registerSubsystem( TowerCalibration3 ); @@ -157,7 +157,7 @@ void FEMC_Towers(int verbosity = 0) { TowerCalibration4->TowerType(4); TowerCalibration4->Verbosity(verbosity); TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 TowerCalibration4->set_pedstal_ADC(0); se->registerSubsystem( TowerCalibration4 ); @@ -166,7 +166,7 @@ void FEMC_Towers(int verbosity = 0) { TowerCalibration5->TowerType(5); TowerCalibration5->Verbosity(verbosity); TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.03084); // sampling fraction = 0.03084 + TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 TowerCalibration5->set_pedstal_ADC(0); se->registerSubsystem( TowerCalibration5 ); From 309d3e66397b564a0b2b355a8a154b80131f59e4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 23 Dec 2018 13:13:27 -0500 Subject: [PATCH 0216/1222] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 025ccc932..517010696 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This is the standard macros respository for [sPHENIX collaboration](https://www. # Get started -Please follow [SPHENIX software day-1 checklist](https://wiki.bnl.gov/sPHENIX/index.php/SPHENIX_software_day-1_checklist) to 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 @@ -55,4 +55,5 @@ root [] .x Fun4All_G4_sPHENIX.C(10) // run 10 events 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://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d1/df4/classJetEvaluator.html), [SvtxEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. From 4cacd1d1bd7d3837f8e75b132ff6733f4fdff7c3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 27 Dec 2018 23:58:39 -0500 Subject: [PATCH 0217/1222] electonr QA --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 59 +++++++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 36363c17b..dcea5e647 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -39,7 +39,7 @@ using namespace std; 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 *inputFile = "", const char *outputFile = "G4sPHENIX.root", const char *embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list") { @@ -168,7 +168,7 @@ int Fun4All_G4_sPHENIX( } Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); + se->Verbosity(01); // just if we set some flags somewhere in this macro recoConsts *rc = recoConsts::instance(); // By default every random number generator uses @@ -235,7 +235,7 @@ int Fun4All_G4_sPHENIX( { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("e-", 1); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { @@ -248,13 +248,13 @@ int Fun4All_G4_sPHENIX( 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_distribution_width(0.0, 0.0, 10.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, 20.0); + gen->set_pt_range(4, 4.0); gen->Embed(2); gen->Verbosity(0); @@ -561,6 +561,50 @@ int Fun4All_G4_sPHENIX( // if (do_dst_compress) DstCompress(out); // se->registerOutputManager(out); + { + assert(gSystem->Load("libqa_modules") >= 0); + + if (do_cemc) + se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC")); + if (do_hcalin) + se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN")); + if (do_hcalout) + se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT")); + + if (do_tracking && do_cemc && do_hcalin && do_hcalout) + { + QAG4SimulationCalorimeterSum *calo_qa = + new QAG4SimulationCalorimeterSum(); + // calo_qa->Verbosity(10); + se->registerSubsystem(calo_qa); + } + + if (do_jet_reco) + { + 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(20); + se->registerSubsystem(calo_jet7); + + QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + "AntiKt_Truth_r04"); + calo_jet7->add_reco_jet("AntiKt_Tower_r04"); + calo_jet7->add_reco_jet("AntiKt_Cluster_r04"); + calo_jet7->add_reco_jet("AntiKt_Track_r04"); + se->registerSubsystem(calo_jet7); + + QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + "AntiKt_Truth_r02"); + calo_jet7->add_reco_jet("AntiKt_Tower_r02"); + calo_jet7->add_reco_jet("AntiKt_Cluster_r02"); + calo_jet7->add_reco_jet("AntiKt_Track_r02"); + se->registerSubsystem(calo_jet7); + } + } + //----------------- // Event processing //----------------- @@ -587,6 +631,11 @@ int Fun4All_G4_sPHENIX( se->run(nEvents); + { + gSystem->Load("libqa_modules"); + QAHistManagerDef::saveQARootFile(string(outputFile) + "_qa.root"); + } + //----- // Exit //----- From ff7cf68dfc105d306caebcde115f60da8ad9c028 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 28 Dec 2018 00:11:49 -0500 Subject: [PATCH 0218/1222] input particle species --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index dcea5e647..664439e8d 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -39,7 +39,8 @@ using namespace std; int Fun4All_G4_sPHENIX( const int nEvents = 1, - const char *inputFile = "", + const char *inputFile = "e-", + const double inputpT = 4, const char *outputFile = "G4sPHENIX.root", const char *embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list") { @@ -235,7 +236,7 @@ int Fun4All_G4_sPHENIX( { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("e-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles(inputFile, 1); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { @@ -254,7 +255,7 @@ int Fun4All_G4_sPHENIX( 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(4, 4.0); + gen->set_pt_range(inputpT, inputpT); gen->Embed(2); gen->Verbosity(0); From 7c2db04120d011fe13ed80a5bf9ad63bb1c5e5e7 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 28 Dec 2018 09:58:50 -0500 Subject: [PATCH 0219/1222] eval off --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 664439e8d..6f22757da 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -94,7 +94,7 @@ int Fun4All_G4_sPHENIX( bool do_tracking = true; bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; - bool do_tracking_eval = do_tracking_track && true; + bool do_tracking_eval = do_tracking_track && false; bool do_pstof = false; @@ -108,7 +108,7 @@ int Fun4All_G4_sPHENIX( 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_hcalin_eval = do_hcalin_cluster && false; bool do_magnet = true; @@ -116,7 +116,7 @@ int Fun4All_G4_sPHENIX( 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_hcalout_eval = do_hcalout_cluster && false; //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; @@ -127,7 +127,7 @@ int Fun4All_G4_sPHENIX( 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; + bool do_jet_eval = do_jet_reco && false; // 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 From 27e49145b2e0d2b5decb3cc0dc98e98650d11fa3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 28 Dec 2018 22:17:03 -0500 Subject: [PATCH 0220/1222] eval off --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 6f22757da..7f408e44a 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -102,7 +102,7 @@ int Fun4All_G4_sPHENIX( 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_cemc_eval = do_cemc_cluster && false; bool do_hcalin = true; bool do_hcalin_cell = do_hcalin && true; From 7d22ed806d0d278b23bc963a1fbfd70bf182eabc Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 30 Dec 2018 14:37:57 -0500 Subject: [PATCH 0221/1222] Fix seed --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 7f408e44a..0f804a7d7 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -180,7 +180,7 @@ int Fun4All_G4_sPHENIX( // 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); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()); //----------------- // Event generation From 4149614016eb939a566cc9e67ae664cd166af724 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 30 Jan 2019 22:52:42 -0500 Subject: [PATCH 0222/1222] add calo qa drawing macros --- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 279 ++++++++++++ .../calorimeter/QA_Draw_CEMC_TowerCluster.C | 305 +++++++++++++ .../QA_Draw_Calorimeter_Sum_Cluster.C | 205 +++++++++ .../QA_Draw_Calorimeter_Sum_TrackProj.C | 170 +++++++ .../QA_Draw_Calorimeter_Sum_TrackProjEP.C | 181 ++++++++ macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 278 ++++++++++++ .../calorimeter/QA_Draw_HCALIN_TowerCluster.C | 312 +++++++++++++ macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 278 ++++++++++++ .../QA_Draw_HCALOUT_TowerCluster.C | 311 +++++++++++++ macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 422 ++++++++++++++++++ macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 356 +++++++++++++++ .../calorimeter/QA_Draw_Jet_TruthMatching.C | 305 +++++++++++++ macros/QA/calorimeter/QA_Draw_Utility.C | 327 ++++++++++++++ macros/QA/calorimeter/SaveCanvas.C | 146 ++++++ macros/QA/calorimeter/SetOKStyle.C | 107 +++++ 15 files changed, 3982 insertions(+) create mode 100644 macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C create mode 100644 macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C create mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C create mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C create mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C create mode 100644 macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C create mode 100644 macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C create mode 100644 macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C create mode 100644 macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C create mode 100644 macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C create mode 100644 macros/QA/calorimeter/QA_Draw_Jet_Summary.C create mode 100644 macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C create mode 100644 macros/QA/calorimeter/QA_Draw_Utility.C create mode 100644 macros/QA/calorimeter/SaveCanvas.C create mode 100644 macros/QA/calorimeter/SetOKStyle.C diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C new file mode 100644 index 000000000..90893a346 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C @@ -0,0 +1,279 @@ +// $Id: $ + +/*! + * \file QA_Draw_CEMC_G4Hit.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_CEMC_G4Hit( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") + +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, + 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_CEMC_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_XY", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_XY); + h_QAG4Sim_CEMC_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_CEMC_G4Hit_XY->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_CEMC_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_RZ", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_RZ); + h_QAG4Sim_CEMC_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_CEMC_G4Hit_RZ->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + + proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + + proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Sumw2(); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C new file mode 100644 index 000000000..507c5823f --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C @@ -0,0 +1,305 @@ +// $Id: $ + +/*! + * \file QA_Draw_CEMC_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_CEMC_TowerCluster( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") + +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_CEMC_TowerCluster", "QA_Draw_CEMC_TowerCluster", 1800, 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( + 1.5); + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, + 5); + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, + 5); + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + + proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + + proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C new file mode 100644 index 000000000..9bfaa20e8 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C @@ -0,0 +1,205 @@ +// $Id: $ + +/*! + * \file QA_Draw_Calorimeter_Sum_Cluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_Calorimeter_Sum_Cluster( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +//QA_Draw_Calorimeter_Sum_Cluster(const char * qa_file_name_new = +// "data/G4sPHENIXCells_100e24GeV.root_qa.root", +// const char * qa_file_name_ref = +// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + // obtain normalization + double Nevent_new = 1; + double Nevent_ref = 1; + + if (qa_file_new) + { + TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } + if (qa_file_ref) + { + TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } + + TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_Cluster", + "QA_Draw_Calorimeter_Sum_Cluster", 1800, 900); + c1->Divide(3, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->GetYaxis()->SetTitleOffset( + 1.5); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->Draw("COLZ"); + + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + { + + TH2F * h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->GetYaxis()->SetTitleOffset( + 1.5); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->Draw("COLZ"); + + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // empty pannel + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", + "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C new file mode 100644 index 000000000..11c4002f5 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C @@ -0,0 +1,170 @@ +// $Id: $ + +/*! + * \file QA_Draw_Calorimeter_Sum_TrackProj.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_Calorimeter_Sum_TrackProj( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +//QA_Draw_Calorimeter_Sum_TrackProj(const char * qa_file_name_new = +// "data/G4sPHENIXCells_100e24GeV.root_qa.root", +// const char * qa_file_name_ref = +// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + // obtain normalization + double Nevent_new = 1; + double Nevent_ref = 1; + + // obtain normalization + double Ntrack_new = 0; + double Ntrack_ref = 0; + + if (qa_file_new) + { + TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } + if (qa_file_ref) + { + TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } + + vector subsystems; + subsystems.push_back("CEMC"); + subsystems.push_back("HCALIN"); + subsystems.push_back("HCALOUT"); + + TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProj", + "QA_Draw_Calorimeter_Sum_TrackProj", 1100, 1100); + c1->Divide(3, 3); + int idx = 1; + TPad * p; + + for (int i = 0; i < subsystems.size(); ++i) + { + const TString subsystem(subsystems[i].c_str()); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_CalorimeterSum_TrackProj = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_TrackProj); + h_QAG4Sim_CalorimeterSum_TrackProj->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_CalorimeterSum_TrackProj->Draw("COLZ"); + + TH2F * h_QAG4Sim_CalorimeterSum_TrackProj_Ref = NULL; + if (qa_file_ref) + { + h_QAG4Sim_CalorimeterSum_TrackProj_Ref = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", + "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_TrackProj); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + // x projections + { + TH1 * h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_px")); + + h_new->Scale(1. / Ntrack_new); + + TH1 * h_ref = NULL; + if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) + { + TH1 * h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_px_ref")); + + h_ref->Scale(1. / Ntrack_ref); + } + + h_new->GetXaxis()->SetTitleOffset(1.05); + h_new->GetYaxis()->SetTitle("Energy / track / bin"); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + // y projections + { + TH1 * h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_py")); + + h_new->Scale(1. / Ntrack_new); + + TH1 * h_ref = NULL; + if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) + { + TH1 * h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_py_ref")); + + h_ref->Scale(1. / Ntrack_ref); + } + + h_new->GetXaxis()->SetTitleOffset(1.05); + h_new->GetYaxis()->SetTitle("Energy / track / bin"); + + DrawReference(h_new, h_ref); + } + + } + + PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); + + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C new file mode 100644 index 000000000..66f29c4b1 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C @@ -0,0 +1,181 @@ +// $Id: $ + +/*! + * \file QA_Draw_Calorimeter_Sum_TrackProjEP.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_Calorimeter_Sum_TrackProjEP( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +//QA_Draw_Calorimeter_Sum_TrackProjEP(const char * qa_file_name_new = +// "data/G4sPHENIXCells_100e24GeV.root_qa.root", +// const char * qa_file_name_ref = +// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + // obtain normalization + double Nevent_new = 1; + double Nevent_ref = 1; + + // obtain normalization + double Ntrack_new = 0; + double Ntrack_ref = 0; + + if (qa_file_new) + { + TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } + if (qa_file_ref) + { + TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } + + TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProjEP", + "QA_Draw_Calorimeter_Sum_TrackProjEP", 1800, 600); + c1->Divide(3, 1); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + if (Ntrack_new>0) + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Ntrack_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Ntrack_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / track / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + if (Ntrack_new>0) + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Ntrack_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Ntrack_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / track / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + if (Nevent_new>0) + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + if (h_new) + { + + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + } + + + PutInputFileName(c1,0.07, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C new file mode 100644 index 000000000..25c6564a0 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C @@ -0,0 +1,278 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALIN_G4Hit.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_HCALIN_G4Hit( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") + +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_G4Hit", "QA_Draw_HCALIN_G4Hit", + 1800, 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALIN_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_XY", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_XY); + h_QAG4Sim_HCALIN_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_HCALIN_G4Hit_XY->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALIN_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_RZ", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_RZ); + h_QAG4Sim_HCALIN_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_HCALIN_G4Hit_RZ->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + + proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + + proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); + assert(h_new); + + h_new->Rebin(2); +// h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .2); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C new file mode 100644 index 000000000..69919c216 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C @@ -0,0 +1,312 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALIN_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_HCALIN_TowerCluster( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_TowerCluster", + "QA_Draw_HCALIN_TowerCluster", 1800, 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( + 1.5); +// h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, +// 5); +// h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, +// 5); + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); + proj_new->Rebin(4); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); + + proj_new->Rebin(4); + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C new file mode 100644 index 000000000..45f27413f --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C @@ -0,0 +1,278 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALOUT_G4Hit.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_HCALOUT_G4Hit( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_G4Hit", "QA_Draw_HCALOUT_G4Hit", + 1800, 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALOUT_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_XY", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_XY); + h_QAG4Sim_HCALOUT_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_HCALOUT_G4Hit_XY->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALOUT_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_RZ", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_RZ); + h_QAG4Sim_HCALOUT_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_HCALOUT_G4Hit_RZ->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); + assert(h_new); + +// h_new->Rebin(2); +// h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); + + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); + + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C new file mode 100644 index 000000000..c80f72266 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C @@ -0,0 +1,311 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALOUT_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_HCALOUT_TowerCluster( + const char * qa_file_name_new = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", + const char * qa_file_name_ref = + "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_TowerCluster", + "QA_Draw_HCALOUT_TowerCluster", 1800, 900); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); +// h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); + assert(h_new); + + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogx(); + p->SetLogy(); + + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); + assert(h_new); + + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); + assert(h_ref); + + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( + 1.5); +// h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, +// 5); +// h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, +// 5); + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->Draw("COLZ"); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); + proj_new->Rebin(4); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + + TH1D * proj_new = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); + + proj_new->Rebin(4); + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D * proj_ref = NULL; + if (qa_file_ref) + { + TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + + proj_ref = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + + } + + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); +// proj_new->GetXaxis()->SetRangeUser(-10, 10); + + DrawReference(proj_new, proj_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + { + + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C new file mode 100644 index 000000000..b1cfa2d0e --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C @@ -0,0 +1,422 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALOUT_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +void +QA_Draw_Jet_Spectrum( + // +// const char * jet = "h_QAG4SimJet_AntiKt_Tower_r07", + const char * jet = "h_QAG4SimJet_AntiKt_Truth_r07", + const char * qa_file_name_new = + "data/G4sPHENIXCells_250jets25GeV.root_qa.root", + const char * qa_file_name_ref = + "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") +{ + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + // obtain normalization + double Nevent_new = 1; + double Nevent_ref = 1; + + if (qa_file_new) + { + TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } + if (qa_file_ref) + { + TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } + + TCanvas *c1 = new TCanvas(TString("QA_Draw_Jet_Spectrum_") + TString(jet), + TString("QA_Draw_Jet_Spectrum_") + TString(jet), 1800, 1000); + c1->Divide(4, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_eta"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_eta"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_phi"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_phi"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Et"), "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Et"), "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Mass"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Mass"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogx(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CompSize"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_CompSize"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + if (TString(jet).Contains("Truth")) + { + // truth jets + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F * h_ref = NULL; + if (qa_file_ref) + { + TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + } + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); +} + +// inclusive jet stuff. Not very interesting. + +// p = (TPad *) c1->cd(idx++); +// c1->Update(); +// p->SetLogy(); +// +// { +// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( +// TString(jet) + TString("_Inclusive_eta"), "TH1F"); +// assert(h_new); +// +//// h_new->Sumw2(); +// h_new->Scale(1. / Nevent_new); +// +// TH1F * h_ref = NULL; +// if (qa_file_ref) +// { +// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( +// TString(jet) + TString("_Inclusive_eta"), "TH1F"); +// assert(h_ref); +// +// h_ref->Scale(1. / Nevent_ref); +// } +// +// h_new->GetYaxis()->SetTitleOffset(1.5); +// h_new->GetYaxis()->SetTitle("Energy (GeV) / event / bin"); +// // h_new->GetXaxis()->SetRangeUser(-0, .1); +// +// DrawReference(h_new, h_ref); +// } +// +// p = (TPad *) c1->cd(idx++); +// c1->Update(); +// p->SetLogy(); +// +// { +// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( +// TString(jet) + TString("_Inclusive_phi"), "TH1F"); +// assert(h_new); +// +//// h_new->Sumw2(); +// h_new->Scale(1. / Nevent_new); +// +// TH1F * h_ref = NULL; +// if (qa_file_ref) +// { +// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( +// TString(jet) + TString("_Inclusive_phi"), "TH1F"); +// assert(h_ref); +// +// h_ref->Scale(1. / Nevent_ref); +// } +// +// h_new->GetYaxis()->SetTitleOffset(1.5); +// h_new->GetYaxis()->SetTitle("Energy (GeV) / event / bin"); +// // h_new->GetXaxis()->SetRangeUser(-0, .1); +// +// DrawReference(h_new, h_ref); +// } +// +// p = (TPad *) c1->cd(idx++); +// c1->Update(); +// p->SetLogy(); +// p->SetLogx(); +// +// { +// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( +// TString(jet) + TString("_Inclusive_E"), "TH1F"); +// assert(h_new); +// +// h_new->Sumw2(); +// h_new->Scale(1. / Nevent_new); +// +// TH1F * h_ref = NULL; +// if (qa_file_ref) +// { +// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( +// TString(jet) + TString("_Inclusive_E"), "TH1F"); +// assert(h_ref); +// +// h_ref->Scale(1. / Nevent_ref); +// } +// +// h_new->GetYaxis()->SetTitleOffset(1.5); +// h_new->GetYaxis()->SetTitle("Count / event / bin"); +// // h_new->GetXaxis()->SetRangeUser(-0, .1); +// +// DrawReference(h_new, h_ref); +// } + diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C new file mode 100644 index 000000000..3928db9e1 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C @@ -0,0 +1,356 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALOUT_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +#include "QA_Draw_Jet_TruthMatching.C" +using namespace std; + +void +QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", + const char * qa_file_name_new = + "data/G4sPHENIXCells_2000jets25GeV.root_qa.root", + const char * qa_file_name_ref = + "data/G4sPHENIXCells_250jets25GeV.root_qa.root") +{ + //! drawing energy range + const double min_Et = 10; + const double max_Et = 80; + + // style sets + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + // file IO + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + // buffer for results + vector vec_radius; + vector vec_phi_res; + vector vec_eta_res; + vector vec_e_res; + vector vec_et_res; + vector vec_reco_eff; + vector vec_purity; + + // list and process all jets + TList* hist_key_list = qa_file_new->GetListOfKeys(); + for (int i = 0; i < hist_key_list->GetSize(); ++i) + { + TString key_name = hist_key_list->At(i)->GetName(); + + TString s_re_fullname = Form( + "h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et", + jet_family); // regular expression for search + TRegexp re_fullname(s_re_fullname, false); + if (key_name.Index(re_fullname) == kNPOS) + continue; + +// cout << " key_name = " << key_name << endl; + TString jet_pair_name = key_name(0, + key_name.Length() - TString("_Matching_Count_Truth_Et").Length()); // remove suffix + +// cout << " jet_pair_name = " << jet_pair_name << endl; + + //get jet radius + TRegexp re_jetradius("_r[0-9]*", false); + Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius + index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius + assert(index_radius != kNPOS); + float radius = 0; + sscanf(key_name(index_radius, 100).Data(), "_r%f", &radius); +// cout << " index_radius = " << index_radius << endl; + assert(radius != 0); + radius /= 10; // jet radius convention in DST names + + cout << "QA_Draw_Jet_Summary - process jet pair " << jet_pair_name + << " with radius = " << radius << endl; + + vector resolution_efficiency_summary( + QA_Draw_Jet_TruthMatching(jet_pair_name, qa_file_name_new, + qa_file_name_ref)); + + //save results + vec_radius.push_back(radius); + vec_phi_res.push_back(resolution_efficiency_summary[0]); + vec_eta_res.push_back(resolution_efficiency_summary[1]); + vec_e_res.push_back(resolution_efficiency_summary[2]); + vec_et_res.push_back(resolution_efficiency_summary[3]); + vec_reco_eff.push_back(resolution_efficiency_summary[4]); + vec_purity.push_back(resolution_efficiency_summary[5]); + +// break; + } + + // plot + TCanvas *c1 = new TCanvas( + TString("QA_Draw_Jet_Summary_") + TString(jet_family), + TString("QA_Draw_Jet_Summary_") + TString(jet_family), 1800, 900); + c1->Divide(3, 2); + int idx = 1; + TPad * p; + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + TH1 * h_frame = + p->DrawFrame(min_Et, -.1, max_Et, .1, + TString(jet_family) + + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + TLine * l = new TLine(min_Et, 0, max_Et, 0); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + TLegend * legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_phi_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + h_frame = + p->DrawFrame(min_Et, -.1, max_Et, .1, + TString(jet_family) + + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + l = new TLine(min_Et, 0, max_Et, 0); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_eta_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, + TString(jet_family) + + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_e_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + h_frame = + p->DrawFrame(min_Et, 0, max_Et, 2, + TString(jet_family) + + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_et_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, + TString(jet_family) + + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_reco_eff[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + // ------------------------------------ + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, + TString(jet_family) + + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); + h_frame->GetYaxis()->SetTitleOffset(1.01); + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + p->SetGridx(0); + p->SetGridy(0); + legend = new TLegend(0.7, 0.2, .95, 0.5); + legend->SetFillColor(kWhite); + legend->SetFillStyle(1001); + legend->SetLineWidth(2); + legend->SetLineColor(kBlack); + legend->SetLineStyle(kSolid); + for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors* ge = vec_purity[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) + { + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar + } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } + legend->Draw(); + + PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); + +} + diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C new file mode 100644 index 000000000..d716be7d8 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C @@ -0,0 +1,305 @@ +// $Id: $ + +/*! + * \file QA_Draw_HCALOUT_TowerCluster.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +//some common style files +#include "SaveCanvas.C" +#include "SetOKStyle.C" +#include "QA_Draw_Utility.C" +using namespace std; + +vector +QA_Draw_Jet_TruthMatching(const char * jet = + "h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07", + const char * qa_file_name_new = + "data/G4sPHENIXCells_250jets25GeV.root_qa.root", + const char * qa_file_name_ref = + "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") +{ + //! drawing energy range + const double min_Et = 10; + const double max_Et = 80; + + SetOKStyle(); + gStyle->SetOptStat(0); + gStyle->SetOptFit(1111); + TVirtualFitter::SetDefaultFitter("Minuit2"); + + TFile * qa_file_new = new TFile(qa_file_name_new); + assert(qa_file_new->IsOpen()); + + TFile * qa_file_ref = NULL; + if (qa_file_name_ref) + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } + + vector resolution_collections; + + TCanvas *c1 = new TCanvas( + TString("QA_Draw_Jet_TruthMatching_") + TString(jet), + TString("QA_Draw_Jet_TruthMatching_") + TString(jet), 1800, 900); + c1->Divide(3, 2); + int idx = 1; + TPad * p; + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dPhi", "TH2F"); + + assert(proj_new); + + proj_new->Rebin2D(1, 5); + + TGraphErrors * ge = FitProfile(proj_new); + + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); + + TGraphErrors * ge_ref = NULL; + if (qa_file_ref) + { + TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dPhi", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors * ge_ref = FitProfile(proj_ref); + } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + + } + TLine * l = new TLine(min_Et, 0, max_Et, 00); + l->Draw(); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dEta", "TH2F"); + + assert(proj_new); + + proj_new->Rebin2D(1, 5); + TGraphErrors * ge = FitProfile(proj_new); + + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); + + TGraphErrors * ge_ref = NULL; + if (qa_file_ref) + { + TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dEta", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors * ge_ref = FitProfile(proj_ref); + } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } + l = new TLine(min_Et, 0, max_Et, 00); + l->Draw(); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dE", "TH2F"); + + assert(proj_new); + +// proj_new->Rebin2D(1,5); + + TGraphErrors * ge = FitProfile(proj_new); + + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); + + TGraphErrors * ge_ref = NULL; + if (qa_file_ref) + { + TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dE", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors * ge_ref = FitProfile(proj_ref); + } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dEt", "TH2F"); + + assert(proj_new); + +// proj_new->Rebin2D(1,5); + TGraphErrors * ge = FitProfile(proj_new); + + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); + + TGraphErrors * ge_ref = NULL; + if (qa_file_ref) + { + TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dEt", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors * ge_ref = FitProfile(proj_ref); + } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + + p = (TPad *) c1->cd(idx++); + c1->Update(); +// p->SetLogz(); + + { + + TH2F * h2 = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); + assert(h2); + + TH1 * h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); + // TH1 * h_pass = h2->ProjectionX( + // TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match + TH1 * h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + TH1 * h_ratio = GetBinominalRatio(h_pass, h_norm); + + h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); + h_ratio->GetYaxis()->SetTitle("Reco efficiency"); + h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); + + TH1 * h_ratio_ref = NULL; + if (qa_file_ref) + { + TH2F * h2 = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); + assert(h2); + TH1 * h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); +// TH1 * h_pass = h2->ProjectionX( +// TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match + TH1 * h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + } + + DrawReference(h_ratio, h_ratio_ref, true); + + resolution_collections.push_back(new TGraphErrors(h_ratio)); + } + + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + // p->SetLogz(); + + { + + TH2F * h2 = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); + assert(h2); + + TH1 * h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); +// TH1 * h_pass = h2->ProjectionX( +// TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match + TH1 * h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + TH1 * h_ratio = GetBinominalRatio(h_pass, h_norm); + + h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); + h_ratio->GetYaxis()->SetTitle("Reconstruction Purity"); + h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); + + TH1 * h_ratio_ref = NULL; + if (qa_file_ref) + { + TH2F * h2 = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); + assert(h2); + + TH1 * h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); + // TH1 * h_pass = h2->ProjectionX( + // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match + TH1 * h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + } + + DrawReference(h_ratio, h_ratio_ref, true); + + resolution_collections.push_back(new TGraphErrors(h_ratio)); + } + + l = new TLine(min_Et, 1, max_Et, 1); + l->Draw(); + + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); + + return resolution_collections; +} + diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C new file mode 100644 index 000000000..172496284 --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -0,0 +1,327 @@ +// $Id: $ + +/*! + * \file QA_Draw_Utility.C + * \brief + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#ifndef QA_Draw_Utility_C +#define QA_Draw_Utility_C + +#include +#include +#include +#include +#include +#include + +//! Draw 1D histogram along with its reference as shade +//! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) +void +DrawReference(TH1 * hnew, TH1 * href, bool draw_href_error = false) +{ + + hnew->SetLineColor(kBlue + 3); + hnew->SetMarkerColor(kBlue + 3); + hnew->SetLineWidth(2); + hnew->SetMarkerStyle(kFullCircle); + hnew->SetMarkerSize(1); + + if (href) + { + if (draw_href_error) + { + + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(kSolid); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(2); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + + } + else + { + + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(0); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(0); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + + } + + } + + hnew->Draw(); // set scale + + if (href) + { + if (draw_href_error) + { + href->DrawClone("E2 same"); + href->SetFillStyle(0); + href->SetLineWidth(8); + href->DrawClone("HIST same ]["); + } + else + href->Draw("HIST same"); + hnew->Draw("same"); // over lay data points + } +} + +//! Draw 1D TGraph along with its reference as shade +//! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) +void +DrawReference(TGraph * hnew, TGraph * href, bool draw_href_error = true) +{ + + hnew->SetLineColor(kBlue + 3); + hnew->SetMarkerColor(kBlue + 3); + hnew->SetLineWidth(2); + hnew->SetMarkerStyle(kFullCircle); + hnew->SetMarkerSize(1); + + if (href) + { + if (draw_href_error) + { + + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetFillStyle(0); + href->SetLineStyle(kSolid); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(4); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + + } + else + { + + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(0); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(0); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + + } + + } + + if (href) + { + if (draw_href_error) + { + href->DrawClone("E2"); + } + else + href->Draw("HIST same"); + hnew->Draw("p e"); // over lay data points + } +} + +//! Fit for resolution of TH2F +TGraphErrors * +FitResolution(const TH2F * h2, const bool normalize_mean = true) +{ + + TProfile * p2 = h2->ProfileX(); + + int n = 0; + double x[1000]; + double ex[1000]; + double y[1000]; + double ey[1000]; + + for (int i = 1; i <= h2->GetNbinsX(); i++) + { + TH1D * h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); + + if (h1->GetSum() < 10) + continue; + + TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, + p2->GetBinError(i) * 4); + + TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", + -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); + + fgaus.SetParameter(1, p2->GetBinContent(i)); + fgaus.SetParameter(2, p2->GetBinError(i)); + + h1->Fit(&fgaus, "MQ0"); + + x[n] = p2->GetBinCenter(i); + ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; + + const double norm = normalize_mean ? fgaus.GetParameter(1) : 1; + + y[n] = fgaus.GetParameter(2) / norm; + ey[n] = fgaus.GetParError(2) / norm; + + n++; + delete h1; + } + + TGraphErrors * ge = new TGraphErrors(n, x, y, 0, ey); + ge->SetName(TString(h2->GetName()) + "_FitResolution"); + + ge->SetLineColor(kBlue + 3); + ge->SetMarkerColor(kBlue + 3); + ge->SetLineWidth(2); + ge->SetMarkerStyle(kFullCircle); + ge->SetMarkerSize(1); + return ge; +} + +//! Fit for profile along the Y direction of TH2F +TGraphErrors * +FitProfile(const TH2F * h2) +{ + + TProfile * p2 = h2->ProfileX(); + + int n = 0; + double x[1000]; + double ex[1000]; + double y[1000]; + double ey[1000]; + + for (int i = 1; i <= h2->GetNbinsX(); i++) + { + TH1D * h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); + + if (h1->GetSum() < 10) + continue; + + TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, + p2->GetBinError(i) * 4); + + TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", + -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); + + fgaus.SetParameter(1, p2->GetBinContent(i)); + fgaus.SetParameter(2, p2->GetBinError(i)); + + h1->Fit(&fgaus, "MQ0"); + +// f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1), +// fgaus.GetParameter(2), fgaus.GetParameter(0) / 2, +// fgaus.GetParameter(2) / 4, 0); +// +// h1->Fit(&f2, "MQ0"); + +// new TCanvas; +// h1->Draw(); +// fgaus.Draw("same"); +// break; + + x[n] = p2->GetBinCenter(i); + ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; + y[n] = fgaus.GetParameter(1); + ey[n] = fgaus.GetParameter(2); + +// p2->SetBinContent(i, fgaus.GetParameter(1)); +// p2->SetBinError(i, fgaus.GetParameter(2)); + + n++; + delete h1; + } + + TGraphErrors * ge = new TGraphErrors(n, x, y, ex, ey); + ge->SetName(TString(h2->GetName()) + "_FitProfile"); + ge->SetLineColor(kBlue + 3); + ge->SetMarkerColor(kBlue + 3); + ge->SetLineWidth(2); + ge->SetMarkerStyle(kFullCircle); + ge->SetMarkerSize(1); + return ge; +} + +//!ratio between two histograms with binominal error based on Wilson score interval. Assuming each histogram is count. +TH1 * +GetBinominalRatio(TH1 * h_pass, TH1 * h_n_trial, bool process_zero_bins = false) +{ + assert(h_pass); + assert(h_n_trial); + + assert(h_pass->GetNbinsX() == h_n_trial->GetNbinsX()); + assert(h_pass->GetNbinsY() == h_n_trial->GetNbinsY()); + assert(h_pass->GetNbinsZ() == h_n_trial->GetNbinsZ()); + + TH1 * h_ratio = (TH1 *) h_pass->Clone(TString(h_pass->GetName()) + "_Ratio"); + assert(h_ratio); + h_ratio->Divide(h_n_trial); // a rough estimation first, also taking care of the overflow bins and zero bins + + for (int x = 1; x <= h_n_trial->GetNbinsX(); ++x) + for (int y = 1; y <= h_n_trial->GetNbinsY(); ++y) + for (int z = 1; z <= h_n_trial->GetNbinsZ(); ++z) + { + const double n_trial = h_n_trial->GetBinContent(x, y, z); + + if (n_trial > 0) + { + const double p = h_pass->GetBinContent(x, y, z) / n_trial; + + // Wilson score interval + h_ratio->SetBinContent(x, y, z, // + (p + 1 / (2 * n_trial)) / (1 + 1 / n_trial)); + h_ratio->SetBinError(x, y, + z, // + TMath::Sqrt( + 1. / n_trial * p * (1 - p) + 1. / (4 * n_trial * n_trial)) + / (1 + 1 / n_trial)); + } + else if (process_zero_bins) + { + + h_ratio->SetBinContent(x, y, z, 0.5); + h_ratio->SetBinError(x, y, z, 0.5); + } + } + + return h_ratio; +} + +//! Put input file name on the canvas +//! \param[in] c1 canvas pointer +//! \param[in] bottom height fraction height of the canvas to be used for this label +//! \param[in] new_file_name new file name being inspected +//! \param[in] ref_file_name reference file name +void +PutInputFileName(TCanvas * c1, const double height, const char * new_file_name, const char * ref_file_name) +{ + c1->cd(); + TPad *pad = new TPad("PutInputFileName","PutInputFileName",0,0,1,height, 18); + pad->Draw(); + pad->cd(); + + if (new_file_name) + { + TText * t = new TText(0.05,0.75,TString("New QA File: ")+TString(new_file_name)); + t->SetTextAlign(12); + t->SetTextColor(kBlue + 3); + t->SetTextSize(.4); + t->Draw(); + } + if (ref_file_name) + { + TText * t = new TText(0.05,0.25,TString("Reference QA File: ")+TString(ref_file_name)); + t->SetTextAlign(12); + t->SetTextColor(kGreen + 1); + t->SetTextSize(.4); + t->Draw(); + } +} + +#endif diff --git a/macros/QA/calorimeter/SaveCanvas.C b/macros/QA/calorimeter/SaveCanvas.C new file mode 100644 index 000000000..fa1554bb5 --- /dev/null +++ b/macros/QA/calorimeter/SaveCanvas.C @@ -0,0 +1,146 @@ +// $Id: $ + +/*! + * \file SaveCanvas.C + * \brief Save canvas as png, eps, cxx, root, etc. + * \author Jin Huang + * \version $Revision: $ + * \date $Date: $ + */ + +#ifndef SaveCanvas_C + +#define SaveCanvas_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +//! Service function to SaveCanvas() +void +SavePad(TPad * p) +{ + if (!p) + return; + + TList * l = p->GetListOfPrimitives(); +// l->Print(); + + TIter next(l); + TObject *obj = NULL; + while ((obj = next())) + { + + if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) + { + if ((TPad *) obj != p) + SavePad((TPad *) obj); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) + { + cout << "Save TH1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) + { + cout << "Save TF1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) + { + cout << "Save TGraph " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + } +} + +//! Save canvas to multiple formats +/*! + * @param[in] c pointer to the canvas + * @param[in] name Base of the file name. The default is the name of the cavas + * @param[in] bEPS true = save .eps and .pdf format too. + */ +void +SaveCanvas(TCanvas * c, TString name = "", Bool_t bEPS = kTRUE) +{ + if (name.Length() == 0) + name = c->GetName(); + + c->Print(name + ".png"); + + TDirectory * oldd = gDirectory; + + TString rootfilename; + + c->Print(rootfilename = name + ".root"); + + TFile f(rootfilename, "update"); + + SavePad(c); + + f.Close(); + + oldd->cd(); + + if (bEPS) + { +// c->Print(name + ".pdf"); + + float x = 20; + float y = 20; + gStyle->GetPaperSize(x, y); + + gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, + c->GetWindowHeight() / 72 * 2.54); +// c->Print(name + ".eps"); + c->Print(name + ".svg"); + gSystem->Exec("rsvg-convert -f pdf -o "+name + ".pdf " + name + ".svg"); + gSystem->Exec("rm -fv " + name + ".svg"); + + gStyle->SetPaperSize(x, y); + } + // c->Print(name+".C"); +} + +//! example to use this SaveCanvas() +/*! + * Output: + * The canvas data will be saved to RootFileName.root, as well as + * RootFileName.png for presentation and RootFileName.eps for Latex + * + * How to use RootFileName.root + * open RootFileName.root with root. + * It contains the canvas object "CanvasTest", which can be redraw with CanvasTest -> Draw() + * It also contains a copy of the histograms and graphs data for use in root again, e.g. + * root [3] h1->GetBinContent(30) + * + */ +void +example_save_canvas() +{ + + TCanvas *c1 = new TCanvas("CanvasTest", "CanvasTest", 800, 900); + + TH1F * h1 = new TH1F("h1", "histo from a gaussian", 100, -3, 3); + h1->FillRandom("gaus", 10000); + + h1->Draw(); + + // single call to save c1 to file RootFileName.* + SaveCanvas(c1, "RootFileName"); + +} + +#endif + diff --git a/macros/QA/calorimeter/SetOKStyle.C b/macros/QA/calorimeter/SetOKStyle.C new file mode 100644 index 000000000..b9311cc00 --- /dev/null +++ b/macros/QA/calorimeter/SetOKStyle.C @@ -0,0 +1,107 @@ + +#ifndef SetOKStyle_C +#define SetOKStyle_C + + +void +SetOKStyle() +{ + TStyle* OKStyle = new TStyle("OKStyle", "OK Default Style"); + + // Colors + + //set the background color to white + OKStyle->SetFillColor(10); + OKStyle->SetFrameFillColor(kWhite); + OKStyle->SetFrameFillStyle(0); + OKStyle->SetFillStyle(0); + OKStyle->SetCanvasColor(kWhite); + OKStyle->SetPadColor(kWhite); + OKStyle->SetTitleFillColor(0); + OKStyle->SetStatColor(kWhite); + + // Get rid of drop shadow on legends + // This doesn't seem to work. Call SetBorderSize(1) directly on your TLegends + OKStyle->SetLegendBorderSize(1); + + //don't put a colored frame around the plots + OKStyle->SetFrameBorderMode(0); + OKStyle->SetCanvasBorderMode(0); + OKStyle->SetPadBorderMode(0); + + //use the primary color palette + OKStyle->SetPalette(1, 0); + + //set the default line color for a histogram to be black + OKStyle->SetHistLineColor(kBlack); + + //set the default line color for a fit function to be red + OKStyle->SetFuncColor(kBlue); + + //make the axis labels black + OKStyle->SetLabelColor(kBlack, "xyz"); + + //set the default title color to be black + OKStyle->SetTitleColor(kBlack); + + //set the margins + OKStyle->SetPadBottomMargin(0.15); + OKStyle->SetPadLeftMargin(0.1); + OKStyle->SetPadTopMargin(0.075); + OKStyle->SetPadRightMargin(0.1); + + //set axis label and title text sizes + OKStyle->SetLabelSize(0.035, "xyz"); + OKStyle->SetTitleSize(0.05, "xyz"); + OKStyle->SetTitleOffset(0.9, "xyz"); + OKStyle->SetStatFontSize(0.035); + OKStyle->SetTextSize(0.05); + OKStyle->SetTitleBorderSize(0); + OKStyle->SetTitleStyle(0); + + OKStyle->SetLegendBorderSize(0); + + //set line widths + OKStyle->SetHistLineWidth(1); + OKStyle->SetFrameLineWidth(2); + OKStyle->SetFuncWidth(2); + + // Misc + + //align the titles to be centered + //OKStyle->SetTextAlign(22); + + //turn off xy grids + OKStyle->SetPadGridX(1); + OKStyle->SetPadGridY(1); + + //set the tick mark style + OKStyle->SetPadTickX(1); + OKStyle->SetPadTickY(1); + + //don't show the fit parameters in a box + OKStyle->SetOptFit(0); + + //set the default stats shown + OKStyle->SetOptStat(1); + + //marker settings +// OKStyle->SetMarkerStyle(8); +// OKStyle->SetMarkerSize(0.7); + + // Fonts + OKStyle->SetStatFont(42); + OKStyle->SetLabelFont(42, "xyz"); + OKStyle->SetTitleFont(42, "xyz"); + OKStyle->SetTextFont(42); + + // Set the paper size for output + OKStyle->SetPaperSize(TStyle::kUSLetter); + + //done + OKStyle->cd(); + + cout << "Using Jin's Style" << endl; +} + +#endif From 79fb605909a1fa1d2069cecb09514a3b7ce9bb9a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 30 Jan 2019 22:52:46 -0500 Subject: [PATCH 0223/1222] add calo qa drawing macros --- macros/QA/calorimeter/QA_Draw_ALL.sh | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 macros/QA/calorimeter/QA_Draw_ALL.sh diff --git a/macros/QA/calorimeter/QA_Draw_ALL.sh b/macros/QA/calorimeter/QA_Draw_ALL.sh new file mode 100755 index 000000000..f8536891e --- /dev/null +++ b/macros/QA/calorimeter/QA_Draw_ALL.sh @@ -0,0 +1,47 @@ +#! /bin/tcsh -f + +echo "Usage: $0 new_QA_file [ reference_QA_file ]"; + +set q = '"'; + +if ($# < 1) then + echo "Missing parameters: $*" + exit 1 +endif + +set new_QA_file = "$q$1$q"; +set reference_QA_file = 'NULL'; + + +if ($# >= 2) then + set reference_QA_file = "$q$2$q"; +endif + +echo "$0 - New QA file: $new_QA_file"; +echo "$0 - Reference QA file: $reference_QA_file"; + +set macros = (\ + QA_Draw_CEMC_G4Hit.C \ + QA_Draw_CEMC_TowerCluster.C \ + QA_Draw_HCALIN_G4Hit.C \ + QA_Draw_HCALIN_TowerCluster.C \ + QA_Draw_HCALOUT_G4Hit.C \ + QA_Draw_HCALOUT_TowerCluster.C \ + QA_Draw_Sum_Cluster.C \ + QA_Draw_Calorimeter_Sum_TrackProj.C \ + QA_Draw_Calorimeter_Sum_TrackProjEP.C \ +); + +# imake nstall-data +foreach macro ($macros) + root -b -q "$macro($new_QA_file, $reference_QA_file)" +end + +# last all jet stuff +root -b -q "QA_Draw_Jet_Spectrum.C(${q}h_QAG4SimJet_AntiKt_Truth_r07${q}, $new_QA_file, $reference_QA_file)" +root -b -q "QA_Draw_Jet_Spectrum.C(${q}h_QAG4SimJet_AntiKt_Tower_r07${q}, $new_QA_file, $reference_QA_file)" +root -b -q "QA_Draw_Jet_Summary.C(${q}AntiKt_Tower${q},$new_QA_file, $reference_QA_file)" + +echo "$0 - Output plots:"; +ls -lh $1*.png; + From 933267cd199ed663c437d047ecec59f3ac010384 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 30 Jan 2019 23:17:27 -0500 Subject: [PATCH 0224/1222] mv SaveCanvas to utility --- macros/QA/calorimeter/QA_Draw_Utility.C | 102 +++++++++++++++++ macros/QA/calorimeter/SaveCanvas.C | 146 ------------------------ 2 files changed, 102 insertions(+), 146 deletions(-) delete mode 100644 macros/QA/calorimeter/SaveCanvas.C diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index 172496284..b08fb380e 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -17,6 +17,108 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +//! Service function to SaveCanvas() +void +SavePad(TPad * p) +{ + if (!p) + return; + + TList * l = p->GetListOfPrimitives(); +// l->Print(); + + TIter next(l); + TObject *obj = NULL; + while ((obj = next())) + { + + if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) + { + if ((TPad *) obj != p) + SavePad((TPad *) obj); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) + { + cout << "Save TH1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) + { + cout << "Save TF1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) + { + cout << "Save TGraph " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + } +} + +//! Save canvas to multiple formats +/*! + * @param[in] c pointer to the canvas + * @param[in] name Base of the file name. The default is the name of the cavas + * @param[in] bEPS true = save .eps and .pdf format too. + */ +void +SaveCanvas(TCanvas * c, TString name = "", Bool_t bEPS = kTRUE) +{ + if (name.Length() == 0) + name = c->GetName(); + + c->Print(name + ".png"); + + TDirectory * oldd = gDirectory; + + TString rootfilename; + + c->Print(rootfilename = name + ".root"); + + TFile f(rootfilename, "update"); + + SavePad(c); + + f.Close(); + + oldd->cd(); + + if (bEPS) + { +// c->Print(name + ".pdf"); + + float x = 20; + float y = 20; + gStyle->GetPaperSize(x, y); + + gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, + c->GetWindowHeight() / 72 * 2.54); +// c->Print(name + ".eps"); + c->Print(name + ".svg"); + gSystem->Exec("rsvg-convert -f pdf -o "+name + ".pdf " + name + ".svg"); + gSystem->Exec("rm -fv " + name + ".svg"); + + gStyle->SetPaperSize(x, y); + } + // c->Print(name+".C"); +} + + + //! Draw 1D histogram along with its reference as shade //! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) diff --git a/macros/QA/calorimeter/SaveCanvas.C b/macros/QA/calorimeter/SaveCanvas.C deleted file mode 100644 index fa1554bb5..000000000 --- a/macros/QA/calorimeter/SaveCanvas.C +++ /dev/null @@ -1,146 +0,0 @@ -// $Id: $ - -/*! - * \file SaveCanvas.C - * \brief Save canvas as png, eps, cxx, root, etc. - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#ifndef SaveCanvas_C - -#define SaveCanvas_C - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; - -//! Service function to SaveCanvas() -void -SavePad(TPad * p) -{ - if (!p) - return; - - TList * l = p->GetListOfPrimitives(); -// l->Print(); - - TIter next(l); - TObject *obj = NULL; - while ((obj = next())) - { - - if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) - { - if ((TPad *) obj != p) - SavePad((TPad *) obj); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) - { - cout << "Save TH1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) - { - cout << "Save TF1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) - { - cout << "Save TGraph " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - } -} - -//! Save canvas to multiple formats -/*! - * @param[in] c pointer to the canvas - * @param[in] name Base of the file name. The default is the name of the cavas - * @param[in] bEPS true = save .eps and .pdf format too. - */ -void -SaveCanvas(TCanvas * c, TString name = "", Bool_t bEPS = kTRUE) -{ - if (name.Length() == 0) - name = c->GetName(); - - c->Print(name + ".png"); - - TDirectory * oldd = gDirectory; - - TString rootfilename; - - c->Print(rootfilename = name + ".root"); - - TFile f(rootfilename, "update"); - - SavePad(c); - - f.Close(); - - oldd->cd(); - - if (bEPS) - { -// c->Print(name + ".pdf"); - - float x = 20; - float y = 20; - gStyle->GetPaperSize(x, y); - - gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, - c->GetWindowHeight() / 72 * 2.54); -// c->Print(name + ".eps"); - c->Print(name + ".svg"); - gSystem->Exec("rsvg-convert -f pdf -o "+name + ".pdf " + name + ".svg"); - gSystem->Exec("rm -fv " + name + ".svg"); - - gStyle->SetPaperSize(x, y); - } - // c->Print(name+".C"); -} - -//! example to use this SaveCanvas() -/*! - * Output: - * The canvas data will be saved to RootFileName.root, as well as - * RootFileName.png for presentation and RootFileName.eps for Latex - * - * How to use RootFileName.root - * open RootFileName.root with root. - * It contains the canvas object "CanvasTest", which can be redraw with CanvasTest -> Draw() - * It also contains a copy of the histograms and graphs data for use in root again, e.g. - * root [3] h1->GetBinContent(30) - * - */ -void -example_save_canvas() -{ - - TCanvas *c1 = new TCanvas("CanvasTest", "CanvasTest", 800, 900); - - TH1F * h1 = new TH1F("h1", "histo from a gaussian", 100, -3, 3); - h1->FillRandom("gaus", 10000); - - h1->Draw(); - - // single call to save c1 to file RootFileName.* - SaveCanvas(c1, "RootFileName"); - -} - -#endif - From b6c14fc4be068a8259a3bcda7092a46811c34e72 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 30 Jan 2019 23:52:46 -0500 Subject: [PATCH 0225/1222] remove SaveCanvas.C --- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 1 - macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C | 1 - macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C | 1 - macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C | 1 - macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C | 1 - macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 1 - macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C | 1 - macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 1 - macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C | 1 - macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 1 - macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 1 - macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C | 1 - 12 files changed, 12 deletions(-) diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C index 90893a346..eb1e72552 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C index 507c5823f..655fd7d9a 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C index 9bfaa20e8..025c211e5 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C index 11c4002f5..4e43f0964 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C @@ -18,7 +18,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C index 66f29c4b1..a42364b38 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C index 25c6564a0..6c7627205 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C index 69919c216..79c379249 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C index 45f27413f..da1cac736 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C index c80f72266..5970671bd 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C index b1cfa2d0e..77b7aee2a 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C @@ -16,7 +16,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C index 3928db9e1..98ce41567 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C @@ -19,7 +19,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" #include "QA_Draw_Jet_TruthMatching.C" diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C index d716be7d8..a5b82ac88 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C @@ -18,7 +18,6 @@ #include //some common style files -#include "SaveCanvas.C" #include "SetOKStyle.C" #include "QA_Draw_Utility.C" using namespace std; From 6768cacc8659a123a69a2effc6bc900d133a41cf Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 30 Jan 2019 23:53:54 -0500 Subject: [PATCH 0226/1222] clang-format --- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 309 +++++++------- .../calorimeter/QA_Draw_CEMC_TowerCluster.C | 345 ++++++++------- .../QA_Draw_Calorimeter_Sum_Cluster.C | 211 +++++---- .../QA_Draw_Calorimeter_Sum_TrackProj.C | 176 ++++---- .../QA_Draw_Calorimeter_Sum_TrackProjEP.C | 188 ++++---- macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 305 +++++++------ .../calorimeter/QA_Draw_HCALIN_TowerCluster.C | 358 ++++++++-------- macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 303 +++++++------ .../QA_Draw_HCALOUT_TowerCluster.C | 358 ++++++++-------- macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 398 +++++++++-------- macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 335 +++++++-------- .../calorimeter/QA_Draw_Jet_TruthMatching.C | 348 ++++++++------- macros/QA/calorimeter/QA_Draw_Utility.C | 402 ++++++++---------- macros/QA/calorimeter/SetOKStyle.C | 8 +- 14 files changed, 1958 insertions(+), 2086 deletions(-) diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C index eb1e72552..657c4b7dc 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C @@ -8,53 +8,51 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_CEMC_G4Hit( - const char * qa_file_name_new = +void QA_Draw_CEMC_G4Hit( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, - 900); + 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_CEMC_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_CEMC_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_XY", "TH2F"); assert(h_QAG4Sim_CEMC_G4Hit_XY); h_QAG4Sim_CEMC_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); @@ -64,7 +62,7 @@ QA_Draw_CEMC_G4Hit( c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_CEMC_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_CEMC_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_RZ", "TH2F"); assert(h_QAG4Sim_CEMC_G4Hit_RZ); h_QAG4Sim_CEMC_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); @@ -72,207 +70,198 @@ QA_Draw_CEMC_G4Hit( p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + // p->SetLogz(); - TH1D * proj_new = - h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); + { + TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - proj_new->Scale(1. / proj_new->GetSum()); + TH1D *proj_new = + h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + proj_new->Scale(1. / proj_new->GetSum()); - proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); + TH1D *proj_new = + h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); - TH1D * proj_new = - h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); + proj_new->Scale(1. / proj_new->GetSum()); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogx(); + // p->SetLogx(); p->SetLogy(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Sumw2(); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(2); + h_ref->Sumw2(); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C index 655fd7d9a..eaa199d2d 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C @@ -8,297 +8,288 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_CEMC_TowerCluster( - const char * qa_file_name_new = +void QA_Draw_CEMC_TowerCluster( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_CEMC_TowerCluster", "QA_Draw_CEMC_TowerCluster", 1800, 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( 1.5); h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, - 5); + 5); h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, - 5); + 5); h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->Draw("COLZ"); p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { - - TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - TH1D * proj_new = - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); + { + TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - proj_new->Scale(1. / proj_new->GetSum()); + TH1D *proj_new = + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); + proj_new->Scale(1. / proj_new->GetSum()); - proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - TH1D * proj_new = - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); + TH1D *proj_new = + h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); - proj_new->Scale(1. / proj_new->GetSum()); + proj_new->Scale(1. / proj_new->GetSum()); - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); + PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C index 025c211e5..f5d7a26ce 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C @@ -8,103 +8,97 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_Calorimeter_Sum_Cluster( - const char * qa_file_name_new = +void QA_Draw_Calorimeter_Sum_Cluster( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") //QA_Draw_Calorimeter_Sum_Cluster(const char * qa_file_name_new = // "data/G4sPHENIXCells_100e24GeV.root_qa.root", // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } // obtain normalization double Nevent_new = 1; double Nevent_ref = 1; if (qa_file_new) - { - TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } if (qa_file_ref) - { - TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_Cluster", - "QA_Draw_Calorimeter_Sum_Cluster", 1800, 900); + "QA_Draw_Calorimeter_Sum_Cluster", 1800, 900); c1->Divide(3, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - { - - TH2F * h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN", "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->GetYaxis()->SetTitleOffset( - 1.5); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->Draw("COLZ"); - - } + { + TH2F *h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->GetYaxis()->SetTitleOffset( + 1.5); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->Draw("COLZ"); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - { - - TH2F * h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT", "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->GetYaxis()->SetTitleOffset( - 1.5); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->Draw("COLZ"); - - } + { + TH2F *h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->GetYaxis()->SetTitleOffset( + 1.5); + h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->Draw("COLZ"); + } p = (TPad *) c1->cd(idx++); c1->Update(); @@ -114,91 +108,90 @@ QA_Draw_Calorimeter_Sum_Cluster( c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); + assert(h_new); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); + assert(h_new); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", - "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", + "TH1F"); + assert(h_ref); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_new); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C index 4e43f0964..5080e3ddf 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C @@ -8,46 +8,44 @@ * \date $Date: $ */ -#include -#include -#include #include -#include #include +#include #include #include +#include +#include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_Calorimeter_Sum_TrackProj( - const char * qa_file_name_new = +void QA_Draw_Calorimeter_Sum_TrackProj( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") //QA_Draw_Calorimeter_Sum_TrackProj(const char * qa_file_name_new = // "data/G4sPHENIXCells_100e24GeV.root_qa.root", // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } // obtain normalization double Nevent_new = 1; @@ -58,23 +56,23 @@ QA_Draw_Calorimeter_Sum_TrackProj( double Ntrack_ref = 0; if (qa_file_new) - { - TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } + { + TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } if (qa_file_ref) - { - TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } vector subsystems; subsystems.push_back("CEMC"); @@ -82,88 +80,86 @@ QA_Draw_Calorimeter_Sum_TrackProj( subsystems.push_back("HCALOUT"); TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProj", - "QA_Draw_Calorimeter_Sum_TrackProj", 1100, 1100); + "QA_Draw_Calorimeter_Sum_TrackProj", 1100, 1100); c1->Divide(3, 3); int idx = 1; - TPad * p; + TPad *p; for (int i = 0; i < subsystems.size(); ++i) + { + const TString subsystem(subsystems[i].c_str()); + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); + + TH2F *h_QAG4Sim_CalorimeterSum_TrackProj = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", "TH2F"); + assert(h_QAG4Sim_CalorimeterSum_TrackProj); + h_QAG4Sim_CalorimeterSum_TrackProj->GetYaxis()->SetTitleOffset(1.5); + h_QAG4Sim_CalorimeterSum_TrackProj->Draw("COLZ"); + + TH2F *h_QAG4Sim_CalorimeterSum_TrackProj_Ref = NULL; + if (qa_file_ref) { - const TString subsystem(subsystems[i].c_str()); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F * h_QAG4Sim_CalorimeterSum_TrackProj = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", "TH2F"); + h_QAG4Sim_CalorimeterSum_TrackProj_Ref = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", + "TH2F"); assert(h_QAG4Sim_CalorimeterSum_TrackProj); - h_QAG4Sim_CalorimeterSum_TrackProj->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_CalorimeterSum_TrackProj->Draw("COLZ"); - - TH2F * h_QAG4Sim_CalorimeterSum_TrackProj_Ref = NULL; - if (qa_file_ref) - { - h_QAG4Sim_CalorimeterSum_TrackProj_Ref = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", - "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_TrackProj); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); + } - // x projections - { - TH1 * h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_px")); + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); - h_new->Scale(1. / Ntrack_new); + // x projections + { + TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px")); - TH1 * h_ref = NULL; - if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) - { - TH1 * h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_px_ref")); + h_new->Scale(1. / Ntrack_new); - h_ref->Scale(1. / Ntrack_ref); - } + TH1 *h_ref = NULL; + if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) + { + TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); - h_new->GetXaxis()->SetTitleOffset(1.05); - h_new->GetYaxis()->SetTitle("Energy / track / bin"); + h_ref->Scale(1. / Ntrack_ref); + } - DrawReference(h_new, h_ref); - } + h_new->GetXaxis()->SetTitleOffset(1.05); + h_new->GetYaxis()->SetTitle("Energy / track / bin"); - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); + DrawReference(h_new, h_ref); + } - // y projections - { - TH1 * h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_py")); + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogz(); - h_new->Scale(1. / Ntrack_new); + // y projections + { + TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py")); - TH1 * h_ref = NULL; - if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) - { - TH1 * h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName()+TString("_py_ref")); + h_new->Scale(1. / Ntrack_new); - h_ref->Scale(1. / Ntrack_ref); - } + TH1 *h_ref = NULL; + if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) + { + TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); - h_new->GetXaxis()->SetTitleOffset(1.05); - h_new->GetYaxis()->SetTitle("Energy / track / bin"); + h_ref->Scale(1. / Ntrack_ref); + } - DrawReference(h_new, h_ref); - } + h_new->GetXaxis()->SetTitleOffset(1.05); + h_new->GetYaxis()->SetTitle("Energy / track / bin"); + DrawReference(h_new, h_ref); } + } PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C index a42364b38..d1fb4add9 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C @@ -8,44 +8,42 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_Calorimeter_Sum_TrackProjEP( - const char * qa_file_name_new = +void QA_Draw_Calorimeter_Sum_TrackProjEP( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") //QA_Draw_Calorimeter_Sum_TrackProjEP(const char * qa_file_name_new = // "data/G4sPHENIXCells_100e24GeV.root_qa.root", // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } // obtain normalization double Nevent_new = 1; @@ -56,125 +54,121 @@ QA_Draw_Calorimeter_Sum_TrackProjEP( double Ntrack_ref = 0; if (qa_file_new) - { - TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } + { + TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); + + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } if (qa_file_ref) - { - TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); + assert(h_norm); - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); + } TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProjEP", - "QA_Draw_Calorimeter_Sum_TrackProjEP", 1800, 600); + "QA_Draw_Calorimeter_Sum_TrackProjEP", 1800, 600); c1->Divide(3, 1); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - if (Ntrack_new>0) + if (Ntrack_new > 0) + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Ntrack_new); + + TH1F *h_ref = NULL; + if (qa_file_ref) { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); - assert(h_new); + assert(h_ref); - h_new->Sumw2(); - h_new->Scale(1. / Ntrack_new); + h_ref->Scale(1. / Ntrack_ref); + } - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); - assert(h_ref); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / track / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - h_ref->Scale(1. / Ntrack_ref); - } + DrawReference(h_new, h_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / track / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); - DrawReference(h_new, h_ref); + if (Ntrack_new > 0) + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); + assert(h_new); + + h_new->Sumw2(); + h_new->Scale(1. / Ntrack_new); + + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); + assert(h_ref); + + h_ref->Scale(1. / Ntrack_ref); } + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / track / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - if (Ntrack_new>0) + if (Nevent_new > 0) + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + if (h_new) { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); - assert(h_new); - h_new->Sumw2(); - h_new->Scale(1. / Ntrack_new); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; + TH1F *h_ref = NULL; if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); - assert(h_ref); + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / Ntrack_ref); - } + h_ref->Scale(1. / Nevent_ref); + } h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / track / bin"); + h_new->GetYaxis()->SetTitle("Count / event / bin"); // h_new->GetXaxis()->SetRangeUser(-0, .1); DrawReference(h_new, h_ref); } + } - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - if (Nevent_new>0) - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - if (h_new) - { - - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - } - - - PutInputFileName(c1,0.07, qa_file_name_new, qa_file_name_ref); + PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C index 6c7627205..2b3b59c03 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C @@ -8,53 +8,51 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_HCALIN_G4Hit( - const char * qa_file_name_new = +void QA_Draw_HCALIN_G4Hit( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_G4Hit", "QA_Draw_HCALIN_G4Hit", - 1800, 900); + 1800, 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALIN_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_HCALIN_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_XY", "TH2F"); assert(h_QAG4Sim_HCALIN_G4Hit_XY); h_QAG4Sim_HCALIN_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); @@ -64,7 +62,7 @@ QA_Draw_HCALIN_G4Hit( c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALIN_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_HCALIN_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_RZ", "TH2F"); assert(h_QAG4Sim_HCALIN_G4Hit_RZ); h_QAG4Sim_HCALIN_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); @@ -72,206 +70,197 @@ QA_Draw_HCALIN_G4Hit( p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + // p->SetLogz(); - TH1D * proj_new = - h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); + { + TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - proj_new->Scale(1. / proj_new->GetSum()); + TH1D *proj_new = + h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + proj_new->Scale(1. / proj_new->GetSum()); - proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); + TH1D *proj_new = + h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); - TH1D * proj_new = - h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); + proj_new->Scale(1. / proj_new->GetSum()); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - } + proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogx(); + // p->SetLogx(); p->SetLogy(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); - assert(h_new); - - h_new->Rebin(2); -// h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(2); + // h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .2); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .2); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C index 79c379249..d027df5b0 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C @@ -8,304 +8,294 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_HCALIN_TowerCluster( - const char * qa_file_name_new = +void QA_Draw_HCALIN_TowerCluster( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_TowerCluster", - "QA_Draw_HCALIN_TowerCluster", 1800, 900); + "QA_Draw_HCALIN_TowerCluster", 1800, 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( 1.5); -// h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, -// 5); -// h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, -// 5); + // h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, + // 5); + // h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, + // 5); h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->Draw("COLZ"); p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + TH1D *proj_new = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); + proj_new->Rebin(4); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); - proj_new->Rebin(4); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); + + TH1D *proj_new = + h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); + + proj_new->Rebin(4); + proj_new->Scale(1. / proj_new->GetSum()); - TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); - - proj_new->Rebin(4); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C index da1cac736..af0bfb08e 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C @@ -8,52 +8,50 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_HCALOUT_G4Hit( - const char * qa_file_name_new = +void QA_Draw_HCALOUT_G4Hit( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_G4Hit", "QA_Draw_HCALOUT_G4Hit", - 1800, 900); + 1800, 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALOUT_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_HCALOUT_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_XY", "TH2F"); assert(h_QAG4Sim_HCALOUT_G4Hit_XY); h_QAG4Sim_HCALOUT_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); @@ -63,7 +61,7 @@ QA_Draw_HCALOUT_G4Hit( c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALOUT_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h_QAG4Sim_HCALOUT_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_RZ", "TH2F"); assert(h_QAG4Sim_HCALOUT_G4Hit_RZ); h_QAG4Sim_HCALOUT_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); @@ -71,207 +69,198 @@ QA_Draw_HCALOUT_G4Hit( p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + TH1D *proj_new = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); - TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); + + TH1D *proj_new = + h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); + + proj_new->Scale(1. / proj_new->GetSum()); - TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized energy per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogx(); + // p->SetLogx(); p->SetLogy(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(20); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(20); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); - assert(h_new); - -// h_new->Rebin(2); -// h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + // h_new->Rebin(2); + // h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_new); - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(4); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); + assert(h_ref); - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(4); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C index 5970671bd..450f0660d 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C @@ -8,303 +8,293 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_HCALOUT_TowerCluster( - const char * qa_file_name_new = +void QA_Draw_HCALOUT_TowerCluster( + const char *qa_file_name_new = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_TowerCluster", - "QA_Draw_HCALOUT_TowerCluster", 1800, 900); + "QA_Draw_HCALOUT_TowerCluster", 1800, 900); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); -// h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); + assert(h_new); - h_new->Scale(1. / h_new->GetSum()); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); + assert(h_ref); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogx(); p->SetLogy(); - { - - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); + assert(h_new); - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(40); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); + assert(h_ref); - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(40); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogz(); - TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = (TH2F *) qa_file_new->GetObjectChecked( "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( 1.5); -// h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, -// 5); -// h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, -// 5); + // h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, + // 5); + // h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, + // 5); h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->Draw("COLZ"); p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + TH1D *proj_new = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( + "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); + proj_new->Rebin(4); + + proj_new->Scale(1. / proj_new->GetSum()); + + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); - proj_new->Rebin(4); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); // p->SetLogz(); - { + { + TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); + assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); + + TH1D *proj_new = + h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( + "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); + + proj_new->Rebin(4); + proj_new->Scale(1. / proj_new->GetSum()); - TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( + TH1D *proj_ref = NULL; + if (qa_file_ref) + { + TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = + (TH2F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - TH1D * proj_new = + proj_ref = h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); - - proj_new->Rebin(4); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D * proj_ref = NULL; - if (qa_file_ref) - { - TH2F * h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - - } + "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); + proj_ref->Rebin(4); + proj_ref->Scale(1. / proj_ref->GetSum()); + } - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); -// proj_new->GetXaxis()->SetRangeUser(-10, 10); + proj_new->GetYaxis()->SetTitleOffset(1.); + proj_new->GetXaxis()->SetTitleOffset(1.); + proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); + // proj_new->GetXaxis()->SetRangeUser(-10, 10); - DrawReference(proj_new, proj_ref); - } + DrawReference(proj_new, proj_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); + assert(h_new); - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / h_new->GetSum()); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } + h_ref->Rebin(2); + h_ref->Scale(1. / h_ref->GetSum()); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Probability per bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } - diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C index 77b7aee2a..7862eb550 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C @@ -8,278 +8,311 @@ * \date $Date: $ */ -#include #include -#include #include +#include #include #include +#include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_Jet_Spectrum( +void QA_Draw_Jet_Spectrum( // -// const char * jet = "h_QAG4SimJet_AntiKt_Tower_r07", - const char * jet = "h_QAG4SimJet_AntiKt_Truth_r07", - const char * qa_file_name_new = + // const char * jet = "h_QAG4SimJet_AntiKt_Tower_r07", + const char *jet = "h_QAG4SimJet_AntiKt_Truth_r07", + const char *qa_file_name_new = "data/G4sPHENIXCells_250jets25GeV.root_qa.root", - const char * qa_file_name_ref = + const char *qa_file_name_ref = "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") { - SetOKStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } // obtain normalization double Nevent_new = 1; double Nevent_ref = 1; if (qa_file_new) - { - TH1D * h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Normalization"), "TH1D"); + assert(h_norm); - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } + Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } if (qa_file_ref) - { - TH1D * h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Normalization"), "TH1D"); - assert(h_norm); + { + TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Normalization"), "TH1D"); + assert(h_norm); - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } + Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); + } TCanvas *c1 = new TCanvas(TString("QA_Draw_Jet_Spectrum_") + TString(jet), - TString("QA_Draw_Jet_Spectrum_") + TString(jet), 1800, 1000); + TString("QA_Draw_Jet_Spectrum_") + TString(jet), 1800, 1000); c1->Divide(4, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_eta"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_eta"), "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_eta"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_eta"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_phi"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_phi"), "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_phi"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_phi"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Et"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Et"), "TH1F"); + assert(h_new); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Et"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Et"), "TH1F"); + assert(h_ref); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Mass"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Mass"), "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Mass"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Mass"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogx(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_CompSize"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CompSize"), "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CompSize"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_CompSize"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); - assert(h_new); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); + assert(h_new); - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); - assert(h_ref); + TH1F *h_ref = NULL; + if (qa_file_ref) + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); - DrawReference(h_new, h_ref); - } + DrawReference(h_new, h_ref); + } p = (TPad *) c1->cd(idx++); c1->Update(); p->SetLogy(); + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); + assert(h_new); + + h_new->Rebin(2); + h_new->Sumw2(); + h_new->Scale(1. / Nevent_new); + + TH1F *h_ref = NULL; + if (qa_file_ref) { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); + assert(h_ref); + + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } + + h_new->GetYaxis()->SetTitleOffset(1.5); + h_new->GetYaxis()->SetTitle("Count / event / bin"); + // h_new->GetXaxis()->SetRangeUser(-0, .1); + + DrawReference(h_new, h_ref); + } + + if (TString(jet).Contains("Truth")) + { + // truth jets + + p = (TPad *) c1->cd(idx++); + c1->Update(); + p->SetLogy(); + + { + TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( + TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); assert(h_new); h_new->Rebin(2); h_new->Sumw2(); h_new->Scale(1. / Nevent_new); - TH1F * h_ref = NULL; + TH1F *h_ref = NULL; if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); - assert(h_ref); + { + TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); + assert(h_ref); - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } + h_ref->Rebin(2); + h_ref->Scale(1. / Nevent_ref); + } h_new->GetYaxis()->SetTitleOffset(1.5); h_new->GetYaxis()->SetTitle("Count / event / bin"); @@ -287,43 +320,7 @@ QA_Draw_Jet_Spectrum( DrawReference(h_new, h_ref); } - - if (TString(jet).Contains("Truth")) - { - // truth jets - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F * h_ref = NULL; - if (qa_file_ref) - { - TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - } + } PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); @@ -418,4 +415,3 @@ QA_Draw_Jet_Spectrum( // // DrawReference(h_new, h_ref); // } - diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C index 98ce41567..52225b8c6 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C @@ -8,28 +8,27 @@ * \date $Date: $ */ -#include #include -#include #include #include +#include #include #include -#include +#include #include +#include //some common style files -#include "SetOKStyle.C" -#include "QA_Draw_Utility.C" #include "QA_Draw_Jet_TruthMatching.C" +#include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; -void -QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", - const char * qa_file_name_new = - "data/G4sPHENIXCells_2000jets25GeV.root_qa.root", - const char * qa_file_name_ref = - "data/G4sPHENIXCells_250jets25GeV.root_qa.root") +void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", + const char *qa_file_name_new = + "data/G4sPHENIXCells_2000jets25GeV.root_qa.root", + const char *qa_file_name_ref = + "data/G4sPHENIXCells_250jets25GeV.root_qa.root") { //! drawing energy range const double min_Et = 10; @@ -42,7 +41,7 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", TVirtualFitter::SetDefaultFitter("Minuit2"); // file IO - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); // buffer for results @@ -55,53 +54,53 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", vector vec_purity; // list and process all jets - TList* hist_key_list = qa_file_new->GetListOfKeys(); + TList *hist_key_list = qa_file_new->GetListOfKeys(); for (int i = 0; i < hist_key_list->GetSize(); ++i) - { - TString key_name = hist_key_list->At(i)->GetName(); - - TString s_re_fullname = Form( - "h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et", - jet_family); // regular expression for search - TRegexp re_fullname(s_re_fullname, false); - if (key_name.Index(re_fullname) == kNPOS) - continue; - -// cout << " key_name = " << key_name << endl; - TString jet_pair_name = key_name(0, - key_name.Length() - TString("_Matching_Count_Truth_Et").Length()); // remove suffix - -// cout << " jet_pair_name = " << jet_pair_name << endl; - - //get jet radius - TRegexp re_jetradius("_r[0-9]*", false); - Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius - index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius - assert(index_radius != kNPOS); - float radius = 0; - sscanf(key_name(index_radius, 100).Data(), "_r%f", &radius); -// cout << " index_radius = " << index_radius << endl; - assert(radius != 0); - radius /= 10; // jet radius convention in DST names - - cout << "QA_Draw_Jet_Summary - process jet pair " << jet_pair_name - << " with radius = " << radius << endl; - - vector resolution_efficiency_summary( - QA_Draw_Jet_TruthMatching(jet_pair_name, qa_file_name_new, - qa_file_name_ref)); - - //save results - vec_radius.push_back(radius); - vec_phi_res.push_back(resolution_efficiency_summary[0]); - vec_eta_res.push_back(resolution_efficiency_summary[1]); - vec_e_res.push_back(resolution_efficiency_summary[2]); - vec_et_res.push_back(resolution_efficiency_summary[3]); - vec_reco_eff.push_back(resolution_efficiency_summary[4]); - vec_purity.push_back(resolution_efficiency_summary[5]); - -// break; - } + { + TString key_name = hist_key_list->At(i)->GetName(); + + TString s_re_fullname = Form( + "h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et", + jet_family); // regular expression for search + TRegexp re_fullname(s_re_fullname, false); + if (key_name.Index(re_fullname) == kNPOS) + continue; + + // cout << " key_name = " << key_name << endl; + TString jet_pair_name = key_name(0, + key_name.Length() - TString("_Matching_Count_Truth_Et").Length()); // remove suffix + + // cout << " jet_pair_name = " << jet_pair_name << endl; + + //get jet radius + TRegexp re_jetradius("_r[0-9]*", false); + Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius + index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius + assert(index_radius != kNPOS); + float radius = 0; + sscanf(key_name(index_radius, 100).Data(), "_r%f", &radius); + // cout << " index_radius = " << index_radius << endl; + assert(radius != 0); + radius /= 10; // jet radius convention in DST names + + cout << "QA_Draw_Jet_Summary - process jet pair " << jet_pair_name + << " with radius = " << radius << endl; + + vector resolution_efficiency_summary( + QA_Draw_Jet_TruthMatching(jet_pair_name, qa_file_name_new, + qa_file_name_ref)); + + //save results + vec_radius.push_back(radius); + vec_phi_res.push_back(resolution_efficiency_summary[0]); + vec_eta_res.push_back(resolution_efficiency_summary[1]); + vec_e_res.push_back(resolution_efficiency_summary[2]); + vec_et_res.push_back(resolution_efficiency_summary[3]); + vec_reco_eff.push_back(resolution_efficiency_summary[4]); + vec_purity.push_back(resolution_efficiency_summary[5]); + + // break; + } // plot TCanvas *c1 = new TCanvas( @@ -109,57 +108,55 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", TString("QA_Draw_Jet_Summary_") + TString(jet_family), 1800, 900); c1->Divide(3, 2); int idx = 1; - TPad * p; + TPad *p; // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); - TH1 * h_frame = + TH1 *h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, - TString(jet_family) - + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); + TString(jet_family) + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); h_frame->GetYaxis()->SetTitleOffset(1.01); - TLine * l = new TLine(min_Et, 0, max_Et, 0); + TLine *l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); p->SetGridx(0); p->SetGridy(0); - TLegend * legend = new TLegend(0.7, 0.2, .95, 0.5); + TLegend *legend = new TLegend(0.7, 0.2, .95, 0.5); legend->SetFillColor(kWhite); legend->SetFillStyle(1001); legend->SetLineWidth(2); legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_phi_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_phi_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, - TString(jet_family) - + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); + TString(jet_family) + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); @@ -172,33 +169,32 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_eta_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_eta_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, - TString(jet_family) - + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); + TString(jet_family) + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -211,34 +207,33 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_e_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_e_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, - TString(jet_family) - + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); + TString(jet_family) + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -251,33 +246,32 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_et_res[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_et_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, - TString(jet_family) - + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); + TString(jet_family) + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -290,33 +284,32 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_reco_eff[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_reco_eff[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); // ------------------------------------ p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, - TString(jet_family) - + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); + TString(jet_family) + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -329,27 +322,25 @@ QA_Draw_Jet_Summary(const char * jet_family = "AntiKt_Tower", legend->SetLineColor(kBlack); legend->SetLineStyle(kSolid); for (int i = 0; i < vec_radius.size(); ++i) + { + const float radius = vec_radius[i]; + + TGraphErrors *ge = vec_purity[i]; + assert(ge); + ge = new TGraphErrors(*ge); // make a copy + + ge->SetLineColor(i + 2); // automatic color scheme from ROOT + ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT + for (int idata = 0; idata < ge->GetN(); ++idata) { - const float radius = vec_radius[i]; - - TGraphErrors* ge = vec_purity[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + (ge->GetX())[idata] += i * 0.5; // shift x a little bit + (ge->GetEX())[idata] = 0; // no x error bar } + ge->Draw("p E l"); + legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); + } legend->Draw(); PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); - } - diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C index a5b82ac88..fd45da15d 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C @@ -8,27 +8,27 @@ * \date $Date: $ */ -#include #include -#include #include #include +#include #include #include +#include #include //some common style files -#include "SetOKStyle.C" #include "QA_Draw_Utility.C" +#include "SetOKStyle.C" using namespace std; vector -QA_Draw_Jet_TruthMatching(const char * jet = - "h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07", - const char * qa_file_name_new = - "data/G4sPHENIXCells_250jets25GeV.root_qa.root", - const char * qa_file_name_ref = - "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") +QA_Draw_Jet_TruthMatching(const char *jet = + "h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07", + const char *qa_file_name_new = + "data/G4sPHENIXCells_250jets25GeV.root_qa.root", + const char *qa_file_name_ref = + "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") { //! drawing energy range const double min_Et = 10; @@ -39,15 +39,15 @@ QA_Draw_Jet_TruthMatching(const char * jet = gStyle->SetOptFit(1111); TVirtualFitter::SetDefaultFitter("Minuit2"); - TFile * qa_file_new = new TFile(qa_file_name_new); + TFile *qa_file_new = new TFile(qa_file_name_new); assert(qa_file_new->IsOpen()); - TFile * qa_file_ref = NULL; + TFile *qa_file_ref = NULL; if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } + { + qa_file_ref = new TFile(qa_file_name_ref); + assert(qa_file_ref->IsOpen()); + } vector resolution_collections; @@ -56,193 +56,187 @@ QA_Draw_Jet_TruthMatching(const char * jet = TString("QA_Draw_Jet_TruthMatching_") + TString(jet), 1800, 900); c1->Divide(3, 2); int idx = 1; - TPad * p; + TPad *p; p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dPhi", "TH2F"); - - assert(proj_new); + // p->SetLogz(); - proj_new->Rebin2D(1, 5); + { + TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dPhi", "TH2F"); - TGraphErrors * ge = FitProfile(proj_new); + assert(proj_new); - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); + proj_new->Rebin2D(1, 5); - TGraphErrors * ge_ref = NULL; - if (qa_file_ref) - { - TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dPhi", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors * ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); + TGraphErrors *ge = FitProfile(proj_new); - resolution_collections.push_back(ge); + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); + TGraphErrors *ge_ref = NULL; + if (qa_file_ref) + { + TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dPhi", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors *ge_ref = FitProfile(proj_ref); } - TLine * l = new TLine(min_Et, 0, max_Et, 00); + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } + TLine *l = new TLine(min_Et, 0, max_Et, 00); l->Draw(); p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dEta", "TH2F"); + // p->SetLogz(); - assert(proj_new); + { + TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dEta", "TH2F"); - proj_new->Rebin2D(1, 5); - TGraphErrors * ge = FitProfile(proj_new); + assert(proj_new); - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); + proj_new->Rebin2D(1, 5); + TGraphErrors *ge = FitProfile(proj_new); - TGraphErrors * ge_ref = NULL; - if (qa_file_ref) - { - TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dEta", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors * ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); - resolution_collections.push_back(ge); + TGraphErrors *ge_ref = NULL; + if (qa_file_ref) + { + TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dEta", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors *ge_ref = FitProfile(proj_ref); } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } l = new TLine(min_Et, 0, max_Et, 00); l->Draw(); p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dE", "TH2F"); + // p->SetLogz(); - assert(proj_new); + { + TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dE", "TH2F"); -// proj_new->Rebin2D(1,5); + assert(proj_new); - TGraphErrors * ge = FitProfile(proj_new); + // proj_new->Rebin2D(1,5); - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); + TGraphErrors *ge = FitProfile(proj_new); - TGraphErrors * ge_ref = NULL; - if (qa_file_ref) - { - TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dE", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors * ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); - resolution_collections.push_back(ge); + TGraphErrors *ge_ref = NULL; + if (qa_file_ref) + { + TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dE", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors *ge_ref = FitProfile(proj_ref); } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); - - { - - TH2F * proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dEt", "TH2F"); + // p->SetLogz(); - assert(proj_new); + { + TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_dEt", "TH2F"); -// proj_new->Rebin2D(1,5); - TGraphErrors * ge = FitProfile(proj_new); + assert(proj_new); - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); + // proj_new->Rebin2D(1,5); + TGraphErrors *ge = FitProfile(proj_new); - TGraphErrors * ge_ref = NULL; - if (qa_file_ref) - { - TH2F * proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dEt", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors * ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); + proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); + proj_new->GetYaxis()->SetTitleOffset(1.5); + proj_new->Draw("COLZ"); - resolution_collections.push_back(ge); + TGraphErrors *ge_ref = NULL; + if (qa_file_ref) + { + TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( + TString(jet) + "_Matching_dEt", "TH2F"); + assert(proj_ref); + proj_ref->Rebin2D(1, 5); + TGraphErrors *ge_ref = FitProfile(proj_ref); } + DrawReference(ge, ge_ref); + + resolution_collections.push_back(ge); + } l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p = (TPad *) c1->cd(idx++); c1->Update(); -// p->SetLogz(); + // p->SetLogz(); + { + TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); + assert(h2); + + TH1 *h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); + // TH1 * h_pass = h2->ProjectionX( + // TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match + TH1 *h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm); + + h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); + h_ratio->GetYaxis()->SetTitle("Reco efficiency"); + h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); + + TH1 *h_ratio_ref = NULL; + if (qa_file_ref) { - - TH2F * h2 = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked( TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); assert(h2); - - TH1 * h_norm = h2->ProjectionX( + TH1 *h_norm = h2->ProjectionX( TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); // TH1 * h_pass = h2->ProjectionX( // TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match - TH1 * h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match + TH1 *h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - TH1 * h_ratio = GetBinominalRatio(h_pass, h_norm); - - h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); - h_ratio->GetYaxis()->SetTitle("Reco efficiency"); - h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); - - TH1 * h_ratio_ref = NULL; - if (qa_file_ref) - { - TH2F * h2 = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); - assert(h2); - TH1 * h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); -// TH1 * h_pass = h2->ProjectionX( -// TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match - TH1 * h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); - } - - DrawReference(h_ratio, h_ratio_ref, true); - - resolution_collections.push_back(new TGraphErrors(h_ratio)); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); } + DrawReference(h_ratio, h_ratio_ref, true); + + resolution_collections.push_back(new TGraphErrors(h_ratio)); + } + l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -250,49 +244,48 @@ QA_Draw_Jet_TruthMatching(const char * jet = c1->Update(); // p->SetLogz(); + { + TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked( + TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); + assert(h2); + + TH1 *h_norm = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); + // TH1 * h_pass = h2->ProjectionX( + // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match + TH1 *h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match + assert(h_norm); + assert(h_pass); + TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm); + + h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); + h_ratio->GetYaxis()->SetTitle("Reconstruction Purity"); + h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); + + TH1 *h_ratio_ref = NULL; + if (qa_file_ref) { - - TH2F * h2 = (TH2F *) qa_file_new->GetObjectChecked( + TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked( TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); assert(h2); - TH1 * h_norm = h2->ProjectionX( + TH1 *h_norm = h2->ProjectionX( TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); -// TH1 * h_pass = h2->ProjectionX( -// TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match - TH1 * h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match + // TH1 * h_pass = h2->ProjectionX( + // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match + TH1 *h_pass = h2->ProjectionX( + TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - TH1 * h_ratio = GetBinominalRatio(h_pass, h_norm); - - h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); - h_ratio->GetYaxis()->SetTitle("Reconstruction Purity"); - h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); - - TH1 * h_ratio_ref = NULL; - if (qa_file_ref) - { - TH2F * h2 = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); - assert(h2); - - TH1 * h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); - // TH1 * h_pass = h2->ProjectionX( - // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match - TH1 * h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); - } - - DrawReference(h_ratio, h_ratio_ref, true); - - resolution_collections.push_back(new TGraphErrors(h_ratio)); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); } + DrawReference(h_ratio, h_ratio_ref, true); + + resolution_collections.push_back(new TGraphErrors(h_ratio)); + } + l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); @@ -301,4 +294,3 @@ QA_Draw_Jet_TruthMatching(const char * jet = return resolution_collections; } - diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index b08fb380e..ada127b8c 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -11,62 +11,59 @@ #ifndef QA_Draw_Utility_C #define QA_Draw_Utility_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 using namespace std; //! Service function to SaveCanvas() -void -SavePad(TPad * p) +void SavePad(TPad *p) { if (!p) return; - TList * l = p->GetListOfPrimitives(); -// l->Print(); + TList *l = p->GetListOfPrimitives(); + // l->Print(); TIter next(l); TObject *obj = NULL; while ((obj = next())) + { + if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) { - - if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) - { - if ((TPad *) obj != p) - SavePad((TPad *) obj); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) - { - cout << "Save TH1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) - { - cout << "Save TF1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) - { - cout << "Save TGraph " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } + if ((TPad *) obj != p) + SavePad((TPad *) obj); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) + { + cout << "Save TH1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) + { + cout << "Save TF1 " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) + { + cout << "Save TGraph " << obj->GetName() << endl; + obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); + } + } } //! Save canvas to multiple formats @@ -75,15 +72,14 @@ SavePad(TPad * p) * @param[in] name Base of the file name. The default is the name of the cavas * @param[in] bEPS true = save .eps and .pdf format too. */ -void -SaveCanvas(TCanvas * c, TString name = "", Bool_t bEPS = kTRUE) +void SaveCanvas(TCanvas *c, TString name = "", Bool_t bEPS = kTRUE) { if (name.Length() == 0) name = c->GetName(); c->Print(name + ".png"); - TDirectory * oldd = gDirectory; + TDirectory *oldd = gDirectory; TString rootfilename; @@ -98,34 +94,29 @@ SaveCanvas(TCanvas * c, TString name = "", Bool_t bEPS = kTRUE) oldd->cd(); if (bEPS) - { -// c->Print(name + ".pdf"); + { + // c->Print(name + ".pdf"); - float x = 20; - float y = 20; - gStyle->GetPaperSize(x, y); + float x = 20; + float y = 20; + gStyle->GetPaperSize(x, y); - gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, - c->GetWindowHeight() / 72 * 2.54); -// c->Print(name + ".eps"); - c->Print(name + ".svg"); - gSystem->Exec("rsvg-convert -f pdf -o "+name + ".pdf " + name + ".svg"); - gSystem->Exec("rm -fv " + name + ".svg"); + gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, + c->GetWindowHeight() / 72 * 2.54); + // c->Print(name + ".eps"); + c->Print(name + ".svg"); + gSystem->Exec("rsvg-convert -f pdf -o " + name + ".pdf " + name + ".svg"); + gSystem->Exec("rm -fv " + name + ".svg"); - gStyle->SetPaperSize(x, y); - } + gStyle->SetPaperSize(x, y); + } // c->Print(name+".C"); } - - - //! Draw 1D histogram along with its reference as shade //! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -void -DrawReference(TH1 * hnew, TH1 * href, bool draw_href_error = false) +void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) { - hnew->SetLineColor(kBlue + 3); hnew->SetMarkerColor(kBlue + 3); hnew->SetLineWidth(2); @@ -133,57 +124,50 @@ DrawReference(TH1 * hnew, TH1 * href, bool draw_href_error = false) hnew->SetMarkerSize(1); if (href) + { + if (draw_href_error) { - if (draw_href_error) - { - - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(kSolid); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(2); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - - } - else - { - - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(0); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(0); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - - } - + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(kSolid); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(2); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + } + else + { + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(0); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(0); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); } + } - hnew->Draw(); // set scale + hnew->Draw(); // set scale if (href) + { + if (draw_href_error) { - if (draw_href_error) - { - href->DrawClone("E2 same"); - href->SetFillStyle(0); - href->SetLineWidth(8); - href->DrawClone("HIST same ]["); - } - else - href->Draw("HIST same"); - hnew->Draw("same"); // over lay data points + href->DrawClone("E2 same"); + href->SetFillStyle(0); + href->SetLineWidth(8); + href->DrawClone("HIST same ]["); } + else + href->Draw("HIST same"); + hnew->Draw("same"); // over lay data points + } } //! Draw 1D TGraph along with its reference as shade //! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -void -DrawReference(TGraph * hnew, TGraph * href, bool draw_href_error = true) +void DrawReference(TGraph *hnew, TGraph *href, bool draw_href_error = true) { - hnew->SetLineColor(kBlue + 3); hnew->SetMarkerColor(kBlue + 3); hnew->SetLineWidth(2); @@ -191,53 +175,47 @@ DrawReference(TGraph * hnew, TGraph * href, bool draw_href_error = true) hnew->SetMarkerSize(1); if (href) + { + if (draw_href_error) { - if (draw_href_error) - { - - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetFillStyle(0); - href->SetLineStyle(kSolid); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(4); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - - } - else - { - - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(0); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(0); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - - } - + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetFillStyle(0); + href->SetLineStyle(kSolid); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(4); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); + } + else + { + href->SetLineColor(kGreen + 1); + href->SetFillColor(kGreen + 1); + href->SetLineStyle(0); + href->SetMarkerColor(kGreen + 1); + href->SetLineWidth(0); + href->SetMarkerStyle(kDot); + href->SetMarkerSize(0); } + } if (href) + { + if (draw_href_error) { - if (draw_href_error) - { - href->DrawClone("E2"); - } - else - href->Draw("HIST same"); - hnew->Draw("p e"); // over lay data points + href->DrawClone("E2"); } + else + href->Draw("HIST same"); + hnew->Draw("p e"); // over lay data points + } } //! Fit for resolution of TH2F TGraphErrors * -FitResolution(const TH2F * h2, const bool normalize_mean = true) +FitResolution(const TH2F *h2, const bool normalize_mean = true) { - - TProfile * p2 = h2->ProfileX(); + TProfile *p2 = h2->ProfileX(); int n = 0; double x[1000]; @@ -246,36 +224,36 @@ FitResolution(const TH2F * h2, const bool normalize_mean = true) double ey[1000]; for (int i = 1; i <= h2->GetNbinsX(); i++) - { - TH1D * h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); + { + TH1D *h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); - if (h1->GetSum() < 10) - continue; + if (h1->GetSum() < 10) + continue; - TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, - p2->GetBinError(i) * 4); + TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, + p2->GetBinError(i) * 4); - TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", - -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); + TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", + -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); - fgaus.SetParameter(1, p2->GetBinContent(i)); - fgaus.SetParameter(2, p2->GetBinError(i)); + fgaus.SetParameter(1, p2->GetBinContent(i)); + fgaus.SetParameter(2, p2->GetBinError(i)); - h1->Fit(&fgaus, "MQ0"); + h1->Fit(&fgaus, "MQ0"); - x[n] = p2->GetBinCenter(i); - ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; + x[n] = p2->GetBinCenter(i); + ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; - const double norm = normalize_mean ? fgaus.GetParameter(1) : 1; + const double norm = normalize_mean ? fgaus.GetParameter(1) : 1; - y[n] = fgaus.GetParameter(2) / norm; - ey[n] = fgaus.GetParError(2) / norm; + y[n] = fgaus.GetParameter(2) / norm; + ey[n] = fgaus.GetParError(2) / norm; - n++; - delete h1; - } + n++; + delete h1; + } - TGraphErrors * ge = new TGraphErrors(n, x, y, 0, ey); + TGraphErrors *ge = new TGraphErrors(n, x, y, 0, ey); ge->SetName(TString(h2->GetName()) + "_FitResolution"); ge->SetLineColor(kBlue + 3); @@ -288,10 +266,9 @@ FitResolution(const TH2F * h2, const bool normalize_mean = true) //! Fit for profile along the Y direction of TH2F TGraphErrors * -FitProfile(const TH2F * h2) +FitProfile(const TH2F *h2) { - - TProfile * p2 = h2->ProfileX(); + TProfile *p2 = h2->ProfileX(); int n = 0; double x[1000]; @@ -300,47 +277,47 @@ FitProfile(const TH2F * h2) double ey[1000]; for (int i = 1; i <= h2->GetNbinsX(); i++) - { - TH1D * h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); + { + TH1D *h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); - if (h1->GetSum() < 10) - continue; + if (h1->GetSum() < 10) + continue; - TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, - p2->GetBinError(i) * 4); + TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, + p2->GetBinError(i) * 4); - TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", - -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); + TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", + -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); - fgaus.SetParameter(1, p2->GetBinContent(i)); - fgaus.SetParameter(2, p2->GetBinError(i)); + fgaus.SetParameter(1, p2->GetBinContent(i)); + fgaus.SetParameter(2, p2->GetBinError(i)); - h1->Fit(&fgaus, "MQ0"); + h1->Fit(&fgaus, "MQ0"); -// f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1), -// fgaus.GetParameter(2), fgaus.GetParameter(0) / 2, -// fgaus.GetParameter(2) / 4, 0); -// -// h1->Fit(&f2, "MQ0"); + // f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1), + // fgaus.GetParameter(2), fgaus.GetParameter(0) / 2, + // fgaus.GetParameter(2) / 4, 0); + // + // h1->Fit(&f2, "MQ0"); -// new TCanvas; -// h1->Draw(); -// fgaus.Draw("same"); -// break; + // new TCanvas; + // h1->Draw(); + // fgaus.Draw("same"); + // break; - x[n] = p2->GetBinCenter(i); - ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; - y[n] = fgaus.GetParameter(1); - ey[n] = fgaus.GetParameter(2); + x[n] = p2->GetBinCenter(i); + ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; + y[n] = fgaus.GetParameter(1); + ey[n] = fgaus.GetParameter(2); -// p2->SetBinContent(i, fgaus.GetParameter(1)); -// p2->SetBinError(i, fgaus.GetParameter(2)); + // p2->SetBinContent(i, fgaus.GetParameter(1)); + // p2->SetBinError(i, fgaus.GetParameter(2)); - n++; - delete h1; - } + n++; + delete h1; + } - TGraphErrors * ge = new TGraphErrors(n, x, y, ex, ey); + TGraphErrors *ge = new TGraphErrors(n, x, y, ex, ey); ge->SetName(TString(h2->GetName()) + "_FitProfile"); ge->SetLineColor(kBlue + 3); ge->SetMarkerColor(kBlue + 3); @@ -351,8 +328,7 @@ FitProfile(const TH2F * h2) } //!ratio between two histograms with binominal error based on Wilson score interval. Assuming each histogram is count. -TH1 * -GetBinominalRatio(TH1 * h_pass, TH1 * h_n_trial, bool process_zero_bins = false) +TH1 *GetBinominalRatio(TH1 *h_pass, TH1 *h_n_trial, bool process_zero_bins = false) { assert(h_pass); assert(h_n_trial); @@ -361,36 +337,35 @@ GetBinominalRatio(TH1 * h_pass, TH1 * h_n_trial, bool process_zero_bins = false) assert(h_pass->GetNbinsY() == h_n_trial->GetNbinsY()); assert(h_pass->GetNbinsZ() == h_n_trial->GetNbinsZ()); - TH1 * h_ratio = (TH1 *) h_pass->Clone(TString(h_pass->GetName()) + "_Ratio"); + TH1 *h_ratio = (TH1 *) h_pass->Clone(TString(h_pass->GetName()) + "_Ratio"); assert(h_ratio); - h_ratio->Divide(h_n_trial); // a rough estimation first, also taking care of the overflow bins and zero bins + h_ratio->Divide(h_n_trial); // a rough estimation first, also taking care of the overflow bins and zero bins for (int x = 1; x <= h_n_trial->GetNbinsX(); ++x) for (int y = 1; y <= h_n_trial->GetNbinsY(); ++y) for (int z = 1; z <= h_n_trial->GetNbinsZ(); ++z) + { + const double n_trial = h_n_trial->GetBinContent(x, y, z); + + if (n_trial > 0) + { + const double p = h_pass->GetBinContent(x, y, z) / n_trial; + + // Wilson score interval + h_ratio->SetBinContent(x, y, z, // + (p + 1 / (2 * n_trial)) / (1 + 1 / n_trial)); + h_ratio->SetBinError(x, y, + z, // + TMath::Sqrt( + 1. / n_trial * p * (1 - p) + 1. / (4 * n_trial * n_trial)) / + (1 + 1 / n_trial)); + } + else if (process_zero_bins) { - const double n_trial = h_n_trial->GetBinContent(x, y, z); - - if (n_trial > 0) - { - const double p = h_pass->GetBinContent(x, y, z) / n_trial; - - // Wilson score interval - h_ratio->SetBinContent(x, y, z, // - (p + 1 / (2 * n_trial)) / (1 + 1 / n_trial)); - h_ratio->SetBinError(x, y, - z, // - TMath::Sqrt( - 1. / n_trial * p * (1 - p) + 1. / (4 * n_trial * n_trial)) - / (1 + 1 / n_trial)); - } - else if (process_zero_bins) - { - - h_ratio->SetBinContent(x, y, z, 0.5); - h_ratio->SetBinError(x, y, z, 0.5); - } + h_ratio->SetBinContent(x, y, z, 0.5); + h_ratio->SetBinError(x, y, z, 0.5); } + } return h_ratio; } @@ -400,17 +375,16 @@ GetBinominalRatio(TH1 * h_pass, TH1 * h_n_trial, bool process_zero_bins = false) //! \param[in] bottom height fraction height of the canvas to be used for this label //! \param[in] new_file_name new file name being inspected //! \param[in] ref_file_name reference file name -void -PutInputFileName(TCanvas * c1, const double height, const char * new_file_name, const char * ref_file_name) +void PutInputFileName(TCanvas *c1, const double height, const char *new_file_name, const char *ref_file_name) { c1->cd(); - TPad *pad = new TPad("PutInputFileName","PutInputFileName",0,0,1,height, 18); + TPad *pad = new TPad("PutInputFileName", "PutInputFileName", 0, 0, 1, height, 18); pad->Draw(); pad->cd(); if (new_file_name) { - TText * t = new TText(0.05,0.75,TString("New QA File: ")+TString(new_file_name)); + TText *t = new TText(0.05, 0.75, TString("New QA File: ") + TString(new_file_name)); t->SetTextAlign(12); t->SetTextColor(kBlue + 3); t->SetTextSize(.4); @@ -418,7 +392,7 @@ PutInputFileName(TCanvas * c1, const double height, const char * new_file_name, } if (ref_file_name) { - TText * t = new TText(0.05,0.25,TString("Reference QA File: ")+TString(ref_file_name)); + TText *t = new TText(0.05, 0.25, TString("Reference QA File: ") + TString(ref_file_name)); t->SetTextAlign(12); t->SetTextColor(kGreen + 1); t->SetTextSize(.4); diff --git a/macros/QA/calorimeter/SetOKStyle.C b/macros/QA/calorimeter/SetOKStyle.C index b9311cc00..c9e4ded71 100644 --- a/macros/QA/calorimeter/SetOKStyle.C +++ b/macros/QA/calorimeter/SetOKStyle.C @@ -2,9 +2,7 @@ #ifndef SetOKStyle_C #define SetOKStyle_C - -void -SetOKStyle() +void SetOKStyle() { TStyle* OKStyle = new TStyle("OKStyle", "OK Default Style"); @@ -86,8 +84,8 @@ SetOKStyle() OKStyle->SetOptStat(1); //marker settings -// OKStyle->SetMarkerStyle(8); -// OKStyle->SetMarkerSize(0.7); + // OKStyle->SetMarkerStyle(8); + // OKStyle->SetMarkerSize(0.7); // Fonts OKStyle->SetStatFont(42); From ed442cbf2c211a270e0da623a5e95ac9399418bd Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Mon, 4 Feb 2019 11:50:40 +0100 Subject: [PATCH 0227/1222] New MVTX configuration. Walt 3 Jan 2019 --- macros/g4simulations/G4_Tracking.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index e3d0f8138..f8c75ae40 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -138,12 +138,16 @@ double Tracking(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 - + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { From 1d9fb8ebafcd0ac033727b5c59f46607de050498 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 6 Feb 2019 11:50:00 -0500 Subject: [PATCH 0228/1222] fix file path - DO NOT USE DIRECT /gpfs mountpoints --- macros/prototype2/Fun4All_TestBeam.C | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C index c4d8657e4..57a83cb2b 100644 --- a/macros/prototype2/Fun4All_TestBeam.C +++ b/macros/prototype2/Fun4All_TestBeam.C @@ -4,9 +4,8 @@ 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") + const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf", + const char *output_file = "beam_00002609.root") { gSystem->Load("libfun4all"); gSystem->Load("libPrototype2.so"); From 1548ca885190cbafb1a342d6efc5c79cd8996c53 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 6 Feb 2019 12:55:40 -0500 Subject: [PATCH 0229/1222] start with root6 includes --- macros/prototype2/Fun4All_TestBeam.C | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C index 57a83cb2b..f2b0c70e9 100644 --- a/macros/prototype2/Fun4All_TestBeam.C +++ b/macros/prototype2/Fun4All_TestBeam.C @@ -1,13 +1,20 @@ -#include +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include -using namespace std; +#include +#include + +R__LOAD_LIBRARY(libPrototype2.so) +#endif void Fun4All_TestBeam(int nEvents = 100, const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf", const char *output_file = "beam_00002609.root") { - gSystem->Load("libfun4all"); gSystem->Load("libPrototype2.so"); Fun4AllServer *se = Fun4AllServer::instance(); From 5482f7d3c85a4ccd40884b31f0bbac1b75a5d633 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 14:05:38 -0500 Subject: [PATCH 0230/1222] work with root6 --- macros/prototype2/Fun4All_TestBeam.C | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C index f2b0c70e9..6986ae67d 100644 --- a/macros/prototype2/Fun4All_TestBeam.C +++ b/macros/prototype2/Fun4All_TestBeam.C @@ -5,7 +5,14 @@ #include #include + +#include +#include +#include +#include +#include #include +#include R__LOAD_LIBRARY(libPrototype2.so) #endif @@ -77,9 +84,7 @@ Fun4All_TestBeam(int nEvents = 100, // unpack->Verbosity(1); se->registerSubsystem(unpack); - CaloCalibration * calib = NULL; - - calib = new CaloCalibration("CEMC"); + CaloCalibration *calib = new CaloCalibration("CEMC"); calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database se->registerSubsystem(calib); @@ -121,11 +126,9 @@ Fun4All_TestBeam(int nEvents = 100, 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"); + GenericUnpackPRDF *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); From 73440b62eaaf8998a311a5e1e553f7a0b1652eda Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 15:46:54 -0500 Subject: [PATCH 0231/1222] work with root6 --- macros/prototype2/Fun4All_G4_Prototype2.C | 59 ++++++++++++++++++++--- macros/prototype2/Fun4All_TestBeam.C | 3 +- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/macros/prototype2/Fun4All_G4_Prototype2.C b/macros/prototype2/Fun4All_G4_Prototype2.C index 97471107b..ef3097cc4 100644 --- a/macros/prototype2/Fun4All_G4_Prototype2.C +++ b/macros/prototype2/Fun4All_G4_Prototype2.C @@ -1,3 +1,49 @@ +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#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(libcalo_reco.so) +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4histos.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#endif + int Fun4All_G4_Prototype2(int nEvents = 1) { @@ -79,8 +125,7 @@ int Fun4All_G4_Prototype2(int nEvents = 1) //---------------------------------------- if (cemc_on) { - PHG4SpacalPrototypeSubsystem *cemc; - cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); + PHG4SpacalPrototypeSubsystem *cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); cemc->SetActive(); cemc->SuperDetector("CEMC"); cemc->SetAbsorberActive(); @@ -224,12 +269,14 @@ int Fun4All_G4_Prototype2(int nEvents = 1) se->registerSubsystem(TowerBuilder); } +// these parameters are used in multiple modules + const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 + const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + 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"); @@ -524,8 +571,8 @@ int Fun4All_G4_Prototype2(int nEvents = 1) // std::cout << "All done" << std::endl; delete se; - // return 0; gSystem->Exit(0); + return 0; } diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C index 6986ae67d..70ad00757 100644 --- a/macros/prototype2/Fun4All_TestBeam.C +++ b/macros/prototype2/Fun4All_TestBeam.C @@ -231,8 +231,7 @@ Fun4All_TestBeam(int nEvents = 100, // ------------------- Output ------------------- //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); + Fun4AllOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT",output_file); se->registerOutputManager(out_Manager); //alternatively, fast check on DST using DST Reader: From f6e8e4f462d3448579b895bdf397c6cf20b1b742 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 18:21:23 -0500 Subject: [PATCH 0232/1222] macro to dump the output int ascii file for comparisons --- macros/prototype2/run_dump.C | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 macros/prototype2/run_dump.C diff --git a/macros/prototype2/run_dump.C b/macros/prototype2/run_dump.C new file mode 100644 index 000000000..b52a7dbe9 --- /dev/null +++ b/macros/prototype2/run_dump.C @@ -0,0 +1,28 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +R__LOAD_LIBRARY(libphnodedump.so) +#endif + +void run_dump(const char *infile, const int evts=100) +{ + gSystem->Load("libPrototype2_io.so"); + gSystem->Load("libphnodedump.so"); + + Fun4AllServer* se = Fun4AllServer::instance(); + + Dumper *dmp = new Dumper(); + gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); + dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); + + se->registerSubsystem(dmp); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); + se->registerInputManager(in); + se->fileopen("DSTin",infile); + se->run(evts); + se->End(); + delete se; +} From 8851451e336cfa547028644adbee0cd8552007bc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 19:39:00 -0500 Subject: [PATCH 0233/1222] run under root6 --- macros/prototype3/Fun4All_TestBeam.C | 34 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/macros/prototype3/Fun4All_TestBeam.C b/macros/prototype3/Fun4All_TestBeam.C index 42c069ead..eb9dc0d07 100644 --- a/macros/prototype3/Fun4All_TestBeam.C +++ b/macros/prototype3/Fun4All_TestBeam.C @@ -1,12 +1,27 @@ -#include - -using namespace std; +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +R__LOAD_LIBRARY(libPrototype3.so) +#endif 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") + const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00003310-0000.prdf", + const char *output_file = "beam_00003310.root") { gSystem->Load("libfun4all"); gSystem->Load("libPrototype3.so"); @@ -71,9 +86,8 @@ Fun4All_TestBeam(int nEvents = 1000, // unpack->Verbosity(1); se->registerSubsystem(unpack); - CaloCalibration * calib = NULL; - calib = new CaloCalibration("CEMC"); + CaloCalibration *calib = new CaloCalibration("CEMC"); calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database se->registerSubsystem(calib); @@ -115,11 +129,9 @@ Fun4All_TestBeam(int nEvents = 1000, 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"); + GenericUnpackPRDF *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); From d73105be40df6ae9f600a7e2619db7f98391fc53 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 20:39:01 -0500 Subject: [PATCH 0234/1222] run under root6 --- macros/prototype3/Fun4All_G4_Prototype3.C | 63 +++++++++++++++++++---- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/macros/prototype3/Fun4All_G4_Prototype3.C b/macros/prototype3/Fun4All_G4_Prototype3.C index 968581815..9701438ce 100644 --- a/macros/prototype3/Fun4All_G4_Prototype3.C +++ b/macros/prototype3/Fun4All_G4_Prototype3.C @@ -1,4 +1,51 @@ -int Fun4All_G4_Prototype3(int nEvents = 1) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#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(libcalo_reco.so) +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4histos.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#endif + +void Fun4All_G4_Prototype3(int nEvents = 1) { gSystem->Load("libfun4all"); @@ -66,8 +113,8 @@ int Fun4All_G4_Prototype3(int nEvents = 1) //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.)); + angle = theta*TMath::Pi()/180.; + 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()); @@ -82,7 +129,7 @@ int Fun4All_G4_Prototype3(int nEvents = 1) gun->set_name("geantino"); // gun->set_name("proton"); gun->set_vtx(0, 0, 0); - double angle = theta*TMath::Pi()/180.; + angle = theta*TMath::Pi()/180.; gun->set_mom(sin(angle),0.,cos(angle)); // se->registerSubsystem(gun); @@ -326,13 +373,13 @@ int Fun4All_G4_Prototype3(int nEvents = 1) if (ohcal_cell) { - hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); + PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); hccell->Detector("HCALOUT"); se->registerSubsystem(hccell); } if (ohcal_twr) { - hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); + Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); hcaltwr->Detector("HCALOUT"); hcaltwr->set_sim_tower_node_prefix("SIM"); se->registerSubsystem(hcaltwr); @@ -571,7 +618,7 @@ int Fun4All_G4_Prototype3(int nEvents = 1) se->registerInputManager( in ); if (nEvents <= 0) { - return 0; + return; } se->run(nEvents); @@ -582,7 +629,5 @@ int Fun4All_G4_Prototype3(int nEvents = 1) // std::cout << "All done" << std::endl; delete se; - // return 0; gSystem->Exit(0); - } From e324752f4b84a6873b889c21f8bd099f1184858c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 Feb 2019 23:38:10 -0500 Subject: [PATCH 0235/1222] add prototype3 specific dump (sim and reco) --- macros/prototype3/run_dump.C | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 macros/prototype3/run_dump.C diff --git a/macros/prototype3/run_dump.C b/macros/prototype3/run_dump.C new file mode 100644 index 000000000..fd0ec7b11 --- /dev/null +++ b/macros/prototype3/run_dump.C @@ -0,0 +1,28 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +R__LOAD_LIBRARY(libphnodedump.so) +#endif + +void run_dump(const char *infile, const int evts=100) +{ + gSystem->Load("libPrototype3_io.so"); + gSystem->Load("libphnodedump.so"); + + Fun4AllServer* se = Fun4AllServer::instance(); + + Dumper *dmp = new Dumper(); + gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); + dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); + + se->registerSubsystem(dmp); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); + se->registerInputManager(in); + se->fileopen("DSTin",infile); + se->run(evts); + se->End(); + delete se; +} From f5ce41ea0da4b5715c5aa89987defa9733974bbf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 Feb 2019 00:39:13 -0500 Subject: [PATCH 0236/1222] run under root6 --- macros/prototype4/Fun4All_G4_Prototype4.C | 32 ++++++++++++++++------- macros/prototype4/Fun4All_TestBeam.C | 26 ++++++++++++++---- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/macros/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C index cdce34007..8d010c8b2 100644 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -1,30 +1,44 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #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(libcalo_reco.so) R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4calo.so) -R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4histos.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libqa_modules.so) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 2dcd8dd55..57c4cd157 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -1,10 +1,26 @@ -#include - -using namespace std; +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +R__LOAD_LIBRARY(libPrototype4.so) +#endif void Fun4All_TestBeam(int nEvents = 100, - const char *input_file = "/sphenix/data/data03//phnxreco/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", - const char *output_file = "data/beam_00000406.root") + const char *input_file = "/sphenix/data/data02/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", + const char *output_file = "beam_00000406.root") { gSystem->Load("libfun4all"); gSystem->Load("libPrototype4.so"); From c8e6e53a85feb34c9947247f25b8db789002dcba Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 Feb 2019 01:45:26 -0500 Subject: [PATCH 0237/1222] write prototype4 named dst --- macros/prototype4/Fun4All_G4_Prototype4.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C index 8d010c8b2..6bebbec93 100644 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -619,7 +619,7 @@ int Fun4All_G4_Prototype4(int nEvents = 1) if (dstoutput) { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype3New.root"); + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype4New.root"); se->registerOutputManager(out); } From 015f13cd24761f10b267a0fe1526cf1a27115fac Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 Feb 2019 01:46:08 -0500 Subject: [PATCH 0238/1222] prototype 4 specific dump --- macros/prototype4/run_dump.C | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 macros/prototype4/run_dump.C diff --git a/macros/prototype4/run_dump.C b/macros/prototype4/run_dump.C new file mode 100644 index 000000000..8595df36b --- /dev/null +++ b/macros/prototype4/run_dump.C @@ -0,0 +1,28 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +R__LOAD_LIBRARY(libphnodedump.so) +#endif + +void run_dump(const char *infile, const int evts=100) +{ + gSystem->Load("libPrototype4_io.so"); + gSystem->Load("libphnodedump.so"); + + Fun4AllServer* se = Fun4AllServer::instance(); + + Dumper *dmp = new Dumper(); + gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); + dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); + + se->registerSubsystem(dmp); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); + se->registerInputManager(in); + se->fileopen("DSTin",infile); + se->run(evts); + se->End(); + delete se; +} From e5d63b02a94d0b612a41edb7737fac95aff9a110 Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Wed, 13 Feb 2019 11:44:03 -0500 Subject: [PATCH 0239/1222] updated E864 fEMC tower geometry --- macros/g4simulations/G4_FEMC.C | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index bd64f2a0a..0155d18a5 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -52,7 +52,7 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) // fsPHENIX ECAL femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v003.txt"; + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; cout << mapping_femc.str() << endl; @@ -75,7 +75,7 @@ void FEMC_Towers(int verbosity = 0) { // fsPHENIX ECAL mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v003.txt"; + "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -122,6 +122,13 @@ void FEMC_Towers(int verbosity = 0) { TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem( TowerDigitizer5 ); + RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); + TowerDigitizer6->Detector("FEMC"); + TowerDigitizer6->TowerType(6); + TowerDigitizer6->Verbosity(verbosity); + TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer6 ); + // PbW crystals //RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); //TowerCalibration1->Detector("FEMC"); @@ -170,6 +177,15 @@ void FEMC_Towers(int verbosity = 0) { TowerCalibration5->set_pedstal_ADC(0); se->registerSubsystem( TowerCalibration5 ); + RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); + TowerCalibration6->Detector("FEMC"); + TowerCalibration6->TowerType(6); + TowerCalibration6->Verbosity(verbosity); + TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration6->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration6 ); + } void FEMC_Clusters(int verbosity = 0) { @@ -197,5 +213,6 @@ void FEMC_Eval(std::string outputfile, int verbosity = 0) eval->Verbosity(verbosity); se->registerSubsystem(eval); + return; } From 7af90a8049aa2d430a9faf1436dd295b5393a839 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 13 Feb 2019 22:31:51 -0500 Subject: [PATCH 0240/1222] Macro to run new storage objects code --- macros/g4simulations/G4_Tracking.C | 431 ++++++++++++++++++----------- 1 file changed, 271 insertions(+), 160 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index e3d0f8138..d49203459 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -2,7 +2,7 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" #include -#include +#include #include #include #include @@ -18,22 +18,28 @@ #include #include #include -#include +#include #include #include #include #include #include +#include #include +#include #include +#include +R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) -R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) #endif #include + +bool old_containers = true; + // define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers // one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter #define INTTLADDER4_PP @@ -104,9 +110,9 @@ int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, PHG4INTTDefs::SEGMENTATION_PHI, PHG4INTTDefs::SEGMENTATION_PHI, PHG4INTTDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +int nladder[4] = {12, 12, 16, 16}; +double sensor_radius[4] = { 7.188, 7.829, 9.680, 10.264}; // radius of center of sensor for layer default +double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER0 int n_intt_layer = 0; @@ -258,13 +264,14 @@ void Tracking_Cells(int verbosity = 0) // Load libraries //--------------- + gSystem->Load("libmvtx.so"); + gSystem->Load("libtrack_io.so"); + gSystem->Load("libg4mvtx.so"); gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4tpc.so"); - gSystem->Load("libg4mvtx.so"); gSystem->Load("libtpc.so"); gSystem->Load("libintt.so"); - gSystem->Load("libmvtx.so"); //--------------- @@ -278,7 +285,17 @@ void Tracking_Cells(int verbosity = 0) if (n_maps_layer > 0) { - // MAPS cells + // new storage containers + PHG4MVTXHitReco* maps_hits = new PHG4MVTXHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); + + // old storage containers PHG4MVTXCellReco* maps_cells = new PHG4MVTXCellReco("MVTX"); maps_cells->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) @@ -293,13 +310,18 @@ void Tracking_Cells(int verbosity = 0) //========= if (n_intt_layer > 0) { - // INTT cells - PHG4INTTCellReco* reco = new PHG4INTTCellReco("INTT"); + // new storage containers + PHG4INTTHitReco* reco = new PHG4INTTHitReco("INTT"); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here //reco->set_double_param("tmax",80.0); //reco->set_double_param("tmin",-20.0); reco->Verbosity(verbosity); se->registerSubsystem(reco); + + // old storage containers + PHG4INTTCellReco* reco_old = new PHG4INTTCellReco("INTT"); + reco_old->Verbosity(verbosity); + se->registerSubsystem(reco_old); } // Set up TPC distortion calculation @@ -323,17 +345,33 @@ void Tracking_Cells(int verbosity = 0) // g4tpc/PHG4TPCPadPlaneReadout //========================= - PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); + PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); + + // new containers + PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); // 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.12 and 0.15, they can be changed here to get a different resolution edrift->set_double_param("added_smear_trans",0.12); edrift->set_double_param("added_smear_long",0.15); - PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); + if(old_containers) + { + // old containers + PHG4TPCElectronDrift *edrift_old = new PHG4TPCElectronDrift(); + edrift_old->Detector("TPC"); + // 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.12 and 0.15, they can be changed here to get a different resolution + edrift_old->set_double_param("added_smear_trans",0.12); + edrift_old->set_double_param("added_smear_long",0.15); + edrift_old->registerPadPlane(padplane); + se->registerSubsystem(edrift_old); + } + // 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",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer @@ -363,160 +401,194 @@ void Tracking_Reco(int verbosity = 0) //---------------------------------- // MVTX - PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); + //====== + // new containers + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); digimvtx->Verbosity(0); for (int i = 0; i < n_maps_layer; ++i) - { - digimvtx->set_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 - } + { + digimvtx->set_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 + } se->registerSubsystem(digimvtx); - - if (n_intt_layer > 0) - { - - if (INTTDeadMapOption != kINTTNoDeadMap) + + if(old_containers) { - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); - for (int i = 0; i < n_intt_layer; i++) - { - const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - - - if (INTTDeadMapOption == kINTT4PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - - } - else if (INTTDeadMapOption == kINTT8PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - - } - else - { - cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "< Verbosity(1); - se->registerSubsystem(deadMapINTT); + // old containers + PHG4MVTXDigitizer* digimvtx_old = new PHG4MVTXDigitizer(); + digimvtx_old->Verbosity(0); + for (int i = 0; i < n_maps_layer; ++i) + { + digimvtx_old->set_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 + } + se->registerSubsystem(digimvtx_old); } - // INTT - // 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); - - PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); - digiintt->Verbosity(verbosity); - for (int i = 0; i < n_intt_layer; i++) + if (n_intt_layer > 0) { - digiintt->set_adc_scale(n_maps_layer + i, userrange); + if (INTTDeadMapOption != kINTTNoDeadMap) + { + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); + for (int i = 0; i < n_intt_layer; i++) + { + const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); + + + if (INTTDeadMapOption == kINTT4PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else if (INTTDeadMapOption == kINTT8PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else + { + cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "< Verbosity(1); + se->registerSubsystem(deadMapINTT); + } + + // INTT + //===== + // 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); + for (int i = 0; i < n_intt_layer; i++) + { + digiintt->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + + if(old_containers) + { + // old containers + PHG4INTTDigitizer* digiintt_old = new PHG4INTTDigitizer(); + digiintt_old->Verbosity(verbosity); + for (int i = 0; i < n_intt_layer; i++) + { + digiintt_old->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt_old); + } } - se->registerSubsystem(digiintt); - } - - // TPC - PHG4TPCDigitizer* digitpc = new PHG4TPCDigitizer(); + + // TPC + //==== + // new containers + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); digitpc->SetTPCMinLayer(n_maps_layer + 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 - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " NEW TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); - //------------------------------------- - // Apply Live Area Inefficiency to Hits - // This is obsolete, please use PHG4SvtxDeadMapLoader instead for pre-defined deadmap - //------------------------------------- - // defaults to 1.0 (fully active) - -// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); -// -// for (int i = 0; i < n_maps_layer; i++) -// { -// deadarea->Verbosity(verbosity); -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) -// { -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// se->registerSubsystem(deadarea); + if(old_containers) + { + // old containers + PHG4TPCDigitizer* digitpc_old = new PHG4TPCDigitizer(); + digitpc_old->SetTPCMinLayer(n_maps_layer + n_intt_layer); + double ENC = 670.0; // standard + digitpc_old->SetENC(ENC); + double ADC_threshold = 4.0*ENC; + digitpc_old->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + cout << " OLD TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; + + se->registerSubsystem(digitpc_old); + } //----------------------------- // Apply MIP thresholds to Hits //----------------------------- + if(old_containers) + { + PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); + thresholds->Verbosity(verbosity); - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - - // maps - for (int i = 0; i < n_maps_layer; i++) - { - // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness - // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss - thresholds->set_threshold(i, -1); - } - // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC + // maps + for (int i = 0; i < n_maps_layer; i++) + { + // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness + // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss + thresholds->set_threshold(i, -1); + } + // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC - se->registerSubsystem(thresholds); + se->registerSubsystem(thresholds); + } //------------- // Cluster Hits //------------- - // For the MVTX layers - //PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); - MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); + // For the MVTX layers + //================ + // new containers + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); mvtxclusterizer->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 - mvtxclusterizer->set_threshold(0.1); // fraction of a mip se->registerSubsystem(mvtxclusterizer); + if(old_containers) + { + // old containers + MVTXClusterizer* mvtxclusterizer_old = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); + mvtxclusterizer_old->Verbosity(verbosity); + mvtxclusterizer_old->set_threshold(0.1); // fraction of a mip + se->registerSubsystem(mvtxclusterizer_old); + } + // For the INTT layers - INTTClusterizer* inttclusterizer = new INTTClusterizer("INTTClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); + //=============== + // new containers + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + 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 @@ -527,16 +599,43 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad } se->registerSubsystem(inttclusterizer); + if(old_containers) + { + // old containers + INTTClusterizer* inttclusterizer_old = new INTTClusterizer("INTTClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); + inttclusterizer_old->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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + if(laddertype[i-n_maps_layer] == PHG4INTTDefs::SEGMENTATION_PHI) + inttclusterizer_old->set_z_clustering(i, false); + } + se->registerSubsystem(inttclusterizer_old); + } + // For the TPC - - TPCClusterizer* tpcclusterizer = new TPCClusterizer(); + //========== + // new containers + TpcClusterizer* tpcclusterizer = new TpcClusterizer(); tpcclusterizer->Verbosity(0); - tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); - tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.10); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); se->registerSubsystem(tpcclusterizer); + if(old_containers) + { + // old containers + TPCClusterizer* tpcclusterizer_old = new TPCClusterizer(); + tpcclusterizer_old->Verbosity(0); + tpcclusterizer_old->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); + tpcclusterizer_old->setEnergyCut(15 /*adc*/); + tpcclusterizer_old->setFitWindowSigmas(0.0150, 0.10); // should be changed when TPC cluster resolution changes + tpcclusterizer_old->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); + se->registerSubsystem(tpcclusterizer_old); + } + + if(!old_containers) + return; + // This should be true for everything except testing! const bool use_kalman_pat_rec = true; if (use_kalman_pat_rec) @@ -629,28 +728,40 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // Tracking evaluation //---------------- - SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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(false); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(0); - se->registerSubsystem(eval); + if(old_containers) + { + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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(false); + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(0); + se->registerSubsystem(eval); + } + + TrkrEvaluator* trkreval; + trkreval = new TrkrEvaluator("TrkrEvaluator", "TrkrEval.root", n_maps_layer, n_intt_layer, n_gas_layer); + trkreval->do_cluster_eval(true); + se->registerSubsystem(trkreval); + 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", n_maps_layer, n_intt_layer, n_gas_layer); 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); + if(old_containers) + { + // 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", n_maps_layer, n_intt_layer, n_gas_layer); 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); + } } return; From d2e21349a8e6f755ce573ed6570c3109cd4171ce Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 21 Feb 2019 15:49:24 -0500 Subject: [PATCH 0241/1222] use https://github.com/sPHENIX-Collaboration/calibrations/pull/48 --- macros/prototype4/Fun4All_TestBeam.C | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 57c4cd157..9a36bc608 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -114,10 +114,10 @@ void Fun4All_TestBeam(int nEvents = 100, calib->set_calib_tower_node_prefix("CALIB_LG"); calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database se->registerSubsystem(calib); // calib = new CaloCalibration("HCALIN"); @@ -125,27 +125,27 @@ void Fun4All_TestBeam(int nEvents = 100, // 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 + // string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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().set_double_param("calib_const_scale", cout_cali); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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().set_double_param("calib_const_scale", cout_cali / 32); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali / 32); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database se->registerSubsystem(calib); } // From 07767c9d196ac7d163211a05abbdcf6986f79215 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 21 Feb 2019 15:49:24 -0500 Subject: [PATCH 0242/1222] use https://github.com/sPHENIX-Collaboration/calibrations/pull/48 --- macros/prototype4/Fun4All_TestBeam.C | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C index 57c4cd157..9a36bc608 100644 --- a/macros/prototype4/Fun4All_TestBeam.C +++ b/macros/prototype4/Fun4All_TestBeam.C @@ -114,10 +114,10 @@ void Fun4All_TestBeam(int nEvents = 100, calib->set_calib_tower_node_prefix("CALIB_LG"); calib->set_raw_tower_node_prefix("RAW_LG"); calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cin_cali); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database se->registerSubsystem(calib); // calib = new CaloCalibration("HCALIN"); @@ -125,27 +125,27 @@ void Fun4All_TestBeam(int nEvents = 100, // 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 + // string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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().set_double_param("calib_const_scale", cout_cali); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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().set_double_param("calib_const_scale", cout_cali / 32); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - // calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, - // string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database +// calib->GetCalibrationParameters().set_double_param("calib_const_scale", cout_cali / 32); +// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); + calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database se->registerSubsystem(calib); } // From 960084f364de9b61433126fb52c08973966bf959 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 5 Mar 2019 16:25:13 -0500 Subject: [PATCH 0243/1222] Modifications to the tracking macro to match the changes to MVTX cell reco and digitization code changes in PR#598. --- macros/g4simulations/G4_Tracking.C | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f8c75ae40..446133961 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -290,6 +290,8 @@ void Tracking_Cells(int verbosity = 0) // override the default timing window for this layer - default is +/- 5000 ns maps_cells->set_timing_window(ilayer, -5000, 5000); } + //maps_cells->set_diffusion_width(22e-04); // maximum diffusion width - sigma in cm - default is 22 microns + se->registerSubsystem(maps_cells); } @@ -342,7 +344,7 @@ void Tracking_Cells(int verbosity = 0) // We may want to change the number of inner layers, and can do that here padplane->set_int_param("tpc_minlayer_inner",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); - padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); + padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); return; } @@ -369,10 +371,9 @@ void Tracking_Reco(int verbosity = 0) // MVTX PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); digimvtx->Verbosity(0); - for (int i = 0; i < n_maps_layer; ++i) - { - digimvtx->set_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 - } + + // 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); if (n_intt_layer > 0) @@ -491,7 +492,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad //----------------------------- // Apply MIP thresholds to Hits //----------------------------- - + /* PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); thresholds->Verbosity(verbosity); @@ -505,6 +506,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC se->registerSubsystem(thresholds); + */ //------------- // Cluster Hits @@ -516,7 +518,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad mvtxclusterizer->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 - mvtxclusterizer->set_threshold(0.1); // fraction of a mip + mvtxclusterizer->set_threshold(0.0); // fraction of a mip se->registerSubsystem(mvtxclusterizer); // For the INTT layers From a8eb759cd2c2398a14148e0ef460f89650aaef44 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 14 Feb 2019 16:35:17 -0500 Subject: [PATCH 0244/1222] Make style file compilable --- macros/sPHENIXStyle/sPhenixStyle.C | 6 ++++-- macros/sPHENIXStyle/sPhenixStyle.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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 /* From 42012b77e04877f687a6e44e3fa62a4e3067bd14 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 7 Mar 2019 15:05:50 -0500 Subject: [PATCH 0245/1222] update date to the sPHENIX tracking macros --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 81 +++++++++++----------- macros/g4simulations/G4Setup_fsPHENIX.C | 10 +-- 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 506a6306e..c88a0afcb 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -147,6 +147,12 @@ int Fun4All_G4_fsPHENIX( // Fun4All server //--------------- + bool display_on = false; + if(display_on) + { + gROOT->LoadMacro("DisplayOn.C"); + } + 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 @@ -260,7 +266,7 @@ int Fun4All_G4_fsPHENIX( // Detector Division //------------------ - if (do_svtx_cell) Svtx_Cells(); + if (do_svtx_cell) Tracking_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -300,7 +306,7 @@ int Fun4All_G4_fsPHENIX( // SVTX tracking //-------------- - if (do_svtx_track) Svtx_Reco(); + if (do_svtx_track) Tracking_Reco(); //-------------- // FGEM tracking @@ -343,7 +349,7 @@ int Fun4All_G4_fsPHENIX( // Simulation evaluation //---------------------- - if (do_svtx_eval) Svtx_Eval("g4svtx_eval.root"); + if (do_svtx_eval) Tracking_Eval("g4svtx_eval.root"); if (do_cemc_eval) CEMC_Eval("g4cemc_eval.root"); @@ -420,51 +426,42 @@ int Fun4All_G4_fsPHENIX( //if (do_dst_compress) DstCompress(out); //se->registerOutputManager(out); + //----------------- + // Event processing + //----------------- + if (nEvents < 0) + { + return 0; + } + // 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 0; - } + { + 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; + } - if (nEvents < 0) + if(display_on) { - 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; + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; } - else - { - se->run(nEvents); + se->run(nEvents); - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 0; - } - return 0; + //----- + // Exit + //----- + + + se->End(); + std::cout << "All done" << std::endl; + delete se; + gSystem->Exit(0); + return 0; } diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 11f741e4f..8f5a60633 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -2,7 +2,7 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" #include "G4_Pipe.C" -#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C" +#include "G4_Tracking.C" #include "G4_CEmc_Spacal.C" #include "G4_HcalIn_ref.C" #include "G4_Magnet.C" @@ -47,8 +47,8 @@ void G4Init(bool do_svtx = true, } if (do_svtx) { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); + gROOT->LoadMacro("G4_Tracking.C"); + TrackingInit(n_TPC_layers); } if (do_cemc) @@ -167,7 +167,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); + if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); //---------------------------------------- // CEMC @@ -208,7 +208,7 @@ int G4Setup(const int absorberactive = 0, if ( do_FHCAL ) FHCALSetup(g4Reco, absorberactive); - // sPHENIX forward flux return(s) + // sPHENIX forward flux return(s) with reduced thickness 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); From 640de39adda86be070c89e3846139f9ba8b21d05 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 11 Mar 2019 11:29:12 -0400 Subject: [PATCH 0246/1222] fix for root6, ifdef around non existing module, fix includes and pre-loaded libs --- macros/g4simulations/G4_Tracking.C | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 446133961..6c5df249d 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -26,11 +26,14 @@ #include #include #include -R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4hough.so) -R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libtpc.so) #endif #include @@ -376,9 +379,10 @@ void Tracking_Reco(int verbosity = 0) //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons se->registerSubsystem(digimvtx); + if (n_intt_layer > 0) { - +#ifdef PHG4SVTXDEADMAPLOADER if (INTTDeadMapOption != kINTTNoDeadMap) { // Load pre-defined deadmaps @@ -414,6 +418,7 @@ void Tracking_Reco(int verbosity = 0) // deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } +#endif // PHG4SVTXDEADMAPLOADER // INTT // these should be used for the INTT From f07aa65ea32d5ff48645cbb7df5533da34973cdb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 11 Mar 2019 11:33:10 -0400 Subject: [PATCH 0247/1222] fix root6 issues --- macros/g4simulations/G4_HIJetReco.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index 9d2099a97..c039d104b 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -8,8 +8,9 @@ #include #include #include -#include #include +#include +#include R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libjetbackground.so) #endif @@ -83,7 +84,7 @@ void HIJetReco(int verbosity = 0, bool do_flow = false, bool do_CS = false ) { st->Verbosity( verbosity ); se->registerSubsystem( st ); - JetReco *towerjetreco = new 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)); From 142c76ddd1957e94fba1e91e11ec28598121dd13 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 12 Mar 2019 15:41:12 -0400 Subject: [PATCH 0248/1222] Mods to G4_Track.C to implement new trackreco area. --- macros/g4simulations/G4_Tracking.C | 219 ++++++++++++++++++++--------- 1 file changed, 156 insertions(+), 63 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index d49203459..63ccd839b 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -29,15 +29,26 @@ #include #include #include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) #endif #include +// set to run the code that produces the old containers through clustering bool old_containers = true; // define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers @@ -272,7 +283,7 @@ void Tracking_Cells(int verbosity = 0) gSystem->Load("libg4tpc.so"); gSystem->Load("libtpc.so"); gSystem->Load("libintt.so"); - + //--------------- // Fun4All server @@ -388,7 +399,9 @@ void Tracking_Reco(int verbosity = 0) //--------------- gSystem->Load("libfun4all.so"); +gSystem->Load("libtrack_reco.so"); gSystem->Load("libg4hough.so"); + //--------------- // Fun4All server @@ -633,67 +646,145 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(tpcclusterizer_old); } - if(!old_containers) - return; + // Old tracking in g4hough using old containers + bool old_tracking = false; + if(old_tracking) + { + // 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(30); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // strip length is along theta + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); + } + } + + 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 + //------------------ + PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } - // 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); - - for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // strip length is along theta - kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); - } - } - - se->registerSubsystem(kalman_pat_rec); - } - else - { - //--------------------- - // Truth Pattern Recognition - //--------------------- - PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); - se->registerSubsystem(pat_rec); - } + // new containers will be implemented here + //============================== - //--------------------- - // Kalman Filter - //--------------------- + if(!old_tracking) + { + // This should be true for everything except testing! + const bool use_track_prop = true; + if (use_track_prop) + { + //--------------------- + // PHG4KalmanPatRec + //--------------------- + + // new clus - 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); + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); + track_seed->Verbosity(50); + se->registerSubsystem(track_seed); + + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + track_prop->Verbosity(50); + se->registerSubsystem(track_prop); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + track_prop->set_min_search_win_theta_intt(i, 0.00); + track_prop->set_max_search_win_phi_intt(i, 0.20); + track_prop->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // 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); + } + } + } + else + { + //--------------------- + // Truth Pattern Recognition + //--------------------- + PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); + se->registerSubsystem(pat_rec); + } + - //------------------ - // Track Projections - //------------------ - PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); + //--------------------- + // Kalman Filter + //--------------------- + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(100); + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } /* //---------------------- @@ -703,10 +794,11 @@ void Tracking_Reco(int verbosity = 0) beamspot->Verbosity(verbosity); se->registerSubsystem( beamspot ); */ - + return; } + void Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- @@ -728,6 +820,12 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // Tracking evaluation //---------------- + TrkrEvaluator* trkreval; + trkreval = new TrkrEvaluator("TrkrEvaluator", "TrkrEval.root", n_maps_layer, n_intt_layer, n_gas_layer); + trkreval->do_cluster_eval(true); + se->registerSubsystem(trkreval); + + if(old_containers) { SvtxEvaluator* eval; @@ -741,11 +839,6 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) se->registerSubsystem(eval); } - TrkrEvaluator* trkreval; - trkreval = new TrkrEvaluator("TrkrEvaluator", "TrkrEval.root", n_maps_layer, n_intt_layer, n_gas_layer); - trkreval->do_cluster_eval(true); - se->registerSubsystem(trkreval); - if (use_primary_vertex) { From e4d9f655cc246ab865078b7b6d8fa8229f91a16b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 16 Mar 2019 22:54:09 -0400 Subject: [PATCH 0249/1222] Update fsPHENIX fast tracking --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 5 +- macros/g4simulations/G4_FGEM_fsPHENIX.C | 117 +++++++++++++++++---- 2 files changed, 101 insertions(+), 21 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index c88a0afcb..9d3cd31eb 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -108,6 +108,7 @@ int Fun4All_G4_fsPHENIX( bool do_FGEM = true; bool do_FGEM_track = do_FGEM && true; + bool do_FGEM_eval = do_FGEM_track && true; bool do_FEMC = true; bool do_FEMC_cell = do_FEMC && true; @@ -141,7 +142,7 @@ int Fun4All_G4_fsPHENIX( int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = 1.0; // already adjusted to 1.4T central field + const float magfield_rescale = -1.4/1.5; // make consistent with Fun4All_G4_sPHENIX() //--------------- // Fun4All server @@ -361,6 +362,8 @@ int Fun4All_G4_fsPHENIX( if (do_fwd_jet_eval) Jet_FwdEval("g4fwdjet_eval.root"); + if (do_FGEM_eval) FGEM_FastSim_Reco("g4fwdjet_eval.root"); + //-------------- // IO management //-------------- diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index b3f8b11e2..85720e9f1 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -269,14 +269,14 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, return 0; } -void FGEM_FastSim_Reco(int verbosity = 0) { - +void FGEM_FastSim_Reco(int verbosity = 0) +{ //--------------- // Load libraries //--------------- gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); + gSystem->Load("libg4trackfastsim.so"); //--------------- // Fun4All server @@ -284,34 +284,111 @@ void FGEM_FastSim_Reco(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(0); + PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + kalman->Verbosity(verbosity); 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_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_fit_alg_name("KalmanFitterRefTrack"); // kalman->set_primary_assumption_pid(13); kalman->set_do_evt_display(false); - se->registerSubsystem(kalman); + // MAPS + kalman->add_phg4hits( + "G4HIT_MAPS", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70 - 4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70 - 4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // TPC + kalman->add_phg4hits( + "G4HIT_TPC", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70 - 4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70 - 4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM4, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70 - 4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // Saved track states (projections) + kalman->add_state_name("FEMC"); + kalman->add_state_name("FHCAL"); + se->registerSubsystem(kalman); } +void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) +{ + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4trackfastsim.so"); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_filename(outputfile.c_str()); + se->registerSubsystem(fast_sim_eval); + + return; +} From 0a1babeaf5e47392ec05d7e62c8c95069892781a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 16 Mar 2019 23:33:37 -0400 Subject: [PATCH 0250/1222] fix note name --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 85720e9f1..297555376 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -300,7 +300,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) // MAPS kalman->add_phg4hits( - "G4HIT_MAPS", // const std::string& phg4hitsNames, + "G4HIT_MVTX", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, 5e-4, // const float radres, 5e-4, // const float phires, @@ -379,7 +379,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) se->registerSubsystem(kalman); } -void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) +void FGEM_FastSim_Eval(std::string outputfile, int verbosity = 0) { gSystem->Load("libfun4all.so"); gSystem->Load("libg4trackfastsim.so"); From b011e9cd57a4ad3e021480f9b9c893d9fb2301a0 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 18:44:43 -0400 Subject: [PATCH 0251/1222] Fix HCal macro lib dependency --- macros/g4simulations/G4_FHCAL.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index 88be4d5a1..1f1f7571c 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -67,7 +67,8 @@ FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) void FHCAL_Towers(int verbosity = 0) { gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; From e4464a38f42e4e2cc12e2b45ea34aabda25ddfd1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 19:18:21 -0400 Subject: [PATCH 0252/1222] remove piston which conflicts with the current field configuration --- macros/g4simulations/G4Setup_fsPHENIX.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 8f5a60633..87f724030 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -235,11 +235,13 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // piston magnet - make_piston("magpiston", g4Reco); +// make_piston("magpiston", g4Reco); //---------------------------------------- // BLACKHOLE - + // minimal space for forward instrumentation + if (radius<270) radius = 270; + // 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 From 354fdb1610da833bde95e3c473858a8fc35bcd97 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 19:19:17 -0400 Subject: [PATCH 0253/1222] format and fix on FGEM tracking --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 114 ++++++++++-------------- 1 file changed, 46 insertions(+), 68 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 297555376..26135cbb1 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -1,23 +1,21 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include #include +#include #include #include -#include #include +#include "GlobalVariables.C" R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4hough.so) -int -make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8); -void -AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); +int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, + double etamax, const int N_Sector = 8); +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); #endif -// $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $ +// $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $ /*! * \file G4_FGEM_fsPHENIX.C @@ -29,18 +27,14 @@ AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); using namespace std; -void -FGEM_Init() +void FGEM_Init() { - } -void -FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // - ) +void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // + const double min_eta = 1.45 // +) { - const double tilt = .1; string name; @@ -105,15 +99,10 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // 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); + 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); + (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)); @@ -156,18 +145,13 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // 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); + 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); + (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)); @@ -186,12 +170,10 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// - } //! Add drift layers to mini TPC -void -AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) { assert(gem); @@ -199,49 +181,45 @@ AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) 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 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); + 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); - - } + { + 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) +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; + // 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(); - - } + { + zpos = -zpos; + polar_angle = TMath::Pi(); + } if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } + { + double t = etamax; + etamax = etamin; + etamin = t; + } PHG4SectorSubsystem *gem; gem = new PHG4SectorSubsystem(name.c_str()); @@ -298,7 +276,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) kalman->set_primary_assumption_pid(13); kalman->set_do_evt_display(false); - // MAPS + // MAPS in MVTX detector kalman->add_phg4hits( "G4HIT_MVTX", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, @@ -314,7 +292,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_0", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70 - 4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise @@ -346,7 +324,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_2", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70 - 4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise @@ -356,7 +334,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_3", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70 - 4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise @@ -366,7 +344,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_4", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70 - 4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise From 842e435c932909a8b07dc3715d6232bf83da91e9 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 19:26:14 -0400 Subject: [PATCH 0254/1222] Update naming conventions --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 9d3cd31eb..432670fe0 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -70,11 +70,13 @@ int Fun4All_G4_fsPHENIX( 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; + // central tracking + bool do_tracking = true; + bool do_tracking_cell = do_tracking && true; + bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_eval = do_tracking_track && true; + // central calorimeters, which is a detailed simulation and slow to run bool do_cemc = true; bool do_cemc_cell = do_cemc && true; bool do_cemc_twr = do_cemc_cell && true; @@ -137,7 +139,7 @@ int Fun4All_G4_fsPHENIX( // 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); + G4Init(do_tracking,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"; // 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) @@ -156,7 +158,7 @@ int Fun4All_G4_fsPHENIX( 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 +// 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 @@ -167,7 +169,7 @@ int Fun4All_G4_fsPHENIX( // 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); +// rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -241,12 +243,12 @@ int Fun4All_G4_fsPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_svtx, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, + do_tracking, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_FGEM, do_FEMC, do_FHCAL, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, + do_tracking, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_FGEM, do_FEMC, do_FHCAL, magfield_rescale); #endif @@ -267,7 +269,7 @@ int Fun4All_G4_fsPHENIX( // Detector Division //------------------ - if (do_svtx_cell) Tracking_Cells(); + if (do_tracking_cell) Tracking_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -307,7 +309,7 @@ int Fun4All_G4_fsPHENIX( // SVTX tracking //-------------- - if (do_svtx_track) Tracking_Reco(); + if (do_tracking_track) Tracking_Reco(); //-------------- // FGEM tracking @@ -350,7 +352,7 @@ int Fun4All_G4_fsPHENIX( // Simulation evaluation //---------------------- - if (do_svtx_eval) Tracking_Eval("g4svtx_eval.root"); + if (do_tracking_eval) Tracking_Eval("g4tracking_eval.root"); if (do_cemc_eval) CEMC_Eval("g4cemc_eval.root"); @@ -362,7 +364,7 @@ int Fun4All_G4_fsPHENIX( if (do_fwd_jet_eval) Jet_FwdEval("g4fwdjet_eval.root"); - if (do_FGEM_eval) FGEM_FastSim_Reco("g4fwdjet_eval.root"); + if (do_FGEM_eval) FGEM_FastSim_Eval("g4tracking_fgem_eval.root"); //-------------- // IO management @@ -409,7 +411,7 @@ int Fun4All_G4_fsPHENIX( G4DSTreader_fsPHENIX( outputFile, // /*int*/ absorberactive , - /*bool*/ do_svtx , + /*bool*/ do_tracking , /*bool*/ do_cemc , /*bool*/ do_hcalin , /*bool*/ do_magnet , From 8b0537d79618351ac628ef2c4a7e77947133cc83 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 21:18:26 -0400 Subject: [PATCH 0255/1222] disable reconstruction for central tracker --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 473 +----------------- 1 file changed, 12 insertions(+), 461 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index ca9ee978f..457add94d 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -47,52 +47,6 @@ int nladder[4] = {34, 30, 36, 42}; // default double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default -// Optionally reconfigure the INTT -//======================================================================== -// example re-configurations of INTT - uncomment one to get the reconfiguration -// n_intt must be 0-4, setting it to zero will remove the INTT completely, otherwise it gives you n layers -//======================================================================== -/* -// Four layers, laddertypes 1-1-0-1 -n_intt_layer = 4; -laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 0; laddertype[3] = 1; -nladder[0] = 22; nladder[1] = 30; nladder[2] = 52; nladder[3] = 42; -sensor_radius_inner[0] = 6.876; sensor_radius_inner[1] = 8.987; sensor_radius_inner[2] = 10.835; sensor_radius_inner[3] = 12.676; -sensor_radius_outer[0] = 7.462; sensor_radius_outer[1] = 9.545; sensor_radius_outer[2] = 11.361; sensor_radius_outer[3] = 13.179; -*/ -/* -// Three outer layers, laddertypes 1-0-1 -n_intt_layer = 3; -laddertype[0] = 1; laddertype[1] = 0; laddertype[2] = 1; -nladder[0] = 30; nladder[1] = 52; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; -*/ -/* -// Three outer layers, laddertypes 1-1-1 -n_intt_layer = 3; -laddertype[0] = 1; laddertype[1] = 1; laddertype[2] = 1; -nladder[0] = 30; nladder[1] = 36; nladder[2] = 42; -sensor_radius_inner[0] = 8.987; sensor_radius_inner[1] = 10.835; sensor_radius_inner[2] = 12.676; -sensor_radius_outer[0] = 9.545; sensor_radius_outer[1] = 11.361; sensor_radius_outer[2] = 13.179; -*/ -/* -// Two outer layers, laddertype 0-1 -n_intt_layer = 2; -laddertype[0] = 0; laddertype[1] = 1; -nladder[0] = 52; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; -*/ -/* -// Two outer layers, laddertype 1-1 -n_intt_layer = 2; -laddertype[0] = 1; laddertype[1] = 1; -nladder[0] = 36; nladder[1] = 42; -sensor_radius_inner[0] = 10.835; sensor_radius_inner[1] = 12.676; -sensor_radius_outer[0] = 11.361; sensor_radius_outer[1] = 13.179; -*/ - int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. int tpc_layer_rphi_count_inner = 1152; @@ -165,6 +119,7 @@ double TPC_SmearZ; int Max_si_layer; void SvtxInit(int verbosity = 0) +{ { Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; @@ -285,12 +240,16 @@ double Svtx(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 - + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { @@ -299,7 +258,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, << " pixel size 30 x 30 microns " << " active pixel thickness 0.0018 microns" << endl; - PHG4MapsSubsystem* lyr = new PHG4MapsSubsystem("MAPS", ilayer, stave_type[ilayer]); + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", ilayer, stave_type[ilayer]); lyr->Verbosity(verbosity); lyr->set_double_param("layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm @@ -314,7 +273,6 @@ double Svtx(PHG4Reco* g4Reco, double radius, lyr->set_int_param("active", 1); lyr->OverlapCheck(maps_overlapcheck); - //lyr->set_string_param("stave_geometry_file", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); g4Reco->registerSubsystem(lyr); @@ -323,52 +281,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, } } - 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; i < 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(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; - } - - // This is a temporary workaround using an alternative constructor for problem with parameter class not updating doubles -// PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem(sensor_radius_inner, sensor_radius_outer, "SILICON_TRACKER", vpair); - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // Update the laddertype and ladder spacing configuration - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - // These are set above in the constructor for now, due to a problem with the parameter class - //sitrack->set_double_param(i,"sensor_radius_inner", sensor_radius_inner[i]*10.0); // expecting mm - //sitrack->set_double_param(i,"sensor_radius_outer", sensor_radius_outer[i]*10.0); - } - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } + assert (n_intt_layer == 0); // int verbosity = 1; @@ -504,6 +417,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, return radius; } +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now void Svtx_Cells(int verbosity = 0) { // runs the cellularization of the energy deposits (g4hits) @@ -526,136 +440,11 @@ void Svtx_Cells(int verbosity = 0) // SVTX cells //----------- - if (verbosity) - { - cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; - cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; - cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; - cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; - cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; - cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; - cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; - cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; - cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; - cout << " TPC z cell " << tpc_cell_z << " cm" << endl; - cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; - cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; - } - - 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, -5000, 5000); - } - 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); - } - - // 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"); - 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); - //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - 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 - // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers - svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits - svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits - svtx_cells->set_drift_velocity(TPCDriftVelocity); - svtx_cells->setHalfLength(105.5); - svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); - 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 - //====================== - - double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns - - // inner layers - double radius_layer = inner_readout_radius ; - for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) - { - // this calculates the radius at the middle of the layer - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_inner; - } - - - // mid layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_mid; - } - - // outer layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - - radius_layer += tpc_layer_thick_outer; - } - - se->registerSubsystem(svtx_cells); return; } +// Central detector reco is disabled as EIC setup use the fast tracking sim for now void Svtx_Reco(int verbosity = 0) { //--------------- @@ -671,247 +460,9 @@ void Svtx_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); - for (int i = 0; i < n_maps_layer; ++i) - { - digi->set_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; i < n_intt_layer; i++) - { - digiintt->set_adc_scale(n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); - } - - // TPC layers use the Svtx digitizer - digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); - double ENC = 670.0; // standard - digi->SetENC(ENC); - double ADC_threshold = 4.0*ENC; - digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold - << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; - - se->registerSubsystem(digi); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - - for (int i = 0; i < n_maps_layer; i++) - { - deadarea->Verbosity(verbosity); - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i, 1.0); - } - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - //deadarea->set_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; i < n_maps_layer; i++) - { - // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness - // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss - thresholds->set_threshold(i, 0.1); - } - // INTT - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - thresholds->set_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 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - if(laddertype[i-n_maps_layer] == 1) - clusterizer->set_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); - tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); - 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); - - for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // strip length is along theta - kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); - } - } - - 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 - //------------------ - PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); - 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(true); // enable to see the hits that includes the chamber physics... - 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 ); From 3e67e62b676fb17e3c1ce3edfca4b6e540492f33 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 22:10:40 -0400 Subject: [PATCH 0256/1222] fix typo --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 26135cbb1..703c78eb4 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -302,7 +302,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70 - 4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise From d3859d07756cea1f0a0f132a9c08571614339833 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 22:31:45 -0400 Subject: [PATCH 0257/1222] Accumulated fix on EIC tracking --- macros/g4simulations/G4_Tracking_EIC.C | 214 +++++++++++++++++-------- 1 file changed, 146 insertions(+), 68 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index d6a4ff386..3a4b36b7d 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include #include @@ -10,6 +10,9 @@ R__LOAD_LIBRARY(libg4eval.so) #include #include "G4_GEM_EIC.C" + +// load the version of central travker macro with cylindrical approximation of the TPC +// This is required for fast tracking to properly count hits in TPC #include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" void TrackingInit(int verbosity = 0) @@ -24,9 +27,9 @@ void TrackingInit(int verbosity = 0) SvtxInit(); } -double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) +double Tracking(PHG4Reco *g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) { /* Place electron-going side tracking detectors */ EGEMSetup(g4Reco); @@ -47,61 +50,148 @@ void Tracking_Reco(int verbosity = 0) //--------------- gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); + gSystem->Load("libg4trackfastsim.so"); //--------------- // Fun4All server //--------------- - Fun4AllServer* se = Fun4AllServer::instance(); - - //--------------------- - // Kalman Filter - //--------------------- + Fun4AllServer *se = Fun4AllServer::instance(); - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(10); + PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + kalman->Verbosity(verbosity); 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_pat_rec_hit_finding_eff(1.); - //kalman->set_pat_rec_noise_prob(0.); - std::string phg4hits_names[] = {"G4HIT_SVTX","G4HIT_MAPS","G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - const PHG4TrackFastSim::DETECTOR_TYPE dettypes[] = {PHG4TrackFastSim::Cylinder,PHG4TrackFastSim::Cylinder, - PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, - PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, - PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, - PHG4TrackFastSim::Vertical_Plane,PHG4TrackFastSim::Vertical_Plane, - PHG4TrackFastSim::Vertical_Plane }; - float rad[] = {5.0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; - float phi[] = {5.0, 150, 100, 100, 100, 100, 100, 100, 100, 100, 100}; - float lon[] = {5.0, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100}; - for(int i=0; i!=11; ++i) { // from um to cm - rad[i] *= 1e-4; - phi[i] *= 1e-4; - lon[i] *= 1e-4; - } - float eff[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; - float noi[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - kalman->set_phg4hits_names(phg4hits_names, dettypes, rad, phi, lon, eff, noi, 11); - - //std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2","G4HIT_EGEM_3","G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - //kalman->set_phg4hits_names(phg4hits_names, 9); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); - //std::string state_names[] = {"FEMC","FHCAL"}; - //kalman->set_state_names(state_names, 2); - - kalman->set_fit_alg_name("KalmanFitterRefTrack");// + // kalman->set_fit_alg_name("KalmanFitterRefTrack"); // + kalman->set_fit_alg_name("DafRef"); // kalman->set_primary_assumption_pid(13); kalman->set_do_evt_display(false); + // MAPS + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // + // TPC + kalman->add_phg4hits( + "G4HIT_SVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM4, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // Saved track states (projections) + kalman->add_state_name("FEMC"); + kalman->add_state_name("FHCAL"); + se->registerSubsystem(kalman); return; @@ -115,45 +205,33 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); + gSystem->Load("libg4trackfastsim.so"); gSystem->Load("libg4eval.so"); //--------------- // Fun4All server //--------------- - Fun4AllServer* se = Fun4AllServer::instance(); + Fun4AllServer *se = Fun4AllServer::instance(); //---------------- // SVTX evaluation //---------------- - SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->do_cluster_eval(false); - eval->do_g4hit_eval(false); - eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... - 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); + // SvtxEvaluator* eval; + // eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); + // eval->do_cluster_eval(false); + // eval->do_g4hit_eval(false); + // eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + // 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); // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); // se->registerSubsystem( eval ); + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_filename(outputfile.c_str()); + se->registerSubsystem(fast_sim_eval); } -// this uses a library which is not in our build -/* -void Fast_Tracking_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libFastTrackingEval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - FastTrackingEval *fast_sim_eval = new FastTrackingEval("FastTrackingEval"); - fast_sim_eval->set_filename( outputfile.c_str() ); - se->registerSubsystem( fast_sim_eval ); - - return; -} -*/ From 393d081667b49ca9ad7b1598e48f90a80c01db12 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 22:34:58 -0400 Subject: [PATCH 0258/1222] Accumulated fix on EIC tracking --- macros/g4simulations/Fun4All_G4_EICDetector.C | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index b0c04b938..e4227c82f 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -80,9 +80,9 @@ int Fun4All_G4_EICDetector( // 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; + const bool particles = true && !readhits; // or gun/ very simple single particle gun generator - const bool usegun = true && !readhits; + 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; @@ -91,14 +91,14 @@ int Fun4All_G4_EICDetector( //====================== // sPHENIX barrel - bool do_bbc = false; + 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; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ + bool do_tracking = true; + bool do_tracking_cell = do_tracking && true; + bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ bool do_pstof = false; @@ -188,7 +188,7 @@ int Fun4All_G4_EICDetector( // 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_plugdoor,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); + G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -200,7 +200,7 @@ int Fun4All_G4_EICDetector( //--------------- Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); // uncomment for batch production running with minimal output messages +// se->Verbosity(01); // 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 @@ -311,7 +311,7 @@ int Fun4All_G4_EICDetector( } 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_eta_range(-3, 3); 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); @@ -394,12 +394,12 @@ int Fun4All_G4_EICDetector( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, + do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, + do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #endif @@ -421,7 +421,7 @@ int Fun4All_G4_EICDetector( // Detector Division //------------------ - if (do_svtx_cell) Svtx_Cells(); + if (do_tracking_cell) Svtx_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -471,7 +471,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- - if (do_svtx_track) Tracking_Reco(); + if (do_tracking_track) Tracking_Reco(); //----------------- // Global Vertexing @@ -523,9 +523,7 @@ int Fun4All_G4_EICDetector( //---------------------- // Simulation evaluation //---------------------- -// commented out because -// Fast_Tracking_Eval function uses a library which is not part of our build -// if (do_svtx_eval) Fast_Tracking_Eval(string(outputFile) + "_g4svtx_eval.root"); + if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); @@ -575,7 +573,7 @@ int Fun4All_G4_EICDetector( G4DSTreader_EICDetector( outputFile, // /*int*/ absorberactive , - /*bool*/ do_svtx , + /*bool*/ do_tracking , /*bool*/ do_cemc , /*bool*/ do_hcalin , /*bool*/ do_magnet , From 94a21d2394b14d820c20e98cca2508c85a107562 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 22:44:04 -0400 Subject: [PATCH 0259/1222] Use the DafRef algorithm as the central Kalman fitter, which appears to be much more stable in fit success --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 703c78eb4..e704d451d 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -272,7 +272,8 @@ void FGEM_FastSim_Reco(int verbosity = 0) kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); - kalman->set_fit_alg_name("KalmanFitterRefTrack"); // +// kalman->set_fit_alg_name("KalmanFitterRefTrack"); // + kalman->set_fit_alg_name("DafRef"); // kalman->set_primary_assumption_pid(13); kalman->set_do_evt_display(false); From dfe492609835c3d471e0e0960239c3909e9feb6c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 17 Mar 2019 22:48:06 -0400 Subject: [PATCH 0260/1222] move macro parameter to default in constructor --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 5 ----- macros/g4simulations/G4_Tracking_EIC.C | 5 ----- 2 files changed, 10 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index e704d451d..6b525544f 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -272,11 +272,6 @@ void FGEM_FastSim_Reco(int verbosity = 0) kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); -// kalman->set_fit_alg_name("KalmanFitterRefTrack"); // - kalman->set_fit_alg_name("DafRef"); // - kalman->set_primary_assumption_pid(13); - kalman->set_do_evt_display(false); - // MAPS in MVTX detector kalman->add_phg4hits( "G4HIT_MVTX", // const std::string& phg4hitsNames, diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 3a4b36b7d..1f7a5ee7d 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -68,11 +68,6 @@ void Tracking_Reco(int verbosity = 0) kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); - // kalman->set_fit_alg_name("KalmanFitterRefTrack"); // - kalman->set_fit_alg_name("DafRef"); // - kalman->set_primary_assumption_pid(13); - kalman->set_do_evt_display(false); - // MAPS kalman->add_phg4hits( "G4HIT_MVTX", // const std::string& phg4hitsNames, From 73cd2dc035ddd5714338226c62226c63f5745791 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 18 Mar 2019 16:57:20 -0400 Subject: [PATCH 0261/1222] works under root6 --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 6b525544f..353d42320 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -2,15 +2,14 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include -#include #include -#include -#include #include +#include +#include #include "GlobalVariables.C" R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4trackfastsim.so) int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); From a9a267b5f03b8ef5e2c094dc7e14a69ea39116d9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 18 Mar 2019 22:47:46 -0400 Subject: [PATCH 0262/1222] Add missing include files --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 432670fe0..466d76c0d 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -15,8 +15,11 @@ #include #include #include +#include +#include #include #include +#include "DisplayOn.C" #include "G4Setup_fsPHENIX.C" #include "G4_Bbc.C" #include "G4_Global.C" From 04eaa34717bd719338d61b7cf22667bd255493de Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 18 Mar 2019 23:38:05 -0400 Subject: [PATCH 0263/1222] adjust for root6 --- macros/g4simulations/Fun4All_G4_EICDetector.C | 1 + ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 23 ++----------------- macros/g4simulations/G4_Tracking_EIC.C | 4 +++- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index e4227c82f..98df2db04 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 457add94d..33c90ea7c 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -3,25 +3,14 @@ #include "GlobalVariables.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(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) #endif @@ -119,7 +108,6 @@ double TPC_SmearZ; int Max_si_layer; void SvtxInit(int verbosity = 0) -{ { Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; @@ -462,10 +450,3 @@ void Svtx_Reco(int verbosity = 0) return; } - - - // 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_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 1f7a5ee7d..785c1a986 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -2,9 +2,11 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include -#include +#include +#include class SubsysReco; R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4trackfastsim.so) #endif #include From 067eebd8483d4154ab1c317c1c6e062a5d3662eb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 19 Mar 2019 15:11:51 -0400 Subject: [PATCH 0264/1222] copy G4_Tracking.C from ModularizedTrackReco branch --- macros/g4simulations/G4_Tracking.C | 352 ++++++++++++++++------------- 1 file changed, 190 insertions(+), 162 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 6c5df249d..98b1b3ed6 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -1,39 +1,57 @@ #pragma once #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.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 -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4hough.so) + +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) + R__LOAD_LIBRARY(libtrack_reco.so) #endif #include @@ -82,11 +100,11 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER6 int n_intt_layer = 6; int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI }; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI }; int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; @@ -94,9 +112,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_ZP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -104,9 +122,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_PP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -129,105 +147,105 @@ void TrackingInit(int verbosity = 0) } double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0, + int verbosity = 0) { // create the three tracker subsystems if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps - // MAPS inner barrel layers - //====================================================== + // MAPS inner barrel layers + //====================================================== - // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + int stave_type[3] = {0, 0, 0}; + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - 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; + 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; - PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", ilayer, stave_type[ilayer]); - lyr->Verbosity(verbosity); + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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 + 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]); + // 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_int_param("active", 1); + lyr->OverlapCheck(maps_overlapcheck); - lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); - g4Reco->registerSubsystem(lyr); + g4Reco->registerSubsystem(lyr); - radius = maps_layer_radius[ilayer]; - } + 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 + { + //------------------- + // INTT ladders + //------------------- - // 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 + bool intt_overlapcheck = false; // set to true if you want to check for overlaps - // PHG4INTTSubsystem creates the detetor layer using PHG4INTTDetector - // and instantiates the appropriate PHG4SteppingAction - const double intt_radius_max = 140.; // including stagger radius (mm) + // 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 - // The length of vpair is used to determine the number of layers - std::vector> vpair; // (sphxlayer, inttlayer) - for (int i = 0; i < 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(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 creates the detetor layer using PHG4INTTDetector + // and instantiates the appropriate PHG4SteppingAction + const double intt_radius_max = 140.; // including stagger radius (mm) - PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); + // The length of vpair is used to determine the number of layers + std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < 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(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; + } - // Set the laddertype and ladder spacing configuration - cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } + PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; + // Set the laddertype and ladder spacing configuration + cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } // The TPC - always present! //================================ @@ -240,10 +258,10 @@ double Tracking(PHG4Reco* g4Reco, double radius, tpc->set_double_param("steplimits", 1); // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - if (absorberactive) - { - tpc->SetAbsorberActive(); - } + if (absorberactive) + { + tpc->SetAbsorberActive(); + } tpc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem( tpc ); @@ -318,10 +336,10 @@ void Tracking_Cells(int verbosity = 0) if (do_tpc_distortion) { string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); + string(getenv("CALIBRATIONROOT")) + + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); + 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 } @@ -360,6 +378,7 @@ void Tracking_Reco(int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4hough.so"); + gSystem->Load("libtrack_reco.so"); //--------------- // Fun4All server @@ -379,10 +398,10 @@ void Tracking_Reco(int verbosity = 0) //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons se->registerSubsystem(digimvtx); - if (n_intt_layer > 0) { -#ifdef PHG4SVTXDEADMAPLOADER + +#ifdef SVTXDEADMAP if (INTTDeadMapOption != kINTTNoDeadMap) { // Load pre-defined deadmaps @@ -418,30 +437,30 @@ void Tracking_Reco(int verbosity = 0) // deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } -#endif // PHG4SVTXDEADMAPLOADER +#endif // SVTXDEADMAP // INTT // 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. - */ + 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); @@ -454,6 +473,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); digiintt->Verbosity(verbosity); + digiintt->Detector("INTT"); for (int i = 0; i < n_intt_layer; i++) { digiintt->set_adc_scale(n_maps_layer + i, userrange); @@ -468,7 +488,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad digitpc->SetENC(ENC); double ADC_threshold = 4.0*ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -498,19 +518,19 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad // Apply MIP thresholds to Hits //----------------------------- /* - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); + PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); + thresholds->Verbosity(verbosity); - // maps - for (int i = 0; i < n_maps_layer; i++) - { + // maps + for (int i = 0; i < n_maps_layer; i++) + { // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss thresholds->set_threshold(i, -1); - } - // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC + } + // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC - se->registerSubsystem(thresholds); + se->registerSubsystem(thresholds); */ //------------- @@ -518,7 +538,6 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad //------------- // For the MVTX layers - //PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); mvtxclusterizer->Verbosity(verbosity); // Reduced by 2 relative to the cylinder cell maps macro. I found this necessary to get full efficiency @@ -549,37 +568,45 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! - const bool use_kalman_pat_rec = true; - if (use_kalman_pat_rec) + const bool use_track_prop = true; + if (use_track_prop) { //--------------------- // PHG4KalmanPatRec //--------------------- - PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); - kalman_pat_rec->Verbosity(0); - + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); + track_seed->Verbosity(2); + se->registerSubsystem(track_seed); + + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + track_prop->Verbosity(10); + se->registerSubsystem(track_prop); + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // strip length is along theta - kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); - } + // strip length is along phi + track_prop->set_max_search_win_theta_intt(i, 0.010); + track_prop->set_min_search_win_theta_intt(i, 0.00); + track_prop->set_max_search_win_phi_intt(i, 0.20); + track_prop->set_min_search_win_phi_intt(i, 0.20); } - - se->registerSubsystem(kalman_pat_rec); + else + { + // 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); + } + } + } else { @@ -594,8 +621,8 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad // Kalman Filter //--------------------- - PHG4TrackKalmanFitter* kalman = new PHG4TrackKalmanFitter(); - kalman->Verbosity(0); + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(100); if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true se->registerSubsystem(kalman); @@ -628,6 +655,7 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4hough.so"); + gSystem->Load("libtrack_reco.so"); gSystem->Load("libg4eval.so"); //--------------- From 1e314b1652e7e98c20691bbd8bea60420ca44f89 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 20 Mar 2019 11:19:33 -0400 Subject: [PATCH 0265/1222] Update to ROOT6 --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 0f804a7d7..dcb77eacd 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,4 +1,8 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include #include #include #include From fcd8b0b02aa813daabc313cddb35ed9fe8c2ee4f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 27 Mar 2019 01:19:14 -0400 Subject: [PATCH 0266/1222] Revert "copy G4_Tracking.C from ModularizedTrackReco branch" --- macros/g4simulations/G4_Tracking.C | 352 +++++++++++++---------------- 1 file changed, 162 insertions(+), 190 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 98b1b3ed6..6c5df249d 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -1,57 +1,39 @@ #pragma once #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.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 -#include -#include -#include -R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4hough.so) -R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) - R__LOAD_LIBRARY(libtrack_reco.so) #endif #include @@ -100,11 +82,11 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER6 int n_intt_layer = 6; int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI }; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI }; int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; @@ -112,9 +94,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_ZP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -122,9 +104,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_PP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -147,105 +129,105 @@ void TrackingInit(int verbosity = 0) } double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0, + int verbosity = 0) { // create the three tracker subsystems if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps - // MAPS inner barrel layers - //====================================================== + // MAPS inner barrel layers + //====================================================== - // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + int stave_type[3] = {0, 0, 0}; + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - 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; + 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; - PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", ilayer, stave_type[ilayer]); - lyr->Verbosity(verbosity); + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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 + 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]); + // 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_int_param("active", 1); + lyr->OverlapCheck(maps_overlapcheck); - lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); - g4Reco->registerSubsystem(lyr); + g4Reco->registerSubsystem(lyr); - radius = maps_layer_radius[ilayer]; + radius = maps_layer_radius[ilayer]; + } } - } if (n_intt_layer > 0) - { - //------------------- - // INTT ladders - //------------------- + { + //------------------- + // INTT ladders + //------------------- - bool intt_overlapcheck = false; // set to true if you want to check for overlaps + bool intt_overlapcheck = false; // set to true if you want to check for overlaps - // 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 + // 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 - const double intt_radius_max = 140.; // including stagger radius (mm) + // PHG4INTTSubsystem creates the detetor layer using PHG4INTTDetector + // 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; i < 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(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; - } + // The length of vpair is used to determine the number of layers + std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < 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(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); - g4Reco->registerSubsystem(sitrack); + PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); - // Set the laddertype and ladder spacing configuration - cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } + // Set the laddertype and ladder spacing configuration + cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees + } - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } // The TPC - always present! //================================ @@ -258,10 +240,10 @@ double Tracking(PHG4Reco* g4Reco, double radius, tpc->set_double_param("steplimits", 1); // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - if (absorberactive) - { - tpc->SetAbsorberActive(); - } + if (absorberactive) + { + tpc->SetAbsorberActive(); + } tpc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem( tpc ); @@ -336,10 +318,10 @@ void Tracking_Cells(int verbosity = 0) if (do_tpc_distortion) { string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); + string(getenv("CALIBRATIONROOT")) + + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); + 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 } @@ -378,7 +360,6 @@ void Tracking_Reco(int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libtrack_reco.so"); //--------------- // Fun4All server @@ -398,10 +379,10 @@ void Tracking_Reco(int verbosity = 0) //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons se->registerSubsystem(digimvtx); + if (n_intt_layer > 0) { - -#ifdef SVTXDEADMAP +#ifdef PHG4SVTXDEADMAPLOADER if (INTTDeadMapOption != kINTTNoDeadMap) { // Load pre-defined deadmaps @@ -437,30 +418,30 @@ void Tracking_Reco(int verbosity = 0) // deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } -#endif // SVTXDEADMAP +#endif // PHG4SVTXDEADMAPLOADER // INTT // 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. - */ +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); @@ -473,7 +454,6 @@ void Tracking_Reco(int verbosity = 0) PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); digiintt->Verbosity(verbosity); - digiintt->Detector("INTT"); for (int i = 0; i < n_intt_layer; i++) { digiintt->set_adc_scale(n_maps_layer + i, userrange); @@ -488,7 +468,7 @@ void Tracking_Reco(int verbosity = 0) digitpc->SetENC(ENC); double ADC_threshold = 4.0*ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -518,19 +498,19 @@ void Tracking_Reco(int verbosity = 0) // Apply MIP thresholds to Hits //----------------------------- /* - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); + PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); + thresholds->Verbosity(verbosity); - // maps - for (int i = 0; i < n_maps_layer; i++) - { + // maps + for (int i = 0; i < n_maps_layer; i++) + { // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss thresholds->set_threshold(i, -1); - } - // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC + } + // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC - se->registerSubsystem(thresholds); + se->registerSubsystem(thresholds); */ //------------- @@ -538,6 +518,7 @@ void Tracking_Reco(int verbosity = 0) //------------- // For the MVTX layers + //PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); mvtxclusterizer->Verbosity(verbosity); // Reduced by 2 relative to the cylinder cell maps macro. I found this necessary to get full efficiency @@ -568,45 +549,37 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! - const bool use_track_prop = true; - if (use_track_prop) + const bool use_kalman_pat_rec = true; + if (use_kalman_pat_rec) { //--------------------- // PHG4KalmanPatRec //--------------------- - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - - PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); - track_seed->Verbosity(2); - se->registerSubsystem(track_seed); - - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); - track_prop->Verbosity(10); - se->registerSubsystem(track_prop); - + PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); + kalman_pat_rec->Verbosity(0); + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - track_prop->set_min_search_win_theta_intt(i, 0.00); - track_prop->set_max_search_win_phi_intt(i, 0.20); - track_prop->set_min_search_win_phi_intt(i, 0.20); + if(laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) + { + // strip length is along phi + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.010); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // strip length is along theta + kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); + kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); + kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); + } } - else - { - // 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); - } - } - + + se->registerSubsystem(kalman_pat_rec); } else { @@ -621,8 +594,8 @@ void Tracking_Reco(int verbosity = 0) // Kalman Filter //--------------------- - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(100); + 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); @@ -655,7 +628,6 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4hough.so"); - gSystem->Load("libtrack_reco.so"); gSystem->Load("libg4eval.so"); //--------------- From dce94ab4cce0bdf2d407e976b1eb43b13e5493c3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 17:21:50 -0400 Subject: [PATCH 0267/1222] recover modular tracking --- macros/g4simulations/G4_Tracking.C | 352 ++++++++++++++++------------- 1 file changed, 190 insertions(+), 162 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 6c5df249d..98b1b3ed6 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -1,39 +1,57 @@ #pragma once #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.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 -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4hough.so) + +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4hough.so) +R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) + R__LOAD_LIBRARY(libtrack_reco.so) #endif #include @@ -82,11 +100,11 @@ double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER6 int n_intt_layer = 6; int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI }; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI }; int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; @@ -94,9 +112,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_ZP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -104,9 +122,9 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladde #ifdef INTTLADDER4_PP int n_intt_layer = 4; int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -129,105 +147,105 @@ void TrackingInit(int verbosity = 0) } double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0, + int verbosity = 0) { // create the three tracker subsystems if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps - // MAPS inner barrel layers - //====================================================== + // MAPS inner barrel layers + //====================================================== - // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + int stave_type[3] = {0, 0, 0}; + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - 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; + 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; - PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", ilayer, stave_type[ilayer]); - lyr->Verbosity(verbosity); + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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 + 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]); + // 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_int_param("active", 1); + lyr->OverlapCheck(maps_overlapcheck); - lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); - g4Reco->registerSubsystem(lyr); + g4Reco->registerSubsystem(lyr); - radius = maps_layer_radius[ilayer]; - } + 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 + { + //------------------- + // INTT ladders + //------------------- - // 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 + bool intt_overlapcheck = false; // set to true if you want to check for overlaps - // PHG4INTTSubsystem creates the detetor layer using PHG4INTTDetector - // and instantiates the appropriate PHG4SteppingAction - const double intt_radius_max = 140.; // including stagger radius (mm) + // 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 - // The length of vpair is used to determine the number of layers - std::vector> vpair; // (sphxlayer, inttlayer) - for (int i = 0; i < 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(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 creates the detetor layer using PHG4INTTDetector + // and instantiates the appropriate PHG4SteppingAction + const double intt_radius_max = 140.; // including stagger radius (mm) - PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); + // The length of vpair is used to determine the number of layers + std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < 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(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; + } - // Set the laddertype and ladder spacing configuration - cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } + PHG4INTTSubsystem* sitrack = new PHG4INTTSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + g4Reco->registerSubsystem(sitrack); - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; + // Set the laddertype and ladder spacing configuration + cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } // The TPC - always present! //================================ @@ -240,10 +258,10 @@ double Tracking(PHG4Reco* g4Reco, double radius, tpc->set_double_param("steplimits", 1); // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - if (absorberactive) - { - tpc->SetAbsorberActive(); - } + if (absorberactive) + { + tpc->SetAbsorberActive(); + } tpc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem( tpc ); @@ -318,10 +336,10 @@ void Tracking_Cells(int verbosity = 0) if (do_tpc_distortion) { string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); + string(getenv("CALIBRATIONROOT")) + + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); + 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 } @@ -360,6 +378,7 @@ void Tracking_Reco(int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4hough.so"); + gSystem->Load("libtrack_reco.so"); //--------------- // Fun4All server @@ -379,10 +398,10 @@ void Tracking_Reco(int verbosity = 0) //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons se->registerSubsystem(digimvtx); - if (n_intt_layer > 0) { -#ifdef PHG4SVTXDEADMAPLOADER + +#ifdef SVTXDEADMAP if (INTTDeadMapOption != kINTTNoDeadMap) { // Load pre-defined deadmaps @@ -418,30 +437,30 @@ void Tracking_Reco(int verbosity = 0) // deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } -#endif // PHG4SVTXDEADMAPLOADER +#endif // SVTXDEADMAP // INTT // 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. - */ + 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); @@ -454,6 +473,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); digiintt->Verbosity(verbosity); + digiintt->Detector("INTT"); for (int i = 0; i < n_intt_layer; i++) { digiintt->set_adc_scale(n_maps_layer + i, userrange); @@ -468,7 +488,7 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad digitpc->SetENC(ENC); double ADC_threshold = 4.0*ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -498,19 +518,19 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad // Apply MIP thresholds to Hits //----------------------------- /* - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); + PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); + thresholds->Verbosity(verbosity); - // maps - for (int i = 0; i < n_maps_layer; i++) - { + // maps + for (int i = 0; i < n_maps_layer; i++) + { // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss thresholds->set_threshold(i, -1); - } - // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC + } + // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC - se->registerSubsystem(thresholds); + se->registerSubsystem(thresholds); */ //------------- @@ -518,7 +538,6 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad //------------- // For the MVTX layers - //PHG4SvtxClusterizer* mvtxclusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer", 0, n_maps_layer - 1); MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); mvtxclusterizer->Verbosity(verbosity); // Reduced by 2 relative to the cylinder cell maps macro. I found this necessary to get full efficiency @@ -549,37 +568,45 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! - const bool use_kalman_pat_rec = true; - if (use_kalman_pat_rec) + const bool use_track_prop = true; + if (use_track_prop) { //--------------------- // PHG4KalmanPatRec //--------------------- - PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); - kalman_pat_rec->Verbosity(0); - + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); + track_seed->Verbosity(2); + se->registerSubsystem(track_seed); + + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + track_prop->Verbosity(10); + se->registerSubsystem(track_prop); + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // strip length is along theta - kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); - } + // strip length is along phi + track_prop->set_max_search_win_theta_intt(i, 0.010); + track_prop->set_min_search_win_theta_intt(i, 0.00); + track_prop->set_max_search_win_phi_intt(i, 0.20); + track_prop->set_min_search_win_phi_intt(i, 0.20); } - - se->registerSubsystem(kalman_pat_rec); + else + { + // 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); + } + } + } else { @@ -594,8 +621,8 @@ DAC0-7 threshold as fraction to MIP voltage are set to PHG4INTTDigitizer::set_ad // Kalman Filter //--------------------- - PHG4TrackKalmanFitter* kalman = new PHG4TrackKalmanFitter(); - kalman->Verbosity(0); + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(100); if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true se->registerSubsystem(kalman); @@ -628,6 +655,7 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4hough.so"); + gSystem->Load("libtrack_reco.so"); gSystem->Load("libg4eval.so"); //--------------- From 16943b911834094395764a0989e3197092ee077a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 17:23:51 -0400 Subject: [PATCH 0268/1222] Fix verbosity setting chain --- macros/g4simulations/G4_Tracking.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 98b1b3ed6..d0564a352 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -392,7 +392,7 @@ void Tracking_Reco(int verbosity = 0) // MVTX PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); - digimvtx->Verbosity(0); + 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 @@ -434,7 +434,7 @@ void Tracking_Reco(int verbosity = 0) exit(1); } } -// deadMapINTT -> Verbosity(1); + deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } #endif // SVTXDEADMAP @@ -560,7 +560,7 @@ void Tracking_Reco(int verbosity = 0) // For the TPC TPCClusterizer* tpcclusterizer = new TPCClusterizer(); - tpcclusterizer->Verbosity(0); + tpcclusterizer->Verbosity(verbosity); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); tpcclusterizer->setEnergyCut(15 /*adc*/); tpcclusterizer->setFitWindowSigmas(0.0150, 0.10); // should be changed when TPC cluster resolution changes @@ -576,15 +576,15 @@ void Tracking_Reco(int verbosity = 0) //--------------------- PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); + init_vtx->Verbosity(verbosity); se->registerSubsystem(init_vtx); PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); - track_seed->Verbosity(2); + track_seed->Verbosity(verbosity); se->registerSubsystem(track_seed); PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); - track_prop->Verbosity(10); + track_prop->Verbosity(verbosity); se->registerSubsystem(track_prop); for(int i = 0;iVerbosity(100); + kalman->Verbosity(verbosity); if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true se->registerSubsystem(kalman); @@ -675,7 +675,7 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(0); + eval->Verbosity(verbosity); se->registerSubsystem(eval); if (use_primary_vertex) @@ -688,7 +688,7 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) 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); + evalp->Verbosity(verbosity); se->registerSubsystem(evalp); } From dec653c83c4c3c916d2f4c80bcb687a0c2070ebc Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 17:45:37 -0400 Subject: [PATCH 0269/1222] clang-format --- macros/g4simulations/G4_Tracking.C | 272 ++++++++++++++--------------- 1 file changed, 132 insertions(+), 140 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index d0564a352..abf44d804 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include "GlobalVariables.C" #include @@ -51,7 +51,7 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) - R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtrack_reco.so) #endif #include @@ -62,16 +62,16 @@ R__LOAD_LIBRARY(libtpc.so) // Dead map options for INTT enum enu_INTTDeadMapType { - kINTTNoDeadMap = 0, // All channel in INTT is alive - kINTT4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kINTT8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + kINTTNoDeadMap = 0, // All channel in INTT is alive + kINTT4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kINTT8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational }; // Choose INTT deadmap here enu_INTTDeadMapType INTTDeadMapOption = kINTTNoDeadMap; // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; +bool tpc_layers_40 = false; // 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 @@ -83,51 +83,51 @@ const int n_maps_layer = 3; // must be 0-3, setting it to zero removes MVTX com // Configure the INTT layers // offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders #ifdef INTTLADDER8 -int n_intt_layer = 8; +int n_intt_layer = 8; // default layer configuration -int laddertype[8] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; // default -int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default +int laddertype[8] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; // default +int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; +double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; #endif #ifdef INTTLADDER6 int n_intt_layer = 6; -int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI }; -int nladder[6] = {17, 17, 15, 15, 18, 18}; +int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; +int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; #endif #ifdef INTTLADDER4_ZP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; -int nladder[4] = {17, 17, 18, 18}; +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_Z, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; +int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER4_PP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; +int nladder[4] = {15, 15, 18, 18}; +double sensor_radius[6] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER0 int n_intt_layer = 0; @@ -147,75 +147,75 @@ void TrackingInit(int verbosity = 0) } double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0, + int verbosity = 0) { - // create the three tracker subsystems + // create the three tracker subsystems if (n_maps_layer > 0) { bool maps_overlapcheck = false; // set to true if you want to check for overlaps - + // MAPS inner barrel layers //====================================================== - + // Y. Corrales Morales 4Feb2019 // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + 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; - + 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; + PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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 - + 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/mvtx_stave_v01.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 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 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; i < n_intt_layer; i++) @@ -224,25 +224,25 @@ double Tracking(PHG4Reco* g4Reco, double radius, vpair.push_back(std::make_pair(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); g4Reco->registerSubsystem(sitrack); - + // Set the laddertype and ladder spacing configuration cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees + sitrack->set_double_param(i, "sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i, "offsetphi", offsetphi[i]); // expecting degrees } - + // outer radius marker (translation back to cm) radius = intt_radius_max * 0.1; } @@ -252,26 +252,25 @@ double Tracking(PHG4Reco* g4Reco, double radius, gSystem->Load("libg4tpc.so"); - PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); + PHG4TPCSubsystem* tpc = new PHG4TPCSubsystem("TPC"); tpc->SetActive(); tpc->SuperDetector("TPC"); tpc->set_double_param("steplimits", 1); // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - if (absorberactive) + if (absorberactive) { tpc->SetAbsorberActive(); } tpc->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem( tpc ); + g4Reco->registerSubsystem(tpc); - radius = 77.+1.17; - + radius = 77. + 1.17; radius += no_overlapp; - - return radius; + + return radius; } void Tracking_Cells(int verbosity = 0) @@ -291,7 +290,6 @@ void Tracking_Cells(int verbosity = 0) gSystem->Load("libintt.so"); gSystem->Load("libmvtx.so"); - //--------------- // Fun4All server //--------------- @@ -336,10 +334,10 @@ void Tracking_Cells(int verbosity = 0) if (do_tpc_distortion) { string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); + string(getenv("CALIBRATIONROOT")) + + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); + 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 } @@ -350,22 +348,22 @@ void Tracking_Cells(int verbosity = 0) // g4tpc/PHG4TPCPadPlaneReadout //========================= - PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); + PHG4TPCElectronDrift* edrift = new PHG4TPCElectronDrift(); edrift->Detector("TPC"); // 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 + // They represent effects not due to ideal gas properties and ideal readout plane behavior // defaults are 0.12 and 0.15, they can be changed here to get a different resolution - edrift->set_double_param("added_smear_trans",0.12); - edrift->set_double_param("added_smear_long",0.15); - PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); + edrift->set_double_param("added_smear_trans", 0.12); + edrift->set_double_param("added_smear_long", 0.15); + PHG4TPCPadPlane* padplane = new PHG4TPCPadPlaneReadout(); 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",n_maps_layer+n_intt_layer); // sPHENIX layer number of first TPC readout layer - padplane->set_int_param("ntpc_layers_inner",n_tpc_layer_inner); - padplane->set_int_param("ntpc_phibins_inner",tpc_layer_rphi_count_inner); + padplane->set_int_param("tpc_minlayer_inner", n_maps_layer + n_intt_layer); // sPHENIX layer number of first TPC readout layer + padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); + padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); return; } @@ -400,7 +398,6 @@ void Tracking_Reco(int verbosity = 0) if (n_intt_layer > 0) { - #ifdef SVTXDEADMAP if (INTTDeadMapOption != kINTTNoDeadMap) { @@ -411,33 +408,28 @@ void Tracking_Reco(int verbosity = 0) const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - if (INTTDeadMapOption == kINTT4PercentDeadMap) { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - DeadMapPath += DeadMapConfigName; + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - } else if (INTTDeadMapOption == kINTT8PercentDeadMap) { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - } else { - cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "<registerSubsystem(digitpc); //------------------------------------- @@ -499,20 +491,20 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------- // defaults to 1.0 (fully active) -// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); -// -// for (int i = 0; i < n_maps_layer; i++) -// { -// deadarea->Verbosity(verbosity); -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) -// { -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// se->registerSubsystem(deadarea); + // PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); + // + // for (int i = 0; i < n_maps_layer; i++) + // { + // deadarea->Verbosity(verbosity); + // //deadarea->set_hit_efficiency(i,0.99); + // deadarea->set_hit_efficiency(i, 1.0); + // } + // for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + // { + // //deadarea->set_hit_efficiency(i,0.99); + // deadarea->set_hit_efficiency(i, 1.0); + // } + // se->registerSubsystem(deadarea); //----------------------------- // Apply MIP thresholds to Hits @@ -545,20 +537,20 @@ void Tracking_Reco(int verbosity = 0) mvtxclusterizer->set_threshold(0.0); // fraction of a mip se->registerSubsystem(mvtxclusterizer); - // For the INTT layers + // For the INTT layers INTTClusterizer* inttclusterizer = new INTTClusterizer("INTTClusterizer", n_maps_layer, n_maps_layer + 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { - if(laddertype[i-n_maps_layer] == PHG4INTTDefs::SEGMENTATION_PHI) + if (laddertype[i - n_maps_layer] == PHG4INTTDefs::SEGMENTATION_PHI) inttclusterizer->set_z_clustering(i, false); } se->registerSubsystem(inttclusterizer); // For the TPC - + TPCClusterizer* tpcclusterizer = new TPCClusterizer(); tpcclusterizer->Verbosity(verbosity); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); @@ -575,7 +567,7 @@ void Tracking_Reco(int verbosity = 0) // PHG4KalmanPatRec //--------------------- - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(verbosity); se->registerSubsystem(init_vtx); @@ -587,26 +579,25 @@ void Tracking_Reco(int verbosity = 0) track_prop->Verbosity(verbosity); se->registerSubsystem(track_prop); - for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - track_prop->set_min_search_win_theta_intt(i, 0.00); - track_prop->set_max_search_win_phi_intt(i, 0.20); - track_prop->set_min_search_win_phi_intt(i, 0.20); + // strip length is along phi + track_prop->set_max_search_win_theta_intt(i, 0.010); + track_prop->set_min_search_win_theta_intt(i, 0.00); + track_prop->set_max_search_win_phi_intt(i, 0.20); + track_prop->set_min_search_win_phi_intt(i, 0.20); } else { - // 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); + // 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); } } - } else { @@ -683,7 +674,8 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // 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", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); + evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From b6f457625750ed54808194dfb275015c46007914 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 18:24:40 -0400 Subject: [PATCH 0270/1222] Correct header files --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index dcb77eacd..aba486f0a 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include From b52adaccd79f686a8e04252ba2a388abbb551d12 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 18:26:13 -0400 Subject: [PATCH 0271/1222] fix duplicated variable --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index aba486f0a..1f5cccfd2 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -594,19 +594,19 @@ int Fun4All_G4_sPHENIX( // calo_jet7->Verbosity(20); se->registerSubsystem(calo_jet7); - QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + QAG4SimulationJet *calo_jet4 = new QAG4SimulationJet( "AntiKt_Truth_r04"); - calo_jet7->add_reco_jet("AntiKt_Tower_r04"); - calo_jet7->add_reco_jet("AntiKt_Cluster_r04"); - calo_jet7->add_reco_jet("AntiKt_Track_r04"); - se->registerSubsystem(calo_jet7); + calo_jet4->add_reco_jet("AntiKt_Tower_r04"); + calo_jet4->add_reco_jet("AntiKt_Cluster_r04"); + calo_jet4->add_reco_jet("AntiKt_Track_r04"); + se->registerSubsystem(calo_jet4); - QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + QAG4SimulationJet *calo_jet2 = new QAG4SimulationJet( "AntiKt_Truth_r02"); - calo_jet7->add_reco_jet("AntiKt_Tower_r02"); - calo_jet7->add_reco_jet("AntiKt_Cluster_r02"); - calo_jet7->add_reco_jet("AntiKt_Track_r02"); - se->registerSubsystem(calo_jet7); + calo_jet2->add_reco_jet("AntiKt_Tower_r02"); + calo_jet2->add_reco_jet("AntiKt_Cluster_r02"); + calo_jet2->add_reco_jet("AntiKt_Track_r02"); + se->registerSubsystem(calo_jet2); } } From 96e0cd57bb6b9e2e60027ddcf622daed3b758a64 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 18:28:09 -0400 Subject: [PATCH 0272/1222] load libs for ROOT6 --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1f5cccfd2..9ef609e05 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -36,6 +36,7 @@ R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libphhepmc.so) R__LOAD_LIBRARY(libPHPythia6.so) R__LOAD_LIBRARY(libPHPythia8.so) +R__LOAD_LIBRARY(libqa_modules.so) #endif using namespace std; @@ -152,6 +153,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); + gSystem->Load("libqa_modules") // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); @@ -566,8 +568,8 @@ int Fun4All_G4_sPHENIX( // if (do_dst_compress) DstCompress(out); // se->registerOutputManager(out); + // QA parts { - assert(gSystem->Load("libqa_modules") >= 0); if (do_cemc) se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC")); From 4c9ee829070777f39dcdeaca2d97469dcd805962 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 18:32:53 -0400 Subject: [PATCH 0273/1222] load libs for ROOT6 --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 9ef609e05..5c8db09da 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -153,7 +153,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules") + gSystem->Load("libqa_modules"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); From aba47daa58e63702fa790dff41b78964edc49c12 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 30 Mar 2019 18:33:11 -0400 Subject: [PATCH 0274/1222] load libs for ROOT6 --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 5c8db09da..335932b7f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -638,8 +638,8 @@ int Fun4All_G4_sPHENIX( se->run(nEvents); + // QA outputs { - gSystem->Load("libqa_modules"); QAHistManagerDef::saveQARootFile(string(outputFile) + "_qa.root"); } From 8eeb32957a094730e4af30ee0aa0988c767ea4e1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 31 Mar 2019 19:33:48 -0400 Subject: [PATCH 0275/1222] Update plotting for ROOT6 --- macros/QA/calorimeter/QA_Draw_ALL.sh | 2 +- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 22 ++++---- .../calorimeter/QA_Draw_CEMC_TowerCluster.C | 18 +++--- .../QA_Draw_Calorimeter_Sum_Cluster.C | 15 +++-- .../QA_Draw_Calorimeter_Sum_TrackProj.C | 13 ++--- .../QA_Draw_Calorimeter_Sum_TrackProjEP.C | 15 +++-- macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 16 +++--- .../calorimeter/QA_Draw_HCALIN_TowerCluster.C | 19 +++---- macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 16 +++--- .../QA_Draw_HCALOUT_TowerCluster.C | 19 +++---- macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 24 ++++---- macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 21 +++---- .../calorimeter/QA_Draw_Jet_TruthMatching.C | 12 ++-- macros/QA/calorimeter/QA_Draw_Utility.C | 55 +++++++++++++++++-- 14 files changed, 146 insertions(+), 121 deletions(-) diff --git a/macros/QA/calorimeter/QA_Draw_ALL.sh b/macros/QA/calorimeter/QA_Draw_ALL.sh index f8536891e..dfc26be51 100755 --- a/macros/QA/calorimeter/QA_Draw_ALL.sh +++ b/macros/QA/calorimeter/QA_Draw_ALL.sh @@ -27,7 +27,7 @@ set macros = (\ QA_Draw_HCALIN_TowerCluster.C \ QA_Draw_HCALOUT_G4Hit.C \ QA_Draw_HCALOUT_TowerCluster.C \ - QA_Draw_Sum_Cluster.C \ + QA_Draw_Calorimeter_Sum_Cluster.C \ QA_Draw_Calorimeter_Sum_TrackProj.C \ QA_Draw_Calorimeter_Sum_TrackProjEP.C \ ); diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C index 657c4b7dc..47b5b2d2e 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_CEMC_G4Hit( @@ -27,9 +28,7 @@ void QA_Draw_CEMC_G4Hit( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -42,8 +41,7 @@ void QA_Draw_CEMC_G4Hit( assert(qa_file_ref->IsOpen()); } - TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, - 900); + TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, 900); c1->Divide(4, 2); int idx = 1; TPad *p; @@ -148,15 +146,17 @@ void QA_Draw_CEMC_G4Hit( "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); assert(h_new); + h_new->Rebin(5); h_new->Scale(1. / h_new->GetSum()); TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); assert(h_ref); + h_ref->Rebin(5); h_ref->Scale(1. / h_ref->GetSum()); } @@ -184,7 +184,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -215,7 +215,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -247,7 +247,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -262,6 +262,6 @@ void QA_Draw_CEMC_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C index eaa199d2d..c3c450490 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_CEMC_TowerCluster( @@ -27,9 +27,7 @@ void QA_Draw_CEMC_TowerCluster( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +60,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +89,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +120,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +152,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -275,7 +273,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -290,6 +288,6 @@ void QA_Draw_CEMC_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C index f5d7a26ce..959f34c88 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_Cluster( @@ -30,9 +31,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -119,7 +118,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); assert(h_ref); @@ -148,7 +147,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); assert(h_ref); @@ -178,7 +177,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); assert(h_ref); @@ -192,6 +191,6 @@ void QA_Draw_Calorimeter_Sum_Cluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C index 5080e3ddf..8cb5d2de0 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C @@ -18,8 +18,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_TrackProj( @@ -32,9 +33,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -123,7 +122,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( TH1 *h_ref = NULL; if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) { - TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); + h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); h_ref->Scale(1. / Ntrack_ref); } @@ -147,7 +146,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( TH1 *h_ref = NULL; if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) { - TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); + h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); h_ref->Scale(1. / Ntrack_ref); } @@ -159,7 +158,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( } } - PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C index d1fb4add9..e75f2cd2c 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_TrackProjEP( @@ -30,9 +31,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -94,7 +93,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); assert(h_ref); @@ -124,7 +123,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); assert(h_ref); @@ -169,6 +168,6 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( } } - PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C index 2b3b59c03..a8786a379 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_HCALIN_G4Hit( @@ -27,9 +27,7 @@ void QA_Draw_HCALIN_G4Hit( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -153,7 +151,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); assert(h_ref); @@ -184,7 +182,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -215,7 +213,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -246,7 +244,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -261,6 +259,6 @@ void QA_Draw_HCALIN_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C index d027df5b0..0ca698407 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_HCALIN_TowerCluster( @@ -26,9 +27,7 @@ void QA_Draw_HCALIN_TowerCluster( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +61,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +90,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +121,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -281,7 +280,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -296,6 +295,6 @@ void QA_Draw_HCALIN_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C index af0bfb08e..000bbc11e 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_HCALOUT_G4Hit( @@ -26,9 +26,7 @@ void QA_Draw_HCALOUT_G4Hit( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -154,7 +152,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); assert(h_ref); @@ -185,7 +183,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -216,7 +214,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -246,7 +244,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -261,6 +259,6 @@ void QA_Draw_HCALOUT_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C index 450f0660d..6e373c367 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_HCALOUT_TowerCluster( @@ -26,9 +27,7 @@ void QA_Draw_HCALOUT_TowerCluster( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +61,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +90,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +121,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -280,7 +279,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -295,6 +294,6 @@ void QA_Draw_HCALOUT_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C index 7862eb550..3129f9f4e 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_Jet_Spectrum( @@ -29,9 +29,7 @@ void QA_Draw_Jet_Spectrum( const char *qa_file_name_ref = "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -87,7 +85,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_eta"), "TH1F"); assert(h_ref); @@ -118,7 +116,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_phi"), "TH1F"); assert(h_ref); @@ -148,7 +146,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Et"), "TH1F"); assert(h_ref); @@ -178,7 +176,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Mass"), "TH1F"); assert(h_ref); @@ -209,7 +207,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CompSize"), "TH1F"); assert(h_ref); @@ -240,7 +238,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); assert(h_ref); @@ -271,7 +269,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); assert(h_ref); @@ -306,7 +304,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); assert(h_ref); @@ -322,7 +320,7 @@ void QA_Draw_Jet_Spectrum( } } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C index 52225b8c6..116d19e16 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C @@ -20,8 +20,8 @@ //some common style files #include "QA_Draw_Jet_TruthMatching.C" +//#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", @@ -34,10 +34,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", const double min_Et = 10; const double max_Et = 80; - // style sets - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); // file IO @@ -118,7 +115,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", TH1 *h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, TString(jet_family) + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); TLine *l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); p->SetGridx(0); @@ -157,7 +154,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, TString(jet_family) + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); p->SetGridx(0); @@ -195,7 +192,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, TString(jet_family) + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -234,7 +231,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, TString(jet_family) + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -272,7 +269,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, TString(jet_family) + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -310,7 +307,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, TString(jet_family) + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -341,6 +338,6 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", } legend->Draw(); - PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); + // PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C index fd45da15d..ec17c2d17 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C @@ -18,8 +18,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; vector @@ -34,9 +34,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = const double min_Et = 10; const double max_Et = 80; - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -229,7 +227,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm); } DrawReference(h_ratio, h_ratio_ref, true); @@ -278,7 +276,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm); } DrawReference(h_ratio, h_ratio_ref, true); @@ -289,7 +287,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); return resolution_collections; diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index ada127b8c..8f0ab4e58 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -15,14 +15,21 @@ #include #include #include +#include + +#include #include -#include #include #include -#include #include #include #include + +#include +#include +#include +#include + #include #include @@ -115,13 +122,13 @@ void SaveCanvas(TCanvas *c, TString name = "", Bool_t bEPS = kTRUE) //! Draw 1D histogram along with its reference as shade //! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) +double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) { hnew->SetLineColor(kBlue + 3); hnew->SetMarkerColor(kBlue + 3); - hnew->SetLineWidth(2); + // hnew->SetLineWidth(2); hnew->SetMarkerStyle(kFullCircle); - hnew->SetMarkerSize(1); + // hnew->SetMarkerSize(1); if (href) { @@ -131,7 +138,7 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) href->SetFillColor(kGreen + 1); href->SetLineStyle(kSolid); href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(2); + // href->SetLineWidth(2); href->SetMarkerStyle(kDot); href->SetMarkerSize(0); } @@ -149,6 +156,8 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) hnew->Draw(); // set scale + double ks_test = NAN; + if (href) { if (draw_href_error) @@ -161,7 +170,41 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) else href->Draw("HIST same"); hnew->Draw("same"); // over lay data points + + ks_test = hnew->KolmogorovTest(href, "D"); } + + // --------------------------------- + // now, make summary header + // --------------------------------- + if (href) + { + gPad->SetTopMargin(.14); + TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); + legend->Draw(); + legend = new TLegend(0, .86, .3, .93, NULL, "NB NDC"); + legend->AddEntry(href, Form("Reference"), "f"); + legend->Draw(); + legend = new TLegend(0.3, .86, 1, .93, NULL, "NB NDC"); + TLegendEntry *le = legend->AddEntry(hnew, Form("New: KS-Test P=%.3f", ks_test), "lpe"); + if (ks_test>=1) + le->SetTextColor(kBlue+1); + else if (ks_test>=.2) + le->SetTextColor(kGreen+2); + else if (ks_test>=.05) + le->SetTextColor(kYellow+1); + else + le->SetTextColor(kRed+1); + legend->Draw(); + } + else + { + gPad->SetTopMargin(.7); + TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); + legend->Draw(); + } + + return ks_test; } //! Draw 1D TGraph along with its reference as shade From abe9f56b3b823c952c40f52d3764dbaf963c3598 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 31 Mar 2019 19:33:48 -0400 Subject: [PATCH 0276/1222] Update plotting for ROOT6 --- macros/QA/calorimeter/QA_Draw_ALL.sh | 2 +- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 22 ++++---- .../calorimeter/QA_Draw_CEMC_TowerCluster.C | 18 +++--- .../QA_Draw_Calorimeter_Sum_Cluster.C | 15 +++-- .../QA_Draw_Calorimeter_Sum_TrackProj.C | 13 ++--- .../QA_Draw_Calorimeter_Sum_TrackProjEP.C | 15 +++-- macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 16 +++--- .../calorimeter/QA_Draw_HCALIN_TowerCluster.C | 19 +++---- macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 16 +++--- .../QA_Draw_HCALOUT_TowerCluster.C | 19 +++---- macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 24 ++++---- macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 21 +++---- .../calorimeter/QA_Draw_Jet_TruthMatching.C | 12 ++-- macros/QA/calorimeter/QA_Draw_Utility.C | 55 +++++++++++++++++-- 14 files changed, 146 insertions(+), 121 deletions(-) diff --git a/macros/QA/calorimeter/QA_Draw_ALL.sh b/macros/QA/calorimeter/QA_Draw_ALL.sh index f8536891e..dfc26be51 100755 --- a/macros/QA/calorimeter/QA_Draw_ALL.sh +++ b/macros/QA/calorimeter/QA_Draw_ALL.sh @@ -27,7 +27,7 @@ set macros = (\ QA_Draw_HCALIN_TowerCluster.C \ QA_Draw_HCALOUT_G4Hit.C \ QA_Draw_HCALOUT_TowerCluster.C \ - QA_Draw_Sum_Cluster.C \ + QA_Draw_Calorimeter_Sum_Cluster.C \ QA_Draw_Calorimeter_Sum_TrackProj.C \ QA_Draw_Calorimeter_Sum_TrackProjEP.C \ ); diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C index 657c4b7dc..47b5b2d2e 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_CEMC_G4Hit( @@ -27,9 +28,7 @@ void QA_Draw_CEMC_G4Hit( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -42,8 +41,7 @@ void QA_Draw_CEMC_G4Hit( assert(qa_file_ref->IsOpen()); } - TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, - 900); + TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, 900); c1->Divide(4, 2); int idx = 1; TPad *p; @@ -148,15 +146,17 @@ void QA_Draw_CEMC_G4Hit( "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); assert(h_new); + h_new->Rebin(5); h_new->Scale(1. / h_new->GetSum()); TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); assert(h_ref); + h_ref->Rebin(5); h_ref->Scale(1. / h_ref->GetSum()); } @@ -184,7 +184,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -215,7 +215,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -247,7 +247,7 @@ void QA_Draw_CEMC_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -262,6 +262,6 @@ void QA_Draw_CEMC_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C index eaa199d2d..c3c450490 100644 --- a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_CEMC_TowerCluster( @@ -27,9 +27,7 @@ void QA_Draw_CEMC_TowerCluster( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +60,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +89,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +120,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +152,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -275,7 +273,7 @@ void QA_Draw_CEMC_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -290,6 +288,6 @@ void QA_Draw_CEMC_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C index f5d7a26ce..959f34c88 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_Cluster( @@ -30,9 +31,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -119,7 +118,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); assert(h_ref); @@ -148,7 +147,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); assert(h_ref); @@ -178,7 +177,7 @@ void QA_Draw_Calorimeter_Sum_Cluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); assert(h_ref); @@ -192,6 +191,6 @@ void QA_Draw_Calorimeter_Sum_Cluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C index 5080e3ddf..8cb5d2de0 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C @@ -18,8 +18,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_TrackProj( @@ -32,9 +33,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -123,7 +122,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( TH1 *h_ref = NULL; if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) { - TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); + h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); h_ref->Scale(1. / Ntrack_ref); } @@ -147,7 +146,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( TH1 *h_ref = NULL; if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) { - TH1 *h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); + h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); h_ref->Scale(1. / Ntrack_ref); } @@ -159,7 +158,7 @@ void QA_Draw_Calorimeter_Sum_TrackProj( } } - PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C index d1fb4add9..e75f2cd2c 100644 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C +++ b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_Calorimeter_Sum_TrackProjEP( @@ -30,9 +31,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( // const char * qa_file_name_ref = // "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -94,7 +93,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); assert(h_ref); @@ -124,7 +123,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); assert(h_ref); @@ -169,6 +168,6 @@ void QA_Draw_Calorimeter_Sum_TrackProjEP( } } - PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C index 2b3b59c03..a8786a379 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_HCALIN_G4Hit( @@ -27,9 +27,7 @@ void QA_Draw_HCALIN_G4Hit( "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -153,7 +151,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); assert(h_ref); @@ -184,7 +182,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -215,7 +213,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -246,7 +244,7 @@ void QA_Draw_HCALIN_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -261,6 +259,6 @@ void QA_Draw_HCALIN_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C index d027df5b0..0ca698407 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_HCALIN_TowerCluster( @@ -26,9 +27,7 @@ void QA_Draw_HCALIN_TowerCluster( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +61,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +90,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +121,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -281,7 +280,7 @@ void QA_Draw_HCALIN_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -296,6 +295,6 @@ void QA_Draw_HCALIN_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C index af0bfb08e..000bbc11e 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_HCALOUT_G4Hit( @@ -26,9 +26,7 @@ void QA_Draw_HCALOUT_G4Hit( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -154,7 +152,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); assert(h_ref); @@ -185,7 +183,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); assert(h_ref); @@ -216,7 +214,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); assert(h_ref); @@ -246,7 +244,7 @@ void QA_Draw_HCALOUT_G4Hit( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); assert(h_ref); @@ -261,6 +259,6 @@ void QA_Draw_HCALOUT_G4Hit( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C index 450f0660d..6e373c367 100644 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C +++ b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C @@ -16,8 +16,9 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" + using namespace std; void QA_Draw_HCALOUT_TowerCluster( @@ -26,9 +27,7 @@ void QA_Draw_HCALOUT_TowerCluster( const char *qa_file_name_ref = "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -62,7 +61,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); assert(h_ref); @@ -91,7 +90,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); assert(h_ref); @@ -122,7 +121,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); assert(h_ref); @@ -154,7 +153,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); assert(h_ref); @@ -280,7 +279,7 @@ void QA_Draw_HCALOUT_TowerCluster( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); assert(h_ref); @@ -295,6 +294,6 @@ void QA_Draw_HCALOUT_TowerCluster( DrawReference(h_new, h_ref); } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C index 7862eb550..3129f9f4e 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C @@ -16,8 +16,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_Jet_Spectrum( @@ -29,9 +29,7 @@ void QA_Draw_Jet_Spectrum( const char *qa_file_name_ref = "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") { - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -87,7 +85,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_eta"), "TH1F"); assert(h_ref); @@ -118,7 +116,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_phi"), "TH1F"); assert(h_ref); @@ -148,7 +146,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Et"), "TH1F"); assert(h_ref); @@ -178,7 +176,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Mass"), "TH1F"); assert(h_ref); @@ -209,7 +207,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CompSize"), "TH1F"); assert(h_ref); @@ -240,7 +238,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); assert(h_ref); @@ -271,7 +269,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); assert(h_ref); @@ -306,7 +304,7 @@ void QA_Draw_Jet_Spectrum( TH1F *h_ref = NULL; if (qa_file_ref) { - TH1F *h_ref = (TH1F *) qa_file_ref->GetObjectChecked( + h_ref = (TH1F *) qa_file_ref->GetObjectChecked( TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); assert(h_ref); @@ -322,7 +320,7 @@ void QA_Draw_Jet_Spectrum( } } - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C index 52225b8c6..116d19e16 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C @@ -20,8 +20,8 @@ //some common style files #include "QA_Draw_Jet_TruthMatching.C" +//#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", @@ -34,10 +34,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", const double min_Et = 10; const double max_Et = 80; - // style sets - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); // file IO @@ -118,7 +115,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", TH1 *h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, TString(jet_family) + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); TLine *l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); p->SetGridx(0); @@ -157,7 +154,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, -.1, max_Et, .1, TString(jet_family) + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 0, max_Et, 0); l->Draw(); p->SetGridx(0); @@ -195,7 +192,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, TString(jet_family) + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -234,7 +231,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, TString(jet_family) + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -272,7 +269,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, TString(jet_family) + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -310,7 +307,7 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, TString(jet_family) + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); - h_frame->GetYaxis()->SetTitleOffset(1.01); + // h_frame->GetYaxis()->SetTitleOffset(1.01); l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); p->SetGridx(0); @@ -341,6 +338,6 @@ void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", } legend->Draw(); - PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); + // PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C index fd45da15d..ec17c2d17 100644 --- a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C +++ b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C @@ -18,8 +18,8 @@ #include //some common style files +#include "../../sPHENIXStyle/sPhenixStyle.C" #include "QA_Draw_Utility.C" -#include "SetOKStyle.C" using namespace std; vector @@ -34,9 +34,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = const double min_Et = 10; const double max_Et = 80; - SetOKStyle(); - gStyle->SetOptStat(0); - gStyle->SetOptFit(1111); + SetsPhenixStyle(); TVirtualFitter::SetDefaultFitter("Minuit2"); TFile *qa_file_new = new TFile(qa_file_name_new); @@ -229,7 +227,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm); } DrawReference(h_ratio, h_ratio_ref, true); @@ -278,7 +276,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match assert(h_norm); assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm, true); + h_ratio_ref = GetBinominalRatio(h_pass, h_norm); } DrawReference(h_ratio, h_ratio_ref, true); @@ -289,7 +287,7 @@ QA_Draw_Jet_TruthMatching(const char *jet = l = new TLine(min_Et, 1, max_Et, 1); l->Draw(); - PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); +// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); return resolution_collections; diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index ada127b8c..8f0ab4e58 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -15,14 +15,21 @@ #include #include #include +#include + +#include #include -#include #include #include -#include #include #include #include + +#include +#include +#include +#include + #include #include @@ -115,13 +122,13 @@ void SaveCanvas(TCanvas *c, TString name = "", Bool_t bEPS = kTRUE) //! Draw 1D histogram along with its reference as shade //! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) +double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) { hnew->SetLineColor(kBlue + 3); hnew->SetMarkerColor(kBlue + 3); - hnew->SetLineWidth(2); + // hnew->SetLineWidth(2); hnew->SetMarkerStyle(kFullCircle); - hnew->SetMarkerSize(1); + // hnew->SetMarkerSize(1); if (href) { @@ -131,7 +138,7 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) href->SetFillColor(kGreen + 1); href->SetLineStyle(kSolid); href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(2); + // href->SetLineWidth(2); href->SetMarkerStyle(kDot); href->SetMarkerSize(0); } @@ -149,6 +156,8 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) hnew->Draw(); // set scale + double ks_test = NAN; + if (href) { if (draw_href_error) @@ -161,7 +170,41 @@ void DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) else href->Draw("HIST same"); hnew->Draw("same"); // over lay data points + + ks_test = hnew->KolmogorovTest(href, "D"); } + + // --------------------------------- + // now, make summary header + // --------------------------------- + if (href) + { + gPad->SetTopMargin(.14); + TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); + legend->Draw(); + legend = new TLegend(0, .86, .3, .93, NULL, "NB NDC"); + legend->AddEntry(href, Form("Reference"), "f"); + legend->Draw(); + legend = new TLegend(0.3, .86, 1, .93, NULL, "NB NDC"); + TLegendEntry *le = legend->AddEntry(hnew, Form("New: KS-Test P=%.3f", ks_test), "lpe"); + if (ks_test>=1) + le->SetTextColor(kBlue+1); + else if (ks_test>=.2) + le->SetTextColor(kGreen+2); + else if (ks_test>=.05) + le->SetTextColor(kYellow+1); + else + le->SetTextColor(kRed+1); + legend->Draw(); + } + else + { + gPad->SetTopMargin(.7); + TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); + legend->Draw(); + } + + return ks_test; } //! Draw 1D TGraph along with its reference as shade From 44fd6f2180799a1c0b580f268bbc73e26b21b190 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 1 Apr 2019 01:21:57 -0400 Subject: [PATCH 0277/1222] Use offical sPHENIX Style --- macros/QA/calorimeter/SetOKStyle.C | 105 ----------------------------- 1 file changed, 105 deletions(-) delete mode 100644 macros/QA/calorimeter/SetOKStyle.C diff --git a/macros/QA/calorimeter/SetOKStyle.C b/macros/QA/calorimeter/SetOKStyle.C deleted file mode 100644 index c9e4ded71..000000000 --- a/macros/QA/calorimeter/SetOKStyle.C +++ /dev/null @@ -1,105 +0,0 @@ - -#ifndef SetOKStyle_C -#define SetOKStyle_C - -void SetOKStyle() -{ - TStyle* OKStyle = new TStyle("OKStyle", "OK Default Style"); - - // Colors - - //set the background color to white - OKStyle->SetFillColor(10); - OKStyle->SetFrameFillColor(kWhite); - OKStyle->SetFrameFillStyle(0); - OKStyle->SetFillStyle(0); - OKStyle->SetCanvasColor(kWhite); - OKStyle->SetPadColor(kWhite); - OKStyle->SetTitleFillColor(0); - OKStyle->SetStatColor(kWhite); - - // Get rid of drop shadow on legends - // This doesn't seem to work. Call SetBorderSize(1) directly on your TLegends - OKStyle->SetLegendBorderSize(1); - - //don't put a colored frame around the plots - OKStyle->SetFrameBorderMode(0); - OKStyle->SetCanvasBorderMode(0); - OKStyle->SetPadBorderMode(0); - - //use the primary color palette - OKStyle->SetPalette(1, 0); - - //set the default line color for a histogram to be black - OKStyle->SetHistLineColor(kBlack); - - //set the default line color for a fit function to be red - OKStyle->SetFuncColor(kBlue); - - //make the axis labels black - OKStyle->SetLabelColor(kBlack, "xyz"); - - //set the default title color to be black - OKStyle->SetTitleColor(kBlack); - - //set the margins - OKStyle->SetPadBottomMargin(0.15); - OKStyle->SetPadLeftMargin(0.1); - OKStyle->SetPadTopMargin(0.075); - OKStyle->SetPadRightMargin(0.1); - - //set axis label and title text sizes - OKStyle->SetLabelSize(0.035, "xyz"); - OKStyle->SetTitleSize(0.05, "xyz"); - OKStyle->SetTitleOffset(0.9, "xyz"); - OKStyle->SetStatFontSize(0.035); - OKStyle->SetTextSize(0.05); - OKStyle->SetTitleBorderSize(0); - OKStyle->SetTitleStyle(0); - - OKStyle->SetLegendBorderSize(0); - - //set line widths - OKStyle->SetHistLineWidth(1); - OKStyle->SetFrameLineWidth(2); - OKStyle->SetFuncWidth(2); - - // Misc - - //align the titles to be centered - //OKStyle->SetTextAlign(22); - - //turn off xy grids - OKStyle->SetPadGridX(1); - OKStyle->SetPadGridY(1); - - //set the tick mark style - OKStyle->SetPadTickX(1); - OKStyle->SetPadTickY(1); - - //don't show the fit parameters in a box - OKStyle->SetOptFit(0); - - //set the default stats shown - OKStyle->SetOptStat(1); - - //marker settings - // OKStyle->SetMarkerStyle(8); - // OKStyle->SetMarkerSize(0.7); - - // Fonts - OKStyle->SetStatFont(42); - OKStyle->SetLabelFont(42, "xyz"); - OKStyle->SetTitleFont(42, "xyz"); - OKStyle->SetTextFont(42); - - // Set the paper size for output - OKStyle->SetPaperSize(TStyle::kUSLetter); - - //done - OKStyle->cd(); - - cout << "Using Jin's Style" << endl; -} - -#endif From a6601dbe59a43e6ed5eaaf66a63e5a24da05846a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 9 Apr 2019 20:58:17 -0400 Subject: [PATCH 0278/1222] Make scan_for_embedded the default --- macros/g4simulations/G4_Tracking.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index abe8d9929..048a14acb 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -622,7 +622,7 @@ void Tracking_Reco(int verbosity = 0) TrkrEvaluator* trkreval; trkreval = new TrkrEvaluator("TrkrEvaluator", outputfile2.c_str(), "SvtxTrackMap",n_maps_layer, n_intt_layer, n_gas_layer); - bool embed_scan = false; + bool embed_scan = true; trkreval->scan_for_embedded(embed_scan); trkreval->Verbosity(0); se->registerSubsystem(trkreval); @@ -631,7 +631,6 @@ void Tracking_Reco(int verbosity = 0) { TrkrEvaluator* trkrevalp; trkrevalp = new TrkrEvaluator("TrkrEvaluator", string(outputfile2.c_str())+"_primary_eval.root","PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); - bool embed_scan = false; trkrevalp->scan_for_embedded(embed_scan); trkrevalp->Verbosity(0); se->registerSubsystem(trkrevalp); From 1bc3ace560d85edff5b86e11a52d132238cd6bbd Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 9 Apr 2019 21:23:31 -0400 Subject: [PATCH 0279/1222] Forgot about the call to PHG4TpcElectronDrift, which has a differently capitalized name now. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- macros/g4simulations/G4_Tracking.C | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 36363c17b..1aeda6661 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -528,7 +528,7 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { // This gets the default drift velocity only! - PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); + PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); assert(dr); double TPCDriftVelocity = dr->get_double_param("drift_velocity"); time_window_minus = -105.5 / TPCDriftVelocity; // ns diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 048a14acb..9f0666852 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -597,7 +597,7 @@ void Tracking_Reco(int verbosity = 0) } - void Tracking_Eval(std::string outputfile1, string outputfile2, int verbosity = 0) + void Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- // Load libraries @@ -621,7 +621,7 @@ void Tracking_Reco(int verbosity = 0) //---------------- TrkrEvaluator* trkreval; - trkreval = new TrkrEvaluator("TrkrEvaluator", outputfile2.c_str(), "SvtxTrackMap",n_maps_layer, n_intt_layer, n_gas_layer); + trkreval = new TrkrEvaluator("TrkrEvaluator", outputfile.c_str(), "SvtxTrackMap",n_maps_layer, n_intt_layer, n_gas_layer); bool embed_scan = true; trkreval->scan_for_embedded(embed_scan); trkreval->Verbosity(0); @@ -630,7 +630,7 @@ void Tracking_Reco(int verbosity = 0) if (use_primary_vertex) { TrkrEvaluator* trkrevalp; - trkrevalp = new TrkrEvaluator("TrkrEvaluator", string(outputfile2.c_str())+"_primary_eval.root","PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); + trkrevalp = new TrkrEvaluator("TrkrEvaluator", string(outputfile.c_str())+"_primary_eval.root","PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); trkrevalp->scan_for_embedded(embed_scan); trkrevalp->Verbosity(0); se->registerSubsystem(trkrevalp); From 813d5220e6b0aed8b366588a223396f7d9744eac Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 13 Apr 2019 22:28:46 -0400 Subject: [PATCH 0280/1222] load missing libg4mvtx.so --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 33c90ea7c..9a149548b 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -13,6 +13,7 @@ #include R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) #endif From 59ad193c86726239669c0b3ad114dc15bb747e29 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 13 Apr 2019 23:10:45 -0400 Subject: [PATCH 0281/1222] work under root5 --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 2 +- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C | 1 + macros/g4simulations/G4_Tracking.C | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 466d76c0d..8d4e8c936 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -139,7 +139,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); - + gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_FEMC,do_FHCAL,n_TPC_layers); diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1aeda6661..89d284f77 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -147,7 +147,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); - + gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 9a149548b..9c52254ba 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -222,6 +222,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { + gSystem->Load("libg4mvtx.so"); if (n_maps_layer > 0) { bool maps_overlapcheck = false; // set to true if you want to check for overlaps diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 9f0666852..94240a756 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -150,6 +150,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, int verbosity = 0) { // create the three tracker subsystems + gSystem->Load("libg4mvtx.so"); if (n_maps_layer > 0) { From 4a8888447e70b63162b17e2b41d2849466918720 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sun, 14 Apr 2019 20:51:19 -0400 Subject: [PATCH 0282/1222] SvtxEvaluator modules converted to use new containers. Switch back to them. --- macros/g4simulations/G4_Tracking.C | 32 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 94240a756..7eb8537a1 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -621,20 +622,29 @@ void Tracking_Reco(int verbosity = 0) // Tracking evaluation //---------------- - TrkrEvaluator* trkreval; - trkreval = new TrkrEvaluator("TrkrEvaluator", outputfile.c_str(), "SvtxTrackMap",n_maps_layer, n_intt_layer, n_gas_layer); - bool embed_scan = true; - trkreval->scan_for_embedded(embed_scan); - trkreval->Verbosity(0); - se->registerSubsystem(trkreval); + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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(false); + eval->do_eval_light(true); + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(0); + se->registerSubsystem(eval); if (use_primary_vertex) { - TrkrEvaluator* trkrevalp; - trkrevalp = new TrkrEvaluator("TrkrEvaluator", string(outputfile.c_str())+"_primary_eval.root","PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); - trkrevalp->scan_for_embedded(embed_scan); - trkrevalp->Verbosity(0); - se->registerSubsystem(trkrevalp); + // 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", n_maps_layer, n_intt_layer, n_gas_layer); 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); } return; From 188eada9a7444c02c106ab020a3031574ad54922 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 15 Apr 2019 13:35:38 -0400 Subject: [PATCH 0283/1222] sync tracking macro to most recent --- macros/g4simulations/G4_Tracking.C | 467 +++++++++++++---------------- 1 file changed, 215 insertions(+), 252 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index abf44d804..7eb8537a1 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -4,38 +4,31 @@ #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 #include @@ -43,6 +36,11 @@ #include #include #include +// still needed +#include +#include + +#include R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) @@ -55,6 +53,7 @@ R__LOAD_LIBRARY(libtrack_reco.so) #endif #include + // define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers // one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter #define INTTLADDER4_PP @@ -70,9 +69,6 @@ enum enu_INTTDeadMapType // Choose INTT deadmap here enu_INTTDeadMapType INTTDeadMapOption = kINTTNoDeadMap; -// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; - // 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 @@ -121,16 +117,20 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder #endif #ifdef INTTLADDER4_PP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[6] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI}; +int nladder[4] = {15, 15, 18, 18}; +double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER0 int n_intt_layer = 0; +int laddertype[1] = {0}; +int nladder[1] = {0}; +double sensor_radius[1] = {0}; +double offsetphi[1] = {0}; #endif int n_tpc_layer_inner = 16; @@ -151,6 +151,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, int verbosity = 0) { // create the three tracker subsystems + gSystem->Load("libg4mvtx.so"); if (n_maps_layer > 0) { @@ -232,21 +233,23 @@ double Tracking(PHG4Reco* g4Reco, double radius, g4Reco->registerSubsystem(sitrack); // Set the laddertype and ladder spacing configuration + cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; - for (int i = 0; i < n_intt_layer; i++) - { - cout << " INTT layer " << i << " laddertype " << laddertype[i] << " nladders " << nladder[i] - << " sensor radius " << sensor_radius[i] << " offsetphi " << offsetphi[i] << endl; - sitrack->set_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i, "sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i, "offsetphi", offsetphi[i]); // expecting degrees - } + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees + } // outer radius marker (translation back to cm) radius = intt_radius_max * 0.1; } + // The TPC - always present! //================================ @@ -282,9 +285,11 @@ void Tracking_Cells(int verbosity = 0) // Load libraries //--------------- + gSystem->Load("libtrack_io.so"); gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4tpc.so"); + gSystem->Load("libg4intt.so"); gSystem->Load("libg4mvtx.so"); gSystem->Load("libtpc.so"); gSystem->Load("libintt.so"); @@ -296,30 +301,28 @@ void Tracking_Cells(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - // MVTX cells - //========= + // MVTX hit reco + //=========== if (n_maps_layer > 0) { - // MAPS cells - PHG4MVTXCellReco* maps_cells = new PHG4MVTXCellReco("MVTX"); - maps_cells->Verbosity(verbosity); + // new storage containers + PHG4MVTXHitReco* maps_hits = new PHG4MVTXHitReco("MVTX"); + maps_hits->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { // override the default timing window for this layer - default is +/- 5000 ns - maps_cells->set_timing_window(ilayer, -5000, 5000); + maps_hits->set_timing_window(ilayer, -5000, 5000); } - //maps_cells->set_diffusion_width(22e-04); // maximum diffusion width - sigma in cm - default is 22 microns - - se->registerSubsystem(maps_cells); + se->registerSubsystem(maps_hits); } - // INTT cells - //========= + // INTT hit reco + //=========== if (n_intt_layer > 0) { - // INTT cells - PHG4INTTCellReco* reco = new PHG4INTTCellReco("INTT"); + // new storage containers + PHG4INTTHitReco* reco = new PHG4INTTHitReco("INTT"); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here //reco->set_double_param("tmax",80.0); //reco->set_double_param("tmin",-20.0); @@ -348,14 +351,15 @@ void Tracking_Cells(int verbosity = 0) // g4tpc/PHG4TPCPadPlaneReadout //========================= - PHG4TPCElectronDrift* edrift = new PHG4TPCElectronDrift(); + PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); + + PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); // 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.12 and 0.15, they can be changed here to get a different resolution - edrift->set_double_param("added_smear_trans", 0.12); - edrift->set_double_param("added_smear_long", 0.15); - PHG4TPCPadPlane* padplane = new PHG4TPCPadPlaneReadout(); + edrift->set_double_param("added_smear_trans",0.12); + edrift->set_double_param("added_smear_long",0.15); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); @@ -384,161 +388,129 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- + //------------------------------------------- + // Digitize the hit energy into ADC + //------------------------------------------ // MVTX - PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); - digimvtx->Verbosity(verbosity); - + //====== + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); + digimvtx->Verbosity(0); // 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); if (n_intt_layer > 0) - { -#ifdef SVTXDEADMAP - if (INTTDeadMapOption != kINTTNoDeadMap) { - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); + +#ifdef SVTXDEADMAP + if (INTTDeadMapOption != kINTTNoDeadMap) + { + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); + for (int i = 0; i < n_intt_layer; i++) + { + const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); + + + if (INTTDeadMapOption == kINTT4PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else if (INTTDeadMapOption == kINTT8PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; + deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else + { + cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "< Verbosity(1); + se->registerSubsystem(deadMapINTT); + } +#endif // SVTXDEADMAP + + // INTT + //===== + // 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); for (int i = 0; i < n_intt_layer; i++) - { - const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - - if (INTTDeadMapOption == kINTT4PercentDeadMap) - { - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - } - else if (INTTDeadMapOption == kINTT8PercentDeadMap) - { - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - } - else - { - cout << "Tracking_Reco - fatal error - invalid INTTDeadMapOption = " << INTTDeadMapOption << endl; - exit(1); - } - } - deadMapINTT->Verbosity(1); - se->registerSubsystem(deadMapINTT); - } -#endif // SVTXDEADMAP - - // INTT - // 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); - - PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); - digiintt->Verbosity(verbosity); - digiintt->Detector("INTT"); - for (int i = 0; i < n_intt_layer; i++) - { - digiintt->set_adc_scale(n_maps_layer + i, userrange); + { + digiintt->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); } - se->registerSubsystem(digiintt); - } - - // TPC - PHG4TPCDigitizer* digitpc = new PHG4TPCDigitizer(); + + // TPC + //==== + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); digitpc->SetTPCMinLayer(n_maps_layer + 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 - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); - //------------------------------------- - // Apply Live Area Inefficiency to Hits - // This is obsolete, please use PHG4SvtxDeadMapLoader instead for pre-defined deadmap - //------------------------------------- - // defaults to 1.0 (fully active) - - // PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - // - // for (int i = 0; i < n_maps_layer; i++) - // { - // deadarea->Verbosity(verbosity); - // //deadarea->set_hit_efficiency(i,0.99); - // deadarea->set_hit_efficiency(i, 1.0); - // } - // for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - // { - // //deadarea->set_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; i < n_maps_layer; i++) - { - // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness - // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss - thresholds->set_threshold(i, -1); - } - // INTT: Does not need PHG4SvtxThresholds as the new digitizer handle the zero-suppression threshold with in ASIC - - se->registerSubsystem(thresholds); - */ - //------------- // Cluster Hits //------------- - // For the MVTX layers - MVTXClusterizer* mvtxclusterizer = new MVTXClusterizer("MVTXClusterizer", 0, n_maps_layer - 1); + // For the MVTX layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); mvtxclusterizer->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 - mvtxclusterizer->set_threshold(0.0); // fraction of a mip se->registerSubsystem(mvtxclusterizer); - // For the INTT layers - INTTClusterizer* inttclusterizer = new INTTClusterizer("INTTClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); + // For the INTT layers + //=============== + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + 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 @@ -550,104 +522,95 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(inttclusterizer); // For the TPC - - TPCClusterizer* tpcclusterizer = new TPCClusterizer(); - tpcclusterizer->Verbosity(verbosity); - tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); - tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.10); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); + //========== + TpcClusterizer* tpcclusterizer = new TpcClusterizer(); + tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! - const bool use_track_prop = true; + const bool use_track_prop = true; if (use_track_prop) - { - //--------------------- - // PHG4KalmanPatRec - //--------------------- - - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - - PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); - track_seed->Verbosity(verbosity); - se->registerSubsystem(track_seed); - - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); - track_prop->Verbosity(verbosity); - se->registerSubsystem(track_prop); - - for (int i = 0; i < n_intt_layer; i++) { - if (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) - { - // strip length is along phi - track_prop->set_max_search_win_theta_intt(i, 0.010); - track_prop->set_min_search_win_theta_intt(i, 0.00); - track_prop->set_max_search_win_phi_intt(i, 0.20); - track_prop->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // 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); - } + //--------------------- + // PHG4KalmanPatRec + //--------------------- + + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); + track_seed->Verbosity(0); + se->registerSubsystem(track_seed); + + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + track_prop->Verbosity(0); + se->registerSubsystem(track_prop); + + for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); + track_prop->set_min_search_win_theta_intt(i, 0.00); + track_prop->set_max_search_win_phi_intt(i, 0.20); + track_prop->set_min_search_win_phi_intt(i, 0.20); + } + else + { + // 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); + } + } } - } else - { - //--------------------- - // Truth Pattern Recognition - //--------------------- - PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); - se->registerSubsystem(pat_rec); - } - + { + //--------------------- + // Truth Pattern Recognition + //--------------------- + PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); + se->registerSubsystem(pat_rec); + } + //--------------------- // Kalman Filter //--------------------- - + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); kalman->Verbosity(verbosity); + if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); - + //------------------ // Track Projections //------------------ PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); - - /* - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - */ - + return; } -void Tracking_Eval(std::string outputfile, int verbosity = 0) + + void Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- // Load libraries //--------------- + gSystem->Load("libg4eval.so"); gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libtrack_reco.so"); - gSystem->Load("libg4eval.so"); + //--------------- // Fun4All server @@ -665,8 +628,9 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) eval->do_g4hit_eval(true); eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); + eval->do_eval_light(true); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(verbosity); + eval->Verbosity(0); se->registerSubsystem(eval); if (use_primary_vertex) @@ -674,13 +638,12 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) // 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", n_maps_layer, n_intt_layer, n_gas_layer); - evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); 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(verbosity); + evalp->Verbosity(0); se->registerSubsystem(evalp); } From 33fad6d45fd8c7f19fbe88c88e6488a647c7d6b1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 15 Apr 2019 17:03:56 -0400 Subject: [PATCH 0284/1222] Oops, remove git comment --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index de35d1768..485e29d32 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -153,12 +153,8 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); -<<<<<<< HEAD - gSystem->Load("libqa_modules"); - -======= gSystem->Load("libg4intt.so"); ->>>>>>> e0d0ef93a357df199334f27b92198feddc4ca805 + gSystem->Load("libqa_modules"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); From 02374a242faadd1f912ca481f5a0935d6a4cb493 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 23 Apr 2019 14:31:59 -0400 Subject: [PATCH 0285/1222] Shift random seed as the last set crashes in a known memory problem --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 485e29d32..7ff37da3d 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -186,7 +186,7 @@ int Fun4All_G4_sPHENIX( // 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()); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()+1); //----------------- // Event generation From caaf6102c3e01c09b71543212d2b3b80d58b4672 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 26 Apr 2019 20:37:15 -0400 Subject: [PATCH 0286/1222] Update QA_Draw_Utility.C --- macros/QA/calorimeter/QA_Draw_Utility.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index 8f0ab4e58..00d54b165 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -156,7 +156,7 @@ double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) hnew->Draw(); // set scale - double ks_test = NAN; + double ks_test = numeric_limits::signaling_NaN(); if (href) { From 5bfd6775dffd0e08db69e2c39aa6c3957888c6eb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 26 Apr 2019 22:34:24 -0400 Subject: [PATCH 0287/1222] Update Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 7ff37da3d..2ee33fb0c 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -186,7 +186,7 @@ int Fun4All_G4_sPHENIX( // 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()+1); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()+2); //----------------- // Event generation From cfeb4b437c7e0a4d97f8cd0ac4c0f4e6729f290d Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 27 Apr 2019 01:01:16 -0400 Subject: [PATCH 0288/1222] Update Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 2ee33fb0c..d25d9ce1e 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -186,7 +186,7 @@ int Fun4All_G4_sPHENIX( // 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()+2); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()+100); //----------------- // Event generation From 573b207ef1c1b736b8bb89e8637cdf5733ea38a8 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 27 Apr 2019 18:39:09 -0400 Subject: [PATCH 0289/1222] Update Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d25d9ce1e..1c06b0820 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -186,7 +186,7 @@ int Fun4All_G4_sPHENIX( // 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()+100); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()+200); //----------------- // Event generation From c3717302ebe35ae3a8dd633badcbb83713e927b4 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Fri, 26 Apr 2019 09:19:45 -0400 Subject: [PATCH 0290/1222] Applying modifications following up new MVTX setup --- macros/g4simulations/G4_Tracking.C | 92 +++++++++++++++--------------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 7eb8537a1..3c0754ec1 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -117,11 +118,11 @@ double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder #endif #ifdef INTTLADDER4_PP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, +int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, + PHG4INTTDefs::SEGMENTATION_PHI, PHG4INTTDefs::SEGMENTATION_PHI, PHG4INTTDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; +int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; #endif @@ -168,37 +169,34 @@ double Tracking(PHG4Reco* g4Reco, double radius, double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - int stave_type[3] = {0, 0, 0}; + // Y. Corrales Morales - removed, no longer used in the code + // int stave_type[3] = {0, 0, 0}; int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + PHG4MVTXSubsystem* mvtx = new PHG4MVTXSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + 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] + cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " << " pixel size 30 x 30 microns " << " active pixel thickness 0.0018 microns" << endl; + mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm + mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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/mvtx_stave_v01.gdml")); - - g4Reco->registerSubsystem(lyr); + mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); radius = maps_layer_radius[ilayer]; } + mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + // 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 + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); } if (n_intt_layer > 0) @@ -237,8 +235,8 @@ double Tracking(PHG4Reco* g4Reco, double radius, cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm @@ -412,23 +410,23 @@ void Tracking_Reco(int verbosity = 0) { const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - - + + if (INTTDeadMapOption == kINTT4PercentDeadMap) { - + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - + } else if (INTTDeadMapOption == kINTT8PercentDeadMap) { - + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational DeadMapPath += DeadMapConfigName; deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - + } else { @@ -440,7 +438,7 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(deadMapINTT); } #endif // SVTXDEADMAP - + // INTT //===== // these should be used for the INTT @@ -473,7 +471,7 @@ void Tracking_Reco(int verbosity = 0) userrange.push_back(0.818475452196383); userrange.push_back(1.05232558139535); userrange.push_back(1.28617571059432); - + // new containers PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); digiintt->Verbosity(verbosity); @@ -483,8 +481,8 @@ void Tracking_Reco(int verbosity = 0) } se->registerSubsystem(digiintt); } - - // TPC + + // TPC //==== PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); digitpc->SetTPCMinLayer(n_maps_layer + n_intt_layer); @@ -493,7 +491,7 @@ void Tracking_Reco(int verbosity = 0) double ADC_threshold = 4.0 * ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -502,13 +500,13 @@ void Tracking_Reco(int verbosity = 0) // Cluster Hits //------------- - // For the MVTX layers + // For the MVTX layers //================ MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); mvtxclusterizer->Verbosity(verbosity); se->registerSubsystem(mvtxclusterizer); - // For the INTT layers + // For the INTT layers //=============== InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); inttclusterizer->Verbosity(verbosity); @@ -528,25 +526,25 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(tpcclusterizer); // This should be true for everything except testing! - const bool use_track_prop = true; + const bool use_track_prop = true; if (use_track_prop) { //--------------------- // PHG4KalmanPatRec //--------------------- - + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); se->registerSubsystem(init_vtx); - + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); track_seed->Verbosity(0); se->registerSubsystem(track_seed); - + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); - + for(int i = 0;iregisterSubsystem(pat_rec); } - + //--------------------- // Kalman Filter //--------------------- - + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); kalman->Verbosity(verbosity); @@ -587,14 +585,14 @@ void Tracking_Reco(int verbosity = 0) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); - + //------------------ // Track Projections //------------------ PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); - + return; } From d6b0a847b0af278a170dc5ed15b1ea1f42d61893 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Sun, 28 Apr 2019 06:13:30 -0400 Subject: [PATCH 0291/1222] Apply changes for new MVTX setup in EIC macro --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 96 +++++++++---------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 9c52254ba..756c699c2 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -9,6 +9,7 @@ #include #include #include +#include #include #include R__LOAD_LIBRARY(libg4hough.so) @@ -30,7 +31,7 @@ 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 // default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired -int n_intt_layer = 0; +int n_intt_layer = 0; // default layer configuration int laddertype[4] = {0, 1, 1, 1}; // default int nladder[4] = {34, 30, 36, 42}; // default @@ -224,59 +225,56 @@ double Svtx(PHG4Reco* g4Reco, double radius, { gSystem->Load("libg4mvtx.so"); if (n_maps_layer > 0) + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + + // Y. Corrales Morales 4Feb2019 + // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + // Y. Corrales Morales - removed, no longer used in the code + // int stave_type[3] = {0, 0, 0}; + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + + PHG4MVTXSubsystem* mvtx = new PHG4MVTXSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // MAPS inner barrel layers - //====================================================== - - // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - - 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; - - PHG4MVTXSubsystem* lyr = new PHG4MVTXSubsystem("MVTX", 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/mvtx_stave_v01.gdml")); - - g4Reco->registerSubsystem(lyr); - - radius = maps_layer_radius[ilayer]; - } + if (verbosity) + cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " + << " pixel size 30 x 30 microns " + << " active pixel thickness 0.0018 microns" << endl; + mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm + mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves + + mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); + + radius = maps_layer_radius[ilayer]; } - + mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + // 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 + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + } + assert (n_intt_layer == 0); - + // int verbosity = 1; - + // time projection chamber layers -------------------------------------------- - + // switch ONLY for backward compatibility with 40 layer hits files! if (tpc_layers_40) { From ecfebe9c84deda940ccc9b40a3d5f3f244fc507b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 29 Apr 2019 10:19:49 -0400 Subject: [PATCH 0292/1222] Update Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1c06b0820..485e29d32 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -186,7 +186,7 @@ int Fun4All_G4_sPHENIX( // 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()+200); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()); //----------------- // Event generation From 8ddb8119ac51658f39708ecca6fb4614d53455c2 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Mon, 29 Apr 2019 11:24:26 -0400 Subject: [PATCH 0293/1222] bump to mvtx stave geometry v02 --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C | 2 +- macros/g4simulations/G4_Tracking.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 756c699c2..33781ccef 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -259,7 +259,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = maps_layer_radius[ilayer]; } - mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); // 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 mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 3c0754ec1..c290c2529 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -189,7 +189,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, radius = maps_layer_radius[ilayer]; } - mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.gdml")); + mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); // 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 mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm From 66bbbddacd6f494bdce82f8769666351b44d469e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Apr 2019 14:10:35 -0400 Subject: [PATCH 0294/1222] remove obsolete tpc space charge distortion --- macros/g4simulations/G4_Tracking.C | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 3c0754ec1..0f4b10631 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -328,21 +327,6 @@ void Tracking_Cells(int verbosity = 0) se->registerSubsystem(reco); } - // Set up TPC distortion calculation - //======================== - const bool do_tpc_distortion = true; - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; - if (do_tpc_distortion) - { - string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - 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 - } - //========================= // setup TPC readout for filling cells // g4tpc/PHG4TPCElectronDrift uses From 31750ec1bc4c3b8474181232d25158f800b9f70c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 2 May 2019 09:22:22 -0400 Subject: [PATCH 0295/1222] add g4->ApplyDisplayAction() needed to set the G4VisAttributes for new DisplayAction --- macros/g4simulations/DisplayOn.C | 1 + macros/prototype2/DisplayOn.C | 1 + macros/prototype3/DisplayOn.C | 1 + macros/prototype4/DisplayOn.C | 1 + 4 files changed, 4 insertions(+) diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C index 6781839e6..3d8c8dc80 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/macros/g4simulations/DisplayOn.C @@ -18,6 +18,7 @@ PHG4Reco * DisplayOn(const char *mac = "vis.mac") 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; diff --git a/macros/prototype2/DisplayOn.C b/macros/prototype2/DisplayOn.C index 4197f6143..f1595e7e9 100644 --- a/macros/prototype2/DisplayOn.C +++ b/macros/prototype2/DisplayOn.C @@ -12,6 +12,7 @@ PHG4Reco * DisplayOn(const char *mac = "vis_prototype2.mac") 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; diff --git a/macros/prototype3/DisplayOn.C b/macros/prototype3/DisplayOn.C index cb75b1cbc..4fa1ac6e5 100644 --- a/macros/prototype3/DisplayOn.C +++ b/macros/prototype3/DisplayOn.C @@ -12,6 +12,7 @@ PHG4Reco * DisplayOn(const char *mac = "vis_prototype3.mac") 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; diff --git a/macros/prototype4/DisplayOn.C b/macros/prototype4/DisplayOn.C index 8295a6700..c8be1ccc9 100644 --- a/macros/prototype4/DisplayOn.C +++ b/macros/prototype4/DisplayOn.C @@ -18,6 +18,7 @@ PHG4Reco * DisplayOn(const char *mac = "vis_prototype3.mac") 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; From 864e408898fda48e6d33536a2acc6f4898d3719a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 2 May 2019 15:41:45 -0400 Subject: [PATCH 0296/1222] use MVTX for g4mvtx modules --- macros/g4simulations/G4_Tracking.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 1ca4de267..b10d99040 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include @@ -376,7 +376,7 @@ void Tracking_Reco(int verbosity = 0) // MVTX //====== - PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); + PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); digimvtx->Verbosity(0); // 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 From c7f337a28d7d3febf07a5efe6f5c26ef07e17f3e Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Tue, 7 May 2019 10:17:47 -0400 Subject: [PATCH 0297/1222] added enum to switch between template and graph clusterizer --- macros/g4simulations/G4_FEMC.C | 46 ++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 0155d18a5..ee09080bf 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,18 @@ R__LOAD_LIBRARY(libg4eval.so) #endif + +enum enu_Femc_clusterizer +{ + kFemcGraphClusterizer, + kFemcTemplateClusterizer +}; + +//template clusterizer, as developed by Sasha Bazilevsky +enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; +// graph clusterizer +//enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; + void FEMCInit() { @@ -193,13 +206,32 @@ 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.010); - se->registerSubsystem( ClusterBuilder ); - + + + if ( Femc_clusterizer == kFemcTemplateClusterizer ) + { + RawClusterBuilderTemplateFEMC *ClusterBuilder = new RawClusterBuilderTemplateFEMC("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem(ClusterBuilder); + } + else if ( Femc_clusterizer == kFemcGraphClusterizer ) + { + RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); + + + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem( ClusterBuilder ); + } + else + { + cout << "FEMC_Clusters - unknown clusterizer setting!"< Date: Sat, 11 May 2019 09:42:07 -0400 Subject: [PATCH 0298/1222] uniform source names in g4tpc (Tpc -> TPC) --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- macros/g4simulations/G4_Tracking.C | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 89d284f77..5d6fd1ffc 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -528,7 +528,7 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { // This gets the default drift velocity only! - PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); + PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); assert(dr); double TPCDriftVelocity = dr->get_double_param("drift_velocity"); time_window_minus = -105.5 / TPCDriftVelocity; // ns diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index b10d99040..f978a92d7 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -20,8 +20,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -249,7 +249,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, // The TPC - always present! //================================ - gSystem->Load("libg4tpc.so"); PHG4TPCSubsystem* tpc = new PHG4TPCSubsystem("TPC"); @@ -335,7 +334,7 @@ void Tracking_Cells(int verbosity = 0) PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); - PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); + PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); edrift->Detector("TPC"); // 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 @@ -457,7 +456,7 @@ void Tracking_Reco(int verbosity = 0) userrange.push_back(1.28617571059432); // new containers - PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); + PHG4INTTDigitizer* digiintt = new PHG4INTTDigitizer(); digiintt->Verbosity(verbosity); for (int i = 0; i < n_intt_layer; i++) { @@ -468,7 +467,7 @@ void Tracking_Reco(int verbosity = 0) // TPC //==== - PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); + PHG4TPCDigitizer* digitpc = new PHG4TPCDigitizer(); digitpc->SetTPCMinLayer(n_maps_layer + n_intt_layer); double ENC = 670.0; // standard digitpc->SetENC(ENC); From bd87d5a751abd8a0255dd710f03a1defd7536db1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 12 May 2019 11:41:13 -0400 Subject: [PATCH 0299/1222] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 517010696..6cf469209 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ 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.racf.bnl.gov/jenkins-sphenix/buildStatus/icon?job=sPHENIX/sPHENIX_CoreSoftware_MasterBranch)](https://web.racf.bnl.gov/jenkins-sphenix/job/sPHENIX/job/sPHENIX_CoreSoftware_MasterBranch/) +[![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) +[![Download size](https://img.shields.io/github/languages/code-size/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/archive/master.zip) + # 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. From 2d487443f943e0fea824ae09871586e560055186 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 12 May 2019 21:54:17 -0400 Subject: [PATCH 0300/1222] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6cf469209..42bb74679 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ 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.racf.bnl.gov/jenkins-sphenix/buildStatus/icon?job=sPHENIX/sPHENIX_CoreSoftware_MasterBranch)](https://web.racf.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/) [![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) -[![Download size](https://img.shields.io/github/languages/code-size/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/archive/master.zip) # Get started From 7306a9c586b976c58076d150186dbd5f97b62848 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 16 May 2019 11:38:44 -0400 Subject: [PATCH 0301/1222] set dstreader to false until its memory leaks are fixed --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 98df2db04..c5b94fcd0 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -174,7 +174,7 @@ int Fun4All_G4_EICDetector( bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; + bool do_DSTReader = false; //--------------- // Load libraries diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 8d4e8c936..d5e9e0b73 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -128,7 +128,7 @@ int Fun4All_G4_fsPHENIX( bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; + bool do_DSTReader = false; //--------------- // Load libraries //--------------- From a0572e310299e88312afdde00f4f2ad6c248da9f Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 21 May 2019 23:34:24 -0400 Subject: [PATCH 0302/1222] Macro to use PHTruthTrackSeeding. --- macros/g4simulations/G4_Tracking.C | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f978a92d7..12ca41fff 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -36,6 +36,7 @@ #include #include #include +#include // still needed #include #include @@ -52,6 +53,8 @@ R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) #endif +//#include + #include // define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers @@ -508,18 +511,21 @@ void Tracking_Reco(int verbosity = 0) tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); + // This should be true for everything except testing! - const bool use_track_prop = true; + //const bool use_track_prop = true; + const bool use_track_prop = false; if (use_track_prop) { //--------------------- // PHG4KalmanPatRec //--------------------- + // for now we cheat to get the vertex for the full track reconstruction case PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - + se->registerSubsystem(init_vtx); + PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); track_seed->Verbosity(0); se->registerSubsystem(track_seed); @@ -553,7 +559,13 @@ void Tracking_Reco(int verbosity = 0) //--------------------- // Truth Pattern Recognition //--------------------- - PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); + + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding(); + pat_rec->Verbosity(0); se->registerSubsystem(pat_rec); } From 4727e7d146c76e76b32d45ad632baac1ac7b8126 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 11:07:09 -0400 Subject: [PATCH 0303/1222] MVTX->Mvtx, INTT->Intt --- macros/g4simulations/G4_Tracking.C | 158 ++++++++++++++--------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f978a92d7..b33921e39 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -7,18 +7,18 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -59,68 +59,68 @@ R__LOAD_LIBRARY(libtrack_reco.so) #define INTTLADDER4_PP // Dead map options for INTT -enum enu_INTTDeadMapType +enum enu_InttDeadMapType { - kINTTNoDeadMap = 0, // All channel in INTT is alive - kINTT4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kINTT8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + kInttNoDeadMap = 0, // All channel in Intt is alive + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational }; -// Choose INTT deadmap here -enu_INTTDeadMapType INTTDeadMapOption = kINTTNoDeadMap; +// Choose Intt deadmap here +enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // 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_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers -// Configure the INTT layers +// Configure the Intt layers // offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders #ifdef INTTLADDER8 int n_intt_layer = 8; // default layer configuration -int laddertype[8] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; // default +int laddertype[8] = {PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; // default int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; #endif #ifdef INTTLADDER6 int n_intt_layer = 6; -int laddertype[6] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; +int laddertype[6] = {PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; int nladder[6] = {17, 17, 15, 15, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; #endif #ifdef INTTLADDER4_ZP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_Z, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; +int laddertype[4] = {PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_Z, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; int nladder[4] = {17, 17, 18, 18}; double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; #endif #ifdef INTTLADDER4_PP int n_intt_layer = 4; -int laddertype[4] = {PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI, - PHG4INTTDefs::SEGMENTATION_PHI}; +int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; @@ -161,18 +161,18 @@ double Tracking(PHG4Reco* g4Reco, double radius, //====================================================== // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code // Y. Corrales Morales - removed, no longer used in the code // int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx - PHG4MVTXSubsystem* mvtx = new PHG4MVTXSubsystem("MVTX"); + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) @@ -188,11 +188,11 @@ double Tracking(PHG4Reco* g4Reco, double radius, radius = maps_layer_radius[ilayer]; } - mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); // 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 - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); @@ -210,7 +210,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, // 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 + // PHG4InttSubsystem creates the detetor layer using PHG4InttDetector // and instantiates the appropriate PHG4SteppingAction const double intt_radius_max = 140.; // including stagger radius (mm) @@ -218,12 +218,12 @@ double Tracking(PHG4Reco* g4Reco, double radius, std::vector> vpair; // (sphxlayer, inttlayer) for (int i = 0; i < 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 + // 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(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); + PHG4InttSubsystem* sitrack = new PHG4InttSubsystem("INTT", vpair); sitrack->Verbosity(verbosity); sitrack->SetActive(1); sitrack->OverlapCheck(intt_overlapcheck); @@ -231,10 +231,10 @@ double Tracking(PHG4Reco* g4Reco, double radius, // Set the laddertype and ladder spacing configuration - cout << "INTT has " << n_intt_layer << " layers with layer setup:" << endl; + cout << "Intt has " << n_intt_layer << " layers with layer setup:" << endl; for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); @@ -297,13 +297,13 @@ void Tracking_Cells(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - // MVTX hit reco + // Mvtx hit reco //=========== if (n_maps_layer > 0) { // new storage containers - PHG4MVTXHitReco* maps_hits = new PHG4MVTXHitReco("MVTX"); + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); maps_hits->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { @@ -313,12 +313,12 @@ void Tracking_Cells(int verbosity = 0) se->registerSubsystem(maps_hits); } - // INTT hit reco + // Intt hit reco //=========== if (n_intt_layer > 0) { // new storage containers - PHG4INTTHitReco* reco = new PHG4INTTHitReco("INTT"); + PHG4InttHitReco* reco = new PHG4InttHitReco("INTT"); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here //reco->set_double_param("tmax",80.0); //reco->set_double_param("tmin",-20.0); @@ -373,9 +373,9 @@ void Tracking_Reco(int verbosity = 0) // Digitize the hit energy into ADC //------------------------------------------ - // MVTX + // Mvtx //====== - PHG4MVTXDigitizer* digimvtx = new PHG4MVTXDigitizer(); + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); digimvtx->Verbosity(0); // 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 @@ -385,46 +385,46 @@ void Tracking_Reco(int verbosity = 0) { #ifdef SVTXDEADMAP - if (INTTDeadMapOption != kINTTNoDeadMap) + if (InttDeadMapOption != kInttNoDeadMap) { // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("INTT"); + PHG4SvtxDeadMapLoader* deadMapIntt = new PHG4SvtxDeadMapLoader("INTT"); for (int i = 0; i < n_intt_layer; i++) { - const int database_strip_type = (laddertype[i] == PHG4INTTDefs::SEGMENTATION_Z) ? 0 : 1; + const int database_strip_type = (laddertype[i] == PHG4InttDefs::SEGMENTATION_Z) ? 0 : 1; string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - if (INTTDeadMapOption == kINTT4PercentDeadMap) + if (InttDeadMapOption == kIntt4PercentDeadMap) { string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); } - else if (INTTDeadMapOption == kINTT8PercentDeadMap) + else if (InttDeadMapOption == kIntt8PercentDeadMap) { string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); + deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); } else { - cout <<"Tracking_Reco - fatal error - invalid INTTDeadMapOption = "<registerSubsystem(digitpc); @@ -483,21 +483,21 @@ void Tracking_Reco(int verbosity = 0) // Cluster Hits //------------- - // For the MVTX layers + // For the Mvtx layers //================ MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); mvtxclusterizer->Verbosity(verbosity); se->registerSubsystem(mvtxclusterizer); - // For the INTT layers + // For the Intt layers //=============== InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); inttclusterizer->Verbosity(verbosity); - // no Z clustering for INTT type 1 layers (we DO want Z clustering for type 0 layers) + // 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) { - if (laddertype[i - n_maps_layer] == PHG4INTTDefs::SEGMENTATION_PHI) + if (laddertype[i - n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) inttclusterizer->set_z_clustering(i, false); } se->registerSubsystem(inttclusterizer); @@ -530,7 +530,7 @@ void Tracking_Reco(int verbosity = 0) for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); @@ -617,7 +617,7 @@ void Tracking_Reco(int verbosity = 0) 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 + // 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", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); From 4e1d5fc310c417166ec23992146f22dfbac58d45 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 11:59:22 -0400 Subject: [PATCH 0304/1222] TPC -> Tpc --- macros/g4simulations/G4_Tracking.C | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index b33921e39..6a6ddc117 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -20,11 +20,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -247,11 +247,11 @@ double Tracking(PHG4Reco* g4Reco, double radius, } - // The TPC - always present! + // The Tpc - always present! //================================ gSystem->Load("libg4tpc.so"); - PHG4TPCSubsystem* tpc = new PHG4TPCSubsystem("TPC"); + PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); tpc->SetActive(); tpc->SuperDetector("TPC"); tpc->set_double_param("steplimits", 1); @@ -327,16 +327,16 @@ void Tracking_Cells(int verbosity = 0) } //========================= - // setup TPC readout for filling cells - // g4tpc/PHG4TPCElectronDrift uses - // g4tpc/PHG4TPCPadPlaneReadout + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout //========================= - PHG4TPCPadPlane *padplane = new PHG4TPCPadPlaneReadout(); + PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); - PHG4TPCElectronDrift *edrift = new PHG4TPCElectronDrift(); + PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); - // fudge factors to get drphi 150 microns (in mid and outer TPC) and dz 500 microns cluster resolution + // 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.12 and 0.15, they can be changed here to get a different resolution edrift->set_double_param("added_smear_trans",0.12); @@ -344,9 +344,9 @@ void Tracking_Cells(int verbosity = 0) edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); - // The pad plane readout default is set in PHG4TPCPadPlaneReadout + // 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", n_maps_layer + n_intt_layer); // sPHENIX layer number of first TPC readout layer + padplane->set_int_param("tpc_minlayer_inner", n_maps_layer + n_intt_layer); // sPHENIX layer number of first Tpc readout layer padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); @@ -465,16 +465,16 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(digiintt); } - // TPC + // Tpc //==== - PHG4TPCDigitizer* digitpc = new PHG4TPCDigitizer(); - digitpc->SetTPCMinLayer(n_maps_layer + n_intt_layer); + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); + digitpc->SetTpcMinLayer(n_maps_layer + 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 - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+Intt layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -502,7 +502,7 @@ void Tracking_Reco(int verbosity = 0) } se->registerSubsystem(inttclusterizer); - // For the TPC + // For the Tpc //========== TpcClusterizer* tpcclusterizer = new TpcClusterizer(); tpcclusterizer->Verbosity(0); From d3031d9251ed37868da3c5bf6733a41df744c993 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 12:00:32 -0400 Subject: [PATCH 0305/1222] TPC -> Tpc --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 5d6fd1ffc..269b81eaf 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -528,11 +528,11 @@ int Fun4All_G4_sPHENIX( if (do_tracking) { // This gets the default drift velocity only! - PHG4TPCElectronDrift *dr = (PHG4TPCElectronDrift *)se->getSubsysReco("PHG4TPCElectronDrift"); + PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); assert(dr); - double TPCDriftVelocity = dr->get_double_param("drift_velocity"); - time_window_minus = -105.5 / TPCDriftVelocity; // ns - time_window_plus = 105.5 / TPCDriftVelocity; // ns; + double TpcDriftVelocity = dr->get_double_param("drift_velocity"); + time_window_minus = -105.5 / TpcDriftVelocity; // ns + time_window_plus = 105.5 / TpcDriftVelocity; // ns; } pileup->set_time_window(time_window_minus, time_window_plus); // override timing window in ns cout << "Collision pileup enabled using file " << pileupfile << " with collision rate " << pileup_collision_rate From 2eaeaa06a665b50c11677d3d5e53df403f2cced1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 12:01:00 -0400 Subject: [PATCH 0306/1222] TPC -> Tpc, MVTX -> Mvtx --- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 280 +++++++++--------- 1 file changed, 140 insertions(+), 140 deletions(-) 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 index dde989a2d..98596eb45 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -3,13 +3,13 @@ #include "GlobalVariables.C" #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -28,7 +28,7 @@ R__LOAD_LIBRARY(libg4eval.so) #include -// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +// ONLY if backward compatibility with hits files already generated with 8 inner Tpc layers is needed, you can set this to "true" bool tpc_layers_40 = false; // if true, refit tracks with primary vertex included in track fit - good for analysis of prompt tracks only @@ -117,10 +117,10 @@ int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double inner_cage_radius = 20.; double inner_readout_radius = 30.; -// TPC gas parameters +// Tpc gas parameters // These are set for a variety of gas choices... //============================================== -enum TPC_Gas +enum Tpc_Gas { Ne2K_100, Ne2K_400, @@ -129,8 +129,8 @@ enum TPC_Gas NeCF4_400, ByHand }; -TPC_Gas ether = TPC_Gas::NeCF4_400; -//TPC_Gas ether = TPC_Gas::ByHand; +Tpc_Gas ether = Tpc_Gas::NeCF4_400; +//Tpc_Gas ether = Tpc_Gas::ByHand; // Data on gasses @20 C and 760 Torr from the following source: // http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf @@ -146,28 +146,28 @@ double Ne_NTotal = 43; // Number/cm double CF4_NTotal = 100; // Number/cm double iBut_NTotal = 195; // Number/cm -// TPC Performance Parameter (applies extra smear to mimic the avalanche): -double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... +// Tpc Performance Parameter (applies extra smear to mimic the avalanche): +double Tpc_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... // to be overwritten... -double TPCDriftVelocity; -double TPC_Trans_Diffusion; -double TPC_Long_Diffusion; -double TPC_dEdx; -double TPC_NPri; -double TPC_NTot; -double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells +double TpcDriftVelocity; +double Tpc_Trans_Diffusion; +double Tpc_Long_Diffusion; +double Tpc_dEdx; +double Tpc_NPri; +double Tpc_NTot; +double Tpc_ElectronsPerKeV; + +// Tpc readout shaping time and ADC clock parameters +// these set the Z size of the Tpc cells // These need to be set in the init since some of them require the drift velocity... //======================================= -double TPCADCClock; -double TPCShapingRMSLead; -double TPCShapingRMSTail; +double TpcADCClock; +double TpcShapingRMSLead; +double TpcShapingRMSTail; double tpc_cell_z; -double TPC_SmearRPhi; -double TPC_SmearZ; +double Tpc_SmearRPhi; +double Tpc_SmearZ; int Max_si_layer; @@ -178,107 +178,107 @@ void SvtxInit(int verbosity = 0) switch (ether) { // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case TPC_Gas::Ne2K_100: + case Tpc_Gas::Ne2K_100: { if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + cout << "Gas Choice: Tpc_Gas::Ne2K_100" << endl; + TpcDriftVelocity = 3.2 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0300; // cm/SQRT(cm) + Tpc_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + Tpc_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + Tpc_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; break; } - case TPC_Gas::Ne2K_400: + case Tpc_Gas::Ne2K_400: { if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + cout << "Gas Choice: Tpc_Gas::Ne2K_400" << endl; + TpcDriftVelocity = 5.5 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0175; // cm/SQRT(cm) + Tpc_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + Tpc_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + Tpc_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; break; } // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: + case Tpc_Gas::NeCF4_100: { if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + cout << "Gas Choice: Tpc_Gas::NeCF4_100" << endl; + TpcDriftVelocity = 4.0 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0270; // cm/SQRT(cm) + Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; break; } - case TPC_Gas::NeCF4_300: + case Tpc_Gas::NeCF4_300: { if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + cout << "Gas Choice: Tpc_Gas::NeCF4_300" << endl; + TpcDriftVelocity = 7.0 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0170; // cm/SQRT(cm) + Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; break; } - case TPC_Gas::NeCF4_400: + case Tpc_Gas::NeCF4_400: { if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + cout << "Gas Choice: Tpc_Gas::NeCF4_400" << endl; + TpcDriftVelocity = 8.0 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0150; // cm/SQRT(cm) + Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; break; } - case TPC_Gas::ByHand: + case Tpc_Gas::ByHand: { if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + cout << "Gas Choice: Tpc_Gas::ByHand" << endl; + TpcDriftVelocity = 6.0 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0130; // cm/SQRT(cm) + Tpc_ElectronsPerKeV = 28.0; + Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + Tpc_NTot = Tpc_ElectronsPerKeV * Tpc_dEdx; break; } default: // defaults to NeCF4_400 { if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + cout << "Gas Choice Undefined...using Tpc_Gas::NeCF4_400" << endl; + TpcDriftVelocity = 8.0 / 1000.0; // cm/ns + Tpc_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + Tpc_Long_Diffusion = 0.0150; // cm/SQRT(cm) + Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; break; } } - TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; + Tpc_ElectronsPerKeV = Tpc_NTot / Tpc_dEdx; - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells + // Tpc readout shaping time and ADC clock parameters + // these set the Z size of the Tpc cells //======================================= - TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time - TPC_SmearRPhi = 0.25; - TPC_SmearZ = 0.15; + TpcShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + TpcShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TpcADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + tpc_cell_z = TpcADCClock * TpcDriftVelocity; // cm + + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer Tpc layers with the Tpc setup used here and 80 ns SAMPA peaking time + Tpc_SmearRPhi = 0.25; + Tpc_SmearZ = 0.15; } double Svtx(PHG4Reco* g4Reco, double radius, @@ -391,7 +391,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = inner_cage_radius; - double cage_length = 211.0; // From TPC group, gives eta = 1.1 at 78 cm + 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 @@ -413,7 +413,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - // Layer of inert TPC gas from 20-30 cm + // Layer of inert Tpc gas from 20-30 cm if (inner_readout_radius - radius > 0) { cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + 1); @@ -430,12 +430,12 @@ double Svtx(PHG4Reco* g4Reco, double radius, double outer_radius = 78.; - // Active layers of the TPC from 30-40 cm (inner layers) + // Active layers of the Tpc from 30-40 cm (inner layers) for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_inner - 0.01 << " length " << cage_length << endl; cyl = new PHG4CylinderSubsystem("SVTX", ilayer); @@ -451,12 +451,12 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius += tpc_layer_thick_inner; } - // Active layers of the TPC from 40-60 cm (mid layers) + // Active layers of the Tpc from 40-60 cm (mid layers) for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_mid - 0.01 << " length " << cage_length << endl; cyl = new PHG4CylinderSubsystem("SVTX", ilayer); @@ -472,12 +472,12 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius += tpc_layer_thick_mid; } - // Active layers of the TPC from 60-80 cm (outer layers) + // Active layers of the Tpc from 60-80 cm (outer layers) for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) { if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " << " thickness " << tpc_layer_thick_outer - 0.01 << " length " << cage_length << endl; cyl = new PHG4CylinderSubsystem("SVTX", ilayer); @@ -532,20 +532,20 @@ void Svtx_Cells(int verbosity = 0) if (verbosity) { - cout << " TPC Drift Velocity: " << TPCDriftVelocity << " cm/nsec" << endl; - cout << " TPC Transverse Diffusion: " << TPC_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC Longitudinal Diffusion: " << TPC_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " TPC dE/dx: " << TPC_dEdx << " keV/cm" << endl; - cout << " TPC N Primary: " << TPC_NPri << " electrons/cm" << endl; - cout << " TPC N Total: " << TPC_NTot << " electrons/cm" << endl; - cout << " TPC Electrons Per keV: " << TPC_ElectronsPerKeV << " electrons/keV" << endl; - cout << " TPC ADC Clock: " << TPCADCClock << " nsec" << endl; - cout << " TPC ADC Rate: " << 1000.0 / TPCADCClock << " MHZ" << endl; - cout << " TPC Shaping Lead: " << TPCShapingRMSLead << " nsec" << endl; - cout << " TPC Shaping Tail: " << TPCShapingRMSTail << " nsec" << endl; - cout << " TPC z cell " << tpc_cell_z << " cm" << endl; - cout << " TPC Smear R-Phi " << TPC_SmearRPhi << " cm" << endl; - cout << " TPC Smear Z " << TPC_SmearZ << " cm" << endl; + cout << " Tpc Drift Velocity: " << TpcDriftVelocity << " cm/nsec" << endl; + cout << " Tpc Transverse Diffusion: " << Tpc_Trans_Diffusion << " cm/SQRT(cm)" << endl; + cout << " Tpc Longitudinal Diffusion: " << Tpc_Long_Diffusion << " cm/SQRT(cm)" << endl; + cout << " Tpc dE/dx: " << Tpc_dEdx << " keV/cm" << endl; + cout << " Tpc N Primary: " << Tpc_NPri << " electrons/cm" << endl; + cout << " Tpc N Total: " << Tpc_NTot << " electrons/cm" << endl; + cout << " Tpc Electrons Per keV: " << Tpc_ElectronsPerKeV << " electrons/keV" << endl; + cout << " Tpc ADC Clock: " << TpcADCClock << " nsec" << endl; + cout << " Tpc ADC Rate: " << 1000.0 / TpcADCClock << " MHZ" << endl; + cout << " Tpc Shaping Lead: " << TpcShapingRMSLead << " nsec" << endl; + cout << " Tpc Shaping Tail: " << TpcShapingRMSTail << " nsec" << endl; + cout << " Tpc z cell " << tpc_cell_z << " cm" << endl; + cout << " Tpc Smear R-Phi " << Tpc_SmearRPhi << " cm" << endl; + cout << " Tpc Smear Z " << Tpc_SmearZ << " cm" << endl; } if (n_maps_layer > 0) @@ -570,54 +570,54 @@ void Svtx_Cells(int verbosity = 0) se->registerSubsystem(reco); } - // Main switch for TPC distortion + // Main switch for Tpc distortion const bool do_tpc_distortion = true; - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; + 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 " + 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 Tpc_distortion_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); + 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); + PHG4CylinderCellTpcReco* svtx_cells = new PHG4CylinderCellTpcReco(n_maps_layer + n_intt_layer); svtx_cells->Detector("SVTX"); svtx_cells->setDistortion(tpc_distortion); //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - svtx_cells->setDiffusionT(TPC_Trans_Diffusion); - svtx_cells->setDiffusionL(TPC_Long_Diffusion); - svtx_cells->setSigmaT(TPC_SigmaT); - svtx_cells->setShapingRMSLead(TPCShapingRMSLead * TPCDriftVelocity); - svtx_cells->setShapingRMSTail(TPCShapingRMSTail * TPCDriftVelocity); + svtx_cells->setDiffusionT(Tpc_Trans_Diffusion); + svtx_cells->setDiffusionL(Tpc_Long_Diffusion); + svtx_cells->setSigmaT(Tpc_SigmaT); + 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 - // Tune TPC_SmearRPhi and TPC_SmearZ to get 150 microns in the outer layers - svtx_cells->setSmearRPhi(TPC_SmearRPhi); // additional random displacement of cloud positions wrt hits - svtx_cells->setSmearZ(TPC_SmearZ); // additional random displacement of cloud positions wrt hits - svtx_cells->set_drift_velocity(TPCDriftVelocity); + // Tune Tpc_SmearRPhi and Tpc_SmearZ to get 150 microns in the outer layers + svtx_cells->setSmearRPhi(Tpc_SmearRPhi); // additional random displacement of cloud positions wrt hits + svtx_cells->setSmearZ(Tpc_SmearZ); // additional random displacement of cloud positions wrt hits + svtx_cells->set_drift_velocity(TpcDriftVelocity); svtx_cells->setHalfLength(105.5); - svtx_cells->setElectronsPerKeV(TPC_ElectronsPerKeV); + svtx_cells->setElectronsPerKeV(Tpc_ElectronsPerKeV); 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 + // set cylinder cell Tpc cell sizes //====================== - double tpc_timing_window = 105.5 / TPCDriftVelocity; // half length in cm / Vd in cm/ns => ns + double tpc_timing_window = 105.5 / TpcDriftVelocity; // half length in cm / Vd in cm/ns => ns // inner layers double radius_layer = inner_readout_radius ; @@ -628,7 +628,7 @@ void Svtx_Cells(int verbosity = 0) svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) - cout << "TPC cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + cout << "Tpc cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; radius_layer += tpc_layer_thick_inner; } @@ -640,7 +640,7 @@ void Svtx_Cells(int verbosity = 0) svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) - cout << "TPC cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + cout << "Tpc cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; radius_layer += tpc_layer_thick_mid; } @@ -651,7 +651,7 @@ void Svtx_Cells(int verbosity = 0) svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); if (verbosity) - cout << "TPC cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; + cout << "Tpc cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; radius_layer += tpc_layer_thick_outer; } @@ -724,13 +724,13 @@ void Svtx_Reco(int verbosity = 0) // digiintt->Verbosity(1); } - // TPC layers use the Svtx digitizer - digi->SetTPCMinLayer(n_maps_layer + n_intt_layer); + // Tpc layers use the Svtx digitizer + digi->SetTpcMinLayer(n_maps_layer + n_intt_layer); double ENC = 670.0; // standard digi->SetENC(ENC); double ADC_threshold = 4.0*ENC; digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " TPC digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digi); @@ -799,11 +799,11 @@ void Svtx_Reco(int verbosity = 0) se->registerSubsystem(clusterizer); - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); + PHG4TpcClusterizer* tpcclusterizer = new PHG4TpcClusterizer(); tpcclusterizer->Verbosity(0); tpcclusterizer->setRangeLayers(n_maps_layer + n_intt_layer, Max_si_layer); tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when TPC cluster resolution changes + tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when Tpc cluster resolution changes tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); se->registerSubsystem(tpcclusterizer); From 9ab79087b9b3b681bbeaacd4ff2e985d1fe845f4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 12:01:19 -0400 Subject: [PATCH 0307/1222] TPC -> Tpc --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 33781ccef..131fb0130 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -9,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) @@ -28,7 +28,7 @@ bool tpc_layers_40 = false; // 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_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers // default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired int n_intt_layer = 0; @@ -232,18 +232,18 @@ double Svtx(PHG4Reco* g4Reco, double radius, //====================================================== // Y. Corrales Morales 4Feb2019 - // New MVTX configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MVTXSubsystem or PHG4MVTXDetector + //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code // Y. Corrales Morales - removed, no longer used in the code // int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx - PHG4MVTXSubsystem* mvtx = new PHG4MVTXSubsystem("MVTX"); + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) @@ -259,11 +259,11 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius = maps_layer_radius[ilayer]; } - mvtx->set_string_param(PHG4MVTXDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); // 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 - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - mvtx->set_double_param(PHG4MVTXDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); From 6ca1864f3b95c37d8b00c6eed436d8745608a6c0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 12:06:23 -0400 Subject: [PATCH 0308/1222] TPC -> Tpc, MVTX -> Mvtx --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index 98596eb45..72b09aa5d 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C @@ -36,7 +36,7 @@ bool tpc_layers_40 = false; // 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_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers // default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired int n_intt_layer = 8; @@ -296,7 +296,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx double phi_tilt[3] = {0.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) @@ -923,7 +923,7 @@ void Svtx_Eval(std::string outputfile, int verbosity = 0) 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 + // 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", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); From a3bf05d4a127be40e85fcef40d796a10982644bd Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 22 May 2019 14:16:36 -0400 Subject: [PATCH 0309/1222] Added some comments, set scan for embedded to true. --- macros/g4simulations/G4_Tracking.C | 38 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 12ca41fff..68eac4c15 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -37,8 +37,8 @@ #include #include #include + // still needed -#include #include #include @@ -53,7 +53,6 @@ R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) #endif -//#include #include @@ -511,25 +510,29 @@ void Tracking_Reco(int verbosity = 0) tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); + //------------- + // Tracking + //------------ - // This should be true for everything except testing! - //const bool use_track_prop = true; - const bool use_track_prop = false; + // This should be true for everything except testing wirh truth track seeding! + const bool use_track_prop = true; if (use_track_prop) { - //--------------------- - // PHG4KalmanPatRec - //--------------------- + //-------------------------------------------------- + // Normal track seeding and propagation + //-------------------------------------------------- - // for now we cheat to get the vertex for the full track reconstruction case + // for now, we cheat to get the initial vertex for the full track reconstruction case PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); se->registerSubsystem(init_vtx); + // find seed tracks using a subset of TPC layers PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); track_seed->Verbosity(0); se->registerSubsystem(track_seed); + // Find all clusters associated with each seed track PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); @@ -556,22 +559,23 @@ void Tracking_Reco(int verbosity = 0) } else { - //--------------------- - // Truth Pattern Recognition - //--------------------- + //-------------------------------------------------- + // Track finding using truth information + //-------------------------------------------------- PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); se->registerSubsystem(init_vtx); - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding(); + // For each truth particle, create a track and associate clusters with it using truth information + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); pat_rec->Verbosity(0); se->registerSubsystem(pat_rec); } - //--------------------- - // Kalman Filter - //--------------------- + //------------------------------------------------ + // Fitting of tracks using Kalman Filter + //------------------------------------------------ PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); kalman->Verbosity(verbosity); @@ -622,7 +626,7 @@ void Tracking_Reco(int verbosity = 0) eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->do_eval_light(true); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true eval->Verbosity(0); se->registerSubsystem(eval); From fb0e5c0b229373883f56d4cb4ec15a9f149a9442 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 May 2019 22:23:22 -0400 Subject: [PATCH 0310/1222] TPC -> Tpc --- .../G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 131fb0130..3942afea2 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -11,7 +11,7 @@ #include #include #include -#include +#include R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) From edb86ae3d0b3266569b824215075b0f287e83f3f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 3 Jun 2019 15:31:28 -0400 Subject: [PATCH 0311/1222] the string parameter is supposed to be the module name, not the detector (default fixed in the intt code) --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 3ad4cdc1f..e2af604ce 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -320,7 +320,7 @@ void Tracking_Cells(int verbosity = 0) if (n_intt_layer > 0) { // new storage containers - PHG4InttHitReco* reco = new PHG4InttHitReco("INTT"); + PHG4InttHitReco* reco = new PHG4InttHitReco(); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here //reco->set_double_param("tmax",80.0); //reco->set_double_param("tmin",-20.0); From 81bc623a4e4fbbf4ec1f904088acf14db117555f Mon Sep 17 00:00:00 2001 From: Xu Sun Date: Thu, 13 Jun 2019 11:47:44 -0400 Subject: [PATCH 0312/1222] update blackhole setup for energy leakage study --- macros/prototype4/Fun4All_G4_Prototype4.C | 56 +++++++++++++---------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/macros/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C index 6bebbec93..98b35da7d 100644 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ b/macros/prototype4/Fun4All_G4_Prototype4.C @@ -238,43 +238,53 @@ int Fun4All_G4_Prototype4(int nEvents = 1) if (bh_on) { // BLACKHOLE, box surrounding the prototype to check for leakage - PHG4BlockSubsystem *bh[5]; + PHG4BlockSubsystem *bh[6]; // 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.); + bh[0]->set_double_param("size_x",310.); + bh[0]->set_double_param("size_y",1.0); + bh[0]->set_double_param("size_z",350.); + bh[0]->set_double_param("place_x",145.); + bh[0]->set_double_param("place_y",63.); + bh[0]->set_double_param("place_z",165.); // 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.); + bh[1]->set_double_param("size_x",310.); + bh[1]->set_double_param("size_y",1.0); + bh[1]->set_double_param("size_z",350.); + bh[1]->set_double_param("place_x",145.); + bh[1]->set_double_param("place_y",-63.); + bh[1]->set_double_param("place_z",165.); // right side bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",200.); + bh[2]->set_double_param("size_x",310.); 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.); + bh[2]->set_double_param("size_z",1.0); + bh[2]->set_double_param("place_x",145.); + bh[2]->set_double_param("place_z",340.5); // left side bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",270.); + bh[3]->set_double_param("size_x",310.); 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.); + bh[3]->set_double_param("size_z",1.0); + bh[3]->set_double_param("place_x",145.); + bh[3]->set_double_param("place_z",-10.5); // back bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",0.01); + bh[4]->set_double_param("size_x",1.0); 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[4]->set_double_param("size_z",350.); + bh[4]->set_double_param("place_x",300.); + bh[4]->set_double_param("place_z",165.); + // front + bh[5] = new PHG4BlockSubsystem("bh6",6); + bh[5]->set_double_param("size_x",1.0); + bh[5]->set_double_param("size_y",125.); + bh[5]->set_double_param("size_z",350.); + bh[5]->set_double_param("place_x",-10.0); + bh[5]->set_double_param("place_z",165.); + for (int i=0; i<6; i++) { bh[i]->BlackHole(); bh[i]->SetActive(); From 0bf0deab8d8fc098de67bd78ebbedc7f1ac35b36 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 20 Jun 2019 21:42:20 -0400 Subject: [PATCH 0313/1222] Switched from g4hough/PHG4GenFitTrackProjection to trackreco/PHGenfitTrackProjection. --- macros/g4simulations/G4_Tracking.C | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index e2af604ce..80cfe16a1 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -37,15 +37,12 @@ #include #include #include - -// still needed -#include +#include #include R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4hough.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) @@ -362,7 +359,6 @@ void Tracking_Reco(int verbosity = 0) //--------------- gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); gSystem->Load("libtrack_reco.so"); //--------------- @@ -588,7 +584,7 @@ void Tracking_Reco(int verbosity = 0) //------------------ // Track Projections //------------------ - PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); @@ -605,7 +601,6 @@ void Tracking_Reco(int verbosity = 0) gSystem->Load("libg4eval.so"); gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); gSystem->Load("libtrack_reco.so"); From 60b06c7e07946131bae197175ee7286b7fd5d43a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 20 Jun 2019 21:43:30 -0400 Subject: [PATCH 0314/1222] Removed unneeded loading of obsolete libg4hough. --- macros/g4simulations/Fun4All_G4_EICDetector.C | 1 - macros/g4simulations/Fun4All_G4_fsPHENIX.C | 1 - macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +- macros/g4simulations/G4_Svtx.C | 350 ------- .../G4_Svtx_MAPScyl_ITTcyl_TPC.C | 339 ------- ...ps_ladders+intt_ladders+tpc_KalmanPatRec.C | 942 ------------------ ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 452 --------- 7 files changed, 2 insertions(+), 2088 deletions(-) delete mode 100644 macros/g4simulations/G4_Svtx.C delete mode 100644 macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C delete mode 100644 macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C delete mode 100644 macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index c5b94fcd0..55cc740bc 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -184,7 +184,6 @@ int Fun4All_G4_EICDetector( gSystem->Load("libg4detectors.so"); gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); // establish the geometry and reconstruction setup diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index d5e9e0b73..63e064a00 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -137,7 +137,6 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4detectors.so"); gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 269b81eaf..ebaf5b6d4 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -145,7 +145,6 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4detectors.so"); gSystem->Load("libphhepmc.so"); gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); gSystem->Load("libg4eval.so"); gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup @@ -235,8 +234,8 @@ int Fun4All_G4_sPHENIX( { // 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 + //gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); 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 72b09aa5d..000000000 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ /dev/null @@ -1,942 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -R__LOAD_LIBRARY(libg4hough.so) -R__LOAD_LIBRARY(libg4eval.so) -#endif - -#include - -// ONLY if backward compatibility with hits files already generated with 8 inner Tpc layers is needed, you can set this to "true" -bool tpc_layers_40 = false; - -// 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 - -// default setup for the INTT - please don't change this. The configuration can be redone later in the macro if desired -int n_intt_layer = 8; -// default layer configuration -int laddertype[8] = {PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_Z, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI, - PHG4SiliconTrackerDefs::SEGMENTATION_PHI}; // default -int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default -double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders -double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; - -// Optionally reconfigure the INTT -//======================================================================== -// example re-configurations of INTT - uncomment to get the reconfiguration -// n_intt must be 0-8, setting it to zero will remove the INTT completely, otherwise it gives you n layers -//======================================================================== - -/* -// Four layers, laddertypes 0-0-1-1 -n_intt_layer = 4; -// -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -nladder[0] = 17; nladder[1] = 17; -sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; -offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; -// -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 21; nladder[3] = 21; -sensor_radius[2] = 12.676; sensor_radius[3] = 13.179; -offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; -*/ - -/* -// Four layers, laddertypes 0-0-1-1 -n_intt_layer = 4; -// -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; laddertype[1] = PHG4SiliconTrackerDefs::SEGMENTATION_Z; -nladder[0] = 17; nladder[1] = 17; -sensor_radius[0] = 6.876; sensor_radius[1] = 7.462; -offsetphi[0] = 0.0; offsetphi[1] = 0.5 * 360.0 / nladder[1]; -// -laddertype[2] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; laddertype[3] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[2] = 18; nladder[3] = 18; -sensor_radius[2] = 10.835; sensor_radius[3] = 11.361; -offsetphi[2] = 0.0; offsetphi[3] = 0.5 * 360.0 / nladder[3]; -*/ - -/* -// single layer for testing -n_intt_layer = 1; -// -laddertype[0] = PHG4SiliconTrackerDefs::SEGMENTATION_PHI; -nladder[0] = 15; -sensor_radius[0] = 8.987; -offsetphi[0] = 12.0; -*/ - -int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25 / 2.0; -int tpc_layer_rphi_count_inner = 1152; - -int n_tpc_layer_mid = 16; -double tpc_layer_thick_mid = 1.25; -int tpc_layer_rphi_count_mid = 1536; - -int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm -int tpc_layer_rphi_count_outer = 2304; - -int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; - -double inner_cage_radius = 20.; -double inner_readout_radius = 30.; - -// Tpc gas parameters -// These are set for a variety of gas choices... -//============================================== -enum Tpc_Gas -{ - Ne2K_100, - Ne2K_400, - NeCF4_100, - NeCF4_300, - NeCF4_400, - ByHand -}; -Tpc_Gas ether = Tpc_Gas::NeCF4_400; -//Tpc_Gas ether = Tpc_Gas::ByHand; - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm -double iBut_dEdx = 5.93; // keV/cm - -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm -double iBut_NPrimary = 84; // Number/cm - -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm -double iBut_NTotal = 195; // Number/cm - -// Tpc Performance Parameter (applies extra smear to mimic the avalanche): -double Tpc_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... -double TpcDriftVelocity; -double Tpc_Trans_Diffusion; -double Tpc_Long_Diffusion; -double Tpc_dEdx; -double Tpc_NPri; -double Tpc_NTot; -double Tpc_ElectronsPerKeV; - -// Tpc readout shaping time and ADC clock parameters -// these set the Z size of the Tpc cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= -double TpcADCClock; -double TpcShapingRMSLead; -double TpcShapingRMSTail; -double tpc_cell_z; -double Tpc_SmearRPhi; -double Tpc_SmearZ; - -int Max_si_layer; - -void SvtxInit(int verbosity = 0) -{ - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; - - switch (ether) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case Tpc_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::Ne2K_100" << endl; - TpcDriftVelocity = 3.2 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0300; // cm/SQRT(cm) - Tpc_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - Tpc_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - Tpc_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - case Tpc_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::Ne2K_400" << endl; - TpcDriftVelocity = 5.5 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0175; // cm/SQRT(cm) - Tpc_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - Tpc_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - Tpc_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case Tpc_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::NeCF4_100" << endl; - TpcDriftVelocity = 4.0 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0270; // cm/SQRT(cm) - Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case Tpc_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::NeCF4_300" << endl; - TpcDriftVelocity = 7.0 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0170; // cm/SQRT(cm) - Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case Tpc_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::NeCF4_400" << endl; - TpcDriftVelocity = 8.0 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0150; // cm/SQRT(cm) - Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case Tpc_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: Tpc_Gas::ByHand" << endl; - TpcDriftVelocity = 6.0 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0130; // cm/SQRT(cm) - Tpc_ElectronsPerKeV = 28.0; - Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - Tpc_NTot = Tpc_ElectronsPerKeV * Tpc_dEdx; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using Tpc_Gas::NeCF4_400" << endl; - TpcDriftVelocity = 8.0 / 1000.0; // cm/ns - Tpc_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - Tpc_Long_Diffusion = 0.0150; // cm/SQRT(cm) - Tpc_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - Tpc_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - Tpc_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - } - - Tpc_ElectronsPerKeV = Tpc_NTot / Tpc_dEdx; - - // Tpc readout shaping time and ADC clock parameters - // these set the Z size of the Tpc cells - //======================================= - TpcShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - TpcShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TpcADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - tpc_cell_z = TpcADCClock * TpcDriftVelocity; // cm - - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer Tpc layers with the Tpc setup used here and 80 ns SAMPA peaking time - Tpc_SmearRPhi = 0.25; - Tpc_SmearZ = 0.15; -} - -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 - - // MAPS inner barrel layers - //====================================================== - - double maps_layer_radius[3] = {24.61, 32.59, 39.88}; // mm - numbers from Walt 6 Aug 2018 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - 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.300, 0.305, 0.300}; // radians - numbers from Walt 6 Aug 2018 - - 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", "/phenix/hhj3/dcm07e/sPHENIX/macros/macros/g4simulations/mvtx_stave_v01.gdml"); - lyr->set_string_param("stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v01.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; i < 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(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; - } - - PHG4SiliconTrackerSubsystem* sitrack = new PHG4SiliconTrackerSubsystem("SILICON_TRACKER", vpair); - sitrack->Verbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem(sitrack); - - // Update the laddertype and ladder spacing configuration - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } - - // int verbosity = 1; - - // time projection chamber layers -------------------------------------------- - - // switch ONLY for backward compatibility with 40 layer hits files! - if (tpc_layers_40) - { - n_tpc_layer_inner = 8; - tpc_layer_thick_inner = 1.25; - tpc_layer_rphi_count_inner = 1152; - cout << "Using 8 inner_layers for backward comatibility" << endl; - } - - 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 < radius) inner_readout_radius = radius; - - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - - // Layer of inert Tpc gas from 20-30 cm - if (inner_readout_radius - 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.; - - // Active layers of the Tpc from 30-40 cm (inner layers) - - for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) - { - if (verbosity) - cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_inner; - } - - // Active layers of the Tpc from 40-60 cm (mid layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) - { - if (verbosity) - cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_mid; - } - - // Active layers of the Tpc from 60-80 cm (outer layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) - { - if (verbosity) - cout << "Create Tpc gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_outer; - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // 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 (verbosity) - { - cout << " Tpc Drift Velocity: " << TpcDriftVelocity << " cm/nsec" << endl; - cout << " Tpc Transverse Diffusion: " << Tpc_Trans_Diffusion << " cm/SQRT(cm)" << endl; - cout << " Tpc Longitudinal Diffusion: " << Tpc_Long_Diffusion << " cm/SQRT(cm)" << endl; - cout << " Tpc dE/dx: " << Tpc_dEdx << " keV/cm" << endl; - cout << " Tpc N Primary: " << Tpc_NPri << " electrons/cm" << endl; - cout << " Tpc N Total: " << Tpc_NTot << " electrons/cm" << endl; - cout << " Tpc Electrons Per keV: " << Tpc_ElectronsPerKeV << " electrons/keV" << endl; - cout << " Tpc ADC Clock: " << TpcADCClock << " nsec" << endl; - cout << " Tpc ADC Rate: " << 1000.0 / TpcADCClock << " MHZ" << endl; - cout << " Tpc Shaping Lead: " << TpcShapingRMSLead << " nsec" << endl; - cout << " Tpc Shaping Tail: " << TpcShapingRMSTail << " nsec" << endl; - cout << " Tpc z cell " << tpc_cell_z << " cm" << endl; - cout << " Tpc Smear R-Phi " << Tpc_SmearRPhi << " cm" << endl; - cout << " Tpc Smear Z " << Tpc_SmearZ << " cm" << endl; - } - - 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, -5000, 5000); - } - 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); - reco->checkenergy(1); - se->registerSubsystem(reco); - } - - // 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"); - 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); - //svtx_cells->setZigzags(true); // set zigzag pads option on if true, use rectangular pads if false (not required, defaults to true in code). - svtx_cells->setDiffusionT(Tpc_Trans_Diffusion); - svtx_cells->setDiffusionL(Tpc_Long_Diffusion); - svtx_cells->setSigmaT(Tpc_SigmaT); - 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 - // Tune Tpc_SmearRPhi and Tpc_SmearZ to get 150 microns in the outer layers - svtx_cells->setSmearRPhi(Tpc_SmearRPhi); // additional random displacement of cloud positions wrt hits - svtx_cells->setSmearZ(Tpc_SmearZ); // additional random displacement of cloud positions wrt hits - svtx_cells->set_drift_velocity(TpcDriftVelocity); - svtx_cells->setHalfLength(105.5); - svtx_cells->setElectronsPerKeV(Tpc_ElectronsPerKeV); - 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 - //====================== - - double tpc_timing_window = 105.5 / TpcDriftVelocity; // half length in cm / Vd in cm/ns => ns - - // inner layers - double radius_layer = inner_readout_radius ; - for (int i = n_maps_layer + n_intt_layer; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner; i++) - { - // this calculates the radius at the middle of the layer - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_inner; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "Tpc cells inner: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_inner; - } - - - // mid layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_mid; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "Tpc cells mid: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - radius_layer += tpc_layer_thick_mid; - } - - // outer layers - for (int i = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; i < n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; i++) - { - double tpc_cell_rphi = 2 * TMath::Pi() * radius_layer / (double) tpc_layer_rphi_count_outer; - svtx_cells->cellsize(i, tpc_cell_rphi, tpc_cell_z); - svtx_cells->set_timing_window(i, -tpc_timing_window, +tpc_timing_window); - if (verbosity) - cout << "Tpc cells outer: layer " << i << " center radius " << radius_layer << " tpc_cell_rphi " << tpc_cell_rphi << " tpc_cell_z " << tpc_cell_z << endl; - - radius_layer += tpc_layer_thick_outer; - } - - 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; i < n_maps_layer; ++i) - { - digi->set_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 - - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapINTT = new PHG4SvtxDeadMapLoader("SILICON_TRACKER"); - for (int i = 0; i < n_intt_layer; i++) - { - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", laddertype[i], i); - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. -// string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapINTT->deadMapPath(n_maps_layer + i, DeadMapPath); - } -// se->registerSubsystem(deadMapINTT); - - 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; i < n_intt_layer; i++) - { - digiintt->set_adc_scale(n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); - -// digiintt->Verbosity(1); - } - - // Tpc layers use the Svtx digitizer - digi->SetTpcMinLayer(n_maps_layer + n_intt_layer); - double ENC = 670.0; // standard - digi->SetENC(ENC); - double ADC_threshold = 4.0*ENC; - digi->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold - << " maps+INTT layers set to " << n_maps_layer + n_intt_layer << endl; - - se->registerSubsystem(digi); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - // This is obsolete, please use PHG4SvtxDeadMapLoader instead for pre-defined deadmap - //------------------------------------- - // defaults to 1.0 (fully active) - -// PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); -// -// for (int i = 0; i < n_maps_layer; i++) -// { -// deadarea->Verbosity(verbosity); -// //deadarea->set_hit_efficiency(i,0.99); -// deadarea->set_hit_efficiency(i, 1.0); -// } -// for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) -// { -// //deadarea->set_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; i < n_maps_layer; i++) - { - // reduced by x2.5 when going from cylinder maps with 50 microns thickness to actual maps with 18 microns thickness - // Note the non-use of set_using_thickness here, this is so that the shortest dimension of the cell sets the mip energy loss - thresholds->set_threshold(i, 0.1); - } - // INTT - for (int i = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - thresholds->set_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 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - if(laddertype[i-n_maps_layer] == 1) - clusterizer->set_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); - tpcclusterizer->setEnergyCut(15 /*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150, 0.0160); // should be changed when Tpc cluster resolution changes - tpcclusterizer->setFitWindowMax(5 /*rphibins*/, 5 /*zbins*/); - 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); - - for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.00); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.20); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // strip length is along theta - kalman_pat_rec->set_max_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_min_search_win_theta_intt(i, 0.200); - kalman_pat_rec->set_max_search_win_phi_intt(i, 0.0050); - kalman_pat_rec->set_min_search_win_phi_intt(i, 0.000); - } - } - - 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 - //------------------ - PHG4GenFitTrackProjection* projection = new PHG4GenFitTrackProjection(); - 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 = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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(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", n_maps_layer, n_intt_layer, n_gas_layer); - 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_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C deleted file mode 100644 index 3942afea2..000000000 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ /dev/null @@ -1,452 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -R__LOAD_LIBRARY(libg4hough.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) -#endif - - -#include - -// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; - -// 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 - -// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired -int n_intt_layer = 0; -// default layer configuration -int laddertype[4] = {0, 1, 1, 1}; // default -int nladder[4] = {34, 30, 36, 42}; // default -double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default -double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default - -int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. -int tpc_layer_rphi_count_inner = 1152; - -int n_tpc_layer_mid = 16; -double tpc_layer_thick_mid = 1.25; -int tpc_layer_rphi_count_mid = 1536; - -int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm -int tpc_layer_rphi_count_outer = 2304; - -int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; - -double inner_cage_radius = 20.; -double inner_readout_radius = 30.; - -// TPC gas parameters -// These are set for a variety of gas choices... -//============================================== -enum TPC_Gas -{ - Ne2K_100, - Ne2K_400, - NeCF4_100, - NeCF4_300, - NeCF4_400, - ByHand -}; -TPC_Gas ether = TPC_Gas::NeCF4_400; -//TPC_Gas ether = TPC_Gas::ByHand; - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm -double iBut_dEdx = 5.93; // keV/cm - -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm -double iBut_NPrimary = 84; // Number/cm - -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm -double iBut_NTotal = 195; // Number/cm - -// TPC Performance Parameter (applies extra smear to mimic the avalanche): -double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... -double TPCDriftVelocity; -double TPC_Trans_Diffusion; -double TPC_Long_Diffusion; -double TPC_dEdx; -double TPC_NPri; -double TPC_NTot; -double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= -double TPCADCClock; -double TPCShapingRMSLead; -double TPCShapingRMSTail; -double tpc_cell_z; -double TPC_SmearRPhi; -double TPC_SmearZ; - -int Max_si_layer; - -void SvtxInit(int verbosity = 0) -{ - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; - - switch (ether) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case TPC_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - case TPC_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - } - - TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; - - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells - //======================================= - TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time - TPC_SmearRPhi = 0.25; - TPC_SmearZ = 0.15; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - gSystem->Load("libg4mvtx.so"); - if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // MAPS inner barrel layers - //====================================================== - - // Y. Corrales Morales 4Feb2019 - // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - // Y. Corrales Morales - removed, no longer used in the code - // int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx - - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " - << " pixel size 30 x 30 microns " - << " active pixel thickness 0.0018 microns" << endl; - mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm - mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - - mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); - - radius = maps_layer_radius[ilayer]; - } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); - // 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 - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - } - - assert (n_intt_layer == 0); - - // int verbosity = 1; - - // time projection chamber layers -------------------------------------------- - - // switch ONLY for backward compatibility with 40 layer hits files! - if (tpc_layers_40) - { - n_tpc_layer_inner = 8; - tpc_layer_thick_inner = 1.25; - tpc_layer_rphi_count_inner = 1152; - cout << "Using 8 inner_layers for backward comatibility" << endl; - } - - 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 = radius; -// if (inner_readout_radius < radius) inner_readout_radius = radius; -// - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc -// -// // Layer of inert TPC gas from 20-30 cm -// if (inner_readout_radius - 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.; - - // Active layers of the TPC from 30-40 cm (inner layers) - - for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_inner; - } - - // Active layers of the TPC from 40-60 cm (mid layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_mid; - } - - // Active layers of the TPC from 60-80 cm (outer layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_outer; - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem(cyl); - - radius += cage_thickness; - - return radius; -} - -// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now -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 - //----------- - - - return; -} - -// Central detector reco is disabled as EIC setup use the fast tracking sim for now -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - return; -} From d4c911e1d3d5cfed7bc4340677ff87159d37f3ac Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 20 Jun 2019 21:54:44 -0400 Subject: [PATCH 0315/1222] Set default number of particles back to 1 --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index ebaf5b6d4..2e794ca6a 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -234,8 +234,8 @@ int Fun4All_G4_sPHENIX( { // 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 + gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { gen->set_reuse_existing_vertex(true); From d1de871040ac6d93f79ef76ef9c90c7140425393 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 21 Jun 2019 08:49:40 -0400 Subject: [PATCH 0316/1222] Update G4_Tracking.C --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 80cfe16a1..c211fea81 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -584,7 +584,7 @@ void Tracking_Reco(int verbosity = 0) //------------------ // Track Projections //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); From 2314664ca5b7cc1e92703ad74ea1ee0835129ba8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 24 Jun 2019 13:31:06 -0400 Subject: [PATCH 0317/1222] comment out eic tracking until it is fixed --- macros/g4simulations/Fun4All_G4_EICDetector.C | 8 ++++---- macros/g4simulations/G4_Tracking_EIC.C | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 55cc740bc..a234587ae 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -96,7 +96,7 @@ int Fun4All_G4_EICDetector( bool do_pipe = true; - bool do_tracking = true; + bool do_tracking = false; bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ @@ -421,7 +421,7 @@ int Fun4All_G4_EICDetector( // Detector Division //------------------ - if (do_tracking_cell) Svtx_Cells(); +// if (do_tracking_cell) Svtx_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -471,7 +471,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- - if (do_tracking_track) Tracking_Reco(); +// if (do_tracking_track) Tracking_Reco(); //----------------- // Global Vertexing @@ -523,7 +523,7 @@ int Fun4All_G4_EICDetector( //---------------------- // Simulation evaluation //---------------------- - if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); +// if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 785c1a986..9fdd98688 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -15,7 +15,7 @@ R__LOAD_LIBRARY(libg4trackfastsim.so) // load the version of central travker macro with cylindrical approximation of the TPC // This is required for fast tracking to properly count hits in TPC -#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" +//#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" void TrackingInit(int verbosity = 0) { @@ -26,7 +26,7 @@ void TrackingInit(int verbosity = 0) FGEM_Init(); /* central detectors */ - SvtxInit(); +// SvtxInit(); } double Tracking(PHG4Reco *g4Reco, double radius, @@ -40,7 +40,7 @@ double Tracking(PHG4Reco *g4Reco, double radius, FGEMSetup(g4Reco); /* Place central tracking detectors */ - Svtx(g4Reco, radius); +// Svtx(g4Reco, radius); return radius; } From b64e27750ee5bdb65833efdb37585c9d7c84dda8 Mon Sep 17 00:00:00 2001 From: bogui56 Date: Tue, 25 Jun 2019 13:50:54 -0400 Subject: [PATCH 0318/1222] explicit defaults for track seeding --- macros/g4simulations/G4_Tracking.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index c211fea81..630b3a51b 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -524,7 +524,9 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(init_vtx); // find seed tracks using a subset of TPC layers - PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); + int min_layers = 4; + int nlayers_seeds = 12; + PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); track_seed->Verbosity(0); se->registerSubsystem(track_seed); From 744411b4b20a484092165e6b4a2d4bba56ba705c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 12 Jul 2019 22:58:26 -0400 Subject: [PATCH 0319/1222] recover EIC tracking --- macros/g4simulations/Fun4All_G4_EICDetector.C | 8 ++++---- macros/g4simulations/G4_Tracking_EIC.C | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index a234587ae..55cc740bc 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -96,7 +96,7 @@ int Fun4All_G4_EICDetector( bool do_pipe = true; - bool do_tracking = false; + bool do_tracking = true; bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ @@ -421,7 +421,7 @@ int Fun4All_G4_EICDetector( // Detector Division //------------------ -// if (do_tracking_cell) Svtx_Cells(); + if (do_tracking_cell) Svtx_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -471,7 +471,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- -// if (do_tracking_track) Tracking_Reco(); + if (do_tracking_track) Tracking_Reco(); //----------------- // Global Vertexing @@ -523,7 +523,7 @@ int Fun4All_G4_EICDetector( //---------------------- // Simulation evaluation //---------------------- -// if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); + if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 9fdd98688..785c1a986 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -15,7 +15,7 @@ R__LOAD_LIBRARY(libg4trackfastsim.so) // load the version of central travker macro with cylindrical approximation of the TPC // This is required for fast tracking to properly count hits in TPC -//#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" +#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" void TrackingInit(int verbosity = 0) { @@ -26,7 +26,7 @@ void TrackingInit(int verbosity = 0) FGEM_Init(); /* central detectors */ -// SvtxInit(); + SvtxInit(); } double Tracking(PHG4Reco *g4Reco, double radius, @@ -40,7 +40,7 @@ double Tracking(PHG4Reco *g4Reco, double radius, FGEMSetup(g4Reco); /* Place central tracking detectors */ -// Svtx(g4Reco, radius); + Svtx(g4Reco, radius); return radius; } From a9076e28d272a5c7c86526e2c331d772ecf0e3f6 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 13 Jul 2019 00:05:58 -0400 Subject: [PATCH 0320/1222] remove unused header --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 446 ++++++++++++++++++ 1 file changed, 446 insertions(+) create mode 100644 macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C new file mode 100644 index 000000000..9261a8763 --- /dev/null +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -0,0 +1,446 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include +#include +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) +#endif + + +#include + +// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" +bool tpc_layers_40 = false; + +// 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 + +// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired +int n_intt_layer = 0; +// default layer configuration +int laddertype[4] = {0, 1, 1, 1}; // default +int nladder[4] = {34, 30, 36, 42}; // default +double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default +double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default + +int n_tpc_layer_inner = 16; +double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. +int tpc_layer_rphi_count_inner = 1152; + +int n_tpc_layer_mid = 16; +double tpc_layer_thick_mid = 1.25; +int tpc_layer_rphi_count_mid = 1536; + +int n_tpc_layer_outer = 16; +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm +int tpc_layer_rphi_count_outer = 2304; + +int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + +double inner_cage_radius = 20.; +double inner_readout_radius = 30.; + +// TPC gas parameters +// These are set for a variety of gas choices... +//============================================== +enum TPC_Gas +{ + Ne2K_100, + Ne2K_400, + NeCF4_100, + NeCF4_300, + NeCF4_400, + ByHand +}; +TPC_Gas ether = TPC_Gas::NeCF4_400; +//TPC_Gas ether = TPC_Gas::ByHand; + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf +double Ne_dEdx = 1.56; // keV/cm +double CF4_dEdx = 7.00; // keV/cm +double iBut_dEdx = 5.93; // keV/cm + +double Ne_NPrimary = 12; // Number/cm +double CF4_NPrimary = 51; // Number/cm +double iBut_NPrimary = 84; // Number/cm + +double Ne_NTotal = 43; // Number/cm +double CF4_NTotal = 100; // Number/cm +double iBut_NTotal = 195; // Number/cm + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): +double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... +double TPCDriftVelocity; +double TPC_Trans_Diffusion; +double TPC_Long_Diffusion; +double TPC_dEdx; +double TPC_NPri; +double TPC_NTot; +double TPC_ElectronsPerKeV; + +// TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... +//======================================= +double TPCADCClock; +double TPCShapingRMSLead; +double TPCShapingRMSTail; +double tpc_cell_z; +double TPC_SmearRPhi; +double TPC_SmearZ; + +int Max_si_layer; + +void SvtxInit(int verbosity = 0) +{ + Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; + + switch (ether) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case TPC_Gas::Ne2K_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_300: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::ByHand: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + break; + } + default: // defaults to NeCF4_400 + { + if (verbosity) + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + } + + TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time + TPC_SmearRPhi = 0.25; + TPC_SmearZ = 0.15; +} + +double Svtx(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + gSystem->Load("libg4mvtx.so"); + if (n_maps_layer > 0) + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + + // Y. Corrales Morales 4Feb2019 + // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) + //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) + //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector + double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + + // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code + // Y. Corrales Morales - removed, no longer used in the code + // int stave_type[3] = {0, 0, 0}; + int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + { + if (verbosity) + cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " + << " pixel size 30 x 30 microns " + << " active pixel thickness 0.0018 microns" << endl; + mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm + mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves + + mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); + + radius = maps_layer_radius[ilayer]; + } + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); + // 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 + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + } + + assert (n_intt_layer == 0); + + // int verbosity = 1; + + // time projection chamber layers -------------------------------------------- + + // switch ONLY for backward compatibility with 40 layer hits files! + if (tpc_layers_40) + { + n_tpc_layer_inner = 8; + tpc_layer_thick_inner = 1.25; + tpc_layer_rphi_count_inner = 1152; + cout << "Using 8 inner_layers for backward comatibility" << endl; + } + + 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 = radius; +// if (inner_readout_radius < radius) inner_readout_radius = radius; +// + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc +// +// // Layer of inert TPC gas from 20-30 cm +// if (inner_readout_radius - 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.; + + // Active layers of the TPC from 30-40 cm (inner layers) + + for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_inner; + } + + // Active layers of the TPC from 40-60 cm (mid layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_mid; + } + + // Active layers of the TPC from 60-80 cm (outer layers) + + for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) + { + if (verbosity) + cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " + << " thickness " << tpc_layer_thick_outer - 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", tpc_layer_thick_outer - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thick_outer; + } + + // outer field cage + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_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); // Kapton X_0 = 28.6 cm + cyl->SuperDetector("SVTXSUPPORT"); + g4Reco->registerSubsystem(cyl); + + radius += cage_thickness; + + return radius; +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +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 + //----------- + + + return; +} + +// Central detector reco is disabled as EIC setup use the fast tracking sim for now +void Svtx_Reco(int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + return; +} From 0e51006e920097d9bb6a5204c81951891a99e127 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 16:26:43 -0400 Subject: [PATCH 0321/1222] initial version --- macros/g4jleic/DisplayOn.C | 41 +++ macros/g4jleic/Fun4All_G4_JLeic.C | 447 ++++++++++++++++++++++++++++++ macros/g4jleic/G4Setup_JLeic.C | 210 ++++++++++++++ macros/g4jleic/G4_CTD.C | 56 ++++ macros/g4jleic/G4_Gem.C | 51 ++++ macros/g4jleic/G4_JLDIRC.C | 29 ++ macros/g4jleic/G4_Magnet.C | 55 ++++ macros/g4jleic/G4_Pipe.C | 117 ++++++++ macros/g4jleic/G4_Tracking_EIC.C | 127 +++++++++ macros/g4jleic/G4_VTX.C | 29 ++ macros/g4jleic/GlobalVariables.C | 6 + macros/g4jleic/vis.mac | 82 ++++++ 12 files changed, 1250 insertions(+) create mode 100644 macros/g4jleic/DisplayOn.C create mode 100644 macros/g4jleic/Fun4All_G4_JLeic.C create mode 100644 macros/g4jleic/G4Setup_JLeic.C create mode 100644 macros/g4jleic/G4_CTD.C create mode 100644 macros/g4jleic/G4_Gem.C create mode 100644 macros/g4jleic/G4_JLDIRC.C create mode 100644 macros/g4jleic/G4_Magnet.C create mode 100644 macros/g4jleic/G4_Pipe.C create mode 100644 macros/g4jleic/G4_Tracking_EIC.C create mode 100644 macros/g4jleic/G4_VTX.C create mode 100644 macros/g4jleic/GlobalVariables.C create mode 100644 macros/g4jleic/vis.mac diff --git a/macros/g4jleic/DisplayOn.C b/macros/g4jleic/DisplayOn.C new file mode 100644 index 000000000..3d8c8dc80 --- /dev/null +++ b/macros/g4jleic/DisplayOn.C @@ -0,0 +1,41 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#endif + +// 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.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; +} +// 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/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C new file mode 100644 index 000000000..43f6505a8 --- /dev/null +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -0,0 +1,447 @@ +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4Setup_JLeic.C" +#include "DisplayOn.C" +#include "G4_Tracking_EIC.C" + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libphhepmc.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +#endif + +using namespace std; + + +int Fun4All_G4_JLeic( + 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 = "G4JLeic.root", + const char *embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list") +{ + + //=============== + // 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; + const int num_upsilons_per_event = 1; // can set more than 1 upsilon per event, each has a unique embed flag + // Event pile up simulation with collision rate in Hz MB collisions. + // Note please follow up the macro to verify the settings for beam parameters + const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. + + //====================== + // What to run + //====================== + + bool do_pipe = true; + + bool do_ctd = true; + + bool do_vtx = true; + + bool do_jldirc = true; + + bool do_magnet = true; + + bool do_gem = true; + + bool do_tracking = true; + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4detectors.so"); + gSystem->Load("libphhepmc.so"); + gSystem->Load("libg4testbench.so"); + gSystem->Load("libg4eval.so"); + gSystem->Load("libg4intt.so"); + // establish the geometry and reconstruction setup + gROOT->LoadMacro("G4Setup_JLeic.C"); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc); + + int absorberactive = 1; // set to 1 to make all absorbers active volumes + // 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) + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const float magfield_rescale = 1; // scale map if needed + + //--------------- + // Fun4All server + //--------------- + + bool display_on = false; + if(display_on) + { + gROOT->LoadMacro("DisplayOn.C"); + } + + 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." << endl; + exit(1); + } + } + else + { + // running Geant4 stage. First load event generators. + + if (readhepmc) + { + // place holder. Additional action is performed in later stage at the input manager level + } + + if (runpythia8) + { + gSystem->Load("libPHPythia8.so"); + + PHPythia8 *pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + pythia8->set_config_file("phpythia8.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia8 + if (readhepmc) + pythia8->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 + // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available + se->registerSubsystem(pythia8); + } + + if (runpythia6) + { + gSystem->Load("libPHPythia6.so"); + + PHPythia6 *pythia6 = new PHPythia6(); + pythia6->set_config_file("phpythia6.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia6 + if (readhepmc) + pythia6->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 + // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available + se->registerSubsystem(pythia6); + } + + // 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 || do_embedding || runpythia8 || runpythia6) + { + 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, jleic_shiftz); + 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, 20.0); + gen->Embed(2); + 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 + + for(int iups = 0; iups < num_upsilons_per_event;iups++) + { + PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); + vgen->add_decay_particles("e+", "e-", 0); // i = decay id + // event vertex + if (readhepmc || do_embedding || particles || runpythia8 || runpythia6) + { + vgen->set_reuse_existing_vertex(true); + } + + // 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(3); + se->registerSubsystem(vgen); + + cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; + } + } + } + + if (!readhits) + { + //--------------------- + // Detector description + //--------------------- + +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + G4Setup(absorberactive, magfield, EDecayType::kAll, + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, magfield_rescale); +#else + G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, magfield_rescale); +#endif + } + + //-------------- + // IO management + //-------------- + + if (readhits) + { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + // 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); + } + + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + 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) + { + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager("HepMCInput_1"); + se->registerInputManager(in); + se->fileopen(in->Name().c_str(), inputFile); + //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space, time + //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space, time + // //optional choice of vertex distribution function in space, time + //in->set_vertex_distribution_function(PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Uniform,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 + //in->set_embedding_id(2); + } + 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 (pileup_collision_rate > 0) + { + // pile up simulation. + // add random beam collisions following a collision diamond and rate from a HepMC stream + Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + se->registerInputManager(pileup); + + const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); + //background files for p+p pileup sim + //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); + pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. + //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time + //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time + pileup->set_collision_rate(pileup_collision_rate); + + double time_window_minus = -35000; + double time_window_plus = 35000; +/* + if (do_tracking) + { + // This gets the default drift velocity only! + PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); + assert(dr); + double TpcDriftVelocity = dr->get_double_param("drift_velocity"); + } +*/ + time_window_minus = -105.5 / 5; // ns + time_window_plus = 105.5 / 5; // ns; + pileup->set_time_window(time_window_minus, time_window_plus); // override timing window in ns + cout << "Collision pileup enabled using file " << pileupfile << " with collision rate " << pileup_collision_rate + << " and time window " << time_window_minus << " to " << time_window_plus << endl; + } + + if (do_tracking) + { + Tracking_Reco(); + Tracking_Eval("trkeval.root"); + } + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + // if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); + + //----------------- + // Event processing + //----------------- + if (nEvents < 0) + { + return 0; + } + // 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 0; + } + + if(display_on) + { + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; + } + + se->run(nEvents); + + //----- + // Exit + //----- + + + se->End(); + std::cout << "All done" << std::endl; + delete se; + gSystem->Exit(0); + return 0; +} + + +// This function is only used to test if we can load this as root6 macro +// without running into unresolved libraries and include files +void RunFFALoadTest() {} diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C new file mode 100644 index 000000000..90aef1a1d --- /dev/null +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -0,0 +1,210 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "G4_Pipe.C" +#include "G4_VTX.C" +#include "G4_CTD.C" +#include "G4_Magnet.C" +#include "G4_Gem.C" +#include "G4_JLDIRC.C" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class SubsysReco; +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) +#else +bool overlapcheck = false; // set to true if you want to check for overlaps +double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +#endif + +// This function is only used to test if we can load this as root6 macro +// without running into unresolved libraries and include files +void RunLoadTest() {} + +void G4Init(const bool do_ctd = true, + const bool do_vtx = true, + const bool do_magnet = true, + const bool do_pipe = true, + const bool do_gem = true, + const bool do_jldirc = true + ) + { + + // load detector/material macros and execute Init() function + + if (do_pipe) + { + gROOT->LoadMacro("G4_Pipe.C"); + PipeInit(); + } + if (do_ctd) + { + gROOT->LoadMacro("G4_CTD.C"); + CTDInit(); + } + if (do_magnet) + { + gROOT->LoadMacro("G4_Magnet.C"); + MagnetInit(); + } + if (do_gem) + { + gROOT->LoadMacro("G4_Gem.C"); + GemInit(); + } + if (do_jldirc) + { + gROOT->LoadMacro("G4_JLDIRC.C"); + JLDIRCInit(); + } + +} + + +int G4Setup(const int absorberactive = 0, + const string &field ="2.0", +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + const EDecayType decayType = EDecayType::kAll, +#else + const EDecayType decayType = TPythia6Decayer::kAll, +#endif + const bool do_ctd = true, + const bool do_vtx = true, + const bool do_magnet = true, + const bool do_pipe = true, + const bool do_gem = true, + const bool do_jldirc = true, + const float magfield_rescale = 1.0) { + + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + + 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 ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + if (decayType != EDecayType::kAll) +#else + if (decayType != TPythia6Decayer::kAll) +#endif + { + 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, PHFieldConfig::Field3DCartesian); + } else { + g4Reco->set_field_map(field, PHFieldConfig::kField2D); + } + } 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); + + //---------------------------------------- + // VTX + if (do_vtx) radius = VTX(g4Reco, radius, absorberactive); + + //---------------------------------------- + // CTD + if (do_ctd) radius = CTD(g4Reco, radius, absorberactive); + + //---------------------------------------- + // DIRC + if (do_jldirc) radius = JLDIRC(g4Reco, radius, absorberactive); + + //---------------------------------------- + // MAGNET + + if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); + + //---------------------------------------- + // Gem (hadron and electron going side + + if (do_gem) double tmp = Gem(g4Reco, radius, 0, absorberactive); + radius = 200.; + //---------------------------------------- + // BLACKHOLE + + // swallow all particles coming out of the backend of sPHENIX + PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 0); +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); + blackhole->SuperDetector("BLACKHOLE"); + g4Reco->registerSubsystem(blackhole); + + //---------------------------------------- + // FORWARD BLACKHOLEs + // +Z + blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); + blackhole->SuperDetector("BLACKHOLE"); +// 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", 2); + blackhole->SuperDetector("BLACKHOLE"); +// 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 ); + return 0; +} diff --git a/macros/g4jleic/G4_CTD.C b/macros/g4jleic/G4_CTD.C new file mode 100644 index 000000000..dc660e123 --- /dev/null +++ b/macros/g4jleic/G4_CTD.C @@ -0,0 +1,56 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void CTDInit() {} + +double CTD(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double inner_radius = 21.; // cm + double outer_radius = 80.; // cm + double size_z = 340.; + double si_layer_gap = 5.; + double si_thickness = 0.001; // cm + if (radius > inner_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than CTD inner radius: " << inner_radius << endl; + gSystem->Exit(-1); + } + + PHG4CylinderSubsystem *cyl; + for (int ilayer = 0; ilayer < 15; ilayer++) + { + radius = inner_radius + ilayer*si_layer_gap; + if (radius+si_thickness > outer_radius) + { + continue; + } + cyl = new PHG4CylinderSubsystem("JLCTD", ilayer); + cyl->set_double_param("radius",radius); + cyl->set_string_param("material","G4_Si"); + cyl->set_double_param("thickness",si_thickness); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("place_z",shift_z); + cyl->SetActive(); + cyl->SuperDetector("JLCTD"); + cyl->set_double_param("length",size_z); + g4Reco->registerSubsystem( cyl ); + } + radius += si_thickness + no_overlapp; + return outer_radius; +} diff --git a/macros/g4jleic/G4_Gem.C b/macros/g4jleic/G4_Gem.C new file mode 100644 index 000000000..bbb618d61 --- /dev/null +++ b/macros/g4jleic/G4_Gem.C @@ -0,0 +1,51 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void GemInit() {} + +double Gem(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double hadron_inner_radius = 0.; // cm + double hadron_outer_radius = 115.; // cm + double size_z = 30.; + double place_z = 400./2.; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("GemH", 0); + cyl->set_double_param("radius",hadron_inner_radius); + cyl->set_string_param("material","G4_Al"); + cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",place_z+shift_z); + cyl->SetActive(); + cyl->SuperDetector("GEMH"); + g4Reco->registerSubsystem( cyl ); + + cyl = new PHG4CylinderSubsystem("GemE", 0); + cyl->set_double_param("radius",hadron_inner_radius); + cyl->set_string_param("material","G4_Al"); + cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",shift_z-place_z); + cyl->SetActive(); + cyl->SuperDetector("GEME"); + g4Reco->registerSubsystem( cyl ); + + + return radius; +} diff --git a/macros/g4jleic/G4_JLDIRC.C b/macros/g4jleic/G4_JLDIRC.C new file mode 100644 index 000000000..501627e13 --- /dev/null +++ b/macros/g4jleic/G4_JLDIRC.C @@ -0,0 +1,29 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4jleic.so) +#endif +void JLDIRCInit() {} + +double JLDIRC(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + gSystem->Load("libg4jleic.so"); + gSystem->Load("libg4testbench.so"); + if (radius > 81) + { + cout << "radius " << radius << " too large (>81) to fit DIRC" << endl; + exit(1); + } + G4JLeicDIRCSubsystem *jldirc = new G4JLeicDIRCSubsystem(); + jldirc->SetActive(); + jldirc->SuperDetector("JLDIRC"); + g4Reco->registerSubsystem(jldirc); + radius = 85.; + return radius; +} diff --git a/macros/g4jleic/G4_Magnet.C b/macros/g4jleic/G4_Magnet.C new file mode 100644 index 000000000..8d360f024 --- /dev/null +++ b/macros/g4jleic/G4_Magnet.C @@ -0,0 +1,55 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void MagnetInit() {} + +double Magnet(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) { + + double magnet_inner_radius = 130; + double magnet_outer_radius = 144; + double magnet_length = 400.; + if (radius > magnet_inner_radius) { + cout << "inconsistency: radius: " << radius + << " larger than Magnet inner radius: " << magnet_inner_radius << endl; + gSystem->Exit(-1); + } + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + radius = magnet_inner_radius; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("MAGNET", 0); + cyl->set_double_param("radius",magnet_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length",magnet_length); + cyl->set_double_param("thickness",magnet_outer_radius - magnet_inner_radius); + cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness + cyl->set_double_param("place_z",-40.); + cyl->SuperDetector("MAGNET"); + if (absorberactive) cyl->SetActive(); + g4Reco->registerSubsystem( cyl ); + + radius = magnet_outer_radius; // outside of magnet + + if (verbosity > 0) { + cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; + cout << " MAGNET Material Description:" << endl; + cout << " inner radius = " << magnet_inner_radius << " cm" << endl; + cout << " outer radius = " << magnet_outer_radius << " cm" << endl; + cout << " length = " << magnet_length << " cm" << endl; + cout << "===========================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} diff --git a/macros/g4jleic/G4_Pipe.C b/macros/g4jleic/G4_Pipe.C new file mode 100644 index 000000000..7f5ccb62f --- /dev/null +++ b/macros/g4jleic/G4_Pipe.C @@ -0,0 +1,117 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +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 = 120.; // 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"); + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + // mid-rapidity beryillium pipe + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0); + cyl->set_double_param("place_z",shift_z); + 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 ); + + cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); + cyl->set_double_param("place_z",shift_z); + 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+shift_z); + 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+shift_z); + 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+shift_z); + 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+shift_z); + 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/g4jleic/G4_Tracking_EIC.C b/macros/g4jleic/G4_Tracking_EIC.C new file mode 100644 index 000000000..6e7dee7d2 --- /dev/null +++ b/macros/g4jleic/G4_Tracking_EIC.C @@ -0,0 +1,127 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include +#include +#include +#include +class SubsysReco; +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4trackfastsim.so) +#endif + + +void Tracking_Reco(int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4trackfastsim.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + kalman->Verbosity(verbosity); + + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50E-4); + kalman->set_vertex_z_resolution(50E-4); + + kalman->set_sub_top_node_name("TRACKS"); + kalman->set_trackmap_out_name("KalFitTrackMap"); + + // VTX + kalman->add_phg4hits( + "G4HIT_JLVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // CTD + kalman->add_phg4hits( + "G4HIT_JLCTD", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-2, // const float radres, + 5e-2, // const float phires, + 5e-2, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_GEMH", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_GEME", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // Saved track states (projections) +// kalman->add_state_name("JLDIRC"); +// kalman->add_state_name("FHCAL"); + + se->registerSubsystem(kalman); + + return; +} + +void Tracking_Eval(std::string outputfile, int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4trackfastsim.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(false); + // eval->do_g4hit_eval(false); + // eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + // 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); + + // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); + // se->registerSubsystem( eval ); + + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval",outputfile,"KalFitTrackMap"); + fast_sim_eval->set_filename(outputfile.c_str()); + se->registerSubsystem(fast_sim_eval); +} diff --git a/macros/g4jleic/G4_VTX.C b/macros/g4jleic/G4_VTX.C new file mode 100644 index 000000000..d9b14659b --- /dev/null +++ b/macros/g4jleic/G4_VTX.C @@ -0,0 +1,29 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4jleic.so) +#endif +void VTXInit() {} + +double VTX(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + gSystem->Load("libg4jleic.so"); + gSystem->Load("libg4testbench.so"); + if (radius > 3.5) + { + cout << "radius too large to fit VTX" << endl; + exit(1); + } + G4JLeicVTXSubsystem *jlvtx = new G4JLeicVTXSubsystem(); + jlvtx->SetActive(); + jlvtx->SuperDetector("JLVTX"); + g4Reco->registerSubsystem(jlvtx); + radius = 15.5; + return radius; +} diff --git a/macros/g4jleic/GlobalVariables.C b/macros/g4jleic/GlobalVariables.C new file mode 100644 index 000000000..9b679af97 --- /dev/null +++ b/macros/g4jleic/GlobalVariables.C @@ -0,0 +1,6 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +static bool overlapcheck = false; +static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +static double jleic_shiftz = -40.; // JLeic is shifted by 40 cm wrp origin +#endif diff --git a/macros/g4jleic/vis.mac b/macros/g4jleic/vis.mac new file mode 100644 index 000000000..539d58b5d --- /dev/null +++ b/macros/g4jleic/vis.mac @@ -0,0 +1,82 @@ +# $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 +# 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 +# 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 2 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. From 2c6f4e079111d1c5ecb206b66b9f919855460d9a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 22:57:44 -0400 Subject: [PATCH 0322/1222] Add barrel hcal --- macros/g4jleic/G4_Barrel_Hcal.C | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 macros/g4jleic/G4_Barrel_Hcal.C diff --git a/macros/g4jleic/G4_Barrel_Hcal.C b/macros/g4jleic/G4_Barrel_Hcal.C new file mode 100644 index 000000000..634eb05c7 --- /dev/null +++ b/macros/g4jleic/G4_Barrel_Hcal.C @@ -0,0 +1,56 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void Barrel_HcalInit() {} + +double Barrel_Hcal(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: +// double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double inner_radius = 144.; // solenoid Rout + double outer_radius = 144.+100.; // out barrel hcal thickness + double size_z = 460.; // magnet (400) + endcap (60) + double gap = 2.; + double thickness = 2.; // cm + if (radius > inner_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than Barrel Hcal inner radius: " << inner_radius << endl; + gSystem->Exit(-1); + } + + PHG4CylinderSubsystem *cyl; + radius = inner_radius; + for (int ilayer = 0; ilayer < 25; ilayer++) + { + if (radius > outer_radius) + { + continue; + } + cyl = new PHG4CylinderSubsystem("BARRELHCAL", ilayer); + cyl->set_double_param("radius",radius); + cyl->set_string_param("material","G4_Fe"); + cyl->set_double_param("thickness",thickness); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length",size_z); +// cyl->set_double_param("place_z",shift_z); + cyl->SetActive(); + cyl->SuperDetector("BARRELHCAL"); + g4Reco->registerSubsystem( cyl ); + radius += gap + thickness; + } + return outer_radius; +} From 95b4f3250406b70545c1ab19daea1054dd1b80a4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 22:58:08 -0400 Subject: [PATCH 0323/1222] Add barrel hcal --- macros/g4jleic/Fun4All_G4_JLeic.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macros/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C index 43f6505a8..22e4b3d32 100644 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -92,6 +92,8 @@ int Fun4All_G4_JLeic( bool do_magnet = true; + bool do_barrel_hcal = true; + bool do_gem = true; bool do_tracking = true; @@ -107,7 +109,7 @@ int Fun4All_G4_JLeic( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -296,10 +298,10 @@ int Fun4All_G4_JLeic( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, magfield_rescale); #endif } From 4b5c2177335b58724319a4e6d1809b90f69e141c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 22:58:40 -0400 Subject: [PATCH 0324/1222] Add barrel hcal --- macros/g4jleic/G4Setup_JLeic.C | 17 ++++++++++++++++- macros/g4jleic/G4_Magnet.C | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C index 90aef1a1d..2101ed51a 100644 --- a/macros/g4jleic/G4Setup_JLeic.C +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -6,6 +6,7 @@ #include "G4_Magnet.C" #include "G4_Gem.C" #include "G4_JLDIRC.C" +#include "G4_Barrel_Hcal.C" #include #include @@ -34,7 +35,8 @@ void G4Init(const bool do_ctd = true, const bool do_magnet = true, const bool do_pipe = true, const bool do_gem = true, - const bool do_jldirc = true + const bool do_jldirc = true, + const bool do_barrel_hcal = true ) { @@ -66,6 +68,12 @@ void G4Init(const bool do_ctd = true, JLDIRCInit(); } + if (do_barrel_hcal) + { + gROOT->LoadMacro("G4_Barrel_Hcal.C"); + Barrel_HcalInit(); + } + } @@ -82,6 +90,7 @@ int G4Setup(const int absorberactive = 0, const bool do_pipe = true, const bool do_gem = true, const bool do_jldirc = true, + const bool do_barrel_hcal = true, const float magfield_rescale = 1.0) { //--------------- @@ -153,6 +162,12 @@ int G4Setup(const int absorberactive = 0, if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); + //---------------------------------------- + // Barrel Hcal + + if (do_barrel_hcal) radius = Barrel_Hcal(g4Reco, radius, 0, absorberactive); + + //---------------------------------------- // Gem (hadron and electron going side diff --git a/macros/g4jleic/G4_Magnet.C b/macros/g4jleic/G4_Magnet.C index 8d360f024..1d15684f9 100644 --- a/macros/g4jleic/G4_Magnet.C +++ b/macros/g4jleic/G4_Magnet.C @@ -15,7 +15,7 @@ double Magnet(PHG4Reco* g4Reco, int verbosity = 0) { double magnet_inner_radius = 130; - double magnet_outer_radius = 144; + double magnet_outer_radius = 143; double magnet_length = 400.; if (radius > magnet_inner_radius) { cout << "inconsistency: radius: " << radius From 81ac094036e53bfce5390d2cf5d6cbb4eb9b02bd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 23:16:56 -0400 Subject: [PATCH 0325/1222] Add hadron endcap --- macros/g4jleic/G4_EndCap_Hadron.C | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 macros/g4jleic/G4_EndCap_Hadron.C diff --git a/macros/g4jleic/G4_EndCap_Hadron.C b/macros/g4jleic/G4_EndCap_Hadron.C new file mode 100644 index 000000000..e65bf31d7 --- /dev/null +++ b/macros/g4jleic/G4_EndCap_Hadron.C @@ -0,0 +1,40 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void EndCap_HadronInit() {} + +double EndCap_Hadron(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double hadron_inner_radius = 20.; // cm + double hadron_outer_radius = 244.; // cm + double size_z = 250.; + double place_z = 400./2.-jleic_shiftz+size_z/2.; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("ECHADRON", 0); + cyl->set_double_param("radius",hadron_inner_radius); + cyl->set_string_param("material","G4_Fe"); + cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",place_z); + cyl->SetActive(); + cyl->SuperDetector("ECHADRON"); + g4Reco->registerSubsystem( cyl ); + + + return radius; +} From 0267039e4ba99f5380222af7f5828e52e0072ad4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jul 2019 23:17:11 -0400 Subject: [PATCH 0326/1222] Add hadron endcap --- macros/g4jleic/Fun4All_G4_JLeic.C | 8 +++++--- macros/g4jleic/G4Setup_JLeic.C | 13 ++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/macros/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C index 22e4b3d32..fd7235c15 100644 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -96,6 +96,8 @@ int Fun4All_G4_JLeic( bool do_gem = true; + bool do_endcap_hadron = true; + bool do_tracking = true; //--------------- // Load libraries @@ -109,7 +111,7 @@ int Fun4All_G4_JLeic( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -298,10 +300,10 @@ int Fun4All_G4_JLeic( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron, magfield_rescale); #endif } diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C index 2101ed51a..28d6f80d9 100644 --- a/macros/g4jleic/G4Setup_JLeic.C +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -7,6 +7,7 @@ #include "G4_Gem.C" #include "G4_JLDIRC.C" #include "G4_Barrel_Hcal.C" +#include "G4_EndCap_Hadron.C" #include #include @@ -36,7 +37,8 @@ void G4Init(const bool do_ctd = true, const bool do_pipe = true, const bool do_gem = true, const bool do_jldirc = true, - const bool do_barrel_hcal = true + const bool do_barrel_hcal = true, + const bool do_endcap_hadron = true ) { @@ -74,6 +76,12 @@ void G4Init(const bool do_ctd = true, Barrel_HcalInit(); } + if (do_endcap_hadron) + { + gROOT->LoadMacro("G4_EndCap_Hadron.C"); + EndCap_HadronInit(); + } + } @@ -91,6 +99,7 @@ int G4Setup(const int absorberactive = 0, const bool do_gem = true, const bool do_jldirc = true, const bool do_barrel_hcal = true, + const bool do_endcap_hadron = true, const float magfield_rescale = 1.0) { //--------------- @@ -172,6 +181,8 @@ int G4Setup(const int absorberactive = 0, // Gem (hadron and electron going side if (do_gem) double tmp = Gem(g4Reco, radius, 0, absorberactive); + + if (do_endcap_hadron) double tmp = EndCap_Hadron(g4Reco, radius, 0, absorberactive); radius = 200.; //---------------------------------------- // BLACKHOLE From 7a561588abeed4a84365ff81e9d2a5f36c3b09be Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 16 Jul 2019 12:42:23 -0400 Subject: [PATCH 0327/1222] enable vertexing as option --- macros/g4simulations/G4_Tracking_EIC.C | 34 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 785c1a986..e10a789df 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -3,9 +3,10 @@ #include #include #include +#include #include class SubsysReco; -R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) #endif @@ -45,7 +46,7 @@ double Tracking(PHG4Reco *g4Reco, double radius, return radius; } -void Tracking_Reco(int verbosity = 0) +void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) { //--------------- // Load libraries @@ -53,6 +54,7 @@ void Tracking_Reco(int verbosity = 0) gSystem->Load("libfun4all.so"); gSystem->Load("libg4trackfastsim.so"); + gSystem->Load("libtrack_reco.so"); //--------------- // Fun4All server @@ -63,9 +65,22 @@ void Tracking_Reco(int verbosity = 0) PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); kalman->Verbosity(verbosity); - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); + if (displaced_vertex) + { + //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(1); + kalman->set_vertex_z_resolution(1); + kalman->enable_vertexing(true); + } + else + { + // constraint to a primary vertex and use it as part of the fitting level arm + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50e-4); + kalman->set_vertex_z_resolution(50e-4); + } + kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); @@ -191,6 +206,15 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(kalman); +// if (displaced_vertex) +// { +// PHRaveVertexing * rave = new PHRaveVertexing (); +// rave->set_vertexing_method("kalman-smoothing:1"); +// rave -> set_over_write_svtxvertexmap(true); +// rave->Verbosity(10); +// se->registerSubsystem(rave); +// } + return; } From 035738fbfc790de5a24f8a2ee48900ddf5be67ca Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jul 2019 15:10:44 -0400 Subject: [PATCH 0328/1222] add gem foils --- macros/g4jleic/G4_Gem.C | 44 ++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/macros/g4jleic/G4_Gem.C b/macros/g4jleic/G4_Gem.C index bbb618d61..13a6fc86b 100644 --- a/macros/g4jleic/G4_Gem.C +++ b/macros/g4jleic/G4_Gem.C @@ -20,32 +20,44 @@ double Gem(PHG4Reco* g4Reco, // here is our silicon: double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double hadron_inner_radius = 0.; // cm - double hadron_outer_radius = 115.; // cm - double size_z = 30.; - double place_z = 400./2.; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("GemH", 0); - cyl->set_double_param("radius",hadron_inner_radius); + double gem_inner_radius = 0.; // cm + double gem_outer_radius = 115.; // cm + double size_z = 1.; + PHG4CylinderSubsystem *cyl; + for (int ilayer=0; ilayer<8; ilayer++) + { + double irad = gem_inner_radius + 1. + 0.5*ilayer; + double orad = gem_outer_radius - 25. + 2.*ilayer; + cyl = new PHG4CylinderSubsystem("GemHadron", ilayer); + cyl->set_double_param("radius",irad); cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_double_param("thickness",orad-irad); cyl->set_int_param("lengthviarapidity",0); cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",place_z+shift_z); + double place_z = 340./2. + shift_z + 5. + 3.*ilayer; + cyl->set_double_param("place_z",place_z); + cout << "place_z H layer " << ilayer << ": " << place_z << endl; cyl->SetActive(); - cyl->SuperDetector("GEMH"); + cyl->SuperDetector("GEMHADRON"); g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("GemE", 0); - cyl->set_double_param("radius",hadron_inner_radius); + } + for (int ilayer=0; ilayer<8; ilayer++) + { + double irad = gem_inner_radius + 1. + 0.5*ilayer; + double orad = gem_outer_radius - 25. + 2.*ilayer; + cyl = new PHG4CylinderSubsystem("GEMELECTRON", ilayer); + cyl->set_double_param("radius",gem_inner_radius); cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_double_param("thickness",orad - irad); cyl->set_int_param("lengthviarapidity",0); cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",shift_z-place_z); + double place_z = -340./2. + shift_z -5. - 3.*ilayer; + cyl->set_double_param("place_z",place_z); + cout << "place_z E layer " << ilayer << ": " << place_z << " orad: " << orad << endl; cyl->SetActive(); - cyl->SuperDetector("GEME"); + cyl->SuperDetector("GEMELECTRON"); g4Reco->registerSubsystem( cyl ); - + } return radius; } From cddad1badb52a1b65a1b30b50996f058ee3c1276 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jul 2019 15:30:25 -0400 Subject: [PATCH 0329/1222] use CO2 for Gems for the time being --- macros/g4jleic/G4_Gem.C | 46 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/macros/g4jleic/G4_Gem.C b/macros/g4jleic/G4_Gem.C index 13a6fc86b..0bb104e9f 100644 --- a/macros/g4jleic/G4_Gem.C +++ b/macros/g4jleic/G4_Gem.C @@ -28,35 +28,33 @@ double Gem(PHG4Reco* g4Reco, { double irad = gem_inner_radius + 1. + 0.5*ilayer; double orad = gem_outer_radius - 25. + 2.*ilayer; - cyl = new PHG4CylinderSubsystem("GemHadron", ilayer); - cyl->set_double_param("radius",irad); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",orad-irad); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - double place_z = 340./2. + shift_z + 5. + 3.*ilayer; - cyl->set_double_param("place_z",place_z); - cout << "place_z H layer " << ilayer << ": " << place_z << endl; - cyl->SetActive(); - cyl->SuperDetector("GEMHADRON"); - g4Reco->registerSubsystem( cyl ); + cyl = new PHG4CylinderSubsystem("GemHadron", ilayer); + cyl->set_double_param("radius",irad); + cyl->set_string_param("material","G4_CARBON_DIOXIDE"); + cyl->set_double_param("thickness",orad-irad); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + double place_z = 340./2. + shift_z + 5. + 3.*ilayer; + cyl->set_double_param("place_z",place_z); + cyl->SetActive(); + cyl->SuperDetector("GEMHADRON"); + g4Reco->registerSubsystem( cyl ); } for (int ilayer=0; ilayer<8; ilayer++) { double irad = gem_inner_radius + 1. + 0.5*ilayer; double orad = gem_outer_radius - 25. + 2.*ilayer; - cyl = new PHG4CylinderSubsystem("GEMELECTRON", ilayer); - cyl->set_double_param("radius",gem_inner_radius); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",orad - irad); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - double place_z = -340./2. + shift_z -5. - 3.*ilayer; - cyl->set_double_param("place_z",place_z); - cout << "place_z E layer " << ilayer << ": " << place_z << " orad: " << orad << endl; - cyl->SetActive(); - cyl->SuperDetector("GEMELECTRON"); - g4Reco->registerSubsystem( cyl ); + cyl = new PHG4CylinderSubsystem("GEMELECTRON", ilayer); + cyl->set_double_param("radius",gem_inner_radius); + cyl->set_string_param("material","G4_CARBON_DIOXIDE"); + cyl->set_double_param("thickness",orad - irad); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + double place_z = -340./2. + shift_z -5. - 3.*ilayer; + cyl->set_double_param("place_z",place_z); + cyl->SetActive(); + cyl->SuperDetector("GEMELECTRON"); + g4Reco->registerSubsystem( cyl ); } return radius; From d5c328781908a7a47a2b1eb940a6511f8be17244 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jul 2019 15:30:48 -0400 Subject: [PATCH 0330/1222] Add rich --- macros/g4jleic/G4_DRich.C | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 macros/g4jleic/G4_DRich.C diff --git a/macros/g4jleic/G4_DRich.C b/macros/g4jleic/G4_DRich.C new file mode 100644 index 000000000..78e37938a --- /dev/null +++ b/macros/g4jleic/G4_DRich.C @@ -0,0 +1,40 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void DRichInit() {} + +double DRich(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double drich_inner_radius = 20.; // cm + double drich_outer_radius = 150.; // cm + double size_z = 170.; + double place_z = 400./2.-jleic_shiftz+size_z/2.; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("DRICH", 0); + cyl->set_double_param("radius",drich_inner_radius); + cyl->set_string_param("material","G4_CARBON_DIOXIDE"); + cyl->set_double_param("thickness",drich_outer_radius - drich_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",place_z); + cyl->SetActive(); + cyl->SuperDetector("DRICH"); + g4Reco->registerSubsystem( cyl ); + + + return radius; +} From 87a40bc28a7bbff4ed9c42a4d439ec5b05696fd8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jul 2019 15:31:01 -0400 Subject: [PATCH 0331/1222] Add rich --- macros/g4jleic/Fun4All_G4_JLeic.C | 10 ++++++---- macros/g4jleic/G4Setup_JLeic.C | 25 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/macros/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C index fd7235c15..7e30f2a34 100644 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -96,7 +96,9 @@ int Fun4All_G4_JLeic( bool do_gem = true; - bool do_endcap_hadron = true; + bool do_drich = true; + + bool do_endcap_electron = true; bool do_tracking = true; //--------------- @@ -111,7 +113,7 @@ int Fun4All_G4_JLeic( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -300,10 +302,10 @@ int Fun4All_G4_JLeic( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_endcap_hadron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, magfield_rescale); #endif } diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C index 28d6f80d9..964ebc033 100644 --- a/macros/g4jleic/G4Setup_JLeic.C +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -7,7 +7,8 @@ #include "G4_Gem.C" #include "G4_JLDIRC.C" #include "G4_Barrel_Hcal.C" -#include "G4_EndCap_Hadron.C" +#include "G4_DRich.C" +#include "G4_EndCap_Electron.C" #include #include @@ -38,7 +39,8 @@ void G4Init(const bool do_ctd = true, const bool do_gem = true, const bool do_jldirc = true, const bool do_barrel_hcal = true, - const bool do_endcap_hadron = true + const bool do_drich = true, + const bool do_endcap_electron = true ) { @@ -76,10 +78,16 @@ void G4Init(const bool do_ctd = true, Barrel_HcalInit(); } - if (do_endcap_hadron) + if (do_drich) { - gROOT->LoadMacro("G4_EndCap_Hadron.C"); - EndCap_HadronInit(); + gROOT->LoadMacro("G4_DRich.C"); + DRichInit(); + } + + if (do_endcap_electron) + { + gROOT->LoadMacro("G4_EndCap_Electron.C"); + EndCap_ElectronInit(); } } @@ -99,7 +107,8 @@ int G4Setup(const int absorberactive = 0, const bool do_gem = true, const bool do_jldirc = true, const bool do_barrel_hcal = true, - const bool do_endcap_hadron = true, + const bool do_drich = true, + const bool do_endcap_electron = true, const float magfield_rescale = 1.0) { //--------------- @@ -182,7 +191,9 @@ int G4Setup(const int absorberactive = 0, if (do_gem) double tmp = Gem(g4Reco, radius, 0, absorberactive); - if (do_endcap_hadron) double tmp = EndCap_Hadron(g4Reco, radius, 0, absorberactive); + if (do_drich) double tmp = DRich(g4Reco, radius, 0, absorberactive); + + if (do_endcap_electron) double tmp = EndCap_Electron(g4Reco, radius, 0, absorberactive); radius = 200.; //---------------------------------------- // BLACKHOLE From c072a74f38471d1a349c228fc2a556cc3d6dbe79 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 16 Jul 2019 17:43:29 -0400 Subject: [PATCH 0332/1222] vertexing tune --- macros/g4simulations/Fun4All_G4_EICDetector.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 55cc740bc..32dfa4946 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -41,7 +41,7 @@ R__LOAD_LIBRARY(libPHPythia8.so) using namespace std; int Fun4All_G4_EICDetector( - const int nEvents = 1, + const int nEvents = 3, 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" ) @@ -100,6 +100,7 @@ int Fun4All_G4_EICDetector( bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ + bool do_vertex_finding = true; bool do_pstof = false; @@ -200,7 +201,7 @@ int Fun4All_G4_EICDetector( //--------------- Fun4AllServer *se = Fun4AllServer::instance(); -// se->Verbosity(01); // uncomment for batch production running with minimal output messages + se->Verbosity(01); // 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 @@ -294,8 +295,8 @@ int Fun4All_G4_EICDetector( { // 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 + gen->add_particles("pi-",3); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi+",3); // 100 pion option if (readhepmc) { gen->set_reuse_existing_vertex(true); @@ -311,7 +312,7 @@ int Fun4All_G4_EICDetector( } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-3, 3); + gen->set_eta_range(-1, 1); 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); @@ -471,7 +472,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- - if (do_tracking_track) Tracking_Reco(); + if (do_tracking_track) Tracking_Reco(0, do_vertex_finding); //----------------- // Global Vertexing From e89edaf5f5f7343f9cfc96bbce6ec4b2fe3e731d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jul 2019 17:58:53 -0400 Subject: [PATCH 0333/1222] endcap volume electron side --- macros/g4jleic/G4_EndCap_Electron.C | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 macros/g4jleic/G4_EndCap_Electron.C diff --git a/macros/g4jleic/G4_EndCap_Electron.C b/macros/g4jleic/G4_EndCap_Electron.C new file mode 100644 index 000000000..f815653a7 --- /dev/null +++ b/macros/g4jleic/G4_EndCap_Electron.C @@ -0,0 +1,40 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void EndCap_ElectronInit() {} + +double EndCap_Electron(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4testbench.so"); + + // here is our silicon: + double shift_z = jleic_shiftz; // shift z from GlobalVariables.C + double electron_inner_radius = 20.; // cm + double electron_outer_radius = 244.; // cm + double size_z = 60.; + double place_z = -400./2.+jleic_shiftz-size_z/2.; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("ECELECTRON", 0); + cyl->set_double_param("radius",electron_inner_radius); + cyl->set_string_param("material","G4_Fe"); + cyl->set_double_param("thickness",electron_outer_radius - electron_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",place_z); + cyl->SetActive(); + cyl->SuperDetector("ECELECTRON"); + g4Reco->registerSubsystem( cyl ); + + + return radius; +} From b346d43c603cfb6370866a6c18656c2795645549 Mon Sep 17 00:00:00 2001 From: shura Date: Mon, 22 Jul 2019 10:52:06 -0400 Subject: [PATCH 0334/1222] Include loading EM profile data file to enable shower profile evaluation --- macros/g4simulations/G4_FEMC.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index ee09080bf..59e9aa2a8 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -213,7 +213,10 @@ void FEMC_Clusters(int verbosity = 0) { RawClusterBuilderTemplateFEMC *ClusterBuilder = new RawClusterBuilderTemplateFEMC("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(ClusterBuilder); } else if ( Femc_clusterizer == kFemcGraphClusterizer ) From 56b71421669dd2ad2273599f11aefdc95ef827b7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 29 Jul 2019 17:39:40 -0400 Subject: [PATCH 0335/1222] load lib for sartre --- macros/g4simulations/Fun4All_G4_EICDetector.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 55cc740bc..cd21d2912 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -36,6 +36,7 @@ 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) #endif using namespace std; From 58f572e74217d7983f513b009ab31e9821b46568 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 29 Jul 2019 17:56:27 -0400 Subject: [PATCH 0336/1222] Add missing phpythia6.cfg copied from analysys/EICTRigger, to make pythia6 mode run --- macros/g4simulations/phpythia6.cfg | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 macros/g4simulations/phpythia6.cfg diff --git a/macros/g4simulations/phpythia6.cfg b/macros/g4simulations/phpythia6.cfg new file mode 100644 index 000000000..5dc006472 --- /dev/null +++ b/macros/g4simulations/phpythia6.cfg @@ -0,0 +1,17 @@ +roots 200 +proj p +targ p +frame cms +msel 0 // turn on all prod. mechanisms manually +msub 11 1 // these are the semi-hard QCD 2->2 processes +msub 12 1 +msub 13 1 +msub 28 1 +msub 53 1 +msub 68 1 +mstp 91 1 // gaussian intrinsic kt +parp 91 1.5 // intrinsic kt value +mstp 33 1 // use k factor +parp 31 2.5 // k factor +ckin 3 2.0 // min parton pt of 2.0 +#mstj 1 2 // independent fragmentation From 2952d1d815be3c38a14fe00c46819010ea8da46e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Jul 2019 09:59:42 -0400 Subject: [PATCH 0337/1222] add phpythia8.cfg so pythia8 runs when selected --- macros/g4simulations/phpythia8.cfg | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 macros/g4simulations/phpythia8.cfg diff --git a/macros/g4simulations/phpythia8.cfg b/macros/g4simulations/phpythia8.cfg new file mode 100644 index 000000000..690260244 --- /dev/null +++ b/macros/g4simulations/phpythia8.cfg @@ -0,0 +1,28 @@ +! Beam settings +Beams:idA = 2212 ! first beam, p = 2212, pbar = -2212 +Beams:idB = 2212 ! second beam, p = 2212, pbar = -2212 +Beams:eCM = 200. ! CM energy of collision + +! Settings related to output in init(), next() and stat() +Init:showChangedSettings = on +#Next:numberCount = 0 ! print message every n events +Next:numberShowInfo = 1 ! print event information n times +#Next:numberShowProcess = 1 ! print process record n times +#Next:numberShowEvent = 1 ! print event record n times + +! PDF +# PDF:useLHAPDF = on +# PDF:LHAPDFset = CT10.LHgrid +PDF:pSet = 7 ! CTEQ6L, NLO alpha_s(M_Z) = 0.1180. + +! Process +#HardQCD:hardccbar = on +# HardQCD:hardbbbar = on +HardQCD:all = on +# Charmonium:all = on +# Bottomonium:all = on +# SoftQCD:nonDiffractive = on + +! Cuts +PhaseSpace:pTHatMin = 10.0 + From 05a0c83df5aea76a20ce0128c796f24c2d2409bc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 6 Aug 2019 10:19:49 -0400 Subject: [PATCH 0338/1222] Add example sartre config file so the macro runs --- macros/g4simulations/sartre.cfg | 113 ++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 macros/g4simulations/sartre.cfg diff --git a/macros/g4simulations/sartre.cfg b/macros/g4simulations/sartre.cfg new file mode 100644 index 000000000..065b27ab2 --- /dev/null +++ b/macros/g4simulations/sartre.cfg @@ -0,0 +1,113 @@ +//============================================================================== +// sartreRuncard.txt +// +// Copyright (C) 2010-2013 Tobias Toll and Thomas Ullrich +// +// This file is part of Sartre version: 1.1 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation. +// This program is distributed in the hope that it will be useful, +// but without any warranty; without even the implied warranty of +// merchantability or fitness for a particular purpose. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// Author: Thomas Ullrich +// Last update: +// $Date: 2015-05-29 13:37:30 -0400 (Fri, 29 May 2015) $ +// $Author: tobilibob@gmail.com $ +//============================================================================== +// +// Example Runcard for Sartre Event Generator. +// +// Comments start with a # or // +// +// Name and value are separated by a "=": name = value +// (alternatively ":" can be used as well) +//============================================================================== +# +# Define beams +# +eBeamEnergy = 100 +hBeamEnergy = 100 +A = 197 + +# +# UPC settings, to run in UPC mode set UPC=true and UPCA into the photon emitting species: +# +UPC=true +UPCA=1 + +# +# Number of events and printout frequency +# +numberOfEvents = 100000 +timesToShow = 20 + +# +# Set verbosity +# +verbose = false +verboseLevel = 0 + +# +# Rootfile +# +rootfile = example.root + +# +# Model parameters +# +# vectorMesonID: 22, 113, 333, 443 +# dipoleModel: bSat or bNonSat +# +vectorMesonId = 443 +#dipoleModel = bSat +dipoleModel = bNonSat + +# +# User variable used for vector meson decays +# PDG: pi+ = 211, K+ = 321, e- = 11, mu- = 13 +# +userInt = 11 + +# +# Kinematic range min > max means no limits (given by table range) +# +Q2min = 1000000 +Q2max = 0 +Wmin = 1000000 +Wmax = 0 + +# +# Corrections +# +correctForRealAmplitude = true +correctSkewedness = true +# maxLambdaUsedInCorrections = 0.65 + +# +# Misc +# +enableNuclearBreakup = false +maxNuclearExcitationEnergy = 0.5 + +# +# Random generator seed (if not given current time is used) +# +#seed = 2011987 + +# +# User parameters +# +# userDouble = 0. +# userString = "Hello World!" +# userInt = 0 + +# +# Expert flags +# +# applyPhotonFlux = true From 3b8c9fc0aea85e3a1de626a3dddaf358950de7c4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 7 Aug 2019 10:57:34 -0400 Subject: [PATCH 0339/1222] relocation prototype macros to prototype repository: https://github.com/sPHENIX-Collaboration/prototype --- macros/prototype2/DisplayOn.C | 35 -- macros/prototype2/Fun4All_G4_Prototype2.C | 578 ------------------- macros/prototype2/Fun4All_TestBeam.C | 298 ---------- macros/prototype2/run_dump.C | 28 - macros/prototype2/vis_prototype2.mac | 80 --- macros/prototype3/DisplayOn.C | 35 -- macros/prototype3/Fun4All_G4_Prototype3.C | 633 --------------------- macros/prototype3/Fun4All_TestBeam.C | 346 ------------ macros/prototype3/run_dump.C | 28 - macros/prototype3/vis_prototype3.mac | 82 --- macros/prototype4/DisplayOn.C | 41 -- macros/prototype4/Fun4All_G4_Prototype4.C | 657 ---------------------- macros/prototype4/Fun4All_TestBeam.C | 464 --------------- macros/prototype4/run_dump.C | 28 - macros/prototype4/vis_prototype3.mac | 82 --- 15 files changed, 3415 deletions(-) delete mode 100644 macros/prototype2/DisplayOn.C delete mode 100644 macros/prototype2/Fun4All_G4_Prototype2.C delete mode 100644 macros/prototype2/Fun4All_TestBeam.C delete mode 100644 macros/prototype2/run_dump.C delete mode 100644 macros/prototype2/vis_prototype2.mac delete mode 100644 macros/prototype3/DisplayOn.C delete mode 100644 macros/prototype3/Fun4All_G4_Prototype3.C delete mode 100644 macros/prototype3/Fun4All_TestBeam.C delete mode 100644 macros/prototype3/run_dump.C delete mode 100644 macros/prototype3/vis_prototype3.mac delete mode 100644 macros/prototype4/DisplayOn.C delete mode 100644 macros/prototype4/Fun4All_G4_Prototype4.C delete mode 100644 macros/prototype4/Fun4All_TestBeam.C delete mode 100644 macros/prototype4/run_dump.C delete mode 100644 macros/prototype4/vis_prototype3.mac diff --git a/macros/prototype2/DisplayOn.C b/macros/prototype2/DisplayOn.C deleted file mode 100644 index f1595e7e9..000000000 --- a/macros/prototype2/DisplayOn.C +++ /dev/null @@ -1,35 +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()); - g4->ApplyDisplayAction(); - 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 ef3097cc4..000000000 --- a/macros/prototype2/Fun4All_G4_Prototype2.C +++ /dev/null @@ -1,578 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#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(libcalo_reco.so) -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4calo.so) -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4histos.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libqa_modules.so) - -#endif - -int Fun4All_G4_Prototype2(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval"); - gSystem->Load("libqa_modules"); - gSystem->Load("libg4calo"); - gSystem->Load("libcalo_reco"); - - 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 = 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); - } - -// these parameters are used in multiple modules - const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 - const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - - if (cemc_digi) - { - const double sampling_fraction = 0.0233369; // +/- 8.22211e-05 from 15 Degree indenting 8 GeV electron showers - - // 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; - gSystem->Exit(0); - return 0; - -} - diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C deleted file mode 100644 index 70ad00757..000000000 --- a/macros/prototype2/Fun4All_TestBeam.C +++ /dev/null @@ -1,298 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -R__LOAD_LIBRARY(libPrototype2.so) -#endif - -void -Fun4All_TestBeam(int nEvents = 100, - const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf", - const char *output_file = "beam_00002609.root") -{ - 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 = 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; - - const int N_hodo = 8; - - GenericUnpackPRDF *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 - Fun4AllOutputManager *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/run_dump.C b/macros/prototype2/run_dump.C deleted file mode 100644 index b52a7dbe9..000000000 --- a/macros/prototype2/run_dump.C +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -R__LOAD_LIBRARY(libphnodedump.so) -#endif - -void run_dump(const char *infile, const int evts=100) -{ - gSystem->Load("libPrototype2_io.so"); - gSystem->Load("libphnodedump.so"); - - Fun4AllServer* se = Fun4AllServer::instance(); - - Dumper *dmp = new Dumper(); - gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); - dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); - - se->registerSubsystem(dmp); - - Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); - se->registerInputManager(in); - se->fileopen("DSTin",infile); - se->run(evts); - se->End(); - delete se; -} 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/DisplayOn.C b/macros/prototype3/DisplayOn.C deleted file mode 100644 index 4fa1ac6e5..000000000 --- a/macros/prototype3/DisplayOn.C +++ /dev/null @@ -1,35 +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_prototype3.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; -} -// 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/prototype3/Fun4All_G4_Prototype3.C b/macros/prototype3/Fun4All_G4_Prototype3.C deleted file mode 100644 index 9701438ce..000000000 --- a/macros/prototype3/Fun4All_G4_Prototype3.C +++ /dev/null @@ -1,633 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#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(libcalo_reco.so) -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4calo.so) -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4histos.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libqa_modules.so) - -#endif - -void 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"); - gSystem->Load("libg4calo"); - gSystem->Load("libcalo_reco"); - - 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); - angle = theta*TMath::Pi()/180.; - 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); - 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) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - 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 - 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; - } - se->run(nEvents); - - se->End(); - - QAHistManagerDef::saveQARootFile("G4Prototype2_qa.root"); - - - // std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); -} diff --git a/macros/prototype3/Fun4All_TestBeam.C b/macros/prototype3/Fun4All_TestBeam.C deleted file mode 100644 index eb9dc0d07..000000000 --- a/macros/prototype3/Fun4All_TestBeam.C +++ /dev/null @@ -1,346 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -R__LOAD_LIBRARY(libPrototype3.so) -#endif - -void -Fun4All_TestBeam(int nEvents = 1000, - const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00003310-0000.prdf", - const char *output_file = "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 = 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; - - const int N_hodo = 8; - - GenericUnpackPRDF *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/run_dump.C b/macros/prototype3/run_dump.C deleted file mode 100644 index fd0ec7b11..000000000 --- a/macros/prototype3/run_dump.C +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -R__LOAD_LIBRARY(libphnodedump.so) -#endif - -void run_dump(const char *infile, const int evts=100) -{ - gSystem->Load("libPrototype3_io.so"); - gSystem->Load("libphnodedump.so"); - - Fun4AllServer* se = Fun4AllServer::instance(); - - Dumper *dmp = new Dumper(); - gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); - dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); - - se->registerSubsystem(dmp); - - Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); - se->registerInputManager(in); - se->fileopen("DSTin",infile); - se->run(evts); - se->End(); - delete se; -} 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/prototype4/DisplayOn.C b/macros/prototype4/DisplayOn.C deleted file mode 100644 index c8be1ccc9..000000000 --- a/macros/prototype4/DisplayOn.C +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#endif - -// 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_prototype3.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; -} -// 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/prototype4/Fun4All_G4_Prototype4.C b/macros/prototype4/Fun4All_G4_Prototype4.C deleted file mode 100644 index 98b35da7d..000000000 --- a/macros/prototype4/Fun4All_G4_Prototype4.C +++ /dev/null @@ -1,657 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#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(libcalo_reco.so) -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4calo.so) -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4histos.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libqa_modules.so) -#endif - -int Fun4All_G4_Prototype4(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules"); - gSystem->Load("libg4calo"); - gSystem->Load("libcalo_reco"); - - 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_al = false; - 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); - angle = theta*TMath::Pi()/180.; - 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); - 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) - { - PHG4Prototype3InnerHcalSubsystem *innerhcal = new PHG4Prototype3InnerHcalSubsystem("HCalIn"); - innerhcal->set_int_param("hi_eta",1); - innerhcal->set_double_param("place_x",add_place_x); - innerhcal->set_double_param("place_z",144); - if (ihcal_al) - { - innerhcal->set_int_param("scintillators",0); - innerhcal->SetActive(0); - innerhcal->set_string_param("material","Al4046"); - } - else - { - 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[6]; - // surrounding outer hcal - // top - bh[0] = new PHG4BlockSubsystem("bh1",1); - bh[0]->set_double_param("size_x",310.); - bh[0]->set_double_param("size_y",1.0); - bh[0]->set_double_param("size_z",350.); - bh[0]->set_double_param("place_x",145.); - bh[0]->set_double_param("place_y",63.); - bh[0]->set_double_param("place_z",165.); - // bottom - bh[1] = new PHG4BlockSubsystem("bh2",2); - bh[1]->set_double_param("size_x",310.); - bh[1]->set_double_param("size_y",1.0); - bh[1]->set_double_param("size_z",350.); - bh[1]->set_double_param("place_x",145.); - bh[1]->set_double_param("place_y",-63.); - bh[1]->set_double_param("place_z",165.); - // right side - bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",310.); - bh[2]->set_double_param("size_y",125.); - bh[2]->set_double_param("size_z",1.0); - bh[2]->set_double_param("place_x",145.); - bh[2]->set_double_param("place_z",340.5); - // left side - bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",310.); - bh[3]->set_double_param("size_y",125.); - bh[3]->set_double_param("size_z",1.0); - bh[3]->set_double_param("place_x",145.); - bh[3]->set_double_param("place_z",-10.5); - // back - bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",1.0); - bh[4]->set_double_param("size_y",125.); - bh[4]->set_double_param("size_z",350.); - bh[4]->set_double_param("place_x",300.); - bh[4]->set_double_param("place_z",165.); - // front - bh[5] = new PHG4BlockSubsystem("bh6",6); - bh[5]->set_double_param("size_x",1.0); - bh[5]->set_double_param("size_y",125.); - bh[5]->set_double_param("size_z",350.); - bh[5]->set_double_param("place_x",-10.0); - bh[5]->set_double_param("place_z",165.); - for (int i=0; i<6; 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) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - 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 - 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","G4Prototype4New.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); - return 0; -} - -// for using QuickTest to check if macro loads -void RunLoadTest() {} diff --git a/macros/prototype4/Fun4All_TestBeam.C b/macros/prototype4/Fun4All_TestBeam.C deleted file mode 100644 index 9a36bc608..000000000 --- a/macros/prototype4/Fun4All_TestBeam.C +++ /dev/null @@ -1,464 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -R__LOAD_LIBRARY(libPrototype4.so) -#endif - -void Fun4All_TestBeam(int nEvents = 100, - const char *input_file = "/sphenix/data/data02/sphenix/t1044/fnal/beam/beam_00000406-0000.prdf", - const char *output_file = "beam_00000406.root") -{ - gSystem->Load("libfun4all"); - gSystem->Load("libPrototype4.so"); - - const bool do_cemc = true; - const bool do_hcal = true; - // const bool do_cemc = false; - // const bool do_hcal = false; - - 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 ------------------- - - CaloCalibration *calib = NULL; - - if (do_cemc) - { - SubsysReco *unpack = new CaloUnpackPRDF(); - // unpack->Verbosity(1); - se->registerSubsystem(unpack); - - calib = new CaloCalibration("CEMC"); - // calib->Verbosity(4); - // calib->GetCalibrationParameters().set_double_param("calib_const_scale", 8. / 3000); - // calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - calib->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database - se->registerSubsystem(calib); - } - - if (do_hcal) - { - // leading order energy scale from Xu Sun - const double cin_cali = 0.00270145; - const double cout_cali = 0.0065718; - - 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().set_double_param("calib_const_scale", cin_cali); -// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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("/Prototype4/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().set_double_param("calib_const_scale", cout_cali); -// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype4/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().set_double_param("calib_const_scale", cout_cali / 32); -// calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 0); - calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype4/Calibration/")); // calibration database - se->registerSubsystem(calib); - } - // - // // ------------------- Hodoscpes ------------------- - // - const int first_packet_id = PROTOTYPE4_FEM::PACKET_ID; - // const int second_packet_id = 21102; - // - GenericUnpackPRDF *gunpack = NULL; - - const int N_hodo = 8; - // mapping based on SPHENIX-doc-121-v6 - // 1 2 3 4 5 6 7 8 - // 101 100 103 102 97 96 99 98 - // - //9 109 - //10 108 - //11 111 - //12 110 - //13 105 - //14 104 - //15 107 - //16 106 - - gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); - gunpack->add_channel(first_packet_id, 101, 0); - gunpack->add_channel(first_packet_id, 100, 1); - gunpack->add_channel(first_packet_id, 103, 2); - gunpack->add_channel(first_packet_id, 102, 3); - gunpack->add_channel(first_packet_id, 97, 4); - gunpack->add_channel(first_packet_id, 96, 5); - gunpack->add_channel(first_packet_id, 99, 6); - gunpack->add_channel(first_packet_id, 98, 7); - se->registerSubsystem(gunpack); - // - gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); - gunpack->add_channel(first_packet_id, 109, 0); - gunpack->add_channel(first_packet_id, 108, 1); - gunpack->add_channel(first_packet_id, 111, 2); - gunpack->add_channel(first_packet_id, 110, 3); - gunpack->add_channel(first_packet_id, 105, 4); - gunpack->add_channel(first_packet_id, 104, 5); - gunpack->add_channel(first_packet_id, 107, 6); - gunpack->add_channel(first_packet_id, 106, 7); - se->registerSubsystem(gunpack); - // - - // Nicole Lewis [7:12 PM] - // added and commented on this Plain Text snippet: Run 545 MPV and Other Values - // Collumns: Height, MPV, Sigma, chi2, NDF - // Run 545 - // HODO_HORIZONTAL[0] 18.0525 319.879 83.4359 139.487 199 - // HODO_HORIZONTAL[1] 26.6811 262.209 65.1704 159.059 171 - // HODO_HORIZONTAL[2] 27.5885 296.343 61.0538 171.291 205 - // HODO_HORIZONTAL[3] 24.4132 299.135 72.4796 205.008 214 - // HODO_HORIZONTAL[4] 28.6331 290.498 66.9209 177.386 205 - // HODO_HORIZONTAL[5] 29.3528 263.781 61.5052 202.933 195 - // HODO_HORIZONTAL[6] 21.5175 336.446 78.8985 170.031 206 - // HODO_HORIZONTAL[7] 17.7948 336.247 91.8477 146.352 201 - // HODO_VERTICAL[0] 15.3648 238.473 94.6679 111.272 166 - // HODO_VERTICAL[1] 23.2368 225.202 54.8611 117.209 145 - // HODO_VERTICAL[2] 25.3442 209.827 66.168 134.383 171 - // HODO_VERTICAL[3] 36.8254 217.544 44.1445 122.811 167 - // HODO_VERTICAL[4] 38.0982 210.6 44.9922 160.269 165 - // HODO_VERTICAL[5] 38.1045 252.022 49.4073 165.239 200 - // HODO_VERTICAL[6] 42.1052 223.528 44.5291 113.343 171 - // HODO_VERTICAL[7] 31.1721 244.299 55.974 160.476 186 - - calib = new CaloCalibration("HODO_VERTICAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 0), 1 / 238.473); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 1), 1 / 225.202); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 2), 1 / 209.827); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 3), 1 / 217.544); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 4), 1 / 210.6); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 5), 1 / 252.022); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 6), 1 / 223.528); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 7), 1 / 244.299); // normalize to 1.0 - se->registerSubsystem(calib); - - calib = new CaloCalibration("HODO_HORIZONTAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 0), 1 / 319.879); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 1), 1 / 262.209); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 2), 1 / 296.343); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 3), 1 / 299.135); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 4), 1 / 290.498); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 5), 1 / 263.781); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 6), 1 / 336.446); // normalize to 1.0 - calib->GetCalibrationParameters().set_double_param(Form("calib_const_column0_row%d", 7), 1 / 336.247); // normalize to 1.0 - se->registerSubsystem(calib); - // - // // ------------------- Other detectors ------------------- - // - // mapping based on SPHENIX-doc-121-v6 - gunpack = new GenericUnpackPRDF("C1"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 165, 0); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - // - calib = new CaloCalibration("C1"); - calib->SetFitType(CaloCalibration::kPeakSample); - se->registerSubsystem(calib); - // - // mapping based on SPHENIX-doc-121-v6 - gunpack = new GenericUnpackPRDF("C2"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 166, 0); // C2 inner fast - gunpack->add_channel(first_packet_id, 160, 1); // C2 outer fast - gunpack->add_channel(first_packet_id, 167, 10); // C2 inner slow - se->registerSubsystem(gunpack); - // - calib = new CaloCalibration("C2"); - calib->SetFitType(CaloCalibration::kPeakSample); - 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); - // - // mapping based on SPHENIX-doc-121-v6 - gunpack = new GenericUnpackPRDF("PbGL"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 171, 0); // PbGl (612AM-3) - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("PbGL"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - // - // mapping based on SPHENIX-doc-121-v6 - gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 172, 0); // 172 Counters Bottom veto - gunpack->add_channel(first_packet_id, 173, 1); // 173 Counters Top veto - gunpack->add_channel(first_packet_id, 174, 2); // 174 Counters Right veto - gunpack->add_channel(first_packet_id, 175, 3); // 175 Counters Left Veto - se->registerSubsystem(gunpack); - - // Calibrate the MIP peak to an relative energy of +1.0 - - // Nicole Lewis [7:12 PM] - // added and commented on this Plain Text snippet: Run 545 MPV and Other Values - // Collumns: Height, MPV, Sigma, chi2, NDF - // Run 545 - // TRIGGER_VETO[0] 501.958 295.811 51.6134 223.972 194 - // TRIGGER_VETO[1] 262.321 305.247 52.5851 138.403 158 - // TRIGGER_VETO[2] 238.726 451.48 99.6016 274.339 245 - // TRIGGER_VETO[3] 135.541 624.076 132.313 284.532 240 - - calib = new CaloCalibration("TRIGGER_VETO"); - calib->SetFitType(CaloCalibration::kPeakSample); - 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. / 295.811); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", 1. / 305.247); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", 1. / 451.48); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", 1. / 624.076); - se->registerSubsystem(calib); - // - const int N_TileMapper = 16; - // - gunpack = new GenericUnpackPRDF("TILE_MAPPER"); - for (int i = 0; i < N_TileMapper; ++i) - gunpack->add_channel(first_packet_id, 176 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - // - calib = new CaloCalibration("TILE_MAPPER"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - // - // mapping based on SPHENIX-doc-121-v6 - gunpack = new GenericUnpackPRDF("SC3"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 169, 0); // MT6SC3 (612AM-2) - se->registerSubsystem(gunpack); - // - calib = new CaloCalibration("SC3"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("FINGER_COUNTER"); - // unpack->Verbosity(1); - gunpack->add_channel(first_packet_id, 168, 0); // 168 Counters Finger counter - se->registerSubsystem(gunpack); - // - calib = new CaloCalibration("FINGER_COUNTER"); - 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 ------------------- - // - // EventInfoSummary * es = new EventInfoSummary(); - // es->Verbosity(EventInfoSummary::VERBOSITY_MORE); - // se->registerSubsystem(es); - - // ------------------- Output ------------------- - //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); - se->registerOutputManager(out_Manager); - - //alternatively, fast check on DST using DST Reader: - Prototype4DSTReader *reader = new Prototype4DSTReader( - 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"); - // - if (do_hcal) - { - 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"); - } - - if (do_cemc) - { - 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_FINGER_COUNTER"); - reader->AddTower("CALIB_FINGER_COUNTER"); - - // - // 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/prototype4/run_dump.C b/macros/prototype4/run_dump.C deleted file mode 100644 index 8595df36b..000000000 --- a/macros/prototype4/run_dump.C +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -R__LOAD_LIBRARY(libphnodedump.so) -#endif - -void run_dump(const char *infile, const int evts=100) -{ - gSystem->Load("libPrototype4_io.so"); - gSystem->Load("libphnodedump.so"); - - Fun4AllServer* se = Fun4AllServer::instance(); - - Dumper *dmp = new Dumper(); - gSystem->Exec("mkdir /phenix/scratch/pinkenbu/g4dump"); - dmp->SetOutDir("/phenix/scratch/pinkenbu/g4dump"); - - se->registerSubsystem(dmp); - - Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); - se->registerInputManager(in); - se->fileopen("DSTin",infile); - se->run(evts); - se->End(); - delete se; -} diff --git a/macros/prototype4/vis_prototype3.mac b/macros/prototype4/vis_prototype3.mac deleted file mode 100644 index 12adcc651..000000000 --- a/macros/prototype4/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. From 1d23167cd338ea1b4dfa7a57eecd270ed19221b4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 9 Aug 2019 15:44:22 -0400 Subject: [PATCH 0340/1222] Reverse field sign to get around a bug in RAVE --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 32dfa4946..2f55706d5 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -194,7 +194,7 @@ int Fun4All_G4_EICDetector( int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = 1.4/1.5; // scale the map to a 1.4 T field + const float magfield_rescale = -1.4/1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE //--------------- // Fun4All server From e72d9221348028a6b2d689851f4b3f362ad57d98 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 9 Aug 2019 15:47:57 -0400 Subject: [PATCH 0341/1222] undo changes in default macros --- macros/g4simulations/Fun4All_G4_EICDetector.C | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 87afec0e6..d9fbb3cb6 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -42,7 +42,7 @@ R__LOAD_LIBRARY(libPHSartre.so) using namespace std; int Fun4All_G4_EICDetector( - const int nEvents = 3, + 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" ) @@ -202,7 +202,7 @@ int Fun4All_G4_EICDetector( //--------------- Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(01); // uncomment for batch production running with minimal output messages + // se->Verbosity(01); // 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 @@ -296,8 +296,7 @@ int Fun4All_G4_EICDetector( { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-",3); // mu+,e+,proton,pi+,Upsilon - gen->add_particles("pi+",3); // 100 pion option + gen->add_particles("pi-",1); // mu+,e+,proton,pi+,Upsilon if (readhepmc) { gen->set_reuse_existing_vertex(true); @@ -313,7 +312,7 @@ int Fun4All_G4_EICDetector( } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-1, 1); + gen->set_eta_range(-3, 3); 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); From e32907a79fd244cc52733448cc17fd74173e9357 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 9 Aug 2019 15:57:35 -0400 Subject: [PATCH 0342/1222] disable vertex finding by default --- macros/g4simulations/Fun4All_G4_EICDetector.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index d9fbb3cb6..30cf1ef95 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -101,7 +101,7 @@ int Fun4All_G4_EICDetector( bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ - bool do_vertex_finding = true; + bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes bool do_pstof = false; @@ -297,6 +297,8 @@ int Fun4All_G4_EICDetector( // 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); From 7e475d14c36e98dde6ef2846bbcf9bfd5366369d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 14 Aug 2019 23:32:00 -0400 Subject: [PATCH 0343/1222] use Al by default --- macros/g4simulations/G4_HcalIn_ref.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 537cf2c11..2443d5d4f 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -22,9 +22,9 @@ R__LOAD_LIBRARY(libg4eval.so) #endif //Inner HCal absorber material selector: -//false - Default, absorber material is SS310 -//true - Choose if you want Aluminum -const bool inner_hcal_material_Al = false; +//false - old version, absorber material is SS310 +//true - default Choose if you want Aluminum +const bool inner_hcal_material_Al = true; static int inner_hcal_eic = 0; From c0fb9e594bbebd2ff6301d702d8926d8f7f503a4 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 19 Aug 2019 18:20:26 -0400 Subject: [PATCH 0344/1222] Macro changes to optionally use PHInitZVertexing to find initial vertex from data. Can choose to use truth vertex instead (as we have always done previously). --- macros/g4simulations/G4_Tracking.C | 33 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index c211fea81..5400a4aa8 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,6 +48,7 @@ R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) +//R__LOAD_LIBRARY(libg4hough.so) #endif @@ -511,17 +512,35 @@ void Tracking_Reco(int verbosity = 0) //------------ // This should be true for everything except testing wirh truth track seeding! - const bool use_track_prop = true; + const bool use_track_prop = true; // false to run truth tracking + const bool use_truth_vertex = false; // false to get initial vertex from MVTX hits if (use_track_prop) { //-------------------------------------------------- // Normal track seeding and propagation //-------------------------------------------------- - // for now, we cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); + if(use_truth_vertex) + { + // We cheat to get the initial vertex for the full track reconstruction case + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + } + else + { + // get the initial vertex for track fitting from the MVTX hits + + PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); + int seed_layer[7] = {0,1,2,3,4,5,6}; + init_zvtx->set_seeding_layer(seed_layer,7); + // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. + // Suggest to use 2 for p+p and 5 for Au+Au (to reduce spurious vertices). + // Track seeding currently uses the vertex with the most triplets - i.e. only one vertex is currently used downstream. + init_zvtx->set_min_zvtx_tracks(2); + init_zvtx->Verbosity(0); + se->registerSubsystem(init_zvtx); + } // find seed tracks using a subset of TPC layers PHTrackSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer); @@ -621,7 +640,7 @@ void Tracking_Reco(int verbosity = 0) eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->do_eval_light(true); - eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true eval->Verbosity(0); se->registerSubsystem(eval); From 753cf58fa684d165a257ba7ee668d1eaa8622e3a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 26 Aug 2019 22:14:43 -0400 Subject: [PATCH 0345/1222] Set use_truth_vertex = true by default. Set minimum Z vertex tracks to 1, suitable for pp events. --- macros/g4simulations/G4_Tracking.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 5400a4aa8..8aa5aa1f3 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -512,8 +512,8 @@ void Tracking_Reco(int verbosity = 0) //------------ // This should be true for everything except testing wirh truth track seeding! - const bool use_track_prop = true; // false to run truth tracking - const bool use_truth_vertex = false; // false to get initial vertex from MVTX hits + const bool use_track_prop = true; // normally true, false to run truth tracking + const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits if (use_track_prop) { //-------------------------------------------------- @@ -535,9 +535,9 @@ void Tracking_Reco(int verbosity = 0) int seed_layer[7] = {0,1,2,3,4,5,6}; init_zvtx->set_seeding_layer(seed_layer,7); // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 2 for p+p and 5 for Au+Au (to reduce spurious vertices). + // Suggest to use 1 for p+p and 5 for Au+Au (to reduce spurious vertices). // Track seeding currently uses the vertex with the most triplets - i.e. only one vertex is currently used downstream. - init_zvtx->set_min_zvtx_tracks(2); + init_zvtx->set_min_zvtx_tracks(1); init_zvtx->Verbosity(0); se->registerSubsystem(init_zvtx); } From e80275231f8ae5be94cfe9081de4068f04459949 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 2 Sep 2019 14:09:20 -0400 Subject: [PATCH 0346/1222] Testing multiple vertexing. --- macros/g4simulations/G4_Tracking.C | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 91e23b7d6..0c5bfa08a 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -513,7 +513,7 @@ void Tracking_Reco(int verbosity = 0) // This should be true for everything except testing wirh truth track seeding! const bool use_track_prop = true; // normally true, false to run truth tracking - const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits + const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits if (use_track_prop) { //-------------------------------------------------- @@ -537,8 +537,8 @@ void Tracking_Reco(int verbosity = 0) // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. // Suggest to use 1 for p+p and 5 for Au+Au (to reduce spurious vertices). // Track seeding currently uses the vertex with the most triplets - i.e. only one vertex is currently used downstream. - init_zvtx->set_min_zvtx_tracks(1); - init_zvtx->Verbosity(0); + //init_zvtx->set_min_zvtx_tracks(5); + init_zvtx->Verbosity(1); se->registerSubsystem(init_zvtx); } @@ -546,7 +546,7 @@ void Tracking_Reco(int verbosity = 0) int min_layers = 4; int nlayers_seeds = 12; PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(0); + track_seed->Verbosity(2); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track @@ -595,11 +595,17 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); + kalman->Verbosity(2); if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true kalman->set_use_truth_vertex(false); + kalman->set_over_write_svtxtrackmap(true); + kalman->set_over_write_svtxvertexmap(true); + //std::string vmethod("avr"); // only for 1 vertex events + //std::string vmethod("mvf-sigmacut:9.0"); // default is 9 sigmas. Method does not work well. + std::string vmethod("avr-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events well. + kalman->set_vertexing_method(vmethod); se->registerSubsystem(kalman); //------------------ From e6fc53ec37b538af414e46b96c80398d6e04a9e8 Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Tue, 3 Sep 2019 14:38:01 -0400 Subject: [PATCH 0347/1222] fix typoo, update to code defaults --- macros/g4simulations/flowAfterburner.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/flowAfterburner.xml b/macros/g4simulations/flowAfterburner.xml index 83eb260c7..7d857050a 100644 --- a/macros/g4simulations/flowAfterburner.xml +++ b/macros/g4simulations/flowAfterburner.xml @@ -6,9 +6,10 @@ sHijing.dat flowAfterburner.dat - -1.0 - 1.0 - 0.0 + -4.0 + 4.0 + 0.0 + 100.0 - JJNEW + MINBIAS From a9565033269fba18acdc22f5078eb3c1aa26ea74 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 9 Sep 2019 13:47:24 -0400 Subject: [PATCH 0348/1222] Removed obsolete setups for INTT. --- macros/g4simulations/G4_Tracking.C | 163 +++++++++-------------------- 1 file changed, 51 insertions(+), 112 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 0c5bfa08a..49cdb8d10 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -51,99 +51,56 @@ R__LOAD_LIBRARY(libtrack_reco.so) //R__LOAD_LIBRARY(libg4hough.so) #endif - #include -// define INTTLADDER8, INTTLADDER6, INTTLADDER4_ZP or INTTLADDER4_PP, INTTLADDER0 to get 8, 6, 4 or 0 layers -// one and only one of these has to be defined, because #elseif does not seem to work properly in the interpreter -#define INTTLADDER4_PP - -// Dead map options for INTT -enum enu_InttDeadMapType -{ - kInttNoDeadMap = 0, // All channel in Intt is alive - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational -}; - -// Choose Intt deadmap here -enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; - -// 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; +// Tracking simulation setup parameters and flag - leave them alone! +//============================================== +////////////// MVTX const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers -// Configure the Intt layers -// offsetphi is in deg, every other layer is offset by one half of the phi spacing between ladders -#ifdef INTTLADDER8 -int n_intt_layer = 8; -// default layer configuration -int laddertype[8] = {PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; // default -int nladder[8] = {17, 17, 15, 15, 18, 18, 21, 21}; // default -double sensor_radius[8] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361, 12.676, 13.179}; // radius of center of sensor for layer default -double offsetphi[8] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5], 0.0, 0.5 * 360.0 / nladder[7]}; -#endif -#ifdef INTTLADDER6 -int n_intt_layer = 6; -int laddertype[6] = {PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; -int nladder[6] = {17, 17, 15, 15, 18, 18}; -double sensor_radius[6] = {6.876, 7.462, 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3], 0.0, 0.5 * 360.0 / nladder[5]}; -#endif -#ifdef INTTLADDER4_ZP -int n_intt_layer = 4; -int laddertype[4] = {PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_Z, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; -int nladder[4] = {17, 17, 18, 18}; -double sensor_radius[6] = {6.876, 7.462, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; -#endif -#ifdef INTTLADDER4_PP -int n_intt_layer = 4; +/////////////// INTT +int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[6] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double offsetphi[6] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; -#endif -#ifdef INTTLADDER0 -int n_intt_layer = 0; -int laddertype[1] = {0}; -int nladder[1] = {0}; -double sensor_radius[1] = {0}; -double offsetphi[1] = {0}; -#endif +double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +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 + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational +}; +enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here +///////////////// TPC 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; -int Max_si_layer; +// Tracking reconstruction setup parameters and flags +//===================================== +const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events +const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead +const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit +const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples + +// This is the setup we have been using before PHInitZVertexing was implemented - 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: +const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex + +// This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event +//const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex +//std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. + void TrackingInit(int verbosity = 0) { - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; } double Tracking(PHG4Reco* g4Reco, double radius, @@ -275,7 +232,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, void Tracking_Cells(int verbosity = 0) { // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) + // into detector hits (TrkrHits) //--------------- // Load libraries @@ -355,10 +312,11 @@ void Tracking_Cells(int verbosity = 0) void Tracking_Reco(int verbosity = 0) { + // processes the TrkrHits to make clusters, then reconstruct tracks and vertices + //--------------- // Load libraries //--------------- - gSystem->Load("libfun4all.so"); gSystem->Load("libtrack_reco.so"); @@ -511,9 +469,6 @@ void Tracking_Reco(int verbosity = 0) // Tracking //------------ - // This should be true for everything except testing wirh truth track seeding! - const bool use_track_prop = true; // normally true, false to run truth tracking - const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits if (use_track_prop) { //-------------------------------------------------- @@ -530,15 +485,13 @@ void Tracking_Reco(int verbosity = 0) else { // get the initial vertex for track fitting from the MVTX hits - PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); int seed_layer[7] = {0,1,2,3,4,5,6}; init_zvtx->set_seeding_layer(seed_layer,7); // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 1 for p+p and 5 for Au+Au (to reduce spurious vertices). - // Track seeding currently uses the vertex with the most triplets - i.e. only one vertex is currently used downstream. - //init_zvtx->set_min_zvtx_tracks(5); - init_zvtx->Verbosity(1); + // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). + init_zvtx->set_min_zvtx_tracks(init_vertexing_min_zvtx_tracks); + init_zvtx->Verbosity(0); se->registerSubsystem(init_zvtx); } @@ -546,39 +499,27 @@ void Tracking_Reco(int verbosity = 0) int min_layers = 4; int nlayers_seeds = 12; PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(2); + track_seed->Verbosity(0); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); - for(int i = 0;iset_max_search_win_theta_intt(i, 0.010); - track_prop->set_min_search_win_theta_intt(i, 0.00); - track_prop->set_max_search_win_phi_intt(i, 0.20); - track_prop->set_min_search_win_phi_intt(i, 0.20); - } - else - { - // 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); - } + // 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); } } else { - //-------------------------------------------------- - // Track finding using truth information - //-------------------------------------------------- + //------------------------------------------------------- + // Track finding using truth information only + //------------------------------------------------------ PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); @@ -594,18 +535,16 @@ void Tracking_Reco(int verbosity = 0) // Fitting of tracks using Kalman Filter //------------------------------------------------ + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(2); + kalman->Verbosity(0); if (use_primary_vertex) kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - kalman->set_use_truth_vertex(false); - kalman->set_over_write_svtxtrackmap(true); - kalman->set_over_write_svtxvertexmap(true); - //std::string vmethod("avr"); // only for 1 vertex events - //std::string vmethod("mvf-sigmacut:9.0"); // default is 9 sigmas. Method does not work well. - std::string vmethod("avr-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events well. + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + se->registerSubsystem(kalman); //------------------ @@ -640,7 +579,6 @@ void Tracking_Reco(int verbosity = 0) //---------------- // Tracking evaluation //---------------- - SvtxEvaluator* eval; eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); eval->do_cluster_eval(true); @@ -648,6 +586,7 @@ void Tracking_Reco(int verbosity = 0) eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->do_eval_light(true); + eval->set_use_initial_vertex(g4eval_use_initial_vertex); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true eval->Verbosity(0); se->registerSubsystem(eval); From 9737d6225d9c477b5110041401dcdd39021c1137 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 10 Sep 2019 21:54:10 -0400 Subject: [PATCH 0349/1222] set material to SS310 if Al is set to false --- macros/g4simulations/G4_HcalIn_ref.C | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 2443d5d4f..e9f58bd07 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -65,10 +65,15 @@ double HCalInner(PHG4Reco* g4Reco, // 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"); - } + { + cout <<"HCalInner - construct inner HCal absorber with G4_Al"<set_string_param("material","G4_Al"); + } + else + { + cout <<"HCalInner - construct inner HCal absorber with SS310"<set_string_param("material","SS310"); + } // hcal->set_double_param("inner_radius", 117.27); //----------------------------------------- // the light correction can be set in a single call From 9bb5e16b3a9813ce49d45d680b8b29befa04a64e Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Fri, 27 Sep 2019 12:26:51 -0400 Subject: [PATCH 0350/1222] add fEMC to sPHENIX --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 12 +++++++++--- macros/g4simulations/G4Setup_sPHENIX.C | 23 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 2e794ca6a..4071d6043 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -117,6 +117,12 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_cluster = do_hcalout_twr && true; bool do_hcalout_eval = do_hcalout_cluster && true; + // forward EMC + 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; + //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; @@ -149,7 +155,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor); + G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_FEMC); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -338,10 +344,10 @@ int Fun4All_G4_sPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_FEMC, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_FEMC, magfield_rescale); #endif } diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index a2389ea76..9d87b3bd5 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -8,6 +8,7 @@ #include "G4_Magnet.C" #include "G4_HcalOut_ref.C" #include "G4_PlugDoor.C" +#include "G4_FEMC.C" #include #include @@ -38,7 +39,8 @@ void G4Init(const bool do_tracking = true, const bool do_magnet = true, const bool do_hcalout = true, const bool do_pipe = true, - const bool do_plugdoor = false + const bool do_plugdoor = false, + const bool do_FEMC = false ) { @@ -89,6 +91,12 @@ void G4Init(const bool do_tracking = true, gROOT->LoadMacro("G4_PlugDoor.C"); PlugDoorInit(); } + if (do_FEMC) + { + gROOT->LoadMacro("G4_FEMC.C"); + FEMCInit(); + } + } @@ -108,6 +116,7 @@ int G4Setup(const int absorberactive = 0, const bool do_pipe = true, const bool do_plugdoor = false, // const bool do_plugdoor = true, + const bool do_FEMC = false, const float magfield_rescale = 1.0) { //--------------- @@ -196,6 +205,9 @@ int G4Setup(const int absorberactive = 0, // sPHENIX forward flux return door if (do_plugdoor) PlugDoor(g4Reco, absorberactive); + // forward EMC + if(do_FEMC) FEMCSetup(g4Reco, absorberactive); + //---------------------------------------- // BLACKHOLE @@ -279,6 +291,12 @@ void ShowerCompress(int verbosity = 0) { 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->AddCellContainer("G4CELL_FEMC"); + compress->AddTowerContainer("TOWER_SIM_FEMC"); + compress->AddTowerContainer("TOWER_RAW_FEMC"); + compress->AddTowerContainer("TOWER_CALIB_FEMC"); se->registerSubsystem(compress); return; @@ -304,5 +322,8 @@ void DstCompress(Fun4AllDstOutputManager* out) { out->StripNode("G4CELL_CEMC"); out->StripNode("G4CELL_HCALIN"); out->StripNode("G4CELL_HCALOUT"); + out->StripNode("G4HIT_FEMC"); + out->StripNode("G4HIT_ABSORBER_FEMC"); + out->StripNode("G4CELL_FEMC"); } } From 80dbed32c20349e16a0d912ef355abac33cdd9c6 Mon Sep 17 00:00:00 2001 From: John Lajoie Date: Fri, 27 Sep 2019 12:33:12 -0400 Subject: [PATCH 0351/1222] fEMC off by default --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 4071d6043..5621b71f1 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -118,7 +118,7 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_eval = do_hcalout_cluster && true; // forward EMC - bool do_FEMC = true; + bool do_FEMC = false; bool do_FEMC_cell = do_FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; From 392e287fd921dfd4f33d82dbd6e6c5a361e48dc1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 29 Sep 2019 22:39:49 -0400 Subject: [PATCH 0352/1222] remove sPHENIX outer hcal used for demo --- macros/g4jleic/G4Setup_JLeic.C | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C index 964ebc033..ea742f6ab 100644 --- a/macros/g4jleic/G4Setup_JLeic.C +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -9,6 +9,7 @@ #include "G4_Barrel_Hcal.C" #include "G4_DRich.C" #include "G4_EndCap_Electron.C" +#include "G4_EndCap_Hadron.C" #include #include @@ -40,7 +41,8 @@ void G4Init(const bool do_ctd = true, const bool do_jldirc = true, const bool do_barrel_hcal = true, const bool do_drich = true, - const bool do_endcap_electron = true + const bool do_endcap_electron = true, + const bool do_endcap_hadron = true ) { @@ -90,6 +92,12 @@ void G4Init(const bool do_ctd = true, EndCap_ElectronInit(); } + if (do_endcap_hadron) + { + gROOT->LoadMacro("G4_EndCap_Hadron.C"); + EndCap_HadronInit(); + } + } @@ -109,6 +117,7 @@ int G4Setup(const int absorberactive = 0, const bool do_barrel_hcal = true, const bool do_drich = true, const bool do_endcap_electron = true, + const bool do_endcap_hadron = true, const float magfield_rescale = 1.0) { //--------------- @@ -194,6 +203,8 @@ int G4Setup(const int absorberactive = 0, if (do_drich) double tmp = DRich(g4Reco, radius, 0, absorberactive); if (do_endcap_electron) double tmp = EndCap_Electron(g4Reco, radius, 0, absorberactive); + + if (do_endcap_hadron) double tmp = EndCap_Hadron(g4Reco, radius, 0, absorberactive); radius = 200.; //---------------------------------------- // BLACKHOLE From 62b5e5a1dd27b20d0957e7d4a0c47b063c736a47 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 29 Sep 2019 22:40:34 -0400 Subject: [PATCH 0353/1222] update --- macros/g4jleic/G4_Tracking_EIC.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/macros/g4jleic/G4_Tracking_EIC.C b/macros/g4jleic/G4_Tracking_EIC.C index 6e7dee7d2..34216853b 100644 --- a/macros/g4jleic/G4_Tracking_EIC.C +++ b/macros/g4jleic/G4_Tracking_EIC.C @@ -28,9 +28,9 @@ void Tracking_Reco(int verbosity = 0) PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); kalman->Verbosity(verbosity); - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); + kalman->set_use_vertex_in_fitting(false); +// kalman->set_vertex_xy_resolution(50E-4); +// kalman->set_vertex_z_resolution(50E-4); kalman->set_sub_top_node_name("TRACKS"); kalman->set_trackmap_out_name("KalFitTrackMap"); @@ -39,9 +39,9 @@ void Tracking_Reco(int verbosity = 0) kalman->add_phg4hits( "G4HIT_JLVTX", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, + 20e-4, // const float radres, + 20e-4, // const float phires, + 20e-4, // const float lonres, 1, // const float eff, 0 // const float noise ); @@ -56,10 +56,10 @@ void Tracking_Reco(int verbosity = 0) 1, // const float eff, 0 // const float noise ); - +// // GEM0, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( - "G4HIT_GEMH", // const std::string& phg4hitsNames, + "G4HIT_GEMHADRON", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, @@ -69,7 +69,7 @@ void Tracking_Reco(int verbosity = 0) ); // GEM1, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( - "G4HIT_GEME", // const std::string& phg4hitsNames, + "G4HIT_GEMHADRON", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, From ece4cf15f6e26961f276c4eaec37484c5ffce228 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 29 Sep 2019 22:41:46 -0400 Subject: [PATCH 0354/1222] Add use of mother volume --- macros/g4jleic/G4_EndCap_Hadron.C | 56 +++++++++++++++++++------------ 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/macros/g4jleic/G4_EndCap_Hadron.C b/macros/g4jleic/G4_EndCap_Hadron.C index e65bf31d7..4059be5b3 100644 --- a/macros/g4jleic/G4_EndCap_Hadron.C +++ b/macros/g4jleic/G4_EndCap_Hadron.C @@ -9,32 +9,46 @@ R__LOAD_LIBRARY(libg4detectors.so) void EndCap_HadronInit() {} double EndCap_Hadron(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) { - gSystem->Load("libg4detectors.so"); gSystem->Load("libg4testbench.so"); // here is our silicon: double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double hadron_inner_radius = 20.; // cm - double hadron_outer_radius = 244.; // cm - double size_z = 250.; - double place_z = 400./2.-jleic_shiftz+size_z/2.; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("ECHADRON", 0); - cyl->set_double_param("radius",hadron_inner_radius); - cyl->set_string_param("material","G4_Fe"); - cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",place_z); - cyl->SetActive(); - cyl->SuperDetector("ECHADRON"); - g4Reco->registerSubsystem( cyl ); - - + double hadron_inner_radius = 80.; // cm + double hadron_outer_radius = 243.; // cm + PHG4CylinderSubsystem *mothervol = new PHG4CylinderSubsystem("EndCapHadronContainer",0); + mothervol->set_color(0.3,0,3.,0.1); + mothervol->set_double_param("radius",20.); + mothervol->set_string_param("material","G4_AIR"); + mothervol->set_double_param("thickness",hadron_outer_radius - 20.); + mothervol->set_double_param("length",250.); + mothervol->set_int_param("lengthviarapidity",0); + mothervol->set_double_param("place_z", 400./2.-jleic_shiftz+250/2.+170.); + g4Reco->registerSubsystem( mothervol ); + double size_z = 2.; + double gap = 2.; + double z_start = size_z/2.-250./2.; + int nlayer=25; + for (int i=0; iSetMotherSubsystem(mothervol); + cyl->set_color(0.6, 0, 0.6, 1); + cyl->set_double_param("radius",hadron_inner_radius); + cyl->set_string_param("material","G4_Fe"); + cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); + cyl->set_int_param("lengthviarapidity",0); + cyl->set_double_param("length", size_z); + cyl->set_double_param("place_z",z_start); + cyl->SetActive(); + cyl->SuperDetector("ECHADRON"); + z_start+=gap+size_z; + g4Reco->registerSubsystem( cyl ); + } return radius; } From 114088b819e2ebe548f3849a271ee2776f6bdfdb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 29 Sep 2019 22:42:32 -0400 Subject: [PATCH 0355/1222] Add color from g4e --- macros/g4jleic/G4_CTD.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4jleic/G4_CTD.C b/macros/g4jleic/G4_CTD.C index dc660e123..65a021a59 100644 --- a/macros/g4jleic/G4_CTD.C +++ b/macros/g4jleic/G4_CTD.C @@ -41,6 +41,7 @@ double CTD(PHG4Reco* g4Reco, continue; } cyl = new PHG4CylinderSubsystem("JLCTD", ilayer); + cyl->set_color(0.1, 0, 1., 0.1); cyl->set_double_param("radius",radius); cyl->set_string_param("material","G4_Si"); cyl->set_double_param("thickness",si_thickness); From b5f943fa92fa19c241412f5e9b8e120ed58ef11f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 29 Sep 2019 22:43:14 -0400 Subject: [PATCH 0356/1222] Add color from g4e --- macros/g4jleic/G4_DRich.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4jleic/G4_DRich.C b/macros/g4jleic/G4_DRich.C index 78e37938a..2aefd9134 100644 --- a/macros/g4jleic/G4_DRich.C +++ b/macros/g4jleic/G4_DRich.C @@ -25,6 +25,7 @@ double DRich(PHG4Reco* g4Reco, double size_z = 170.; double place_z = 400./2.-jleic_shiftz+size_z/2.; PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("DRICH", 0); + cyl->set_color(1.,1.,0.2,0.2); cyl->set_double_param("radius",drich_inner_radius); cyl->set_string_param("material","G4_CARBON_DIOXIDE"); cyl->set_double_param("thickness",drich_outer_radius - drich_inner_radius); From 74a294a1da91060ca160c07c97208de85b90758b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 30 Sep 2019 00:57:57 -0400 Subject: [PATCH 0357/1222] macro updates --- macros/g4jleic/Fun4All_G4_JLeic.C | 35 ++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/macros/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C index 7e30f2a34..dbb8713ec 100644 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,8 @@ R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libphhepmc.so) R__LOAD_LIBRARY(libPHPythia6.so) R__LOAD_LIBRARY(libPHPythia8.so) +R__LOAD_LIBRARY(libg4histos.so) + #endif using namespace std; @@ -68,9 +71,9 @@ int Fun4All_G4_JLeic( // 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; + const bool particles = false && !readhits; // or gun/ very simple single particle gun generator - const bool usegun = false && !readhits; + 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; const int num_upsilons_per_event = 1; // can set more than 1 upsilon per event, each has a unique embed flag @@ -100,7 +103,9 @@ int Fun4All_G4_JLeic( bool do_endcap_electron = true; - bool do_tracking = true; + bool do_endcap_hadron = true; + + bool do_tracking = false; //--------------- // Load libraries //--------------- @@ -113,11 +118,12 @@ int Fun4All_G4_JLeic( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron); int absorberactive = 1; // set to 1 to make all absorbers active volumes - // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + +// const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const string magfield = "2.0"; // 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) const float magfield_rescale = 1; // scale map if needed //--------------- @@ -238,10 +244,10 @@ int Fun4All_G4_JLeic( // se->registerSubsystem(gun); PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); pgen->set_name("geantino"); - pgen->set_z_range(0, 0); + pgen->set_z_range(-40, -40); 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()); + pgen->set_phi_range(-1 * TMath::Pi(), 1 * TMath::Pi()); se->registerSubsystem(pgen); } @@ -302,10 +308,10 @@ int Fun4All_G4_JLeic( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, magfield_rescale); #endif } @@ -405,6 +411,15 @@ int Fun4All_G4_JLeic( Tracking_Reco(); Tracking_Eval("trkeval.root"); } + G4HitNtuple *g4h = new G4HitNtuple("G4HitNtuple","/phenix/scratch/pinkenbu/g4hitntuple.root"); + g4h->AddNode("PIPE", 0); + g4h->AddNode("JLVTX",1); + g4h->AddNode("JLCTD",2); + g4h->AddNode("JLDIRC",3); + g4h->AddNode("MAGNET",4); + g4h->AddNode("BARRELHCAL",5); + se->registerSubsystem(g4h); + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); // if (do_dst_compress) DstCompress(out); se->registerOutputManager(out); From 9b6d2ebaf04180fe6a1bd2e6596fcac95871a688 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 4 Oct 2019 18:01:47 -0400 Subject: [PATCH 0358/1222] add init gui for qt based command G4 line --- macros/g4simulations/init_gui_vis.mac | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 macros/g4simulations/init_gui_vis.mac diff --git a/macros/g4simulations/init_gui_vis.mac b/macros/g4simulations/init_gui_vis.mac new file mode 100644 index 000000000..e5e8a0dcf --- /dev/null +++ b/macros/g4simulations/init_gui_vis.mac @@ -0,0 +1,17 @@ +# 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 +# +# Visualization setting +/control/execute vis.mac From 56351d0c60a9c15ad55000097b8b75ac50e59aaf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 4 Oct 2019 18:02:22 -0400 Subject: [PATCH 0359/1222] add init gui for qt based command G4 line --- macros/g4jleic/init_gui_vis.mac | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 macros/g4jleic/init_gui_vis.mac diff --git a/macros/g4jleic/init_gui_vis.mac b/macros/g4jleic/init_gui_vis.mac new file mode 100644 index 000000000..e5e8a0dcf --- /dev/null +++ b/macros/g4jleic/init_gui_vis.mac @@ -0,0 +1,17 @@ +# 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 +# +# Visualization setting +/control/execute vis.mac From 5ea73f8fd179c847b49839527a379707fc9e1a02 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 15 Oct 2019 16:24:14 -0400 Subject: [PATCH 0360/1222] Add comment to clarify where the xml file applies --- macros/g4simulations/flowAfterburner.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/flowAfterburner.xml b/macros/g4simulations/flowAfterburner.xml index 7d857050a..b7c9b482c 100644 --- a/macros/g4simulations/flowAfterburner.xml +++ b/macros/g4simulations/flowAfterburner.xml @@ -5,6 +5,11 @@ sHijing.dat flowAfterburner.dat + -4.0 4.0 From d3b148d116fe57c762dbd15e4a7f2bb89f149664 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 19 Oct 2019 17:09:14 -0400 Subject: [PATCH 0361/1222] use new phparameter based forward emc --- macros/g4simulations/G4_FEMC.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 59e9aa2a8..23ee19c56 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -68,10 +68,11 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile( mapping_femc.str() ); femc->OverlapCheck(overlapcheck); - + femc->SetActive(); + femc->SetAbsorberActive(); + femc->SuperDetector("FEMC"); if (absorberactive) femc->SetAbsorberActive(); g4Reco->registerSubsystem( femc ); From 9cef2cef630d5cef5b00c8cbf39004ccba550998 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 19 Oct 2019 17:10:28 -0400 Subject: [PATCH 0362/1222] use OGL which uses qt in the geant4 gui --- macros/g4simulations/vis.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 539d58b5d..47db266aa 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -26,7 +26,7 @@ # 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 From 0f2d51313a53044ca03d6364a9b59f2d076be819 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Oct 2019 14:07:46 -0400 Subject: [PATCH 0363/1222] put absorberactive setting behind if statement --- macros/g4simulations/G4_FEMC.C | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 23ee19c56..6bbd708b0 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -71,7 +71,6 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) femc->SetTowerMappingFile( mapping_femc.str() ); femc->OverlapCheck(overlapcheck); femc->SetActive(); - femc->SetAbsorberActive(); femc->SuperDetector("FEMC"); if (absorberactive) femc->SetAbsorberActive(); From 63698809c48479c47eaea86c6466821438068290 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Oct 2019 14:28:49 -0400 Subject: [PATCH 0364/1222] add femc reco chain --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 5621b71f1..d8fad92aa 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -118,10 +118,11 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_eval = do_hcalout_cluster && true; // forward EMC - bool do_FEMC = false; - 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 = 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; //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; @@ -155,7 +156,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_FEMC); + G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -344,10 +345,10 @@ int Fun4All_G4_sPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_FEMC, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_FEMC, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, magfield_rescale); #endif } @@ -373,6 +374,8 @@ int Fun4All_G4_sPHENIX( if (do_hcalout_cell) HCALOuter_Cells(); + if (do_femc_cell) FEMC_Cells(); + //----------------------------- // CEMC towering and clustering //----------------------------- @@ -390,6 +393,9 @@ int Fun4All_G4_sPHENIX( 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_dst_compress) ShowerCompress(); //-------------- @@ -452,6 +458,8 @@ int Fun4All_G4_sPHENIX( if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); + if (do_femc_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); + if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); //-------------- From ab00f9c0541ade2f56484dc8c8690772617a83cd Mon Sep 17 00:00:00 2001 From: osbornjd Date: Tue, 22 Oct 2019 11:45:11 +0000 Subject: [PATCH 0365/1222] Separated fsPHENIX FEMC and EIC FEMC --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_FEMC_EIC.C | 194 ++++++++++++++++++--- 2 files changed, 169 insertions(+), 27 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index af291d0f2..155670e0b 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -92,7 +92,7 @@ void G4Init(bool do_svtx = true, if (do_FEMC) { - gROOT->LoadMacro("G4_FEMC.C"); + gROOT->LoadMacro("G4_FEMC_EIC.C"); FEMCInit(); } diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index b02b5ce0d..59e9aa2a8 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -1,4 +1,34 @@ -using namespace std; +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#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) +#endif + + + +enum enu_Femc_clusterizer +{ + kFemcGraphClusterizer, + kFemcTemplateClusterizer +}; + +//template clusterizer, as developed by Sasha Bazilevsky +enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; +// graph clusterizer +//enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; void FEMCInit() @@ -14,8 +44,8 @@ void FEMC_Cells(int verbosity = 0) { PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); hc->Detector("FEMC"); se->registerSubsystem(hc); - - return; + + return; } void @@ -23,6 +53,8 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) { gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4calo.so"); + gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -31,9 +63,9 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; - // EIC ECAL - femc->SetEICDetector(); - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; + // fsPHENIX ECAL + femc->SetfsPHENIXDetector(); + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; cout << mapping_femc.str() << endl; @@ -53,8 +85,10 @@ void FEMC_Towers(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; - // EIC ECAL - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; + + // fsPHENIX ECAL + mapping_femc << getenv("CALIBRATIONROOT") << + "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -63,23 +97,107 @@ void FEMC_Towers(int verbosity = 0) { 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 ); + //RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); + //TowerDigitizer2->Detector("FEMC"); + //TowerDigitizer2->TowerType(2); + //TowerDigitizer2->Verbosity(verbosity); + //TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + //se->registerSubsystem( TowerDigitizer2 ); + + // E864 towers (three types for three sizes) + RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); + TowerDigitizer3->Detector("FEMC"); + TowerDigitizer3->TowerType(3); + TowerDigitizer3->Verbosity(verbosity); + TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer3 ); + + RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); + TowerDigitizer4->Detector("FEMC"); + TowerDigitizer4->TowerType(4); + TowerDigitizer4->Verbosity(verbosity); + TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer4 ); + + RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); + TowerDigitizer5->Detector("FEMC"); + TowerDigitizer5->TowerType(5); + TowerDigitizer5->Verbosity(verbosity); + TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer5 ); + + RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); + TowerDigitizer6->Detector("FEMC"); + TowerDigitizer6->TowerType(6); + TowerDigitizer6->Verbosity(verbosity); + TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer6 ); + + // 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 ); + //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 ); + + // E864 towers (three types for three sizes) + RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); + TowerCalibration3->Detector("FEMC"); + TowerCalibration3->TowerType(3); + TowerCalibration3->Verbosity(verbosity); + TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration3->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration3 ); + + RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); + TowerCalibration4->Detector("FEMC"); + TowerCalibration4->TowerType(4); + TowerCalibration4->Verbosity(verbosity); + TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration4->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration4 ); + + RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); + TowerCalibration5->Detector("FEMC"); + TowerCalibration5->TowerType(5); + TowerCalibration5->Verbosity(verbosity); + TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration5->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration5 ); + + RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); + TowerCalibration6->Detector("FEMC"); + TowerCalibration6->TowerType(6); + TowerCalibration6->Verbosity(verbosity); + TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration6->set_pedstal_ADC(0); + se->registerSubsystem( TowerCalibration6 ); } @@ -89,10 +207,33 @@ void FEMC_Clusters(int verbosity = 0) { gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); + + if ( Femc_clusterizer == kFemcTemplateClusterizer ) + { + RawClusterBuilderTemplateFEMC *ClusterBuilder = new RawClusterBuilderTemplateFEMC("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(ClusterBuilder); + } + else if ( Femc_clusterizer == kFemcGraphClusterizer ) + { + RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); + + + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem( ClusterBuilder ); + } + else + { + cout << "FEMC_Clusters - unknown clusterizer setting!"<Verbosity(verbosity); se->registerSubsystem(eval); + return; } From 8daa8501110aa61621d70dfdfb61c975dc499a07 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 22 Oct 2019 14:45:49 -0400 Subject: [PATCH 0366/1222] Update G4_FEMC_EIC.C Since the FEMC for fsPHENIX and EIC is identical let's drop the fsPHENIX/EIC setting. Chances are we can retire the oddball EICForwardEcal Detector (it is probably covered by one of the fsPHENIX options) --- macros/g4simulations/G4_FEMC_EIC.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 59e9aa2a8..0fee11327 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -63,8 +63,7 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; - // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; cout << mapping_femc.str() << endl; From a78a462b76c394f86b2e79aabb27cf781ad72862 Mon Sep 17 00:00:00 2001 From: Joseph Osborn Date: Wed, 23 Oct 2019 08:22:51 -0400 Subject: [PATCH 0367/1222] Fixed root5 bug --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_FEMC_EIC.C | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 155670e0b..f7164d1d8 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -9,7 +9,7 @@ #include "G4_Magnet.C" #include "G4_HcalOut_ref.C" #include "G4_PlugDoor_EIC.C" -#include "G4_FEMC.C" +#include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" #include "G4_EEMC.C" #include "G4_DIRC.C" diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 0fee11327..de7253dcb 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -64,13 +64,15 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; + femc->SetEICDetector(); + // fsPHENIX ECAL mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile( mapping_femc.str() ); femc->OverlapCheck(overlapcheck); - + femc->SetActive(); + femc->SuperDetector("FEMC"); if (absorberactive) femc->SetAbsorberActive(); g4Reco->registerSubsystem( femc ); From 63bc625377ce08311344db668c0921662ea3fd89 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 16 Nov 2019 13:47:49 -0500 Subject: [PATCH 0368/1222] need to separate g4 vis macros for qt and fun4all based graphics --- macros/g4jleic/init_gui_vis.mac | 7 +++++-- macros/g4simulations/init_gui_vis.mac | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/macros/g4jleic/init_gui_vis.mac b/macros/g4jleic/init_gui_vis.mac index e5e8a0dcf..8aca21396 100644 --- a/macros/g4jleic/init_gui_vis.mac +++ b/macros/g4jleic/init_gui_vis.mac @@ -13,5 +13,8 @@ # Initialize kernel /run/initialize # -# Visualization setting -/control/execute vis.mac +# create empty scene +# +/vis/scene/create +# open graphics (opengl QT) +/vis/open OGL diff --git a/macros/g4simulations/init_gui_vis.mac b/macros/g4simulations/init_gui_vis.mac index e5e8a0dcf..8aca21396 100644 --- a/macros/g4simulations/init_gui_vis.mac +++ b/macros/g4simulations/init_gui_vis.mac @@ -13,5 +13,8 @@ # Initialize kernel /run/initialize # -# Visualization setting -/control/execute vis.mac +# create empty scene +# +/vis/scene/create +# open graphics (opengl QT) +/vis/open OGL From bd771b292a5b79ae747d25687725afd0124f60de Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 16 Nov 2019 13:48:35 -0500 Subject: [PATCH 0369/1222] add QTGui() which starts QT gui properly --- macros/g4jleic/DisplayOn.C | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/macros/g4jleic/DisplayOn.C b/macros/g4jleic/DisplayOn.C index 3d8c8dc80..7436916ca 100644 --- a/macros/g4jleic/DisplayOn.C +++ b/macros/g4jleic/DisplayOn.C @@ -4,6 +4,19 @@ #include #endif +// 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 From dc881a71d255914fe365419d3d5003cedf81c1d9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 16 Nov 2019 13:49:15 -0500 Subject: [PATCH 0370/1222] add QTGui() which starts QT gui properly --- macros/g4simulations/DisplayOn.C | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C index 3d8c8dc80..7436916ca 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/macros/g4simulations/DisplayOn.C @@ -4,6 +4,19 @@ #include #endif +// 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 From 6c5bade01ed5afb28e4a6f7683ee6c38c630e8ab Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 22 Nov 2019 13:30:25 -0500 Subject: [PATCH 0371/1222] Add beamline magnets --- macros/g4jleic/Fun4All_G4_JLeic.C | 8 +++++--- macros/g4jleic/G4Setup_JLeic.C | 12 +++++++++++- macros/g4jleic/vis.mac | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/macros/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C index dbb8713ec..82120f5ed 100644 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ b/macros/g4jleic/Fun4All_G4_JLeic.C @@ -105,6 +105,8 @@ int Fun4All_G4_JLeic( bool do_endcap_hadron = true; + bool do_beamline = true; + bool do_tracking = false; //--------------- // Load libraries @@ -118,7 +120,7 @@ int Fun4All_G4_JLeic( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron); + G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline); int absorberactive = 1; // set to 1 to make all absorbers active volumes @@ -308,10 +310,10 @@ int Fun4All_G4_JLeic( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, magfield_rescale); + do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline, magfield_rescale); #endif } diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C index ea742f6ab..6ddb139f0 100644 --- a/macros/g4jleic/G4Setup_JLeic.C +++ b/macros/g4jleic/G4Setup_JLeic.C @@ -7,6 +7,7 @@ #include "G4_Gem.C" #include "G4_JLDIRC.C" #include "G4_Barrel_Hcal.C" +#include "G4_BeamLine.C" #include "G4_DRich.C" #include "G4_EndCap_Electron.C" #include "G4_EndCap_Hadron.C" @@ -42,7 +43,8 @@ void G4Init(const bool do_ctd = true, const bool do_barrel_hcal = true, const bool do_drich = true, const bool do_endcap_electron = true, - const bool do_endcap_hadron = true + const bool do_endcap_hadron = true, + const bool do_beamline = true ) { @@ -97,6 +99,11 @@ void G4Init(const bool do_ctd = true, gROOT->LoadMacro("G4_EndCap_Hadron.C"); EndCap_HadronInit(); } + if (do_beamline) + { + gROOT->LoadMacro("G4_BeamLine.C"); + BeamLineInit(); + } } @@ -118,6 +125,7 @@ int G4Setup(const int absorberactive = 0, const bool do_drich = true, const bool do_endcap_electron = true, const bool do_endcap_hadron = true, + const bool do_beamline = true, const float magfield_rescale = 1.0) { //--------------- @@ -205,6 +213,8 @@ int G4Setup(const int absorberactive = 0, if (do_endcap_electron) double tmp = EndCap_Electron(g4Reco, radius, 0, absorberactive); if (do_endcap_hadron) double tmp = EndCap_Hadron(g4Reco, radius, 0, absorberactive); + + if (do_beamline) double tmp = BeamLine(g4Reco, radius, 0, absorberactive); radius = 200.; //---------------------------------------- // BLACKHOLE diff --git a/macros/g4jleic/vis.mac b/macros/g4jleic/vis.mac index 539d58b5d..3c3fae86c 100644 --- a/macros/g4jleic/vis.mac +++ b/macros/g4jleic/vis.mac @@ -25,8 +25,8 @@ # 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/open OGLIX 1200x900-0+0 +#/vis/open OGLSX 1200x900-0+0 # increase display limit for more complex detectors /vis/ogl/set/displayListLimit 500000 /vis/viewer/set/viewpointThetaPhi 240 -10 From 74828d89a68b09b3e0e9f7408aa8e60bdb7a499f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 22 Nov 2019 13:31:16 -0500 Subject: [PATCH 0372/1222] Add magnet lattice files --- macros/g4jleic/e_ir_10.txt | 24 ++++++++++ macros/g4jleic/ion_ir_200.txt | 83 +++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 macros/g4jleic/e_ir_10.txt create mode 100644 macros/g4jleic/ion_ir_200.txt diff --git a/macros/g4jleic/e_ir_10.txt b/macros/g4jleic/e_ir_10.txt new file mode 100644 index 000000000..ea9bf5a57 --- /dev/null +++ b/macros/g4jleic/e_ir_10.txt @@ -0,0 +1,24 @@ + +Detector region electron elements +10 GeV/c electrons (use more digits to calculate the brho) + +Element name Type Length [m] Good field half-aperture [cm] Inner Half-A [cm] Outer Radius [cm] Dipole field [T] Quadrupole field [T/m] Sextupole [T/m^2] Solenoid [T] X center [m] Y center [m] Z center [m] Theta center [rad] Phi [rad] +Downstream elements (second focusing point approximately in the middle of chicane) Bx By Normal Skew +eBDS6 RBEND 3 1.8 4.5 11 0 0.44 0 0 0 0 -0.030 0 -34.5 -0.02 0 +eBDS5 RBEND 3 1.8 4.5 11 0 -0.42 0 0 0 0 -0.260 0 -27.3 -0.0213 0 +eBDS4 RBEND 0.5 1.8 4.5 11 0 -0.17 0 0 0 0 -0.293 0 -25.0 -0.00125 0 +eBDS3 RBEND 0.5 1.8 4.5 11 0 -0.17 0 0 0 0 -0.293 0 -21.3 0.00125 0 +eBDS2 RBEND 3 1.8 4.5 11 0 -0.42 0 0 0 0 -0.260 0 -19.1 0.0213 0 +eBDS1 RBEND 3 1.8 4.5 11 0 0.44 0 0 0 0 -0.030 0 -11.9 0.02 0 +eASDS SOLENOID 1.2 2.2 4.5 11 0 0 0 0 0 -4 0 0 -7 0 0 +eQDS3 QUADRUPOLE 0.6 2.4 4.5 10 0 0 -18.7 -2.71 0 0 0 0 -5.6 0 0 +eQDS2 QUADRUPOLE 0.6 2.8 4.5 8.5 0 0 36.2 5.25 0 0 0 0 -4.4 0 0 +eQDS1 QUADRUPOLE 0.6 1.7 4.5 8 0 0 -33.7 -4.89 0 0 0 0 -2.5 0 0 +eDSDS SOLENOID 1.6 2 160 210 0 0 0 0 0 3 0 0 -0.8 0 0 + +Upstream elements +eDSUS SOLENOID 2.4 2 160 210 0 0 0 0 0 3 0 0 1.2 0 0 +eQUS1 QUADRUPOLE 0.6 2 4.5 10 0 0 -36.9 8.10 0 0 0 0 3.26 0 0 +eQUS2 QUADRUPOLE 0.6 3.2 4.5 11 0 0 33.7 -7.38 0 0 0 0 4.46 0 0 +eQUS3 QUADRUPOLE 0.6 1.5 4.5 11 0 0 -20.8 4.56 0 0 0 0 8.01 0 0 +eASUS SOLENOID 1.8 2.2 4.5 11 0 0 0 0 0 -4 0 0 9.61 0 0 diff --git a/macros/g4jleic/ion_ir_200.txt b/macros/g4jleic/ion_ir_200.txt new file mode 100644 index 000000000..d1cbc4106 --- /dev/null +++ b/macros/g4jleic/ion_ir_200.txt @@ -0,0 +1,83 @@ +Detector region ion elements +momentum 200 GeV/c + +Element name Type Length [m] Good field half-aperture [cm] Inner Half-A [cm] Outer Radius [cm] Dipole field [T] Quadrupole field [T/m] Sextupole [T/m^2] Solenoid [T] X center [m] Y center [m] Z center [m] Theta center [rad] Phi [rad] +Upstream elements Bx By Normal Skew +iASUS SOLENOID 1.6 3 4 12 0 0 0 0 0 0 0.639733367 0 -12.78400333 -0.05 0 +iQUS3S QUADRUPOLE 0.5 3 4 12 0 0 0 0 0 0 0.567263571 0 -11.33581546 -0.05 0 +iQUS2 QUADRUPOLE 2.1 3 4 12 0 0 93.39904288 0 0 0 0.492294817 0 -9.837690066 -0.05 0 +iQUS2S QUADRUPOLE 0.5 2 3 10 0 0 0 0 0 0 0.417326063 0 -8.339564674 -0.05 0 +iQUS1b QUADRUPOLE 1.45 2 3 10 0 0 -95.10673243 0 0 0 0.35860054 0 -7.166033119 -0.05 0 +iQUS1S QUADRUPOLE 0.5 2 3 10 0 0 0 0 0 0 0.299875016 0 -5.992501562 -0.05 0 +iQUS1A QUADRUPOLE 1.45 2 3 10 0 0 -95.10673243 0 0 0 0.241149492 0 -4.818970007 -0.05 0 +iCUS1 KICKER 0.3 2 3 10 0 0 0 0 0 0 0.187421885 0 -3.745313477 -0.05 0 +iCUS2 KICKER 0.3 2 3 10 0 0 0 0 0 0 0.1624323 0 -3.245938346 -0.05 0 + +Downstream elements +iBDS1a RBEND 1.499999437 4 38.5 48.5 0 1.3342564 0 0 0 0 -0.288222883 0 5.742771125 -0.0515 0 +iQDS1a QUADRUPOLE 2.25 4 9.2 23.1 0 0 -37.24620638 0 0 0 -0.413196359 0 8.114480214 -0.053 0 +iQDS1S QUADRUPOLE 0.5 4 9.9 24.8 0 0 0 0 0 0 -0.496632284 0 9.687268644 -0.053 0 +iQDS1b QUADRUPOLE 2.25 4 12.3 31.0 0 0 -37.24620638 0 0 0 -0.58006821 0 11.26005708 -0.053 0 +iQDS2S QUADRUPOLE 0.5 4 13.0 32.7 0 0 0 0 0 0 -0.663504135 0 12.83284551 -0.053 0 +iQDS2 QUADRUPOLE 4.5 4 17.7 44.4 0 0 25.96076478 0 0 0 -0.80653715 0 15.52905425 -0.053 0 +iQDS3S QUADRUPOLE 0.5 4 18.4 46.2 0 0 0 0 0 0 -0.949570164 0 18.22526298 -0.053 0 +iASDS SOLENOID 1.2 4 19.8 49.7 0 0 0 0 0 0 -1.005194115 0 19.2737886 -0.053 0 +iBDS2 RBEND 7.999063697 4 40 90 0 -4.419724325 0 0 0 0 -1.270096426 0 25.76770364 -0.0265 0 +iBDS3 RBEND 6.499239262 4.5 4.5 30 0 5.439660708 0 0 0 0 -1.414164881 0 44.56372384 -0.0265 0 +iQDS4 QUADRUPOLE 0.8 3.5 4.5 30 0 0 150.2308213 0 0 0 -1.791435874 0 52.89448481 -0.053 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cd2a308c098860d5c1d1b461f384fb0d09d2363d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 22 Nov 2019 13:43:42 -0500 Subject: [PATCH 0373/1222] Add beamline magnet macro --- macros/g4jleic/G4_BeamLine.C | 109 +++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 macros/g4jleic/G4_BeamLine.C diff --git a/macros/g4jleic/G4_BeamLine.C b/macros/g4jleic/G4_BeamLine.C new file mode 100644 index 000000000..9b67ab776 --- /dev/null +++ b/macros/g4jleic/G4_BeamLine.C @@ -0,0 +1,109 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4jleic.so) +#endif +void BeamLineInit() {} + +double BeamLine(PHG4Reco* g4Reco, + double radius, + const int crossings = 0, + const int absorberactive = 0, + int verbosity = 0) +{ + + const char *fname[2]= {"ion_ir_200.txt","e_ir_10.txt"} ; + gSystem->Load("libg4jleic.so"); + gSystem->Load("libg4testbench.so"); + G4JLeicBeamLineMagnetSubsystem *bl = nullptr; + int imagnet=0; + for (int fi=0; fi<2; fi++) + { + std::ifstream infile(fname[fi]); + if (infile.is_open()) + { + double biggest_z = 0.; + std::string line; + while (std::getline(infile, line)) + { + if (line.find("QUADRUPOLE") != string::npos || + line.find("KICKER") != string::npos || + (line.find("RBEND") != string::npos && fi == 0) || + (line.find("SOLENOID") != string::npos && fi == 0)) + { + std::istringstream iss(line); + string magname; + string magtype; + double length; + double half_aper; + double inner_radius; + double outer_radius; + double dipole_field_x; + double dipole_field_y; + double quad_field_n; + double quad_field_s; + double sext_field; + double solenoid_field; + double x; + double y; + double z; + double theta; + double phi; + + if (!(iss >> magname >> magtype >> length >> half_aper + >> inner_radius >> outer_radius >> dipole_field_x + >> dipole_field_y + >> quad_field_n >> quad_field_s >> sext_field >> solenoid_field + >> x >> y >> z >> theta >> phi)) { break; } // error + else + { +// convert to our units (cm, deg) + x *= 100.; + y *= 100.; + z *= 100.; + length *= 100.; + theta = theta/TMath::Pi()*360.; + bl = new G4JLeicBeamLineMagnetSubsystem("BEAMLINE",imagnet); + if (magtype == "RBEND" || magtype == "KICKER") + { + magtype = "DIPOLE"; + } + bl->set_double_param("field_x",dipole_field_x); + bl->set_double_param("field_y",dipole_field_y); + bl->set_double_param("fieldgradient",quad_field_n); + bl->set_string_param("magtype",magtype); + bl->set_double_param("length",length); + bl->set_double_param("place_x",x); + bl->set_double_param("place_y",y); + bl->set_double_param("place_z",z); + bl->set_double_param("rot_y",theta); + bl->set_double_param("inner_radius",inner_radius); + bl->set_double_param("outer_radius", outer_radius); + bl->SetActive(); + if (absorberactive) + { + bl->SetAbsorberActive(); + } + bl->OverlapCheck(overlapcheck); + bl->SuperDetector("BEAMLINE"); + g4Reco->registerSubsystem(bl); + imagnet++; + if (fabs(z)+length > biggest_z) + { + biggest_z = fabs(z)+length; + } + } + } + } + if (biggest_z*2. > g4Reco->GetWorldSizeZ()) + { + g4Reco->SetWorldSizeZ(biggest_z*2.+200.); // leave 1m on both sides + } + infile.close(); + } + } + radius = 85.; + return radius; +} From f0554fe63e5a741e44bb3ab1f4800d132d8d4baa Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 9 Dec 2019 14:24:59 -0500 Subject: [PATCH 0374/1222] move g4jleic to https://github.com/EIC-Detector/g4jleic --- macros/g4jleic/DisplayOn.C | 54 ---- macros/g4jleic/Fun4All_G4_JLeic.C | 470 ---------------------------- macros/g4jleic/G4Setup_JLeic.C | 268 ---------------- macros/g4jleic/G4_Barrel_Hcal.C | 56 ---- macros/g4jleic/G4_BeamLine.C | 109 ------- macros/g4jleic/G4_CTD.C | 57 ---- macros/g4jleic/G4_DRich.C | 41 --- macros/g4jleic/G4_EndCap_Electron.C | 40 --- macros/g4jleic/G4_EndCap_Hadron.C | 54 ---- macros/g4jleic/G4_Gem.C | 61 ---- macros/g4jleic/G4_JLDIRC.C | 29 -- macros/g4jleic/G4_Magnet.C | 55 ---- macros/g4jleic/G4_Pipe.C | 117 ------- macros/g4jleic/G4_Tracking_EIC.C | 127 -------- macros/g4jleic/G4_VTX.C | 29 -- macros/g4jleic/GlobalVariables.C | 6 - macros/g4jleic/e_ir_10.txt | 24 -- macros/g4jleic/init_gui_vis.mac | 20 -- macros/g4jleic/ion_ir_200.txt | 83 ----- macros/g4jleic/vis.mac | 82 ----- 20 files changed, 1782 deletions(-) delete mode 100644 macros/g4jleic/DisplayOn.C delete mode 100644 macros/g4jleic/Fun4All_G4_JLeic.C delete mode 100644 macros/g4jleic/G4Setup_JLeic.C delete mode 100644 macros/g4jleic/G4_Barrel_Hcal.C delete mode 100644 macros/g4jleic/G4_BeamLine.C delete mode 100644 macros/g4jleic/G4_CTD.C delete mode 100644 macros/g4jleic/G4_DRich.C delete mode 100644 macros/g4jleic/G4_EndCap_Electron.C delete mode 100644 macros/g4jleic/G4_EndCap_Hadron.C delete mode 100644 macros/g4jleic/G4_Gem.C delete mode 100644 macros/g4jleic/G4_JLDIRC.C delete mode 100644 macros/g4jleic/G4_Magnet.C delete mode 100644 macros/g4jleic/G4_Pipe.C delete mode 100644 macros/g4jleic/G4_Tracking_EIC.C delete mode 100644 macros/g4jleic/G4_VTX.C delete mode 100644 macros/g4jleic/GlobalVariables.C delete mode 100644 macros/g4jleic/e_ir_10.txt delete mode 100644 macros/g4jleic/init_gui_vis.mac delete mode 100644 macros/g4jleic/ion_ir_200.txt delete mode 100644 macros/g4jleic/vis.mac diff --git a/macros/g4jleic/DisplayOn.C b/macros/g4jleic/DisplayOn.C deleted file mode 100644 index 7436916ca..000000000 --- a/macros/g4jleic/DisplayOn.C +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#endif - -// 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 -// 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.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; -} -// 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/g4jleic/Fun4All_G4_JLeic.C b/macros/g4jleic/Fun4All_G4_JLeic.C deleted file mode 100644 index 82120f5ed..000000000 --- a/macros/g4jleic/Fun4All_G4_JLeic.C +++ /dev/null @@ -1,470 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "G4Setup_JLeic.C" -#include "DisplayOn.C" -#include "G4_Tracking_EIC.C" - -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libphhepmc.so) -R__LOAD_LIBRARY(libPHPythia6.so) -R__LOAD_LIBRARY(libPHPythia8.so) -R__LOAD_LIBRARY(libg4histos.so) - -#endif - -using namespace std; - - -int Fun4All_G4_JLeic( - 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 = "G4JLeic.root", - const char *embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list") -{ - - //=============== - // 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 = 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; - const int num_upsilons_per_event = 1; // can set more than 1 upsilon per event, each has a unique embed flag - // Event pile up simulation with collision rate in Hz MB collisions. - // Note please follow up the macro to verify the settings for beam parameters - const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. - - //====================== - // What to run - //====================== - - bool do_pipe = true; - - bool do_ctd = true; - - bool do_vtx = true; - - bool do_jldirc = true; - - bool do_magnet = true; - - bool do_barrel_hcal = true; - - bool do_gem = true; - - bool do_drich = true; - - bool do_endcap_electron = true; - - bool do_endcap_hadron = true; - - bool do_beamline = true; - - bool do_tracking = false; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libg4intt.so"); - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_JLeic.C"); - G4Init(do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline); - - int absorberactive = 1; // set to 1 to make all absorbers active volumes - -// const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const string magfield = "2.0"; // 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) - const float magfield_rescale = 1; // scale map if needed - - //--------------- - // Fun4All server - //--------------- - - bool display_on = false; - if(display_on) - { - gROOT->LoadMacro("DisplayOn.C"); - } - - 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." << endl; - exit(1); - } - } - else - { - // running Geant4 stage. First load event generators. - - if (readhepmc) - { - // place holder. Additional action is performed in later stage at the input manager level - } - - if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8 *pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia8 - if (readhepmc) - pythia8->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 - // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available - se->registerSubsystem(pythia8); - } - - if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia6 - if (readhepmc) - pythia6->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 - // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available - se->registerSubsystem(pythia6); - } - - // 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 || do_embedding || runpythia8 || runpythia6) - { - 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, jleic_shiftz); - 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, 20.0); - gen->Embed(2); - 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(-40, -40); - pgen->set_eta_range(0.01, 0.01); - pgen->set_mom_range(10, 10); - pgen->set_phi_range(-1 * TMath::Pi(), 1 * 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 - - for(int iups = 0; iups < num_upsilons_per_event;iups++) - { - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+", "e-", 0); // i = decay id - // event vertex - if (readhepmc || do_embedding || particles || runpythia8 || runpythia6) - { - vgen->set_reuse_existing_vertex(true); - } - - // 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(3); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - } - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - G4Setup(absorberactive, magfield, EDecayType::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline, magfield_rescale); -#else - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_ctd, do_vtx, do_magnet, do_pipe, do_gem, do_jldirc, do_barrel_hcal, do_drich, do_endcap_electron, do_endcap_hadron, do_beamline, magfield_rescale); -#endif - } - - //-------------- - // IO management - //-------------- - - if (readhits) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - // 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); - } - - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - 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) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager("HepMCInput_1"); - se->registerInputManager(in); - se->fileopen(in->Name().c_str(), inputFile); - //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space, time - //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space, time - // //optional choice of vertex distribution function in space, time - //in->set_vertex_distribution_function(PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Uniform,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 - //in->set_embedding_id(2); - } - 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 (pileup_collision_rate > 0) - { - // pile up simulation. - // add random beam collisions following a collision diamond and rate from a HepMC stream - Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); - se->registerInputManager(pileup); - - const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); - //background files for p+p pileup sim - //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); - pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. - //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time - //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time - pileup->set_collision_rate(pileup_collision_rate); - - double time_window_minus = -35000; - double time_window_plus = 35000; -/* - if (do_tracking) - { - // This gets the default drift velocity only! - PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); - assert(dr); - double TpcDriftVelocity = dr->get_double_param("drift_velocity"); - } -*/ - time_window_minus = -105.5 / 5; // ns - time_window_plus = 105.5 / 5; // ns; - pileup->set_time_window(time_window_minus, time_window_plus); // override timing window in ns - cout << "Collision pileup enabled using file " << pileupfile << " with collision rate " << pileup_collision_rate - << " and time window " << time_window_minus << " to " << time_window_plus << endl; - } - - if (do_tracking) - { - Tracking_Reco(); - Tracking_Eval("trkeval.root"); - } - G4HitNtuple *g4h = new G4HitNtuple("G4HitNtuple","/phenix/scratch/pinkenbu/g4hitntuple.root"); - g4h->AddNode("PIPE", 0); - g4h->AddNode("JLVTX",1); - g4h->AddNode("JLCTD",2); - g4h->AddNode("JLDIRC",3); - g4h->AddNode("MAGNET",4); - g4h->AddNode("BARRELHCAL",5); - se->registerSubsystem(g4h); - - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - // if (do_dst_compress) DstCompress(out); - se->registerOutputManager(out); - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return 0; - } - // 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 0; - } - - if(display_on) - { - DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 0; -} - - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunFFALoadTest() {} diff --git a/macros/g4jleic/G4Setup_JLeic.C b/macros/g4jleic/G4Setup_JLeic.C deleted file mode 100644 index 6ddb139f0..000000000 --- a/macros/g4jleic/G4Setup_JLeic.C +++ /dev/null @@ -1,268 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "G4_Pipe.C" -#include "G4_VTX.C" -#include "G4_CTD.C" -#include "G4_Magnet.C" -#include "G4_Gem.C" -#include "G4_JLDIRC.C" -#include "G4_Barrel_Hcal.C" -#include "G4_BeamLine.C" -#include "G4_DRich.C" -#include "G4_EndCap_Electron.C" -#include "G4_EndCap_Hadron.C" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -class SubsysReco; -R__LOAD_LIBRARY(libg4decayer.so) -R__LOAD_LIBRARY(libg4detectors.so) -#else -bool overlapcheck = false; // set to true if you want to check for overlaps -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -#endif - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunLoadTest() {} - -void G4Init(const bool do_ctd = true, - const bool do_vtx = true, - const bool do_magnet = true, - const bool do_pipe = true, - const bool do_gem = true, - const bool do_jldirc = true, - const bool do_barrel_hcal = true, - const bool do_drich = true, - const bool do_endcap_electron = true, - const bool do_endcap_hadron = true, - const bool do_beamline = true - ) - { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_ctd) - { - gROOT->LoadMacro("G4_CTD.C"); - CTDInit(); - } - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_gem) - { - gROOT->LoadMacro("G4_Gem.C"); - GemInit(); - } - if (do_jldirc) - { - gROOT->LoadMacro("G4_JLDIRC.C"); - JLDIRCInit(); - } - - if (do_barrel_hcal) - { - gROOT->LoadMacro("G4_Barrel_Hcal.C"); - Barrel_HcalInit(); - } - - if (do_drich) - { - gROOT->LoadMacro("G4_DRich.C"); - DRichInit(); - } - - if (do_endcap_electron) - { - gROOT->LoadMacro("G4_EndCap_Electron.C"); - EndCap_ElectronInit(); - } - - if (do_endcap_hadron) - { - gROOT->LoadMacro("G4_EndCap_Hadron.C"); - EndCap_HadronInit(); - } - if (do_beamline) - { - gROOT->LoadMacro("G4_BeamLine.C"); - BeamLineInit(); - } - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="2.0", -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - const EDecayType decayType = EDecayType::kAll, -#else - const EDecayType decayType = TPythia6Decayer::kAll, -#endif - const bool do_ctd = true, - const bool do_vtx = true, - const bool do_magnet = true, - const bool do_pipe = true, - const bool do_gem = true, - const bool do_jldirc = true, - const bool do_barrel_hcal = true, - const bool do_drich = true, - const bool do_endcap_electron = true, - const bool do_endcap_hadron = true, - const bool do_beamline = true, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - - 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 ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - if (decayType != EDecayType::kAll) -#else - if (decayType != TPythia6Decayer::kAll) -#endif - { - 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, PHFieldConfig::Field3DCartesian); - } else { - g4Reco->set_field_map(field, PHFieldConfig::kField2D); - } - } 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); - - //---------------------------------------- - // VTX - if (do_vtx) radius = VTX(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CTD - if (do_ctd) radius = CTD(g4Reco, radius, absorberactive); - - //---------------------------------------- - // DIRC - if (do_jldirc) radius = JLDIRC(g4Reco, radius, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // Barrel Hcal - - if (do_barrel_hcal) radius = Barrel_Hcal(g4Reco, radius, 0, absorberactive); - - - //---------------------------------------- - // Gem (hadron and electron going side - - if (do_gem) double tmp = Gem(g4Reco, radius, 0, absorberactive); - - if (do_drich) double tmp = DRich(g4Reco, radius, 0, absorberactive); - - if (do_endcap_electron) double tmp = EndCap_Electron(g4Reco, radius, 0, absorberactive); - - if (do_endcap_hadron) double tmp = EndCap_Hadron(g4Reco, radius, 0, absorberactive); - - if (do_beamline) double tmp = BeamLine(g4Reco, radius, 0, absorberactive); - radius = 200.; - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 0); -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); - blackhole->SuperDetector("BLACKHOLE"); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BLACKHOLE"); -// 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", 2); - blackhole->SuperDetector("BLACKHOLE"); -// 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 ); - return 0; -} diff --git a/macros/g4jleic/G4_Barrel_Hcal.C b/macros/g4jleic/G4_Barrel_Hcal.C deleted file mode 100644 index 634eb05c7..000000000 --- a/macros/g4jleic/G4_Barrel_Hcal.C +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void Barrel_HcalInit() {} - -double Barrel_Hcal(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: -// double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double inner_radius = 144.; // solenoid Rout - double outer_radius = 144.+100.; // out barrel hcal thickness - double size_z = 460.; // magnet (400) + endcap (60) - double gap = 2.; - double thickness = 2.; // cm - if (radius > inner_radius) - { - cout << "inconsistency: radius: " << radius - << " larger than Barrel Hcal inner radius: " << inner_radius << endl; - gSystem->Exit(-1); - } - - PHG4CylinderSubsystem *cyl; - radius = inner_radius; - for (int ilayer = 0; ilayer < 25; ilayer++) - { - if (radius > outer_radius) - { - continue; - } - cyl = new PHG4CylinderSubsystem("BARRELHCAL", ilayer); - cyl->set_double_param("radius",radius); - cyl->set_string_param("material","G4_Fe"); - cyl->set_double_param("thickness",thickness); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",size_z); -// cyl->set_double_param("place_z",shift_z); - cyl->SetActive(); - cyl->SuperDetector("BARRELHCAL"); - g4Reco->registerSubsystem( cyl ); - radius += gap + thickness; - } - return outer_radius; -} diff --git a/macros/g4jleic/G4_BeamLine.C b/macros/g4jleic/G4_BeamLine.C deleted file mode 100644 index 9b67ab776..000000000 --- a/macros/g4jleic/G4_BeamLine.C +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4jleic.so) -#endif -void BeamLineInit() {} - -double BeamLine(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - const char *fname[2]= {"ion_ir_200.txt","e_ir_10.txt"} ; - gSystem->Load("libg4jleic.so"); - gSystem->Load("libg4testbench.so"); - G4JLeicBeamLineMagnetSubsystem *bl = nullptr; - int imagnet=0; - for (int fi=0; fi<2; fi++) - { - std::ifstream infile(fname[fi]); - if (infile.is_open()) - { - double biggest_z = 0.; - std::string line; - while (std::getline(infile, line)) - { - if (line.find("QUADRUPOLE") != string::npos || - line.find("KICKER") != string::npos || - (line.find("RBEND") != string::npos && fi == 0) || - (line.find("SOLENOID") != string::npos && fi == 0)) - { - std::istringstream iss(line); - string magname; - string magtype; - double length; - double half_aper; - double inner_radius; - double outer_radius; - double dipole_field_x; - double dipole_field_y; - double quad_field_n; - double quad_field_s; - double sext_field; - double solenoid_field; - double x; - double y; - double z; - double theta; - double phi; - - if (!(iss >> magname >> magtype >> length >> half_aper - >> inner_radius >> outer_radius >> dipole_field_x - >> dipole_field_y - >> quad_field_n >> quad_field_s >> sext_field >> solenoid_field - >> x >> y >> z >> theta >> phi)) { break; } // error - else - { -// convert to our units (cm, deg) - x *= 100.; - y *= 100.; - z *= 100.; - length *= 100.; - theta = theta/TMath::Pi()*360.; - bl = new G4JLeicBeamLineMagnetSubsystem("BEAMLINE",imagnet); - if (magtype == "RBEND" || magtype == "KICKER") - { - magtype = "DIPOLE"; - } - bl->set_double_param("field_x",dipole_field_x); - bl->set_double_param("field_y",dipole_field_y); - bl->set_double_param("fieldgradient",quad_field_n); - bl->set_string_param("magtype",magtype); - bl->set_double_param("length",length); - bl->set_double_param("place_x",x); - bl->set_double_param("place_y",y); - bl->set_double_param("place_z",z); - bl->set_double_param("rot_y",theta); - bl->set_double_param("inner_radius",inner_radius); - bl->set_double_param("outer_radius", outer_radius); - bl->SetActive(); - if (absorberactive) - { - bl->SetAbsorberActive(); - } - bl->OverlapCheck(overlapcheck); - bl->SuperDetector("BEAMLINE"); - g4Reco->registerSubsystem(bl); - imagnet++; - if (fabs(z)+length > biggest_z) - { - biggest_z = fabs(z)+length; - } - } - } - } - if (biggest_z*2. > g4Reco->GetWorldSizeZ()) - { - g4Reco->SetWorldSizeZ(biggest_z*2.+200.); // leave 1m on both sides - } - infile.close(); - } - } - radius = 85.; - return radius; -} diff --git a/macros/g4jleic/G4_CTD.C b/macros/g4jleic/G4_CTD.C deleted file mode 100644 index 65a021a59..000000000 --- a/macros/g4jleic/G4_CTD.C +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void CTDInit() {} - -double CTD(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double inner_radius = 21.; // cm - double outer_radius = 80.; // cm - double size_z = 340.; - double si_layer_gap = 5.; - double si_thickness = 0.001; // cm - if (radius > inner_radius) - { - cout << "inconsistency: radius: " << radius - << " larger than CTD inner radius: " << inner_radius << endl; - gSystem->Exit(-1); - } - - PHG4CylinderSubsystem *cyl; - for (int ilayer = 0; ilayer < 15; ilayer++) - { - radius = inner_radius + ilayer*si_layer_gap; - if (radius+si_thickness > outer_radius) - { - continue; - } - cyl = new PHG4CylinderSubsystem("JLCTD", ilayer); - cyl->set_color(0.1, 0, 1., 0.1); - cyl->set_double_param("radius",radius); - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",si_thickness); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("place_z",shift_z); - cyl->SetActive(); - cyl->SuperDetector("JLCTD"); - cyl->set_double_param("length",size_z); - g4Reco->registerSubsystem( cyl ); - } - radius += si_thickness + no_overlapp; - return outer_radius; -} diff --git a/macros/g4jleic/G4_DRich.C b/macros/g4jleic/G4_DRich.C deleted file mode 100644 index 2aefd9134..000000000 --- a/macros/g4jleic/G4_DRich.C +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void DRichInit() {} - -double DRich(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double drich_inner_radius = 20.; // cm - double drich_outer_radius = 150.; // cm - double size_z = 170.; - double place_z = 400./2.-jleic_shiftz+size_z/2.; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("DRICH", 0); - cyl->set_color(1.,1.,0.2,0.2); - cyl->set_double_param("radius",drich_inner_radius); - cyl->set_string_param("material","G4_CARBON_DIOXIDE"); - cyl->set_double_param("thickness",drich_outer_radius - drich_inner_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",place_z); - cyl->SetActive(); - cyl->SuperDetector("DRICH"); - g4Reco->registerSubsystem( cyl ); - - - return radius; -} diff --git a/macros/g4jleic/G4_EndCap_Electron.C b/macros/g4jleic/G4_EndCap_Electron.C deleted file mode 100644 index f815653a7..000000000 --- a/macros/g4jleic/G4_EndCap_Electron.C +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void EndCap_ElectronInit() {} - -double EndCap_Electron(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double electron_inner_radius = 20.; // cm - double electron_outer_radius = 244.; // cm - double size_z = 60.; - double place_z = -400./2.+jleic_shiftz-size_z/2.; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("ECELECTRON", 0); - cyl->set_double_param("radius",electron_inner_radius); - cyl->set_string_param("material","G4_Fe"); - cyl->set_double_param("thickness",electron_outer_radius - electron_inner_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",place_z); - cyl->SetActive(); - cyl->SuperDetector("ECELECTRON"); - g4Reco->registerSubsystem( cyl ); - - - return radius; -} diff --git a/macros/g4jleic/G4_EndCap_Hadron.C b/macros/g4jleic/G4_EndCap_Hadron.C deleted file mode 100644 index 4059be5b3..000000000 --- a/macros/g4jleic/G4_EndCap_Hadron.C +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void EndCap_HadronInit() {} - -double EndCap_Hadron(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double hadron_inner_radius = 80.; // cm - double hadron_outer_radius = 243.; // cm - PHG4CylinderSubsystem *mothervol = new PHG4CylinderSubsystem("EndCapHadronContainer",0); - mothervol->set_color(0.3,0,3.,0.1); - mothervol->set_double_param("radius",20.); - mothervol->set_string_param("material","G4_AIR"); - mothervol->set_double_param("thickness",hadron_outer_radius - 20.); - mothervol->set_double_param("length",250.); - mothervol->set_int_param("lengthviarapidity",0); - mothervol->set_double_param("place_z", 400./2.-jleic_shiftz+250/2.+170.); - g4Reco->registerSubsystem( mothervol ); - double size_z = 2.; - double gap = 2.; - double z_start = size_z/2.-250./2.; - int nlayer=25; - for (int i=0; iSetMotherSubsystem(mothervol); - cyl->set_color(0.6, 0, 0.6, 1); - cyl->set_double_param("radius",hadron_inner_radius); - cyl->set_string_param("material","G4_Fe"); - cyl->set_double_param("thickness",hadron_outer_radius - hadron_inner_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - cyl->set_double_param("place_z",z_start); - cyl->SetActive(); - cyl->SuperDetector("ECHADRON"); - z_start+=gap+size_z; - g4Reco->registerSubsystem( cyl ); - } - return radius; -} diff --git a/macros/g4jleic/G4_Gem.C b/macros/g4jleic/G4_Gem.C deleted file mode 100644 index 0bb104e9f..000000000 --- a/macros/g4jleic/G4_Gem.C +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void GemInit() {} - -double Gem(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // here is our silicon: - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - double gem_inner_radius = 0.; // cm - double gem_outer_radius = 115.; // cm - double size_z = 1.; - PHG4CylinderSubsystem *cyl; - for (int ilayer=0; ilayer<8; ilayer++) - { - double irad = gem_inner_radius + 1. + 0.5*ilayer; - double orad = gem_outer_radius - 25. + 2.*ilayer; - cyl = new PHG4CylinderSubsystem("GemHadron", ilayer); - cyl->set_double_param("radius",irad); - cyl->set_string_param("material","G4_CARBON_DIOXIDE"); - cyl->set_double_param("thickness",orad-irad); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - double place_z = 340./2. + shift_z + 5. + 3.*ilayer; - cyl->set_double_param("place_z",place_z); - cyl->SetActive(); - cyl->SuperDetector("GEMHADRON"); - g4Reco->registerSubsystem( cyl ); - } - for (int ilayer=0; ilayer<8; ilayer++) - { - double irad = gem_inner_radius + 1. + 0.5*ilayer; - double orad = gem_outer_radius - 25. + 2.*ilayer; - cyl = new PHG4CylinderSubsystem("GEMELECTRON", ilayer); - cyl->set_double_param("radius",gem_inner_radius); - cyl->set_string_param("material","G4_CARBON_DIOXIDE"); - cyl->set_double_param("thickness",orad - irad); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length", size_z); - double place_z = -340./2. + shift_z -5. - 3.*ilayer; - cyl->set_double_param("place_z",place_z); - cyl->SetActive(); - cyl->SuperDetector("GEMELECTRON"); - g4Reco->registerSubsystem( cyl ); - } - - return radius; -} diff --git a/macros/g4jleic/G4_JLDIRC.C b/macros/g4jleic/G4_JLDIRC.C deleted file mode 100644 index 501627e13..000000000 --- a/macros/g4jleic/G4_JLDIRC.C +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4jleic.so) -#endif -void JLDIRCInit() {} - -double JLDIRC(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - gSystem->Load("libg4jleic.so"); - gSystem->Load("libg4testbench.so"); - if (radius > 81) - { - cout << "radius " << radius << " too large (>81) to fit DIRC" << endl; - exit(1); - } - G4JLeicDIRCSubsystem *jldirc = new G4JLeicDIRCSubsystem(); - jldirc->SetActive(); - jldirc->SuperDetector("JLDIRC"); - g4Reco->registerSubsystem(jldirc); - radius = 85.; - return radius; -} diff --git a/macros/g4jleic/G4_Magnet.C b/macros/g4jleic/G4_Magnet.C deleted file mode 100644 index 1d15684f9..000000000 --- a/macros/g4jleic/G4_Magnet.C +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void MagnetInit() {} - -double Magnet(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) { - - double magnet_inner_radius = 130; - double magnet_outer_radius = 143; - double magnet_length = 400.; - if (radius > magnet_inner_radius) { - cout << "inconsistency: radius: " << radius - << " larger than Magnet inner radius: " << magnet_inner_radius << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - radius = magnet_inner_radius; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("MAGNET", 0); - cyl->set_double_param("radius",magnet_inner_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",magnet_length); - cyl->set_double_param("thickness",magnet_outer_radius - magnet_inner_radius); - cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->set_double_param("place_z",-40.); - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - radius = magnet_outer_radius; // outside of magnet - - if (verbosity > 0) { - cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; - cout << " MAGNET Material Description:" << endl; - cout << " inner radius = " << magnet_inner_radius << " cm" << endl; - cout << " outer radius = " << magnet_outer_radius << " cm" << endl; - cout << " length = " << magnet_length << " cm" << endl; - cout << "===========================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} diff --git a/macros/g4jleic/G4_Pipe.C b/macros/g4jleic/G4_Pipe.C deleted file mode 100644 index 7f5ccb62f..000000000 --- a/macros/g4jleic/G4_Pipe.C +++ /dev/null @@ -1,117 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -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 = 120.; // 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"); - double shift_z = jleic_shiftz; // shift z from GlobalVariables.C - // mid-rapidity beryillium pipe - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0); - cyl->set_double_param("place_z",shift_z); - 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 ); - - cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("place_z",shift_z); - 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+shift_z); - 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+shift_z); - 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+shift_z); - 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+shift_z); - 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/g4jleic/G4_Tracking_EIC.C b/macros/g4jleic/G4_Tracking_EIC.C deleted file mode 100644 index 34216853b..000000000 --- a/macros/g4jleic/G4_Tracking_EIC.C +++ /dev/null @@ -1,127 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include -#include -#include -#include -class SubsysReco; -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) -#endif - - -void Tracking_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4trackfastsim.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(verbosity); - - kalman->set_use_vertex_in_fitting(false); -// kalman->set_vertex_xy_resolution(50E-4); -// kalman->set_vertex_z_resolution(50E-4); - - kalman->set_sub_top_node_name("TRACKS"); - kalman->set_trackmap_out_name("KalFitTrackMap"); - - // VTX - kalman->add_phg4hits( - "G4HIT_JLVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 20e-4, // const float radres, - 20e-4, // const float phires, - 20e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // CTD - kalman->add_phg4hits( - "G4HIT_JLCTD", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-2, // const float radres, - 5e-2, // const float phires, - 5e-2, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); -// - // GEM0, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_GEMHADRON", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM1, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_GEMHADRON", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // Saved track states (projections) -// kalman->add_state_name("JLDIRC"); -// kalman->add_state_name("FHCAL"); - - se->registerSubsystem(kalman); - - return; -} - -void Tracking_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4trackfastsim.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(false); - // eval->do_g4hit_eval(false); - // eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... - // 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); - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval",outputfile,"KalFitTrackMap"); - fast_sim_eval->set_filename(outputfile.c_str()); - se->registerSubsystem(fast_sim_eval); -} diff --git a/macros/g4jleic/G4_VTX.C b/macros/g4jleic/G4_VTX.C deleted file mode 100644 index d9b14659b..000000000 --- a/macros/g4jleic/G4_VTX.C +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4jleic.so) -#endif -void VTXInit() {} - -double VTX(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - gSystem->Load("libg4jleic.so"); - gSystem->Load("libg4testbench.so"); - if (radius > 3.5) - { - cout << "radius too large to fit VTX" << endl; - exit(1); - } - G4JLeicVTXSubsystem *jlvtx = new G4JLeicVTXSubsystem(); - jlvtx->SetActive(); - jlvtx->SuperDetector("JLVTX"); - g4Reco->registerSubsystem(jlvtx); - radius = 15.5; - return radius; -} diff --git a/macros/g4jleic/GlobalVariables.C b/macros/g4jleic/GlobalVariables.C deleted file mode 100644 index 9b679af97..000000000 --- a/macros/g4jleic/GlobalVariables.C +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -static bool overlapcheck = false; -static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -static double jleic_shiftz = -40.; // JLeic is shifted by 40 cm wrp origin -#endif diff --git a/macros/g4jleic/e_ir_10.txt b/macros/g4jleic/e_ir_10.txt deleted file mode 100644 index ea9bf5a57..000000000 --- a/macros/g4jleic/e_ir_10.txt +++ /dev/null @@ -1,24 +0,0 @@ - -Detector region electron elements -10 GeV/c electrons (use more digits to calculate the brho) - -Element name Type Length [m] Good field half-aperture [cm] Inner Half-A [cm] Outer Radius [cm] Dipole field [T] Quadrupole field [T/m] Sextupole [T/m^2] Solenoid [T] X center [m] Y center [m] Z center [m] Theta center [rad] Phi [rad] -Downstream elements (second focusing point approximately in the middle of chicane) Bx By Normal Skew -eBDS6 RBEND 3 1.8 4.5 11 0 0.44 0 0 0 0 -0.030 0 -34.5 -0.02 0 -eBDS5 RBEND 3 1.8 4.5 11 0 -0.42 0 0 0 0 -0.260 0 -27.3 -0.0213 0 -eBDS4 RBEND 0.5 1.8 4.5 11 0 -0.17 0 0 0 0 -0.293 0 -25.0 -0.00125 0 -eBDS3 RBEND 0.5 1.8 4.5 11 0 -0.17 0 0 0 0 -0.293 0 -21.3 0.00125 0 -eBDS2 RBEND 3 1.8 4.5 11 0 -0.42 0 0 0 0 -0.260 0 -19.1 0.0213 0 -eBDS1 RBEND 3 1.8 4.5 11 0 0.44 0 0 0 0 -0.030 0 -11.9 0.02 0 -eASDS SOLENOID 1.2 2.2 4.5 11 0 0 0 0 0 -4 0 0 -7 0 0 -eQDS3 QUADRUPOLE 0.6 2.4 4.5 10 0 0 -18.7 -2.71 0 0 0 0 -5.6 0 0 -eQDS2 QUADRUPOLE 0.6 2.8 4.5 8.5 0 0 36.2 5.25 0 0 0 0 -4.4 0 0 -eQDS1 QUADRUPOLE 0.6 1.7 4.5 8 0 0 -33.7 -4.89 0 0 0 0 -2.5 0 0 -eDSDS SOLENOID 1.6 2 160 210 0 0 0 0 0 3 0 0 -0.8 0 0 - -Upstream elements -eDSUS SOLENOID 2.4 2 160 210 0 0 0 0 0 3 0 0 1.2 0 0 -eQUS1 QUADRUPOLE 0.6 2 4.5 10 0 0 -36.9 8.10 0 0 0 0 3.26 0 0 -eQUS2 QUADRUPOLE 0.6 3.2 4.5 11 0 0 33.7 -7.38 0 0 0 0 4.46 0 0 -eQUS3 QUADRUPOLE 0.6 1.5 4.5 11 0 0 -20.8 4.56 0 0 0 0 8.01 0 0 -eASUS SOLENOID 1.8 2.2 4.5 11 0 0 0 0 0 -4 0 0 9.61 0 0 diff --git a/macros/g4jleic/init_gui_vis.mac b/macros/g4jleic/init_gui_vis.mac deleted file mode 100644 index 8aca21396..000000000 --- a/macros/g4jleic/init_gui_vis.mac +++ /dev/null @@ -1,20 +0,0 @@ -# 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/g4jleic/ion_ir_200.txt b/macros/g4jleic/ion_ir_200.txt deleted file mode 100644 index d1cbc4106..000000000 --- a/macros/g4jleic/ion_ir_200.txt +++ /dev/null @@ -1,83 +0,0 @@ -Detector region ion elements -momentum 200 GeV/c - -Element name Type Length [m] Good field half-aperture [cm] Inner Half-A [cm] Outer Radius [cm] Dipole field [T] Quadrupole field [T/m] Sextupole [T/m^2] Solenoid [T] X center [m] Y center [m] Z center [m] Theta center [rad] Phi [rad] -Upstream elements Bx By Normal Skew -iASUS SOLENOID 1.6 3 4 12 0 0 0 0 0 0 0.639733367 0 -12.78400333 -0.05 0 -iQUS3S QUADRUPOLE 0.5 3 4 12 0 0 0 0 0 0 0.567263571 0 -11.33581546 -0.05 0 -iQUS2 QUADRUPOLE 2.1 3 4 12 0 0 93.39904288 0 0 0 0.492294817 0 -9.837690066 -0.05 0 -iQUS2S QUADRUPOLE 0.5 2 3 10 0 0 0 0 0 0 0.417326063 0 -8.339564674 -0.05 0 -iQUS1b QUADRUPOLE 1.45 2 3 10 0 0 -95.10673243 0 0 0 0.35860054 0 -7.166033119 -0.05 0 -iQUS1S QUADRUPOLE 0.5 2 3 10 0 0 0 0 0 0 0.299875016 0 -5.992501562 -0.05 0 -iQUS1A QUADRUPOLE 1.45 2 3 10 0 0 -95.10673243 0 0 0 0.241149492 0 -4.818970007 -0.05 0 -iCUS1 KICKER 0.3 2 3 10 0 0 0 0 0 0 0.187421885 0 -3.745313477 -0.05 0 -iCUS2 KICKER 0.3 2 3 10 0 0 0 0 0 0 0.1624323 0 -3.245938346 -0.05 0 - -Downstream elements -iBDS1a RBEND 1.499999437 4 38.5 48.5 0 1.3342564 0 0 0 0 -0.288222883 0 5.742771125 -0.0515 0 -iQDS1a QUADRUPOLE 2.25 4 9.2 23.1 0 0 -37.24620638 0 0 0 -0.413196359 0 8.114480214 -0.053 0 -iQDS1S QUADRUPOLE 0.5 4 9.9 24.8 0 0 0 0 0 0 -0.496632284 0 9.687268644 -0.053 0 -iQDS1b QUADRUPOLE 2.25 4 12.3 31.0 0 0 -37.24620638 0 0 0 -0.58006821 0 11.26005708 -0.053 0 -iQDS2S QUADRUPOLE 0.5 4 13.0 32.7 0 0 0 0 0 0 -0.663504135 0 12.83284551 -0.053 0 -iQDS2 QUADRUPOLE 4.5 4 17.7 44.4 0 0 25.96076478 0 0 0 -0.80653715 0 15.52905425 -0.053 0 -iQDS3S QUADRUPOLE 0.5 4 18.4 46.2 0 0 0 0 0 0 -0.949570164 0 18.22526298 -0.053 0 -iASDS SOLENOID 1.2 4 19.8 49.7 0 0 0 0 0 0 -1.005194115 0 19.2737886 -0.053 0 -iBDS2 RBEND 7.999063697 4 40 90 0 -4.419724325 0 0 0 0 -1.270096426 0 25.76770364 -0.0265 0 -iBDS3 RBEND 6.499239262 4.5 4.5 30 0 5.439660708 0 0 0 0 -1.414164881 0 44.56372384 -0.0265 0 -iQDS4 QUADRUPOLE 0.8 3.5 4.5 30 0 0 150.2308213 0 0 0 -1.791435874 0 52.89448481 -0.053 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/macros/g4jleic/vis.mac b/macros/g4jleic/vis.mac deleted file mode 100644 index 3c3fae86c..000000000 --- a/macros/g4jleic/vis.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 1200x900-0+0 -#/vis/open OGLSX 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 -# 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 2 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. From 4539c275b607828d1bf089b7168050b9511e08bf Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 11 Dec 2019 15:36:05 -0500 Subject: [PATCH 0375/1222] Enable printing of random seeds for rare problem debugging --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d8fad92aa..d44c118fa 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,4 +1,5 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include #include #include #include @@ -175,6 +176,10 @@ int Fun4All_G4_sPHENIX( 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 From 842a9567bf590f9cf43d1ea9cfa0201e869bc083 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Wed, 11 Dec 2019 18:28:40 -0500 Subject: [PATCH 0376/1222] Configure 3-D TopoCluster reconstruction --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 9 ++++++ macros/g4simulations/G4_TopoClusterReco.C | 34 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 macros/g4simulations/G4_TopoClusterReco.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d44c118fa..767feecc3 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -141,6 +141,9 @@ int Fun4All_G4_sPHENIX( // simulations which don't particularly care about jets) bool do_HIjetreco = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; + // 3-D topoCluster reconstruction in both HCal layers -- requires towers from both + bool do_topocluster = false && 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 @@ -451,6 +454,12 @@ int Fun4All_G4_sPHENIX( HIJetReco(); } + if (do_topoCluster) + { + gROOT->LoadMacro("G4_TopoClusterReco.C"); + TopoClusterReco(); + } + //---------------------- // Simulation evaluation //---------------------- diff --git a/macros/g4simulations/G4_TopoClusterReco.C b/macros/g4simulations/G4_TopoClusterReco.C new file mode 100644 index 000000000..0c9e9642d --- /dev/null +++ b/macros/g4simulations/G4_TopoClusterReco.C @@ -0,0 +1,34 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcalo_reco.so) +#endif + +void TopoClusterRecoInit() {} + +void TopoClusterReco(int verbosity = 0) { + + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libcalo_reco.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawClusterBuilderTopo* ClusterBuilder = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo"); + ClusterBuilder->Verbosity( verbosity ); + ClusterBuilder->set_noise( 0.0025 , 0.006 ); + ClusterBuilder->set_significance( 4.0 , 2.0 , 0.0 ); + ClusterBuilder->allow_corner_neighbor( true ); + se->registerSubsystem( ClusterBuilder ); + + return; + +} From d3be86239a7a4693fb90c02778ef86394eb9eeab Mon Sep 17 00:00:00 2001 From: bogui56 Date: Fri, 13 Dec 2019 06:06:08 -0500 Subject: [PATCH 0377/1222] split clustering and tracking to write cluster files --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 18 +- macros/g4simulations/G4_Tracking.C | 20 ++- .../g4simulations/ReadClustersRunTracking.C | 165 ++++++++++++++++++ 3 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 macros/g4simulations/ReadClustersRunTracking.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d44c118fa..1003057c8 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -82,6 +82,10 @@ int Fun4All_G4_sPHENIX( // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. + const bool do_write_output = false; + // To write cluster files set do_write_output = true and set + // do_tracking = true, do_tracking_cell = true, do_tracking_cluster = true and + // leave the tracking for later do_tracking_track = false, do_tracking_eval = false //====================== // What to run @@ -93,7 +97,8 @@ int Fun4All_G4_sPHENIX( bool do_tracking = true; bool do_tracking_cell = do_tracking && true; - bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_cluster = do_tracking_cell && true; + bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; bool do_pstof = false; @@ -407,6 +412,8 @@ int Fun4All_G4_sPHENIX( // SVTX tracking //-------------- + if (do_tracking_cluster) Tracking_Clus(); + if (do_tracking_track) Tracking_Reco(); //----------------- @@ -575,10 +582,11 @@ int Fun4All_G4_sPHENIX( /*bool*/ do_hcalout_twr); } - // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - // if (do_dst_compress) DstCompress(out); - // se->registerOutputManager(out); - + if(do_write_output) { + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); + } //----------------- // Event processing //----------------- diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 49cdb8d10..39a12f470 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -310,7 +310,7 @@ void Tracking_Cells(int verbosity = 0) return; } -void Tracking_Reco(int verbosity = 0) +void Tracking_Clus(int verbosity = 0) { // processes the TrkrHits to make clusters, then reconstruct tracks and vertices @@ -465,6 +465,24 @@ void Tracking_Reco(int verbosity = 0) tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); +} + +void Tracking_Reco(int verbosity = 0) +{ + // processes the TrkrHits to make clusters, then reconstruct tracks and vertices + + //--------------- + // Load libraries + //--------------- + gSystem->Load("libfun4all.so"); + gSystem->Load("libtrack_reco.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + //------------- // Tracking //------------ diff --git a/macros/g4simulations/ReadClustersRunTracking.C b/macros/g4simulations/ReadClustersRunTracking.C new file mode 100644 index 000000000..2a4bc81db --- /dev/null +++ b/macros/g4simulations/ReadClustersRunTracking.C @@ -0,0 +1,165 @@ +/*! + * \file RunGenFit.C + * \brief Example macro to run PHG4KalmanPatRec + * \author Haiwang Yu + */ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include "GlobalVariables.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 + + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtrack_reco.so) +#endif + +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4Setup_sPHENIX.C" +#include "G4_Bbc.C" +#include "G4_Global.C" +#include "G4_CaloTrigger.C" +#include "G4_Jets.C" +#include "G4_HIJetReco.C" +#include "G4_DSTReader.C" +#include "DisplayOn.C" +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libphhepmc.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +#endif + + +//#define _ONLY_SEEDING_ +void ReadClustersRunTracking( + const int nEvents = 1, + const char *inputFile = "G4sPHENIX.root", + const char *outputFile = "G4sPHENIX_tracking.root") +{ + + gSystem->Load("libtrack_reco.so"); + + gROOT->LoadMacro("G4Setup_sPHENIX.C"); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(10); + + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libphool.so"); + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4dst.so"); + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4eval.so"); + + gROOT->LoadMacro("G4_Tracking.C"); + + Tracking_Reco(0); + + // explicitely configure the evaluator + SvtxEvaluator* eval; + const int n_maps_layer = 3; + const int n_intt_layer = 4; + int n_gas_layer = 48; + + eval = new SvtxEvaluator("SVTXEVALUATOR", outputFile, "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); + eval->do_cluster_eval(false); + eval->do_g4hit_eval(false); + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(false); + eval->do_eval_light(true); + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(0); + se->registerSubsystem(eval); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); + + TString tstr_input(inputFile); + if (tstr_input.EndsWith(".root")) + in->AddFile(inputFile); + else + in->AddListFile(inputFile); + se->registerInputManager(in); + + se->run(nEvents); + std::cout << " Done Run, ending... " << std::endl; + se->End(); + + se->PrintTimer(); + + std::cout << " Success!! " << std::endl; + // delete se; + gSystem->Exit(0); + + +} + From 0dbc5f6d74ed08e354276626d71fb6b6d78758f6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 13 Dec 2019 17:01:27 -0500 Subject: [PATCH 0378/1222] propagate change from Fun4All_G4_sPHENIX.C to here --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 63e064a00..0f9959c7c 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -76,7 +76,8 @@ int Fun4All_G4_fsPHENIX( // central tracking bool do_tracking = true; bool do_tracking_cell = do_tracking && true; - bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_cluster = do_tracking_cell && true; + bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run @@ -310,6 +311,7 @@ int Fun4All_G4_fsPHENIX( //-------------- // SVTX tracking //-------------- + if (do_tracking_cluster) Tracking_Clus(); if (do_tracking_track) Tracking_Reco(); From 4450b5709819da4f39d5e6c06b01aac97eff1fb4 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Mon, 23 Dec 2019 13:53:22 -0500 Subject: [PATCH 0379/1222] fix typo and includes --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 767feecc3..fe663b7c0 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -26,6 +26,7 @@ #include "G4_CaloTrigger.C" #include "G4_Jets.C" #include "G4_HIJetReco.C" +#include "G4_TopoClusterReco.C" #include "G4_DSTReader.C" #include "DisplayOn.C" R__LOAD_LIBRARY(libfun4all.so) @@ -142,7 +143,7 @@ int Fun4All_G4_sPHENIX( bool do_HIjetreco = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; // 3-D topoCluster reconstruction in both HCal layers -- requires towers from both - bool do_topocluster = false && do_hcalin_twr && do_hcalout_twr; + bool do_topoCluster = false && do_hcalin_twr && do_hcalout_twr; bool do_dst_compress = false; From 70aab0f1751b79e0de205840bb993a7e9e49a652 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 23 Dec 2019 13:56:16 -0500 Subject: [PATCH 0380/1222] set the femc to false by default --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1003057c8..479738b93 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -124,7 +124,7 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_eval = do_hcalout_cluster && true; // forward EMC - bool do_femc = true; + bool do_femc = false; bool do_femc_cell = do_femc && true; bool do_femc_twr = do_femc_cell && true; bool do_femc_cluster = do_femc_twr && true; From 609164ba68cf58ee8cf1dd80fe4a90f4b2c9e378 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Mon, 6 Jan 2020 19:14:32 -0500 Subject: [PATCH 0381/1222] Use a more realistic stave model and MVTX configuration Use stave model from mvtx_stave_01.gdml which implement a more realistic description for Alpide chip and pixel dimentions. A new Mvtx configuration with latest values for layer radius and implementing offset for first stave in layer. --- macros/g4simulations/G4_Tracking.C | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 39a12f470..bbf03da6a 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -56,10 +57,10 @@ R__LOAD_LIBRARY(libtrack_reco.so) // Tracking simulation setup parameters and flag - leave them alone! //============================================== -////////////// MVTX +////////////// MVTX const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers -/////////////// INTT +/////////////// INTT int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, @@ -76,7 +77,7 @@ enum enu_InttDeadMapType // Dead map options for INTT }; enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here -///////////////// TPC +///////////////// TPC int n_tpc_layer_inner = 16; int tpc_layer_rphi_count_inner = 1152; int n_tpc_layer_mid = 16; @@ -121,8 +122,9 @@ double Tracking(PHG4Reco* g4Reco, double radius, // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + double maps_layer_radius[3] = {25.23, 33.36, 41.48}; // mm - numbers from Walt 3 Jan 2019 (Rmid) + double phi_tilt[3] = {0.233, 0.295, 0.297}; // radians - numbers calculated from values given by Walt 3 Jan 2019 + double phi_0[3] = {0.285, 0.199, 0.166}; // radians - rotation offset of first stave // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code // Y. Corrales Morales - removed, no longer used in the code @@ -142,14 +144,18 @@ double Tracking(PHG4Reco* g4Reco, double radius, mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); + mvtx->set_double_param(ilayer,"phi0", phi_0[ilayer]); radius = maps_layer_radius[ilayer]; } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); // 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 - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm + //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm + //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", SegmentationAlpide::PitchRow); // pitch in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", SegmentationAlpide::PitchCol); // length in cm + mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", SegmentationAlpide::SensorLayerThickness); // thickness in cm mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); @@ -511,8 +517,8 @@ void Tracking_Reco(int verbosity = 0) init_zvtx->set_min_zvtx_tracks(init_vertexing_min_zvtx_tracks); init_zvtx->Verbosity(0); se->registerSubsystem(init_zvtx); - } - + } + // find seed tracks using a subset of TPC layers int min_layers = 4; int nlayers_seeds = 12; @@ -541,10 +547,10 @@ void Tracking_Reco(int verbosity = 0) PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); + se->registerSubsystem(init_vtx); // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); pat_rec->Verbosity(0); se->registerSubsystem(pat_rec); } From 87c26fa7c9762962503f168195eb13a36da354f2 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Wed, 15 Jan 2020 22:30:01 -0500 Subject: [PATCH 0382/1222] topoCluster building comes before any jet reco --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 46bdd11e5..a6de5ddd7 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -407,6 +407,13 @@ int Fun4All_G4_sPHENIX( if (do_hcalout_twr) HCALOuter_Towers(); if (do_hcalout_cluster) HCALOuter_Clusters(); + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (do_topoCluster) + { + gROOT->LoadMacro("G4_TopoClusterReco.C"); + TopoClusterReco(); + } + if (do_femc_twr) FEMC_Towers(); if (do_femc_cluster) FEMC_Clusters(); @@ -462,12 +469,6 @@ int Fun4All_G4_sPHENIX( HIJetReco(); } - if (do_topoCluster) - { - gROOT->LoadMacro("G4_TopoClusterReco.C"); - TopoClusterReco(); - } - //---------------------- // Simulation evaluation //---------------------- From c318be0f46bbb6aba8002dd3d9cee7a1ebd151c4 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Thu, 16 Jan 2020 13:47:05 -0500 Subject: [PATCH 0383/1222] New Mvtx model, no user parameter --- macros/g4simulations/G4_Tracking.C | 35 ++++-------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index bbf03da6a..78d688887 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -27,7 +27,6 @@ #include #include -#include #include #include @@ -117,45 +116,19 @@ double Tracking(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - - // Y. Corrales Morales 4Feb2019 - // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector - double maps_layer_radius[3] = {25.23, 33.36, 41.48}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.233, 0.295, 0.297}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - double phi_0[3] = {0.285, 0.199, 0.166}; // radians - rotation offset of first stave - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - // Y. Corrales Morales - removed, no longer used in the code - // int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx + // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " - << " pixel size 30 x 30 microns " - << " active pixel thickness 0.0018 microns" << endl; - mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm - mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - - mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); - mvtx->set_double_param(ilayer,"phi0", phi_0[ilayer]); - - radius = maps_layer_radius[ilayer]; + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + radius = radius_lyr; } mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - // 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 - //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - //mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", SegmentationAlpide::PitchRow); // pitch in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", SegmentationAlpide::PitchCol); // length in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", SegmentationAlpide::SensorLayerThickness); // thickness in cm mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); From 2340348d36f1498f5833909a390b1af82b4637b2 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Fri, 17 Jan 2020 02:51:23 -0500 Subject: [PATCH 0384/1222] Bump new mvtx code to EIC tracking too --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 9261a8763..b6613cda2 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -225,40 +225,19 @@ double Svtx(PHG4Reco* g4Reco, double radius, // MAPS inner barrel layers //====================================================== - - // Y. Corrales Morales 4Feb2019 - // New Mvtx configuration to give 2.0 mm clearance from sPHENIX beam-pipe (Walt 3 Jan 2018) - //TODO: Add function to estimate stave tilt angle from values given by Walt (Rmin, Rmid, Rmax and sensor width) - //TODO: Add default values in PHG4MvtxSubsystem or PHG4MvtxDetector - double maps_layer_radius[3] = {25.69, 33.735, 41.475}; // mm - numbers from Walt 3 Jan 2019 (Rmid) - double phi_tilt[3] = {0.295, 0.303, 0.298}; // radians - numbers calculated from values given by Walt 3 Jan 2019 - - // D. McGlinchey 6Aug2018 - type no longer is used, included here because I was too lazy to remove it from the code - // Y. Corrales Morales - removed, no longer used in the code - // int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX Mvtx + // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) { + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, " - << " pixel size 30 x 30 microns " - << " active pixel thickness 0.0018 microns" << endl; - mvtx->set_double_param(ilayer,"layer_nominal_radius", maps_layer_radius[ilayer]); // thickness in cm - mvtx->set_int_param(ilayer, "N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - - mvtx->set_double_param(ilayer,"phitilt", phi_tilt[ilayer]); - - radius = maps_layer_radius[ilayer]; + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + radius = radius_lyr; } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v02.gdml")); - // 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 - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_x", 0.0030); // pitch in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_z", 0.0030); // length in cm - mvtx->set_double_param(PHG4MvtxDefs::ALPIDE_SEGMENTATION, "pixel_thickness", 0.0018); // thickness in cm + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); From c65123f5fd768f9dfde66d017c89494067635033 Mon Sep 17 00:00:00 2001 From: Barak Schmookler Date: Thu, 30 Jan 2020 12:03:02 -0500 Subject: [PATCH 0385/1222] Modified EEMC and CEMC_EIC Geometry for consistency --- macros/g4simulations/G4_CEmc_EIC.C | 47 +++++++++++++++++++++++------- macros/g4simulations/G4_EEMC.C | 2 +- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index d63d90303..0a8a367c0 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -88,14 +88,17 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // this is the bottom layer length double totalbottomlength = z3 + z4; + //Added by Barak, 12/12/19 + double ztemp = 0; + double layer_shift = 0; + double height = 0; for (int thislayer = min_cemc_layer; thislayer <= max_cemc_layer; thislayer++) { // the length for a particular layer is determined from the bottom length - double thislength = totalbottomlength + height / TMath::Tan(theta1) + - height / TMath::Tan(theta2); - + double thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); + cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "Spacal_W_Epoxy"); @@ -105,7 +108,13 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // starts centered around IP // shift backwards 30 cm for total 370 cm length to cover -1.5set_double_param("place_z", -30); + //cemc->set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + ztemp = radius / TMath::Tan(theta2); + layer_shift = -1. * (ztemp - (thislength/2.)); + cemc->set_double_param("place_z", layer_shift); + cemc->SuperDetector("ABSORBER_CEMC"); if (absorberactive) cemc->SetActive(); @@ -117,6 +126,10 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, radius += no_overlapp; height += tungs_width; + height += no_overlapp; //Added by Barak, 12/13/19 + + //Added by Barak, 12/13/19 + thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); cemc = new PHG4CylinderSubsystem("CEMC", thislayer); cemc->set_double_param("radius", radius); @@ -127,7 +140,11 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->set_double_param("length", thislength); // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + //cemc->set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + cemc->set_double_param("place_z", layer_shift); + cemc->SuperDetector("CEMC"); cemc->SetActive(); @@ -138,6 +155,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, radius += no_overlapp; height += scint_width; + height += no_overlapp; //Added by Barak, 12/13/19 } PHG4CylinderSubsystem *cemc_cyl = @@ -145,13 +163,18 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc_cyl->set_double_param("radius", radius); cemc_cyl->set_string_param("material", "G4_TEFLON"); cemc_cyl->set_double_param("thickness", 0.5); - + double l1 = (radius + 0.5) / TMath::Tan(theta1); double l2 = (radius + 0.5) / TMath::Tan(theta2); cemc_cyl->set_int_param("lengthviarapidity", 0); cemc_cyl->set_double_param("length", l1 + l2); // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + //cemc_cyl->set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + layer_shift = -1.*( (l2 - l1)/2. ); + cemc_cyl->set_double_param("place_z", layer_shift); + if (absorberactive) cemc_cyl->SetActive(); cemc_cyl->OverlapCheck(overlapcheck); @@ -170,9 +193,13 @@ void CEMC_Cells(int verbosity = 0) { cemc_cells->Verbosity(verbosity); double radius = 95; for (int i = min_cemc_layer; i <= max_cemc_layer; i++) { - cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, - 2. * TMath::Pi() / 256. * radius); - radius += (scint_width + tungs_width); + + //Added by Barak, 12/13/19 + radius += (tungs_width + no_overlapp); + if(i>1) radius += (scint_width + no_overlapp); + + cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, 2. * TMath::Pi() / 256. * radius); + } se->registerSubsystem(cemc_cells); diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 4947a8cc7..ea629a911 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -83,7 +83,7 @@ void EEMC_Towers(int verbosity = 0) { ostringstream mapping_eemc; mapping_eemc << getenv("CALIBRATIONROOT") << - "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; + "/CrystalCalorimeter/mapping/towerMap_EEMC_v005.txt"; RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); tower_EEMC->Detector("EEMC"); From 12ad989e56befe876b6bc83914ffbe8a64765be9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 12 Feb 2020 15:18:46 -0500 Subject: [PATCH 0386/1222] use embedding file from phenix web server --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index a6de5ddd7..5af795e4f 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -43,7 +43,7 @@ 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") + const char *embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { //=============== @@ -512,8 +512,9 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4dst.so"); 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 + in1->AddFile(embed_input_file); // if one use a single input file +// in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning se->registerInputManager(in1); } From aaf38f3111deb9180d068408f2144be629851d1b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 12 Feb 2020 15:51:29 -0500 Subject: [PATCH 0387/1222] point to phenix web server for embedding file --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 0f9959c7c..f64351d05 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -34,11 +34,10 @@ R__LOAD_LIBRARY(libPHPythia8.so) #endif 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" - ) + 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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { // Set the number of TPC layer const int n_TPC_layers = 40; // use 60 for backward compatibility only @@ -382,18 +381,21 @@ int Fun4All_G4_fsPHENIX( se->registerInputManager(hitsin); } if (do_embedding) + { + if (embed_input_file == NULL) { - 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); + cout << "Missing embed_input_file! Exit"; + exit(3); } + //meta-lib for DST objects used in simulation outputs + gSystem->Load("libg4dst.so"); + + Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); + in1->AddFile(embed_input_file); // if one use a single input file +// in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning + se->registerInputManager(in1); + } if (readhepmc) { Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); From 3f656ea3aa3a588b1296d3b8386cb020c4e35f5d Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Thu, 20 Feb 2020 10:52:44 -0500 Subject: [PATCH 0388/1222] update topoCluster macros --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 ++-- macros/g4simulations/G4_TopoClusterReco.C | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index a6de5ddd7..09d6de404 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -147,8 +147,8 @@ int Fun4All_G4_sPHENIX( // simulations which don't particularly care about jets) bool do_HIjetreco = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - // 3-D topoCluster reconstruction in both HCal layers -- requires towers from both - bool do_topoCluster = false && do_hcalin_twr && do_hcalout_twr; + // 3-D topoCluster reconstruction, potentially in all calorimeter layers + bool do_topoCluster = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; bool do_dst_compress = false; diff --git a/macros/g4simulations/G4_TopoClusterReco.C b/macros/g4simulations/G4_TopoClusterReco.C index 0c9e9642d..1a7941250 100644 --- a/macros/g4simulations/G4_TopoClusterReco.C +++ b/macros/g4simulations/G4_TopoClusterReco.C @@ -24,7 +24,9 @@ void TopoClusterReco(int verbosity = 0) { RawClusterBuilderTopo* ClusterBuilder = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo"); ClusterBuilder->Verbosity( verbosity ); - ClusterBuilder->set_noise( 0.0025 , 0.006 ); + 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 ); se->registerSubsystem( ClusterBuilder ); From 6753171a008898ce47aa9bd1a7424f09fe981500 Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:01:28 -0500 Subject: [PATCH 0389/1222] Include loading shower profile hists for prob evaluation --- macros/g4simulations/G4_CEmc_EIC.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 0a8a367c0..df3af02ab 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -269,6 +269,11 @@ void CEMC_Clusters(int verbosity = 0) { cemc_clusterbuilder->Detector("CEMC"); 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 femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(cemc_clusterbuilder); } else { cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; From d7ad543f08979ffec2dbfc0b5544e052649f8366 Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:01:45 -0500 Subject: [PATCH 0390/1222] Include loading shower profile hists for prob evaluation --- macros/g4simulations/G4_CEmc_Spacal.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 2cdcce2d8..95a643879 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -411,6 +411,10 @@ void CEMC_Clusters(int verbosity = 0) 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 femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(ClusterBuilder); } else if (Cemc_clusterizer == kCemcGraphClusterizer) From f8c71430be7a990b1107c5c742d51ea05ab6aceb Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:03:23 -0500 Subject: [PATCH 0391/1222] Replace RawClusterBuilderTemplateFEMC with RawClusterBuilderTemplate --- macros/g4simulations/G4_FEMC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 6bbd708b0..817e10337 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -210,7 +210,7 @@ void FEMC_Clusters(int verbosity = 0) { if ( Femc_clusterizer == kFemcTemplateClusterizer ) { - RawClusterBuilderTemplateFEMC *ClusterBuilder = new RawClusterBuilderTemplateFEMC("EmcRawClusterBuilderTemplateFEMC"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); ClusterBuilder->Verbosity(verbosity); ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below From fee857be73b5a969a44307598799e4791b64f35c Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:03:38 -0500 Subject: [PATCH 0392/1222] Replace RawClusterBuilderTemplateFEMC with RawClusterBuilderTemplate --- macros/g4simulations/G4_FEMC_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index de7253dcb..4cdf221c3 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -211,7 +211,7 @@ void FEMC_Clusters(int verbosity = 0) { if ( Femc_clusterizer == kFemcTemplateClusterizer ) { - RawClusterBuilderTemplateFEMC *ClusterBuilder = new RawClusterBuilderTemplateFEMC("EmcRawClusterBuilderTemplateFEMC"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); ClusterBuilder->Verbosity(verbosity); ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below From 396fbe3e67771c306dda9151a5af008ac7fa454b Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:04:26 -0500 Subject: [PATCH 0393/1222] Include ClusterBuilder->SetCylindricalGeometry() --- macros/g4simulations/G4_HcalIn_EIC.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_HcalIn_EIC.C b/macros/g4simulations/G4_HcalIn_EIC.C index 165d5b449..c3c70d6a5 100644 --- a/macros/g4simulations/G4_HcalIn_EIC.C +++ b/macros/g4simulations/G4_HcalIn_EIC.C @@ -181,6 +181,7 @@ void HCALInner_Clusters(int verbosity = 0) { { RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); From c64da78d6e41de091593de82bf9be30f16866ae5 Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:04:41 -0500 Subject: [PATCH 0394/1222] Include ClusterBuilder->SetCylindricalGeometry() --- macros/g4simulations/G4_HcalIn_ref.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index e9f58bd07..27a22ef78 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -244,6 +244,7 @@ void HCALInner_Clusters(int verbosity = 0) { { RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); From 50efc88ad28f688eafff454309ce11802e4f93fd Mon Sep 17 00:00:00 2001 From: shura Date: Thu, 27 Feb 2020 15:04:45 -0500 Subject: [PATCH 0395/1222] Include ClusterBuilder->SetCylindricalGeometry() --- macros/g4simulations/G4_HcalOut_ref.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 41e4e3f49..007f8b5dd 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -168,6 +168,7 @@ void HCALOuter_Clusters(int verbosity = 0) { { RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->SetCylindricalGeometry(); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); } From 07745dcba0fafae7e683ab87f7aead60cbc3dc19 Mon Sep 17 00:00:00 2001 From: shura Date: Tue, 10 Mar 2020 08:45:46 -0400 Subject: [PATCH 0396/1222] Correct a bug in my previous pull request --- macros/g4simulations/G4_CEmc_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index df3af02ab..3ceead828 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -269,10 +269,10 @@ void CEMC_Clusters(int verbosity = 0) { cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below std::string femc_prof = getenv("CALIBRATIONROOT"); femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); + cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(cemc_clusterbuilder); } else { From 1f22a8c6e27e69b25713e56f1d9cad5ac8290cec Mon Sep 17 00:00:00 2001 From: shura Date: Wed, 11 Mar 2020 12:45:00 -0400 Subject: [PATCH 0397/1222] Fixing a bug --- macros/g4simulations/G4_CEmc_EIC.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 3ceead828..8f4b29d2e 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -262,6 +262,11 @@ void CEMC_Clusters(int verbosity = 0) { cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); + cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(cemc_clusterbuilder); } else if (Cemc_clusterizer == kCemcGraphClusterizer) { RawClusterBuilderGraph *cemc_clusterbuilder = @@ -269,11 +274,6 @@ void CEMC_Clusters(int verbosity = 0) { cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); - cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(cemc_clusterbuilder); } else { cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; From 7ef01764efe9862c6323a7531e49067d4c0c16e0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 19 Mar 2020 23:00:26 -0400 Subject: [PATCH 0398/1222] remove obsolete TrkrEvaluator.h --- macros/g4simulations/G4_Tracking.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 78d688887..83e0e4fbb 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -4,7 +4,6 @@ #include -#include #include #include @@ -48,7 +47,7 @@ R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) -//R__LOAD_LIBRARY(libg4hough.so) + #endif #include From 2ed326e68ad96e9dc137e293e8f966c4b726a688 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 26 Mar 2020 22:30:12 -0400 Subject: [PATCH 0399/1222] Tuned tpc cluster resolution fudge factors to produce 150 micron r-phi resolution with Jin's variable GEM gain modification. --- macros/g4simulations/G4_Tracking.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 78d688887..cbda66098 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -4,7 +4,6 @@ #include -#include #include #include @@ -269,14 +268,16 @@ void Tracking_Cells(int verbosity = 0) //========================= PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); + padplane->Verbosity(0); PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); + edrift->Verbosity(0); // 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.12 and 0.15, they can be changed here to get a different resolution - edrift->set_double_param("added_smear_trans",0.12); - edrift->set_double_param("added_smear_long",0.15); + edrift->set_double_param("added_smear_trans",0.085); + edrift->set_double_param("added_smear_long",0.105); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); @@ -409,7 +410,7 @@ void Tracking_Clus(int verbosity = 0) digitpc->SetENC(ENC); double ADC_threshold = 4.0 * ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - + digitpc->Verbosity(0); cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold << " maps+Intt layers set to " << n_maps_layer + n_intt_layer << endl; From cbc20ce0736013957c364183b5b41b6bdb8a954c Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 26 Mar 2020 23:17:39 -0400 Subject: [PATCH 0400/1222] Comment now has correct new defaults. --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index c871fbffb..b606831ea 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -275,7 +275,7 @@ void Tracking_Cells(int verbosity = 0) edrift->Verbosity(0); // 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.12 and 0.15, they can be changed here to get a different resolution + // defaults are 0.085 and 0.105, they can be changed here to get a different resolution edrift->set_double_param("added_smear_trans",0.085); edrift->set_double_param("added_smear_long",0.105); edrift->registerPadPlane(padplane); From 08c701b3442cb838aae5b0aea729a08b3a8bbb67 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 27 Mar 2020 11:19:52 -0400 Subject: [PATCH 0401/1222] Commented out the TPC cluster resolution fudge factors in the macxro, so the defaults in the code will be used. --- macros/g4simulations/G4_Tracking.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index b606831ea..4e183eded 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -276,8 +276,8 @@ void Tracking_Cells(int verbosity = 0) // 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->set_double_param("added_smear_trans",0.085); - edrift->set_double_param("added_smear_long",0.105); + //edrift->set_double_param("added_smear_trans",0.085); + //edrift->set_double_param("added_smear_long",0.105); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); From 05d74df8cd0938c7f267efb478630a4421001227 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Sun, 29 Mar 2020 13:57:06 -0400 Subject: [PATCH 0402/1222] Adding new topoCluster reco options --- macros/g4simulations/G4_TopoClusterReco.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/macros/g4simulations/G4_TopoClusterReco.C b/macros/g4simulations/G4_TopoClusterReco.C index 1a7941250..6de1f4b3e 100644 --- a/macros/g4simulations/G4_TopoClusterReco.C +++ b/macros/g4simulations/G4_TopoClusterReco.C @@ -29,6 +29,9 @@ void TopoClusterReco(int verbosity = 0) { 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( false ); + ClusterBuilder->set_minE_local_max( 1.0, 1.0, 1.0 ); + ClusterBuilder->set_R_shower( 0.025 ); se->registerSubsystem( ClusterBuilder ); return; From b9f1fb47f894dc07121952936bb31c4d8095688f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 30 Mar 2020 19:01:33 -0400 Subject: [PATCH 0403/1222] fix no ref drawing --- macros/QA/calorimeter/QA_Draw_Utility.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index 00d54b165..1533ac1aa 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -199,7 +199,7 @@ double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) } else { - gPad->SetTopMargin(.7); + gPad->SetTopMargin(.07); TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); legend->Draw(); } From 11ff8c75f5c2b914e5d6f0e2f1a30a65dc933bde Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Apr 2020 17:01:44 -0400 Subject: [PATCH 0404/1222] add EIC beam pipe center section --- macros/g4simulations/G4Setup_EICDetector.C | 4 +- macros/g4simulations/G4_Pipe_EIC.C | 67 ++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 macros/g4simulations/G4_Pipe_EIC.C diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index f7164d1d8..fc365a371 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -1,7 +1,7 @@ #pragma once #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" -#include "G4_Pipe.C" +#include "G4_Pipe_EIC.C" #include "G4_Tracking_EIC.C" #include "G4_PSTOF.C" #include "G4_CEmc_EIC.C" @@ -52,7 +52,7 @@ void G4Init(bool do_svtx = true, if (do_pipe) { - gROOT->LoadMacro("G4_Pipe.C"); + gROOT->LoadMacro("G4_Pipe_EIC.C"); PipeInit(); } diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C new file mode 100644 index 000000000..ba54a49ce --- /dev/null +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -0,0 +1,67 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include +#include +#include "GlobalVariables.C" +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void PipeInit() +{ +} + +double Pipe(PHG4Reco* g4Reco, + double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + // extracted via mechanical model: Detector chamber 3-20-20 + // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. + // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here + static const double be_pipe_radius = 3.1000; + static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um based on spec sheet + static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. + static const double be_pipe_length_neg = -79.8; // +z beam pipe extend. + + static const double be_pipe_length = be_pipe_length_plus - be_pipe_length_neg; // pipe length + static const double be_pipe_center = 0.5 * (be_pipe_length_plus + be_pipe_length_neg); + + 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_double_param("place_z", be_pipe_center); + 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); + + 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_double_param("place_z", be_pipe_center); + 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); + + radius = be_pipe_radius + be_pipe_thickness; + + radius += no_overlapp; + + return radius; +} From dd865920849447dfd2b6b42fd326bd789b4d51cd Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Apr 2020 17:03:37 -0400 Subject: [PATCH 0405/1222] update comment --- macros/g4simulations/G4_Pipe_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index ba54a49ce..9820dca16 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -21,7 +21,7 @@ double Pipe(PHG4Reco* g4Reco, static const double be_pipe_radius = 3.1000; static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um based on spec sheet static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. - static const double be_pipe_length_neg = -79.8; // +z beam pipe extend. + static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. static const double be_pipe_length = be_pipe_length_plus - be_pipe_length_neg; // pipe length static const double be_pipe_center = 0.5 * (be_pipe_length_plus + be_pipe_length_neg); From 39bd421ef20e6ff7f92516ec6db58df4c849f3d7 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Apr 2020 17:45:13 -0400 Subject: [PATCH 0406/1222] adjust radius for MAPS --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 130 +++++++++++------- 1 file changed, 82 insertions(+), 48 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index b6613cda2..89506180f 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -1,6 +1,6 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include #include #include #include @@ -8,15 +8,15 @@ #include #include #include +#include "GlobalVariables.C" R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) #endif - #include // ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; +bool tpc_layers_40 = false; // 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 @@ -28,13 +28,13 @@ const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx com // default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired int n_intt_layer = 0; // default layer configuration -int laddertype[4] = {0, 1, 1, 1}; // default -int nladder[4] = {34, 30, 36, 42}; // default +int laddertype[4] = {0, 1, 1, 1}; // default +int nladder[4] = {34, 30, 36, 42}; // default double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. +double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. int tpc_layer_rphi_count_inner = 1152; int n_tpc_layer_mid = 16; @@ -42,7 +42,7 @@ double tpc_layer_thick_mid = 1.25; int tpc_layer_rphi_count_mid = 1536; int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm +double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm int tpc_layer_rphi_count_outer = 2304; int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; @@ -204,12 +204,12 @@ void SvtxInit(int verbosity = 0) // TPC readout shaping time and ADC clock parameters // these set the Z size of the TPC cells //======================================= - TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time TPC_SmearRPhi = 0.25; TPC_SmearZ = 0.15; } @@ -223,27 +223,62 @@ double Svtx(PHG4Reco* g4Reco, double radius, { bool maps_overlapcheck = false; // set to true if you want to check for overlaps - // MAPS inner barrel layers - //====================================================== - // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... + // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; - radius = radius_lyr; - } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + // H?kan Wennl?f : + // Without time-stamping layer: + // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves + // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 + // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 + // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 + // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 + + + static const double Degree2Rad = 180. / TMath::Pi(); + int ilyr = 0; + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", 18); + mvtx->set_double_param(ilyr, "layer_nominal_radius", 36.4); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); + mvtx->set_double_param(ilyr, "phi0", 0); + + // Then add a new mid layer that is extrapolation of the inner two. + ++ilyr; + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", 24); + mvtx->set_double_param(ilyr, "layer_nominal_radius", 48.1 ); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); + mvtx->set_double_param(ilyr, "phi0", 0); + + ++ilyr; + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", 30); + mvtx->set_double_param(ilyr, "layer_nominal_radius", 59.8 ); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); + mvtx->set_double_param(ilyr, "phi0", 0); + +// // Then add a new 3rd layer that is extrapolation of the inner two. +// ++ilyr; +// mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem +// mvtx->set_int_param(ilyr, "layer", ilyr); +// mvtx->set_int_param(ilyr, "N_staves", 42); +// mvtx->set_double_param(ilyr, "layer_nominal_radius", 83.2 ); // mm +// mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); +// mvtx->set_double_param(ilyr, "phi0", 0); + + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); - } + } // if (n_maps_layer > 0) - assert (n_intt_layer == 0); + assert(n_intt_layer == 0); // int verbosity = 1; @@ -251,12 +286,12 @@ double Svtx(PHG4Reco* g4Reco, double radius, // switch ONLY for backward compatibility with 40 layer hits files! if (tpc_layers_40) - { - n_tpc_layer_inner = 8; - tpc_layer_thick_inner = 1.25; - tpc_layer_rphi_count_inner = 1152; - cout << "Using 8 inner_layers for backward comatibility" << endl; - } + { + n_tpc_layer_inner = 8; + tpc_layer_thick_inner = 1.25; + tpc_layer_rphi_count_inner = 1152; + cout << "Using 8 inner_layers for backward comatibility" << endl; + } PHG4CylinderSubsystem* cyl; @@ -280,24 +315,24 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius += cage_thickness; double inner_readout_radius = radius; -// if (inner_readout_radius < radius) inner_readout_radius = radius; -// + // if (inner_readout_radius < radius) inner_readout_radius = radius; + // string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc -// -// // Layer of inert TPC gas from 20-30 cm -// if (inner_readout_radius - 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; + // + // // Layer of inert TPC gas from 20-30 cm + // if (inner_readout_radius - 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.; @@ -402,7 +437,6 @@ void Svtx_Cells(int verbosity = 0) // SVTX cells //----------- - return; } From 2e8060944b30d6e51d418994f0802102174053fb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Apr 2020 23:06:05 -0400 Subject: [PATCH 0407/1222] Add LANL FST --- macros/g4simulations/G4_GEM_EIC.C | 260 ++++++++++++++++++------------ 1 file changed, 156 insertions(+), 104 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 70556a3bf..7da3b1dd3 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,28 +1,30 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include #include #include -int make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8); +#include +#include "GlobalVariables.C" + +using namespace std; + +int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, + double etamax, const int N_Sector = 8); void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax); R__LOAD_LIBRARY(libg4detectors.so) #endif -void -EGEM_Init() +void EGEM_Init() { - } -void -FGEM_Init() +void FGEM_Init() { - } -void -EGEMSetup(PHG4Reco* g4Reco) +void EGEMSetup(PHG4Reco *g4Reco) { /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be * drawn in event display but will NOT register any hits. @@ -30,17 +32,16 @@ EGEMSetup(PHG4Reco* g4Reco) * Geometric constraints: * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ - float thickness=3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + float thickness = 3.; + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.9); make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -4.00); } -void -FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.245 // - ) +void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // + const double min_eta = 1.245 // +) { const double tilt = .1; @@ -50,13 +51,27 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // double zpos; PHG4SectorSubsystem *gem; - make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 2.73, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 4.00, N_Sector); + /// LANL FST From Xuan Li + // plane 1, z location: 1200mm, inner radius: 45mm, outer radius: 350mm + // plane 2, z location: 1400mm, inner radius: 50mm, outer radius: 390mm + // plane 3, z location: 1700mm, inner radius: 60mm, outer radius: 410mm + // plane 4, z location: 1900mm, inner radius: 70mm, outer radius: 430mm + // We also need two outer barrel layers which might need some adjustments by the space limitation + // and needs integration with the central vertex detector. + // + // Note: last station need to be removed to avoid confliction with the gas RICH. GEM chamber at z=2.7m is used instead + + make_LANL_FST_station("FST_0", g4Reco, 17, 3.2, 19); + make_LANL_FST_station("FST_1", g4Reco, 62, 3.2, 19); + + /////////////////////////////////////////////////////////////////////////// + + make_LANL_FST_station("FST_2", g4Reco, 120, 4.5, 35); /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; - etamax = 4; + etamax = 2; etamin = min_eta; zpos = 134.0; @@ -64,13 +79,13 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // gem->get_geometry().set_normal_polar_angle(tilt); gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); + zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + PHG4Sector::Sector_Geometry::FlatEdge()); gem->get_geometry().set_material("G4_METHANE"); gem->get_geometry().set_N_Sector(N_Sector); gem->OverlapCheck(overlapcheck); @@ -80,52 +95,33 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// + make_LANL_FST_station("FST_3", g4Reco, 140, 5, 39); + + /////////////////////////////////////////////////////////////////////////// + name = "FGEM_3"; - etamax = 4; + etamax = 2; etamin = min_eta; zpos = 157.0; - 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); + zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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); + (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)) / 2); gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); + zpos * PHG4Sector::Sector_Geometry::Unit_cm(), + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); + 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()); + PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); @@ -134,6 +130,10 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// + make_LANL_FST_station("FST_4", g4Reco, 160, 6, 41); + + /////////////////////////////////////////////////////////////////////////// + name = "FGEM_4"; etamax = 4; etamin = min_eta; @@ -143,13 +143,13 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // gem->SuperDetector(name); gem->get_geometry().set_normal_polar_angle(tilt); gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); + zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + PHG4Sector::Sector_Geometry::FlatEdge()); gem->get_geometry().set_material("G4_METHANE"); gem->get_geometry().set_N_Sector(N_Sector); gem->OverlapCheck(overlapcheck); @@ -157,29 +157,24 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // 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); + 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); + (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)); + 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)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); + 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()); + PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); @@ -188,11 +183,72 @@ FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// + make_LANL_FST_station("FST_5", g4Reco, 280, 10, 41); + + /////////////////////////////////////////////////////////////////////////// +} + +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax) +{ + // cout + // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " + // << name << endl; + + // always facing the interaction point + double polar_angle = 0; + if (zpos < 0) + { + zpos = -zpos; + polar_angle = TMath::Pi(); + } + + double min_polar_angle = TMath::ATan2(Rmin, zpos); + double max_polar_angle = TMath::ATan2(Rmax, zpos); + + if (max_polar_angle < min_polar_angle) + { + double t = max_polar_angle; + max_polar_angle = min_polar_angle; + min_polar_angle = t; + } + + PHG4SectorSubsystem *fst; + fst = new PHG4SectorSubsystem(name.c_str()); + + fst->SuperDetector(name); + + fst->get_geometry().set_normal_polar_angle(polar_angle); + fst->get_geometry().set_normal_start( + zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + fst->get_geometry().set_min_polar_angle(min_polar_angle); + fst->get_geometry().set_max_polar_angle(max_polar_angle); + fst->get_geometry().set_max_polar_edge( + PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_min_polar_edge( + PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_N_Sector(1); + fst->get_geometry().set_material("G4_AIR"); + fst->OverlapCheck(overlapcheck); + + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + // build up layers + fst->get_geometry().AddLayer("SliconSensor", "G4_Al", 20 * um, false, 100); + fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 50 * um, true, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 50 * um, false, 100); + fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + + g4Reco->registerSubsystem(fst); + return 0; } //! Add drift layers to mini TPC -void -AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) { assert(gem); @@ -201,7 +257,7 @@ AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) 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 int N_Layers = 1; // simplified setup const double thickness = 2 * cm; gem->get_geometry().AddLayer("EntranceWindow", "G4_MYLAR", 25 * um, false, @@ -209,22 +265,19 @@ AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) 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); - - } + { + 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) +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; @@ -232,17 +285,16 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, double polar_angle = 0; if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - - } + { + zpos = -zpos; + polar_angle = TMath::Pi(); + } if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } + { + double t = etamax; + etamax = etamin; + etamin = t; + } PHG4SectorSubsystem *gem; gem = new PHG4SectorSubsystem(name.c_str()); @@ -251,15 +303,15 @@ make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, gem->get_geometry().set_normal_polar_angle(polar_angle); gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + zpos * PHG4Sector::Sector_Geometry::Unit_cm()); gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + PHG4Sector::Sector_Geometry::FlatEdge()); gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + PHG4Sector::Sector_Geometry::FlatEdge()); gem->get_geometry().set_N_Sector(N_Sector); gem->get_geometry().set_material("G4_METHANE"); gem->OverlapCheck(overlapcheck); From bcf473a0f1a25b74ac1939e99f9483f002d2f7d9 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 11:18:04 -0400 Subject: [PATCH 0408/1222] add beam pipe extension --- macros/g4simulations/G4_Pipe_EIC.C | 40 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 9820dca16..8742f1047 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -2,7 +2,9 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include +#include #include "GlobalVariables.C" +#include R__LOAD_LIBRARY(libg4detectors.so) #endif @@ -10,16 +12,25 @@ void PipeInit() { } +//! construct beam pipe +//! \param[in] use_forward_pipes whetehr to include the engineer double Pipe(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, - int verbosity = 0) + int verbosity = 0, + bool use_forward_pipes = true +) { - // extracted via mechanical model: Detector chamber 3-20-20 + // process pipe extentions? + const static bool do_pipe_hadron_forward_extension = true; + const static bool do_pipe_electron_forward_extension = true; + + // Central pipe dimension + // Extracted via mechanical model: Detector chamber 3-20-20 // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here static const double be_pipe_radius = 3.1000; - static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um based on spec sheet + static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. @@ -45,6 +56,7 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material", "G4_Galactic"); cyl->set_double_param("thickness", be_pipe_radius); cyl->SuperDetector("PIPE"); + cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); @@ -56,6 +68,7 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material", "G4_Be"); cyl->set_double_param("thickness", be_pipe_thickness); cyl->SuperDetector("PIPE"); + cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); @@ -63,5 +76,26 @@ double Pipe(PHG4Reco* g4Reco, radius += no_overlapp; + if (do_pipe_electron_forward_extension) + { + PHG4GDMLSubsystem *gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); + gdml->set_string_param("GDMPath",string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName","ElectronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(gdml); + } + + if (do_pipe_hadron_forward_extension) + { + PHG4GDMLSubsystem *gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); + gdml->set_string_param("GDMPath",string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName","HadronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(gdml); + } + + return radius; } From d0018ad8ddd690c492d903805d4148d807a075c2 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 11:41:29 -0400 Subject: [PATCH 0409/1222] tracker adjustment for new beam pipe --- macros/g4simulations/G4_GEM_EIC.C | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 7da3b1dd3..0e8f4c8ac 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -35,8 +35,8 @@ void EGEMSetup(PHG4Reco *g4Reco) float thickness = 3.; make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.9); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -4.00); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -59,14 +59,15 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // // We also need two outer barrel layers which might need some adjustments by the space limitation // and needs integration with the central vertex detector. // - // Note: last station need to be removed to avoid confliction with the gas RICH. GEM chamber at z=2.7m is used instead + // Note1: last station need to be removed to avoid confliction with the gas RICH. GEM chamber at z=2.7m is used instead + // Note2: increase inner radius for beam pipe flange clearance - make_LANL_FST_station("FST_0", g4Reco, 17, 3.2, 19); - make_LANL_FST_station("FST_1", g4Reco, 62, 3.2, 19); + make_LANL_FST_station("FST_0", g4Reco, 17, 3.2, 18); + make_LANL_FST_station("FST_1", g4Reco, 62, 3.2, 18); /////////////////////////////////////////////////////////////////////////// - make_LANL_FST_station("FST_2", g4Reco, 120, 4.5, 35); + make_LANL_FST_station("FST_2", g4Reco, 120, 10, 35); /////////////////////////////////////////////////////////////////////////// @@ -95,7 +96,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// - make_LANL_FST_station("FST_3", g4Reco, 140, 5, 39); + make_LANL_FST_station("FST_3", g4Reco, 140, 12, 41); /////////////////////////////////////////////////////////////////////////// @@ -130,12 +131,12 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// - make_LANL_FST_station("FST_4", g4Reco, 160, 6, 41); + make_LANL_FST_station("FST_4", g4Reco, 160, 12, 41); /////////////////////////////////////////////////////////////////////////// name = "FGEM_4"; - etamax = 4; + etamax = 3.5; etamin = min_eta; zpos = 271.0; gem = new PHG4SectorSubsystem(name.c_str()); @@ -183,7 +184,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// - make_LANL_FST_station("FST_5", g4Reco, 280, 10, 41); + make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); /////////////////////////////////////////////////////////////////////////// } From e353afad164b7ca4bb6999790f5cd2ab936fb896 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 11:42:45 -0400 Subject: [PATCH 0410/1222] clang format --- macros/g4simulations/G4_Pipe_EIC.C | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 8742f1047..3ef1df0a9 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -1,10 +1,10 @@ #pragma once #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include #include -#include #include +#include #include "GlobalVariables.C" -#include R__LOAD_LIBRARY(libg4detectors.so) #endif @@ -18,12 +18,11 @@ double Pipe(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0, - bool use_forward_pipes = true -) + bool use_forward_pipes = true) { // process pipe extentions? - const static bool do_pipe_hadron_forward_extension = true; - const static bool do_pipe_electron_forward_extension = true; + const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; + const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; // Central pipe dimension // Extracted via mechanical model: Detector chamber 3-20-20 @@ -78,24 +77,23 @@ double Pipe(PHG4Reco* g4Reco, if (do_pipe_electron_forward_extension) { - PHG4GDMLSubsystem *gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); - gdml->set_string_param("GDMPath",string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName","ElectronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gdml); + PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(gdml); } if (do_pipe_hadron_forward_extension) { - PHG4GDMLSubsystem *gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); - gdml->set_string_param("GDMPath",string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName","HadronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gdml); + PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(gdml); } - return radius; } From 7fcbca06d074cb36c92388c3b3c6fb6f89e3f5c1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 11:43:15 -0400 Subject: [PATCH 0411/1222] include FST in fit --- macros/g4simulations/G4_Tracking_EIC.C | 65 ++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index e10a789df..9d2ff0aec 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -137,23 +137,23 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 0 // const float noise ); - // GEM0, 70um azimuthal resolution, 1cm radial strips + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. kalman->add_phg4hits( - "G4HIT_FGEM_0", // const std::string& phg4hitsNames, + "G4HIT_FST_0", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, 1, // const float eff, 0 // const float noise ); - // GEM1, 70um azimuthal resolution, 1cm radial strips + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. kalman->add_phg4hits( - "G4HIT_FGEM_1", // const std::string& phg4hitsNames, + "G4HIT_FST_1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, 1, // const float eff, 0 // const float noise ); @@ -169,6 +169,17 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 0 // const float noise ); + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM2, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( "G4HIT_FGEM_2", // const std::string& phg4hitsNames, @@ -179,6 +190,18 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( "G4HIT_FGEM_3", // const std::string& phg4hitsNames, @@ -189,6 +212,18 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM4, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( "G4HIT_FGEM_4", // const std::string& phg4hitsNames, @@ -200,6 +235,16 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 0 // const float noise ); + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_5", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); // Saved track states (projections) kalman->add_state_name("FEMC"); kalman->add_state_name("FHCAL"); From 20921cf8a498fd664bd4f5fa96e7ca7b76bac417 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 15:14:28 -0400 Subject: [PATCH 0412/1222] switch to ScintPb calorimeter and use larger beam pipe opening --- macros/g4simulations/G4_FEMC_EIC.C | 174 +++++++++++++++-------------- 1 file changed, 90 insertions(+), 84 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 4cdf221c3..ff1ed397a 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -65,8 +65,11 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) femc->SetEICDetector(); + // fsPHENIX ECAL - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; +// mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v006.txt"; cout << mapping_femc.str() << endl; femc->SetTowerMappingFile( mapping_femc.str() ); @@ -87,9 +90,12 @@ void FEMC_Towers(int verbosity = 0) { ostringstream mapping_femc; - // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; +// // fsPHENIX ECAL +// mapping_femc << getenv("CALIBRATIONROOT") << +// "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v006.txt"; + RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -107,41 +113,41 @@ void FEMC_Towers(int verbosity = 0) { //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 ); - - // E864 towers (three types for three sizes) - RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); - TowerDigitizer3->Detector("FEMC"); - TowerDigitizer3->TowerType(3); - TowerDigitizer3->Verbosity(verbosity); - TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer3 ); - - RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); - TowerDigitizer4->Detector("FEMC"); - TowerDigitizer4->TowerType(4); - TowerDigitizer4->Verbosity(verbosity); - TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer4 ); - - RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); - TowerDigitizer5->Detector("FEMC"); - TowerDigitizer5->TowerType(5); - TowerDigitizer5->Verbosity(verbosity); - TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer5 ); - - RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); - TowerDigitizer6->Detector("FEMC"); - TowerDigitizer6->TowerType(6); - TowerDigitizer6->Verbosity(verbosity); - TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer6 ); + RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); + TowerDigitizer2->Detector("FEMC"); + TowerDigitizer2->TowerType(2); + TowerDigitizer2->Verbosity(verbosity); + TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem( TowerDigitizer2 ); + +// // E864 towers (three types for three sizes) +// RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); +// TowerDigitizer3->Detector("FEMC"); +// TowerDigitizer3->TowerType(3); +// TowerDigitizer3->Verbosity(verbosity); +// TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); +// se->registerSubsystem( TowerDigitizer3 ); +// +// RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); +// TowerDigitizer4->Detector("FEMC"); +// TowerDigitizer4->TowerType(4); +// TowerDigitizer4->Verbosity(verbosity); +// TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); +// se->registerSubsystem( TowerDigitizer4 ); +// +// RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); +// TowerDigitizer5->Detector("FEMC"); +// TowerDigitizer5->TowerType(5); +// TowerDigitizer5->Verbosity(verbosity); +// TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); +// se->registerSubsystem( TowerDigitizer5 ); +// +// RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); +// TowerDigitizer6->Detector("FEMC"); +// TowerDigitizer6->TowerType(6); +// TowerDigitizer6->Verbosity(verbosity); +// TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); +// se->registerSubsystem( TowerDigitizer6 ); // PbW crystals //RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); @@ -154,51 +160,51 @@ void FEMC_Towers(int verbosity = 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 ); - - // E864 towers (three types for three sizes) - RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); - TowerCalibration3->Detector("FEMC"); - TowerCalibration3->TowerType(3); - TowerCalibration3->Verbosity(verbosity); - TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - TowerCalibration3->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration3 ); - - RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); - TowerCalibration4->Detector("FEMC"); - TowerCalibration4->TowerType(4); - TowerCalibration4->Verbosity(verbosity); - TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - TowerCalibration4->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration4 ); - - RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); - TowerCalibration5->Detector("FEMC"); - TowerCalibration5->TowerType(5); - TowerCalibration5->Verbosity(verbosity); - TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - TowerCalibration5->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration5 ); - - RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); - TowerCalibration6->Detector("FEMC"); - TowerCalibration6->TowerType(6); - TowerCalibration6->Verbosity(verbosity); - TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - TowerCalibration6->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration6 ); + 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 ); + +// // E864 towers (three types for three sizes) +// RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); +// TowerCalibration3->Detector("FEMC"); +// TowerCalibration3->TowerType(3); +// TowerCalibration3->Verbosity(verbosity); +// TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); +// TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 +// TowerCalibration3->set_pedstal_ADC(0); +// se->registerSubsystem( TowerCalibration3 ); +// +// RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); +// TowerCalibration4->Detector("FEMC"); +// TowerCalibration4->TowerType(4); +// TowerCalibration4->Verbosity(verbosity); +// TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); +// TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 +// TowerCalibration4->set_pedstal_ADC(0); +// se->registerSubsystem( TowerCalibration4 ); +// +// RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); +// TowerCalibration5->Detector("FEMC"); +// TowerCalibration5->TowerType(5); +// TowerCalibration5->Verbosity(verbosity); +// TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); +// TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 +// TowerCalibration5->set_pedstal_ADC(0); +// se->registerSubsystem( TowerCalibration5 ); +// +// RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); +// TowerCalibration6->Detector("FEMC"); +// TowerCalibration6->TowerType(6); +// TowerCalibration6->Verbosity(verbosity); +// TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); +// TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 +// TowerCalibration6->set_pedstal_ADC(0); +// se->registerSubsystem( TowerCalibration6 ); } From 4c0d2423c1a26a8408c3b9d08682c4b4385530e4 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 15:15:05 -0400 Subject: [PATCH 0413/1222] use larger beam pipe opening --- macros/g4simulations/G4_EEMC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index ea629a911..51205a457 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -51,7 +51,7 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) /* Use non-projective geometry */ if(!use_projective_geometry) { - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v005.txt"; + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; eemc->SetTowerMappingFile( mapping_eemc.str() ); } @@ -83,7 +83,7 @@ void EEMC_Towers(int verbosity = 0) { ostringstream mapping_eemc; mapping_eemc << getenv("CALIBRATIONROOT") << - "/CrystalCalorimeter/mapping/towerMap_EEMC_v005.txt"; + "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); tower_EEMC->Detector("EEMC"); From b5045bf8554d743eba2bace3285cad779ada6060 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 15:15:22 -0400 Subject: [PATCH 0414/1222] use larger beam pipe opening --- macros/g4simulations/G4_RICH.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index f95e53194..6bcc46f9a 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -35,7 +35,9 @@ RICHSetup(PHG4Reco* g4Reco, // const double min_eta = 1.3, // const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) const double z_shift = 75, // cm - const double R_shift = 18.5 // cm + const double R_shift = 18.5, // cm + const double R_beampipe_front = 8, // clearance for EIC beam pipe flange + const double R_beampipe_back = 27 // clearance for EIC beam pipe flange ) { @@ -51,6 +53,9 @@ RICHSetup(PHG4Reco* g4Reco, // 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()); + rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); + rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); + /* Register RICH module */ rich->OverlapCheck( overlapcheck ); From 094299652fcc8aef89c5bd7c86373e2053580e5b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 16:48:01 -0400 Subject: [PATCH 0415/1222] use larger beam pipe opening --- macros/g4simulations/G4_FHCAL.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index 1f1f7571c..dfd2b1257 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -51,7 +51,7 @@ FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) /* path to central copy of calibrations repositry */ mapping_hhcal << getenv("CALIBRATIONROOT") ; - mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; + mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; cout << mapping_hhcal.str() << endl; //mapping_hhcal << "towerMap_FHCAL_latest.txt"; @@ -73,7 +73,7 @@ void FHCAL_Towers(int verbosity = 0) { ostringstream mapping_fhcal; mapping_fhcal << getenv("CALIBRATIONROOT") << - "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; + "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; //mapping_fhcal << "towerMap_FHCAL_latest.txt"; RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); From 93693972daa14d8228874746c4595c3af7aeafc5 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 22:17:37 -0400 Subject: [PATCH 0416/1222] disable the pipe extension by default --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 ++ macros/g4simulations/G4_Pipe_EIC.C | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 30cf1ef95..26f40ce74 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -95,7 +95,9 @@ int Fun4All_G4_EICDetector( // sPHENIX barrel bool do_bbc = true; + // whether to simulate the Be section of the beam pipe bool do_pipe = true; + // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C bool do_tracking = true; bool do_tracking_cell = do_tracking && true; diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 3ef1df0a9..bdacc8bec 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -13,14 +13,15 @@ void PipeInit() } //! construct beam pipe -//! \param[in] use_forward_pipes whetehr to include the engineer +//! \param[in] use_forward_pipes whether to include the forward pipe extension beyond the Be section double Pipe(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, - int verbosity = 0, - bool use_forward_pipes = true) + int verbosity = 0 + ) { // process pipe extentions? + bool use_forward_pipes = false; const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; From 2b60030d1254ce89fd9714b012668f9f19982cdb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 22 Apr 2020 22:17:51 -0400 Subject: [PATCH 0417/1222] add FST --- macros/g4simulations/G4_DSTReader_EICDetector.C | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index 19d5df9ba..e6b73d842 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -62,15 +62,22 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// if (do_svtx) { ana->AddNode("SVTX"); + ana->AddNode("MVTX"); + ana->AddNode("EGEM_0"); ana->AddNode("EGEM_1"); ana->AddNode("EGEM_2"); ana->AddNode("EGEM_3"); - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); + ana->AddNode("FGEM_2"); ana->AddNode("FGEM_3"); ana->AddNode("FGEM_4"); + + ana->AddNode("FST_0"); + ana->AddNode("FST_1"); + ana->AddNode("FST_2"); + ana->AddNode("FST_3"); + ana->AddNode("FST_4"); } if (do_cemc) From e4522a46737a191181ddf91bdf4962f0e4956a24 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 27 Apr 2020 16:59:31 -0400 Subject: [PATCH 0418/1222] use PHG4ForwardEcalDetector::ConstructTowerType2 for FEMCal construction --- macros/g4simulations/G4_FEMC_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index ff1ed397a..f50357636 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -64,7 +64,7 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; - femc->SetEICDetector(); +// femc->SetEICDetector(); // fsPHENIX ECAL // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; From b90bcdfcd4845bbb5e794e3f2069393a7b53f144 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 27 Apr 2020 17:19:10 -0400 Subject: [PATCH 0419/1222] Update material for FST from Xuan Li (LANL) --- macros/g4simulations/G4_GEM_EIC.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 0e8f4c8ac..32eb7b92b 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -236,9 +236,10 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmi const double mm = .1 * cm; const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SliconSensor", "G4_Al", 20 * um, false, 100); - fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 50 * um, true, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 50 * um, false, 100); + fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 18 * um, true, 100); + fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + fst->get_geometry().AddLayer("SliconSupport", "G4_Al", 285 * um, false, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); From e6f6872e160a0b3c880d93f1e294143349d6d21d Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 27 Apr 2020 17:33:37 -0400 Subject: [PATCH 0420/1222] use new version of mapping to reflect structure needed for PHG4EICForwardEcalDetector::ConstructTower() --- macros/g4simulations/G4_FEMC_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index f50357636..8b86c643d 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -69,7 +69,7 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) // fsPHENIX ECAL // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v006.txt"; + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; cout << mapping_femc.str() << endl; femc->SetTowerMappingFile( mapping_femc.str() ); @@ -94,7 +94,7 @@ void FEMC_Towers(int verbosity = 0) { // mapping_femc << getenv("CALIBRATIONROOT") << // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v006.txt"; + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); From 4aff2e61da133f19abfd94ee879df7b222acd6c3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 28 Apr 2020 11:30:50 -0400 Subject: [PATCH 0421/1222] Removing inner_readout_radius and correcting comment as the the EIC inner TPC starts from field cage --- ...G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 89506180f..34799ef4e 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -48,7 +48,7 @@ int tpc_layer_rphi_count_outer = 2304; int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double inner_cage_radius = 20.; -double inner_readout_radius = 30.; +// double inner_readout_radius = 30.; - deprecated for EIC simulation // TPC gas parameters // These are set for a variety of gas choices... @@ -314,7 +314,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, radius += cage_thickness; - double inner_readout_radius = radius; + // double inner_readout_radius = radius; // if (inner_readout_radius < radius) inner_readout_radius = radius; // string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc @@ -336,7 +336,7 @@ double Svtx(PHG4Reco* g4Reco, double radius, double outer_radius = 78.; - // Active layers of the TPC from 30-40 cm (inner layers) + // Active layers of the TPC (inner layers) for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) { From a572682f2c7dde688f736d5537a0bb4b835cada3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 11:23:04 -0400 Subject: [PATCH 0422/1222] add max radius for black hole so all detectors can update it, return code only works for barrel --- macros/g4simulations/GlobalVariables.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 85226a4b8..a59353365 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -2,4 +2,8 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) static bool overlapcheck = false; static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +namespace BlackHoleGeometry +{ + static double max_radius = 0.; // this is needed for the overall dimension of the black hole +}; #endif From f83b2de4be60670ff3f18a8250696f8fb8cadba5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 11:23:11 -0400 Subject: [PATCH 0423/1222] add max radius for black hole so all detectors can update it, return code only works for barrel --- macros/g4simulations/G4_RICH.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 6bcc46f9a..ff7e44154 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -23,6 +23,10 @@ using namespace std; void RICHInit() { + if (BlackHoleGeometry::max_radius < 200) + { + BlackHoleGeometry::max_radius = 200; // from default in code - needs changing + } } //! ePHENIX Gas RICH. Ref to Geometry parameter defined in ePHENIXRICH::RICH_Geometry @@ -36,9 +40,9 @@ RICHSetup(PHG4Reco* g4Reco, // const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) const double z_shift = 75, // cm const double R_shift = 18.5, // cm - const double R_beampipe_front = 8, // clearance for EIC beam pipe flange - const double R_beampipe_back = 27 // clearance for EIC beam pipe flange - ) + const double R_beampipe_front = 8, // clearance for EIC beam pipe flange + const double R_beampipe_back = 27 // clearance for EIC beam pipe flange + ) { /* Use dedicated RICH subsystem */ From f4977f0841cf19d735f5dce7628b39c20a0f2273 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 13:47:46 -0400 Subject: [PATCH 0424/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4_Aerogel.C | 4 ++++ macros/g4simulations/G4_DIRC.C | 12 ++++++++---- macros/g4simulations/G4_FEMC_EIC.C | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index e55c035b4..e9ad8b9bf 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -18,6 +18,10 @@ R__LOAD_LIBRARY(libg4detectors.so) void AerogelInit() { + if (BlackHoleGeometry::max_radius < 174.5) + { + BlackHoleGeometry::max_radius = 174.5; // magnet outer radius generous value from display + } } diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index f46b7f9c6..f32d86e29 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -18,9 +18,15 @@ R__LOAD_LIBRARY(libg4detectors.so) #include +const double radiator_R = 83.65; + void DIRCInit() { + if (BlackHoleGeometry::max_radius < radiator_R) + { + BlackHoleGeometry::max_radius = radiator_R; // from default in code - needs changing + } } @@ -30,7 +36,6 @@ DIRCInit() double DIRCSetup(PHG4Reco* g4Reco) { - const double radiator_R = 83.65; const double length = 400; const double z_shift = -75; //115 const double z_start = z_shift + length / 2.; @@ -38,9 +43,8 @@ DIRCSetup(PHG4Reco* g4Reco) 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_normal_polar_angle(M_PI/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()); diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 8b86c643d..eca253db5 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -33,6 +33,10 @@ enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; void FEMCInit() { + if (BlackHoleGeometry::max_radius < 200) + { + BlackHoleGeometry::max_radius = 200; // eye balled, it can shrink a bit + } } void FEMC_Cells(int verbosity = 0) { From ccca9363c4962577545d4c5d91baaa32ce815419 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 13:57:23 -0400 Subject: [PATCH 0425/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4_EEMC.C | 4 ++++ macros/g4simulations/G4_FHCAL.C | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 51205a457..cb24774c8 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -21,6 +21,10 @@ const int use_projective_geometry = 0; void EEMCInit() { + if (BlackHoleGeometry::max_radius < 70) + { + BlackHoleGeometry::max_radius = 70; // eye balled, it can shrink a bit + } } void EEMC_Cells(int verbosity = 0) { diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index dfd2b1257..82247b333 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -21,6 +21,10 @@ using namespace std; void FHCALInit() { + if (BlackHoleGeometry::max_radius < 270) + { + BlackHoleGeometry::max_radius = 270; // eye balled, it can shrink a bit + } } void FHCAL_Cells(int verbosity = 0) { From 48069406ed4d72273ebbd861c658cfe3e7652224 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 14:00:57 -0400 Subject: [PATCH 0426/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4_PlugDoor_EIC.C | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 732fdd6c2..6c1f5c01a 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -6,7 +6,16 @@ R__LOAD_LIBRARY(libg4detectors.so) #endif -void PlugDoorInit() {} +const double r_2 = 263.5; + +void PlugDoorInit() +{ + if (BlackHoleGeometry::max_radius < r_2) + { + BlackHoleGeometry::max_radius = r_2; // eye balled, it can shrink a bit + } +} + void PlugDoor(PHG4Reco *g4Reco, const int absorberactive = 0, int verbosity = 0) @@ -17,7 +26,6 @@ void PlugDoor(PHG4Reco *g4Reco, const double z_1 = 330.81; const double z_2 = 360.81; const double r_1 = 30; - const double r_2 = 263.5; const string material("Steel_1006"); const int flux_door_active = false; From da23e1cf9a5541ff08e509f932bcc9e9ca41f380 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 14:06:21 -0400 Subject: [PATCH 0427/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4Setup_EICDetector.C | 33 +++++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index fc365a371..e11584078 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -266,44 +266,49 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // BLACKHOLE - // swallow all particles coming out of the backend of sPHENIX + if (radius < BlackHoleGeometry::max_radius) + { + radius = BlackHoleGeometry::max_radius; + } + double blackholeradius = radius + no_overlapp; // make the black hole 100 cm larger than the detector PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); - blackhole->set_double_param("radius",radius + 100); // add 100 cm + blackhole->set_double_param("radius",blackholeradius); // 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->set_double_param("length",g4Reco->GetWorldSizeZ() - 2*no_overlapp); // make it cover the world in length blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness + blackhole->set_double_param("thickness",no_overlapp/2.); // it needs some thickness blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); + blackhole->OverlapCheck(true); g4Reco->registerSubsystem(blackhole); //---------------------------------------- - // FORWARD BLACKHOLEs + // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) // +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->set_double_param("length",no_overlapp/2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - no_overlapp); // put at the end of the world blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness + // make it slightly larger in radius so we cover the small gap left by central BH cylinder + blackhole->set_double_param("thickness",blackholeradius+no_overlapp); blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); + blackhole->OverlapCheck(true); 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->set_double_param("length",no_overlapp/2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. + no_overlapp); blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness + blackhole->set_double_param("thickness",blackholeradius+no_overlapp); blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); + blackhole->OverlapCheck(true); g4Reco->registerSubsystem(blackhole); PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); From 8ea80ce41da270bb9e62ec59144d84909824e7e7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 14:10:11 -0400 Subject: [PATCH 0428/1222] leave 100 cm between barrel and black hole --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index e11584078..ed43739a5 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -271,7 +271,7 @@ int G4Setup(const int absorberactive = 0, { radius = BlackHoleGeometry::max_radius; } - double blackholeradius = radius + no_overlapp; // make the black hole 100 cm larger than the detector + double blackholeradius = radius + 100; // make the black hole 100 cm larger than the detector PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); blackhole->set_double_param("radius",blackholeradius); // add 100 cm From cedaff0c2f2e34446225cb215fc92547fe23b5b0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 14:32:59 -0400 Subject: [PATCH 0429/1222] add clang format so we can format the macros --- .clang-format | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..fd3e684e0 --- /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: None +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 +... + From dd2953c8fa06a782fb446bfcaf26c4b223d0c9fe Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 16:05:01 -0400 Subject: [PATCH 0430/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 353d42320..65232e37e 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -28,6 +28,10 @@ using namespace std; void FGEM_Init() { + if (BlackHoleGeometry::max_radius < 130) + { + BlackHoleGeometry::max_radius = 130; // eye balled + } } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -221,7 +225,7 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, } PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(name); gem->SuperDetector(name); From 6e51a8c53a68bb2ae1b4519980d1adb05958deab Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 16:05:21 -0400 Subject: [PATCH 0431/1222] set/adjust radius for black holes in Init function --- macros/g4simulations/G4_FEMC.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 817e10337..5e166c20d 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -33,6 +33,10 @@ enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; void FEMCInit() { + if (BlackHoleGeometry::max_radius < 180) + { + BlackHoleGeometry::max_radius = 180; // eye balled + } } void FEMC_Cells(int verbosity = 0) { From edc52f94108316a7519e4e0742d215d268a70838 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 16:22:49 -0400 Subject: [PATCH 0432/1222] move fsPHENIX plugdoor setup into its own macro --- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 macros/g4simulations/G4_PlugDoor_fsPHENIX.C diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C new file mode 100644 index 000000000..062568b76 --- /dev/null +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -0,0 +1,51 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include +#include +#include "GlobalVariables.C" +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +void PlugDoorInit() +{ + if (BlackHoleGeometry::max_radius < 263.5) + { + BlackHoleGeometry::max_radius = 263.5; // eye balled, it can shrink a bit + } +} + +void PlugDoor(PHG4Reco *g4Reco, + const int absorberactive = 0, + int verbosity = 0) +{ + //---------------------------------------- + // fsPHENIX forward flux return(s) + const string material("Steel_1006"); + const int flux_door_active = false; + + 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("place_z", 335.9); + flux_return_plus->set_double_param("thickness", 263.5 - 5.0); + 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); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 1); + 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", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} From 419252b9d8f2e5006c84d91c307a0d39620b4018 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 23:45:18 -0400 Subject: [PATCH 0433/1222] separate off the black hole and make it a tight fit --- macros/g4simulations/G4_BlackHole.C | 78 +++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 macros/g4simulations/G4_BlackHole.C diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C new file mode 100644 index 000000000..99980488c --- /dev/null +++ b/macros/g4simulations/G4_BlackHole.C @@ -0,0 +1,78 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +#include +R__LOAD_LIBRARY(libg4detectors.so) +#endif + +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+10; // make the black hole slightly larger than the radius + cout << "blackhole_length: " << blackhole_length << endl; + cout << "blackhole_zpos: " << blackhole_zpos << endl; + cout << "blackhole_radius: " << blackhole_radius << endl; + cout << "BlackHoleGeometry::min_z: " << BlackHoleGeometry::min_z << endl; + cout << "BlackHoleGeometry::max_z: " << BlackHoleGeometry::max_z << endl; + cout << "BlackHoleGeometry::gap: " << BlackHoleGeometry::gap << endl; + 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(); + blackhole->SetActive(); // always see what leaks out + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + //---------------------------------------- + // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) + // +Z + double blackhole_forward_zpos = blackhole_zpos + blackhole_length/2.+BlackHoleGeometry::gap/4.+BlackHoleGeometry::gap; + 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(); + blackhole->SetActive(); // always see what leaks out + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + // -Z + double blackhole_backward_zpos = blackhole_zpos - (blackhole_length/2.+BlackHoleGeometry::gap/4.+BlackHoleGeometry::gap); + + 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(); + blackhole->SetActive(); // always see what leaks out + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + return; +} From 6583989e07c92f5cbc395adeac929631d1ff6bf5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 23:45:42 -0400 Subject: [PATCH 0434/1222] adjust world size if detectors are too large forthe default --- macros/g4simulations/G4_WorldSize.C | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 macros/g4simulations/G4_WorldSize.C diff --git a/macros/g4simulations/G4_WorldSize.C b/macros/g4simulations/G4_WorldSize.C new file mode 100644 index 000000000..e47f7aa54 --- /dev/null +++ b/macros/g4simulations/G4_WorldSize.C @@ -0,0 +1,29 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include "GlobalVariables.C" +#include +R__LOAD_LIBRARY(libg4testbench.so) +#endif + +void WorldSize(PHG4Reco *g4Reco, double radius) +{ + double world_radius = radius; + if (world_radius < BlackHoleGeometry::max_radius) + { + world_radius = BlackHoleGeometry::max_radius; + } + if (g4Reco->GetWorldSizeX() < (world_radius+100)) // add 1m + { + g4Reco->SetWorldSizeX(world_radius+100); + } +// our world is symmetric, pick the largest of abs(min_z) || abs(max_z) + double max_zval = std::max(fabs(BlackHoleGeometry::min_z),fabs(BlackHoleGeometry::max_z)); + cout << "max_zval: " << max_zval << endl; + if (g4Reco->GetWorldSizeZ() < 2*(max_zval+100)) + { + g4Reco->SetWorldSizeZ( 2*(max_zval+100)); + } + cout << "worldsize X: " << g4Reco->GetWorldSizeX() << endl; + cout << "worldsize Z: " << g4Reco->GetWorldSizeZ() << endl; + return; +} From 682c2338b3e067a57fd4c8fbf7542a251efc5487 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 May 2020 23:56:18 -0400 Subject: [PATCH 0435/1222] add modr comments, remove printouts --- macros/g4simulations/G4_BlackHole.C | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C index 99980488c..e7b608d7f 100644 --- a/macros/g4simulations/G4_BlackHole.C +++ b/macros/g4simulations/G4_BlackHole.C @@ -18,12 +18,7 @@ void BlackHole(PHG4Reco *g4Reco, double 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+10; // make the black hole slightly larger than the radius - cout << "blackhole_length: " << blackhole_length << endl; - cout << "blackhole_zpos: " << blackhole_zpos << endl; - cout << "blackhole_radius: " << blackhole_radius << endl; - cout << "BlackHoleGeometry::min_z: " << BlackHoleGeometry::min_z << endl; - cout << "BlackHoleGeometry::max_z: " << BlackHoleGeometry::max_z << endl; - cout << "BlackHoleGeometry::gap: " << BlackHoleGeometry::gap << endl; + 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 @@ -41,7 +36,14 @@ void BlackHole(PHG4Reco *g4Reco, double radius) //---------------------------------------- // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) // +Z - double blackhole_forward_zpos = blackhole_zpos + blackhole_length/2.+BlackHoleGeometry::gap/4.+BlackHoleGeometry::gap; +// 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.); @@ -58,7 +60,7 @@ void BlackHole(PHG4Reco *g4Reco, double radius) g4Reco->registerSubsystem(blackhole); // -Z - double blackhole_backward_zpos = blackhole_zpos - (blackhole_length/2.+BlackHoleGeometry::gap/4.+BlackHoleGeometry::gap); + double blackhole_backward_zpos = blackhole_zpos - (blackhole_length/2.+BlackHoleGeometry::gap/2.); blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); blackhole->SuperDetector("BH_FORWARD_NEG"); From 2be05bf48b5e85d71a4afeaa9e77d50d4449cffb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:04:42 -0400 Subject: [PATCH 0436/1222] fix the dimensions to be exact for a tight fit of the black hole --- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 42 +++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C index 062568b76..40aab91d4 100644 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -1,16 +1,30 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) + +#include "GlobalVariables.C" + #include #include -#include "GlobalVariables.C" + R__LOAD_LIBRARY(libg4detectors.so) -#endif + +const double place_z = 335.9; +const double length = 10.2; +const double inner_radius = 2.1; +const double thickness = 258.5; void PlugDoorInit() { - if (BlackHoleGeometry::max_radius < 263.5) + if (BlackHoleGeometry::max_radius < (inner_radius+thickness)) + { + BlackHoleGeometry::max_radius = inner_radius+thickness; + } + if (BlackHoleGeometry::max_z < (place_z + length/2.)) + { + BlackHoleGeometry::max_z = place_z + length/2.; + } + if (BlackHoleGeometry::min_z > -(place_z + length/2.)) { - BlackHoleGeometry::max_radius = 263.5; // eye balled, it can shrink a bit + BlackHoleGeometry::min_z = -(place_z + length/2.); } } @@ -24,11 +38,10 @@ void PlugDoor(PHG4Reco *g4Reco, const int flux_door_active = false; 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("place_z", 335.9); - flux_return_plus->set_double_param("thickness", 263.5 - 5.0); + flux_return_plus->set_double_param("length", length); + flux_return_plus->set_double_param("radius", inner_radius); + flux_return_plus->set_double_param("place_z", place_z); + flux_return_plus->set_double_param("thickness", thickness); flux_return_plus->set_string_param("material", material); flux_return_plus->SetActive(flux_door_active); flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); @@ -36,11 +49,10 @@ void PlugDoor(PHG4Reco *g4Reco, g4Reco->registerSubsystem(flux_return_plus); PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 1); - 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_double_param("length", length); + flux_return_minus->set_double_param("radius", inner_radius); + flux_return_minus->set_double_param("place_z", -place_z); + flux_return_minus->set_double_param("thickness", thickness); flux_return_minus->set_string_param("material", material); flux_return_minus->SetActive(flux_door_active); flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); From 2b852e08b8b165b47aeb2949ef3fcf875d0faef1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:09:09 -0400 Subject: [PATCH 0437/1222] add Enable namespace for future enable flags, add parameters for black hole dimensions --- macros/g4simulations/GlobalVariables.C | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index a59353365..257061c01 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -1,9 +1,18 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) static bool overlapcheck = false; static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes + +namespace Enable +{ + static bool BlackHole = false; + static bool OverLapCheck = false; +} + namespace BlackHoleGeometry { static double max_radius = 0.; // this is needed for the overall dimension of the black hole + static double min_z = 0.; + static double max_z = 0.; + static double gap = no_overlapp; + static bool visible = false; }; -#endif From 5878854b525448685299a9abd63cad2c47b5efcc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:11:59 -0400 Subject: [PATCH 0438/1222] remove printouts --- macros/g4simulations/G4_WorldSize.C | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_WorldSize.C b/macros/g4simulations/G4_WorldSize.C index e47f7aa54..b3463ac07 100644 --- a/macros/g4simulations/G4_WorldSize.C +++ b/macros/g4simulations/G4_WorldSize.C @@ -1,9 +1,10 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" #include + R__LOAD_LIBRARY(libg4testbench.so) -#endif + void WorldSize(PHG4Reco *g4Reco, double radius) { @@ -18,12 +19,9 @@ void WorldSize(PHG4Reco *g4Reco, double radius) } // our world is symmetric, pick the largest of abs(min_z) || abs(max_z) double max_zval = std::max(fabs(BlackHoleGeometry::min_z),fabs(BlackHoleGeometry::max_z)); - cout << "max_zval: " << max_zval << endl; if (g4Reco->GetWorldSizeZ() < 2*(max_zval+100)) { g4Reco->SetWorldSizeZ( 2*(max_zval+100)); } - cout << "worldsize X: " << g4Reco->GetWorldSizeX() << endl; - cout << "worldsize Z: " << g4Reco->GetWorldSizeZ() << endl; return; } From b38513d493d63d92522bbd8250aea48cb10cd95c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:19:25 -0400 Subject: [PATCH 0439/1222] move black hole and plugdoor to its own macros --- macros/g4simulations/G4Setup_fsPHENIX.C | 89 ++++++------------------- 1 file changed, 22 insertions(+), 67 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 87f724030..8eafd466c 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -10,6 +10,9 @@ #include "G4_FGEM_fsPHENIX.C" #include "G4_FEMC.C" #include "G4_FHCAL.C" +#include "G4_PlugDoor_fsPHENIX.C" +#include "G4_BlackHole.C" +#include "G4_WorldSize.C" #include #include #include @@ -91,6 +94,14 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_FHCAL.C"); FHCALInit(); } + if (Enable::PlugDoor) + { + PlugDoorInit(); + } + if (Enable::BlackHole) + { + BlackHoleInit(); + } } @@ -208,81 +219,25 @@ int G4Setup(const int absorberactive = 0, if ( do_FHCAL ) FHCALSetup(g4Reco, absorberactive); - // sPHENIX forward flux return(s) with reduced thickness - 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); + if (Enable::PlugDoor) + { + PlugDoor(g4Reco, absorberactive); + } //---------------------------------------- // piston magnet // make_piston("magpiston", g4Reco); //---------------------------------------- - // BLACKHOLE - // minimal space for forward instrumentation - if (radius<270) radius = 270; - - // 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); - + // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions + 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; } From 58051b3a3a47dcbc63becdc2a7c563b1920badeb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:19:40 -0400 Subject: [PATCH 0440/1222] Add enable PlugDoor --- macros/g4simulations/GlobalVariables.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 257061c01..7e1eea1d2 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -6,6 +6,7 @@ namespace Enable { static bool BlackHole = false; static bool OverLapCheck = false; + static bool PlugDoor = false; } namespace BlackHoleGeometry From 1a784a8292a732c787e754fe9453c39028e3b69f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:57:47 -0400 Subject: [PATCH 0441/1222] update only min_z, 0/0/0 still needs to be covered --- macros/g4simulations/G4_PlugDoor_EIC.C | 29 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 6c1f5c01a..4ce1fe98c 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -1,18 +1,32 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include #include + R__LOAD_LIBRARY(libg4detectors.so) -#endif + + // sPHENIX forward flux return(s) + // define via four corners in the engineering drawing +const double z_1 = 330.81; +const double z_2 = 360.81; +const double r_1 = 30; const double r_2 = 263.5; +const double length = z_2 - z_1; +const double place_z = -(z_1 + z_2) / 2.; + void PlugDoorInit() { if (BlackHoleGeometry::max_radius < r_2) { - BlackHoleGeometry::max_radius = r_2; // eye balled, it can shrink a bit + BlackHoleGeometry::max_radius = r_2; + } + if (BlackHoleGeometry::min_z > (place_z - length/2.)) + { + BlackHoleGeometry::min_z = (place_z - length/2.); } } @@ -21,19 +35,14 @@ void PlugDoor(PHG4Reco *g4Reco, int verbosity = 0) { //---------------------------------------- - // sPHENIX forward flux return(s) - // define via four cornors in the engineering drawing - const double z_1 = 330.81; - const double z_2 = 360.81; - const double r_1 = 30; const string material("Steel_1006"); const int flux_door_active = false; PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); flux_return_minus->set_int_param("lengthviarapidity", 0); - flux_return_minus->set_double_param("length", z_2 - z_1); + flux_return_minus->set_double_param("length", length); flux_return_minus->set_double_param("radius", r_1); - flux_return_minus->set_double_param("place_z", -(z_1 + z_2) / 2.); + flux_return_minus->set_double_param("place_z", place_z); flux_return_minus->set_double_param("thickness", r_2 - r_1); flux_return_minus->set_string_param("material", material); flux_return_minus->SetActive(flux_door_active); From 75bffa1f1fc6ac71693b5f83a1ad167381e79428 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:58:15 -0400 Subject: [PATCH 0442/1222] do not shrink below default world size --- macros/g4simulations/G4_WorldSize.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_WorldSize.C b/macros/g4simulations/G4_WorldSize.C index b3463ac07..88da54fe3 100644 --- a/macros/g4simulations/G4_WorldSize.C +++ b/macros/g4simulations/G4_WorldSize.C @@ -18,10 +18,12 @@ void WorldSize(PHG4Reco *g4Reco, double radius) g4Reco->SetWorldSizeX(world_radius+100); } // our world is symmetric, pick the largest of abs(min_z) || abs(max_z) - double max_zval = std::max(fabs(BlackHoleGeometry::min_z),fabs(BlackHoleGeometry::max_z)); - if (g4Reco->GetWorldSizeZ() < 2*(max_zval+100)) + double min_zval = std::min(BlackHoleGeometry::min_z,-((g4Reco->GetWorldSizeZ()-100)/2.)); + double max_zval = std::max(BlackHoleGeometry::max_z,(g4Reco->GetWorldSizeZ()-100)/2.); + double final_zval = std::max(fabs(min_zval),fabs(max_zval))+100; // add 1m + if (g4Reco->GetWorldSizeZ() < 2*(final_zval)) { - g4Reco->SetWorldSizeZ( 2*(max_zval+100)); + g4Reco->SetWorldSizeZ( 2*(max_zval)); } return; } From fab3a2e9a0049e9ff85ebe9dee7e6ffe00ab72bf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 00:59:51 -0400 Subject: [PATCH 0443/1222] move blackhole to separate macro --- macros/g4simulations/G4Setup_EICDetector.C | 73 +++++++--------------- 1 file changed, 21 insertions(+), 52 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index ed43739a5..c58824b03 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" #include "G4_Pipe_EIC.C" #include "G4_Tracking_EIC.C" @@ -15,6 +15,8 @@ #include "G4_DIRC.C" #include "G4_RICH.C" #include "G4_Aerogel.C" +#include "G4_BlackHole.C" +#include "G4_WorldSize.C" #include #include #include @@ -27,10 +29,7 @@ #include R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) -#else -bool overlapcheck = false; // set to true if you want to check for overlaps -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -#endif + void RunLoadTest() {} void G4Init(bool do_svtx = true, @@ -56,11 +55,11 @@ void G4Init(bool do_svtx = true, PipeInit(); } - if (do_plugdoor) + if (Enable::PlugDoor) { - gROOT->LoadMacro("G4_PlugDoor_EIC.C"); PlugDoorInit(); } + if (do_svtx) { //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); @@ -126,6 +125,11 @@ void G4Init(bool do_svtx = true, AerogelInit(); } + if (Enable::BlackHole) + { + BlackHoleInit(); + } + } @@ -262,57 +266,22 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // sPHENIX forward flux return door - if (do_plugdoor) PlugDoor(g4Reco, absorberactive); - - //---------------------------------------- - // BLACKHOLE - // swallow all particles coming out of the backend of sPHENIX - if (radius < BlackHoleGeometry::max_radius) + if (Enable::PlugDoor) { - radius = BlackHoleGeometry::max_radius; + PlugDoor(g4Reco, absorberactive); } - double blackholeradius = radius + 100; // make the black hole 100 cm larger than the detector - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); - blackhole->set_double_param("radius",blackholeradius); // add 100 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - 2*no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",no_overlapp/2.); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(true); - g4Reco->registerSubsystem(blackhole); - //---------------------------------------- - // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) - // +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",no_overlapp/2.); // it needs some thickness but not go outside world - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - no_overlapp); // put at the end of the world - blackhole->BlackHole(); - // make it slightly larger in radius so we cover the small gap left by central BH cylinder - blackhole->set_double_param("thickness",blackholeradius+no_overlapp); - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(true); - 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",no_overlapp/2.); // it needs some thickness but not go outside world - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",blackholeradius+no_overlapp); - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(true); - g4Reco->registerSubsystem(blackhole); + // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions + 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; } From c08ce163b801ed7cd71453e9534ff8a31febd0d6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 01:04:55 -0400 Subject: [PATCH 0444/1222] move plugdoor and black hole to Enable namespace --- macros/g4simulations/Fun4All_G4_EICDetector.C | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 26f40ce74..a36bdd9d5 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -93,13 +93,13 @@ int Fun4All_G4_EICDetector( //====================== // sPHENIX barrel - bool do_bbc = true; + bool do_bbc = false; // whether to simulate the Be section of the beam pipe - bool do_pipe = true; + bool do_pipe = false; // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C - bool do_tracking = true; + bool do_tracking = false; bool do_tracking_cell = do_tracking && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ @@ -107,57 +107,57 @@ int Fun4All_G4_EICDetector( bool do_pstof = false; - bool do_cemc = true; + bool do_cemc = false; 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 = false; 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_magnet = false; - bool do_hcalout = true; + bool do_hcalout = false; 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; + bool do_DIRC = false; // EICDetector geometry - 'hadron' direction - bool do_RICH = true; - bool do_Aerogel = true; + bool do_RICH = false; + bool do_Aerogel = false; - bool do_FEMC = true; + bool do_FEMC = false; 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 = false; 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_EEMC = true; + bool do_EEMC = false; 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; - bool do_plugdoor = true; + Enable::PlugDoor = true; // Other options - bool do_global = true; - bool do_global_fastsim = true; + bool do_global = false; + bool do_global_fastsim = false; bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; @@ -166,7 +166,7 @@ int Fun4All_G4_EICDetector( bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; - bool do_fwd_jet_reco = true; + bool do_fwd_jet_reco = false; bool do_fwd_jet_eval = do_fwd_jet_reco && true; // HI Jet Reco for jet simulations in Au+Au (default is false for @@ -180,6 +180,10 @@ int Fun4All_G4_EICDetector( //Option to convert DST to human command readable TTree for quick poke around the outputs bool do_DSTReader = false; +// new settings using Enable namespace in GlobalVariables.C + Enable::BlackHole = true; + BlackHoleGeometry::visible = true; + //--------------- // Load libraries //--------------- @@ -192,7 +196,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); + G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -399,12 +403,12 @@ int Fun4All_G4_EICDetector( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, + do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_plugdoor, + do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #endif From f92a087083a0cad27bd8e802841a129a5150e3f1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 01:05:28 -0400 Subject: [PATCH 0445/1222] remove do_plugdoor --- macros/g4simulations/G4Setup_EICDetector.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index c58824b03..bfd5385e5 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -38,7 +38,6 @@ void G4Init(bool do_svtx = true, bool do_magnet = true, bool do_hcalout = true, bool do_pipe = true, - bool do_plugdoor = true, bool do_FEMC = true, bool do_FHCAL = true, bool do_EEMC = true, @@ -147,7 +146,6 @@ int G4Setup(const int absorberactive = 0, const bool do_magnet = true, const bool do_hcalout = true, const bool do_pipe = true, - const bool do_plugdoor = true, const bool do_FEMC = false, const bool do_FHCAL = false, const bool do_EEMC = true, From 1baf524610f688ed9db4e8269e78eb9cbf93b6c2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 01:50:14 -0400 Subject: [PATCH 0446/1222] remove 10 cm test gap --- macros/g4simulations/G4_BlackHole.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C index e7b608d7f..91f386327 100644 --- a/macros/g4simulations/G4_BlackHole.C +++ b/macros/g4simulations/G4_BlackHole.C @@ -1,10 +1,12 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include #include + R__LOAD_LIBRARY(libg4detectors.so) -#endif + void BlackHoleInit() {} @@ -17,8 +19,7 @@ void BlackHole(PHG4Reco *g4Reco, double 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+10; // make the black hole slightly larger than the radius - + 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 From 2f49110abb76bb10c4c00e61f0ba05bb66626460 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 01:50:52 -0400 Subject: [PATCH 0447/1222] Add max_radius and min_z from parameter file --- macros/g4simulations/G4_EEMC.C | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index cb24774c8..176c87e35 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" #include #include @@ -14,16 +14,22 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -#endif -using namespace std; + const int use_projective_geometry = 0; -void -EEMCInit() + +const double Gdz = 18.+0.0001; +const double Gz0 = -170.; + +void EEMCInit() { - if (BlackHoleGeometry::max_radius < 70) + if (BlackHoleGeometry::max_radius < 65.6) + { + BlackHoleGeometry::max_radius = 65.6; // from towerMap_EEMC_v006.txt + } + if (BlackHoleGeometry::min_z > Gz0 - Gdz/2.) { - BlackHoleGeometry::max_radius = 70; // eye balled, it can shrink a bit + BlackHoleGeometry::min_z = Gz0 - Gdz/2.; } } From 196268dc295367db83cfdb823eba724a5c98233f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 02:00:00 -0400 Subject: [PATCH 0448/1222] Add EEMC --- macros/g4simulations/GlobalVariables.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 7e1eea1d2..5143d9358 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -5,6 +5,7 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volum namespace Enable { static bool BlackHole = false; + static bool EEMC = false; static bool OverLapCheck = false; static bool PlugDoor = false; } From f9fac33fdc78e6cdb8c58479782b78e8bd8139eb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 02:01:01 -0400 Subject: [PATCH 0449/1222] move EEMC to Enable namespace --- macros/g4simulations/Fun4All_G4_EICDetector.C | 14 +++++++------- macros/g4simulations/G4Setup_EICDetector.C | 9 ++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index a36bdd9d5..40e081360 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -147,13 +147,13 @@ int Fun4All_G4_EICDetector( bool do_FHCAL_eval = do_FHCAL_cluster && true; // EICDetector geometry - 'electron' direction - bool do_EEMC = false; - bool do_EEMC_cell = do_EEMC && true; + Enable::EEMC = true; + bool do_EEMC_cell = Enable::EEMC && false; bool do_EEMC_twr = do_EEMC_cell && true; bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; - Enable::PlugDoor = true; + Enable::PlugDoor = false; // Other options bool do_global = false; @@ -196,7 +196,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel); + G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -404,12 +404,12 @@ int Fun4All_G4_EICDetector( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, + do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, + do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel, magfield_rescale); #endif @@ -594,7 +594,7 @@ int Fun4All_G4_EICDetector( /*bool*/ do_FHCAL_twr, /*bool*/ do_FEMC, /*bool*/ do_FEMC_twr, - /*bool*/ do_EEMC, + /*bool*/ Enable::EEMC, /*bool*/ do_EEMC_twr ); } diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index bfd5385e5..244dafa36 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -40,7 +40,6 @@ void G4Init(bool do_svtx = true, bool do_pipe = 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) @@ -100,9 +99,8 @@ void G4Init(bool do_svtx = true, FHCALInit(); } - if (do_EEMC) + if ( Enable::EEMC) { - gROOT->LoadMacro("G4_EEMC.C"); EEMCInit(); } @@ -148,7 +146,6 @@ int G4Setup(const int absorberactive = 0, const bool do_pipe = 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, @@ -247,8 +244,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // EEMC - if ( do_EEMC ) + if ( Enable::EEMC ) + { EEMCSetup(g4Reco, absorberactive); + } //---------------------------------------- // PID From a126898fbe78666de3493269f3e2f9f1fe40099a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 03:50:39 -0400 Subject: [PATCH 0450/1222] Add Aerogel, DIRC and RICH --- macros/g4simulations/GlobalVariables.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 5143d9358..40bbcf897 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -4,9 +4,12 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volum namespace Enable { + static bool Aerogel = false; static bool BlackHole = false; + static bool DIRC = false; static bool EEMC = false; static bool OverLapCheck = false; + static bool RICH = false; static bool PlugDoor = false; } From b25e625bc42d1a422e2cd314729a3dabe0d34679 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 03:51:19 -0400 Subject: [PATCH 0451/1222] add good max_radius and max_z --- macros/g4simulations/G4_Aerogel.C | 8 ++++++-- macros/g4simulations/G4_RICH.C | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index e9ad8b9bf..882771a33 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -18,9 +18,13 @@ R__LOAD_LIBRARY(libg4detectors.so) void AerogelInit() { - if (BlackHoleGeometry::max_radius < 174.5) + if (BlackHoleGeometry::max_radius < 164) { - BlackHoleGeometry::max_radius = 174.5; // magnet outer radius generous value from display + BlackHoleGeometry::max_radius = 164; // magnet outer radius generous value from display + } + if (BlackHoleGeometry::max_z < 287.) + { + BlackHoleGeometry::max_z = 287; } } diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index ff7e44154..a4e25ac2d 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -23,9 +23,13 @@ using namespace std; void RICHInit() { - if (BlackHoleGeometry::max_radius < 200) + if (BlackHoleGeometry::max_radius < 135) { - BlackHoleGeometry::max_radius = 200; // from default in code - needs changing + BlackHoleGeometry::max_radius = 135; + } + if (BlackHoleGeometry::max_z < 268.) + { + BlackHoleGeometry::max_z = 268; } } From dd52741715d6feec1737ffcbf0e35282e75e5102 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 03:52:25 -0400 Subject: [PATCH 0452/1222] Enable namespace for Aerogel, DIRC and RICH --- macros/g4simulations/G4Setup_EICDetector.C | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 244dafa36..74af88b86 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -40,9 +40,7 @@ void G4Init(bool do_svtx = true, bool do_pipe = true, bool do_FEMC = true, bool do_FHCAL = true, - bool do_DIRC = true, - bool do_RICH = true, - bool do_Aerogel = true) + bool do_DIRC = true) { // load detector/material macros and execute Init() function @@ -104,21 +102,18 @@ void G4Init(bool do_svtx = true, EEMCInit(); } - if (do_DIRC) + if (Enable::DIRC) { - gROOT->LoadMacro("G4_DIRC.C"); DIRCInit(); } - if (do_RICH) + if (Enable::RICH) { - gROOT->LoadMacro("G4_RICH.C"); RICHInit(); } - if (do_Aerogel) + if (Enable::Aerogel) { - gROOT->LoadMacro("G4_Aerogel.C"); AerogelInit(); } @@ -147,8 +142,6 @@ int G4Setup(const int absorberactive = 0, const bool do_FEMC = false, const bool do_FHCAL = false, const bool do_DIRC = true, - const bool do_RICH = true, - const bool do_Aerogel = true, const float magfield_rescale = 1.0) { //--------------- @@ -252,15 +245,20 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // PID - if ( do_DIRC ) + if (Enable::DIRC) + { DIRCSetup(g4Reco); + } - if ( do_RICH ) + if (Enable::RICH) + { RICHSetup(g4Reco); + } - if ( do_Aerogel ) + if (Enable::Aerogel) + { AerogelSetup(g4Reco); - + } //---------------------------------------- // sPHENIX forward flux return door if (Enable::PlugDoor) From 1939282df388510db8f579dfaadf681ecdfbb14c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 03:52:55 -0400 Subject: [PATCH 0453/1222] Enable namespace for Aerogel, DIRC and RICH --- macros/g4simulations/Fun4All_G4_EICDetector.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 40e081360..09f7b5a91 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -131,8 +131,8 @@ int Fun4All_G4_EICDetector( bool do_DIRC = false; // EICDetector geometry - 'hadron' direction - bool do_RICH = false; - bool do_Aerogel = false; + Enable::RICH = true; + Enable::Aerogel = false; bool do_FEMC = false; bool do_FEMC_cell = do_FEMC && true; @@ -147,7 +147,7 @@ int Fun4All_G4_EICDetector( bool do_FHCAL_eval = do_FHCAL_cluster && true; // EICDetector geometry - 'electron' direction - Enable::EEMC = true; + Enable::EEMC = false; bool do_EEMC_cell = Enable::EEMC && false; bool do_EEMC_twr = do_EEMC_cell && true; bool do_EEMC_cluster = do_EEMC_twr && true; @@ -196,7 +196,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel); + G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_DIRC); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -404,12 +404,12 @@ int Fun4All_G4_EICDetector( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel, + do_FEMC,do_FHCAL,do_DIRC, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_DIRC,do_RICH,do_Aerogel, + do_FEMC,do_FHCAL,do_DIRC, magfield_rescale); #endif From d9652349470e243a79871dcbd274505862e6021f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 04:13:32 -0400 Subject: [PATCH 0454/1222] add good max_radius and max_z --- macros/g4simulations/G4_DIRC.C | 41 +++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index f32d86e29..c8cc2d8fe 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -17,15 +17,30 @@ R__LOAD_LIBRARY(libg4detectors.so) */ #include - +namespace DIRC +{ const double radiator_R = 83.65; + const double length = 400; + const double z_shift = -75; //115 + const double z_start = z_shift + length / 2.; + const double z_end = z_shift - length / 2.; + const double outer_skin_radius = 89.25; +} void DIRCInit() { - if (BlackHoleGeometry::max_radius < radiator_R) + if (BlackHoleGeometry::max_radius < DIRC::outer_skin_radius) { - BlackHoleGeometry::max_radius = radiator_R; // from default in code - needs changing + BlackHoleGeometry::max_radius = DIRC::outer_skin_radius; // from default in code - needs changing + } + if (BlackHoleGeometry::max_z < DIRC::z_start) + { + BlackHoleGeometry::max_z = DIRC::z_start; + } + if (BlackHoleGeometry::min_z > DIRC::z_end) + { + BlackHoleGeometry::min_z = DIRC::z_end; } } @@ -36,17 +51,13 @@ DIRCInit() double DIRCSetup(PHG4Reco* g4Reco) { - const double length = 400; - const double z_shift = -75; //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(M_PI/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_angle(atan2(DIRC::radiator_R, DIRC::z_start)); + dirc->get_geometry().set_max_polar_angle(atan2(DIRC::radiator_R, DIRC::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"); @@ -65,13 +76,12 @@ DIRCSetup(PHG4Reco* g4Reco) // 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_double_param("length",DIRC::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->set_double_param("place_z",DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -80,14 +90,13 @@ DIRCSetup(PHG4Reco* g4Reco) // 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_double_param("radius",DIRC::outer_skin_radius - 0.076); + cyl->set_double_param("length",DIRC::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->set_double_param("place_z",DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); From 85c20deabce11fbad07e616ff42014a611e4b044 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 10:26:34 -0400 Subject: [PATCH 0455/1222] clang-format --- macros/g4simulations/G4_DIRC.C | 62 ++++++++++++++++------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index c8cc2d8fe..b3507aae2 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -1,11 +1,15 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include #include #include + +#include + R__LOAD_LIBRARY(libg4detectors.so) -#endif + // $Id: G4_DIRC.C,v 1.3 2013/10/09 01:08:17 jinhuang Exp $ /*! @@ -16,23 +20,21 @@ R__LOAD_LIBRARY(libg4detectors.so) * \date $Date: 2013/10/09 01:08:17 $ */ -#include namespace DIRC { const double radiator_R = 83.65; - const double length = 400; - const double z_shift = -75; //115 - const double z_start = z_shift + length / 2.; - const double z_end = z_shift - length / 2.; - const double outer_skin_radius = 89.25; -} +const double length = 400; +const double z_shift = -75; //115 +const double z_start = z_shift + length / 2.; +const double z_end = z_shift - length / 2.; +const double outer_skin_radius = 89.25; +} // namespace DIRC -void -DIRCInit() +void DIRCInit() { if (BlackHoleGeometry::max_radius < DIRC::outer_skin_radius) { - BlackHoleGeometry::max_radius = DIRC::outer_skin_radius; // from default in code - needs changing + BlackHoleGeometry::max_radius = DIRC::outer_skin_radius; // from default in code - needs changing } if (BlackHoleGeometry::max_z < DIRC::z_start) { @@ -42,19 +44,16 @@ DIRCInit() { BlackHoleGeometry::min_z = DIRC::z_end; } - } //! 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) +double DIRCSetup(PHG4Reco *g4Reco) { - PHG4SectorSubsystem *dirc; dirc = new PHG4SectorSubsystem("DIRC"); - dirc->get_geometry().set_normal_polar_angle(M_PI/2); + dirc->get_geometry().set_normal_polar_angle(M_PI / 2); dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); dirc->get_geometry().set_min_polar_angle(atan2(DIRC::radiator_R, DIRC::z_start)); dirc->get_geometry().set_max_polar_angle(atan2(DIRC::radiator_R, DIRC::z_end)); @@ -75,13 +74,13 @@ DIRCSetup(PHG4Reco* g4Reco) // Inner skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10); - cyl->set_double_param("radius",81.71); - cyl->set_double_param("length",DIRC::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",DIRC::z_shift); + cyl->set_double_param("radius", 81.71); + cyl->set_double_param("length", DIRC::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", DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -90,13 +89,13 @@ DIRCSetup(PHG4Reco* g4Reco) // Outer skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11); - cyl->set_double_param("radius",DIRC::outer_skin_radius - 0.076); - cyl->set_double_param("length",DIRC::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",DIRC::z_shift); + cyl->set_double_param("radius", DIRC::outer_skin_radius - 0.076); + cyl->set_double_param("length", DIRC::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", DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -105,5 +104,4 @@ DIRCSetup(PHG4Reco* g4Reco) // Done return 89.25; - } From d79d5d09245733b4d966c04687ef6ffee32f67b2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 10:56:56 -0400 Subject: [PATCH 0456/1222] Add all EIC subsystems --- macros/g4simulations/GlobalVariables.C | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 40bbcf897..235b2cf49 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -4,13 +4,21 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volum namespace Enable { - static bool Aerogel = false; - static bool BlackHole = false; + static bool AEROGEL = false; + static bool BLACKHOLE = false; + static bool CEMC = false; static bool DIRC = false; static bool EEMC = false; - static bool OverLapCheck = false; + static bool FEMC = false; + static bool FHCAL = false; + static bool HCALIN = false; + static bool HCALOUT = false; + static bool OVERLAPCHECK = false; + static bool PIPE = false; + static bool PSTOF = false; static bool RICH = false; - static bool PlugDoor = false; + static bool PLUGDOOR = false; + static bool TRACKING = false; } namespace BlackHoleGeometry From b0ede9583a9383ad7dd23e120c58b8d261e16fd8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 11:43:11 -0400 Subject: [PATCH 0457/1222] use caps for enable flags --- macros/g4simulations/G4Setup_fsPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 8eafd466c..bd44ff993 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -94,11 +94,11 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_FHCAL.C"); FHCALInit(); } - if (Enable::PlugDoor) + if (Enable::PLUGDOOR) { PlugDoorInit(); } - if (Enable::BlackHole) + if (Enable::BLACKHOLE) { BlackHoleInit(); } @@ -219,7 +219,7 @@ int G4Setup(const int absorberactive = 0, if ( do_FHCAL ) FHCALSetup(g4Reco, absorberactive); - if (Enable::PlugDoor) + if (Enable::PLUGDOOR) { PlugDoor(g4Reco, absorberactive); } @@ -230,7 +230,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions - if (Enable::BlackHole) + if (Enable::BLACKHOLE) { BlackHole(g4Reco, radius); } From 45ac9a0cf26a2716ade6398cb1adc3a1caf17cdd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 11:44:49 -0400 Subject: [PATCH 0458/1222] use caps for enable flags, move dirc to enable namespace --- macros/g4simulations/G4Setup_EICDetector.C | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 74af88b86..965a0416a 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -39,8 +39,7 @@ void G4Init(bool do_svtx = true, bool do_hcalout = true, bool do_pipe = true, bool do_FEMC = true, - bool do_FHCAL = true, - bool do_DIRC = true) + bool do_FHCAL = true) { // load detector/material macros and execute Init() function @@ -51,7 +50,7 @@ void G4Init(bool do_svtx = true, PipeInit(); } - if (Enable::PlugDoor) + if (Enable::PLUGDOOR) { PlugDoorInit(); } @@ -112,12 +111,12 @@ void G4Init(bool do_svtx = true, RICHInit(); } - if (Enable::Aerogel) + if (Enable::AEROGEL) { AerogelInit(); } - if (Enable::BlackHole) + if (Enable::BLACKHOLE) { BlackHoleInit(); } @@ -141,7 +140,6 @@ int G4Setup(const int absorberactive = 0, const bool do_pipe = true, const bool do_FEMC = false, const bool do_FHCAL = false, - const bool do_DIRC = true, const float magfield_rescale = 1.0) { //--------------- @@ -255,19 +253,19 @@ int G4Setup(const int absorberactive = 0, RICHSetup(g4Reco); } - if (Enable::Aerogel) + if (Enable::AEROGEL) { AerogelSetup(g4Reco); } //---------------------------------------- // sPHENIX forward flux return door - if (Enable::PlugDoor) + if (Enable::PLUGDOOR) { PlugDoor(g4Reco, absorberactive); } //---------------------------------------- // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions - if (Enable::BlackHole) + if (Enable::BLACKHOLE) { BlackHole(g4Reco, radius); } From ea794badcd6a256c00081e665cbd8d10879ca16b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 12:01:10 -0400 Subject: [PATCH 0459/1222] add good max_radius and max_z --- macros/g4simulations/G4_FEMC_EIC.C | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index eca253db5..6e964ad8b 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -30,12 +30,24 @@ enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +namespace FEMCMACRO +{ +// from ForwardEcal/mapping/towerMap_FEMC_v007.txt + const double Gz0 = 310.; + const double Gdz = 36.5; + const double outer_radius = 182.655; +} + void FEMCInit() { - if (BlackHoleGeometry::max_radius < 200) + if (BlackHoleGeometry::max_radius < FEMCMACRO::outer_radius) + { + BlackHoleGeometry::max_radius = FEMCMACRO::outer_radius; + } + if (BlackHoleGeometry::max_z < FEMCMACRO::Gz0 + FEMCMACRO::Gdz/2.) { - BlackHoleGeometry::max_radius = 200; // eye balled, it can shrink a bit + BlackHoleGeometry::max_z = FEMCMACRO::Gz0 + FEMCMACRO::Gdz/2.; } } From be81e6f484828393ada946ac1b75e5ef3f9237cb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 12:13:59 -0400 Subject: [PATCH 0460/1222] clang-format, move global variables into FemcMacro namespace --- macros/g4simulations/G4_FEMC_EIC.C | 289 +++++++++++++---------------- 1 file changed, 132 insertions(+), 157 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 6e964ad8b..ab8144857 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -1,77 +1,65 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.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) -#endif - - +namespace FemcMacro +{ +// from ForwardEcal/mapping/towerMap_FEMC_v007.txt +const double Gz0 = 310.; +const double Gdz = 36.5; +const double outer_radius = 182.655; enum enu_Femc_clusterizer { kFemcGraphClusterizer, kFemcTemplateClusterizer }; - //template clusterizer, as developed by Sasha Bazilevsky enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +} // namespace FemcMacro -namespace FEMCMACRO +void FEMCInit() { -// from ForwardEcal/mapping/towerMap_FEMC_v007.txt - const double Gz0 = 310.; - const double Gdz = 36.5; - const double outer_radius = 182.655; -} - -void -FEMCInit() -{ - if (BlackHoleGeometry::max_radius < FEMCMACRO::outer_radius) + if (BlackHoleGeometry::max_radius < FemcMacro::outer_radius) { - BlackHoleGeometry::max_radius = FEMCMACRO::outer_radius; + BlackHoleGeometry::max_radius = FemcMacro::outer_radius; } - if (BlackHoleGeometry::max_z < FEMCMACRO::Gz0 + FEMCMACRO::Gdz/2.) + if (BlackHoleGeometry::max_z < FemcMacro::Gz0 + FemcMacro::Gdz / 2.) { - BlackHoleGeometry::max_z = FEMCMACRO::Gz0 + FEMCMACRO::Gdz/2.; + BlackHoleGeometry::max_z = FemcMacro::Gz0 + FemcMacro::Gdz / 2.; } } -void FEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); +void FEMC_Cells(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); hc->Detector("FEMC"); se->registerSubsystem(hc); - - return; + + return; } -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) +void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); - Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FEMC module */ @@ -79,51 +67,46 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; - -// femc->SetEICDetector(); + // femc->SetEICDetector(); // fsPHENIX ECAL -// mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile( mapping_femc.str() ); + femc->SetTowerMappingFile(mapping_femc.str()); femc->OverlapCheck(overlapcheck); femc->SetActive(); femc->SuperDetector("FEMC"); - if (absorberactive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem( femc ); + if (absorberactive) femc->SetAbsorberActive(); + g4Reco->registerSubsystem(femc); } -void FEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); +void FEMC_Towers(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; -// // fsPHENIX ECAL -// mapping_femc << getenv("CALIBRATIONROOT") << -// "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // // fsPHENIX ECAL + // mapping_femc << getenv("CALIBRATIONROOT") << + // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); + 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() ); + tower_FEMC->GeometryTableFile(mapping_femc.str()); se->registerSubsystem(tower_FEMC); // PbW crystals //RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1"); //TowerDigitizer1->Detector("FEMC"); - //TowerDigitizer1->TowerType(1); + //TowerDigitizer1->TowerType(1); //TowerDigitizer1->Verbosity(verbosity); //TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); //se->registerSubsystem( TowerDigitizer1 ); @@ -134,36 +117,36 @@ void FEMC_Towers(int verbosity = 0) { TowerDigitizer2->TowerType(2); TowerDigitizer2->Verbosity(verbosity); TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer2 ); - -// // E864 towers (three types for three sizes) -// RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); -// TowerDigitizer3->Detector("FEMC"); -// TowerDigitizer3->TowerType(3); -// TowerDigitizer3->Verbosity(verbosity); -// TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); -// se->registerSubsystem( TowerDigitizer3 ); -// -// RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); -// TowerDigitizer4->Detector("FEMC"); -// TowerDigitizer4->TowerType(4); -// TowerDigitizer4->Verbosity(verbosity); -// TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); -// se->registerSubsystem( TowerDigitizer4 ); -// -// RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); -// TowerDigitizer5->Detector("FEMC"); -// TowerDigitizer5->TowerType(5); -// TowerDigitizer5->Verbosity(verbosity); -// TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); -// se->registerSubsystem( TowerDigitizer5 ); -// -// RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); -// TowerDigitizer6->Detector("FEMC"); -// TowerDigitizer6->TowerType(6); -// TowerDigitizer6->Verbosity(verbosity); -// TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); -// se->registerSubsystem( TowerDigitizer6 ); + se->registerSubsystem(TowerDigitizer2); + + // // E864 towers (three types for three sizes) + // RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); + // TowerDigitizer3->Detector("FEMC"); + // TowerDigitizer3->TowerType(3); + // TowerDigitizer3->Verbosity(verbosity); + // TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer3 ); + // + // RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); + // TowerDigitizer4->Detector("FEMC"); + // TowerDigitizer4->TowerType(4); + // TowerDigitizer4->Verbosity(verbosity); + // TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer4 ); + // + // RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); + // TowerDigitizer5->Detector("FEMC"); + // TowerDigitizer5->TowerType(5); + // TowerDigitizer5->Verbosity(verbosity); + // TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer5 ); + // + // RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); + // TowerDigitizer6->Detector("FEMC"); + // TowerDigitizer6->TowerType(6); + // TowerDigitizer6->Verbosity(verbosity); + // TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer6 ); // PbW crystals //RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); @@ -181,96 +164,88 @@ void FEMC_Towers(int verbosity = 0) { 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_calib_const_GeV_ADC(1.0 / 0.249); // sampling fraction = 0.249 for e- TowerCalibration2->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration2 ); - -// // E864 towers (three types for three sizes) -// RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); -// TowerCalibration3->Detector("FEMC"); -// TowerCalibration3->TowerType(3); -// TowerCalibration3->Verbosity(verbosity); -// TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); -// TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 -// TowerCalibration3->set_pedstal_ADC(0); -// se->registerSubsystem( TowerCalibration3 ); -// -// RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); -// TowerCalibration4->Detector("FEMC"); -// TowerCalibration4->TowerType(4); -// TowerCalibration4->Verbosity(verbosity); -// TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); -// TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 -// TowerCalibration4->set_pedstal_ADC(0); -// se->registerSubsystem( TowerCalibration4 ); -// -// RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); -// TowerCalibration5->Detector("FEMC"); -// TowerCalibration5->TowerType(5); -// TowerCalibration5->Verbosity(verbosity); -// TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); -// TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 -// TowerCalibration5->set_pedstal_ADC(0); -// se->registerSubsystem( TowerCalibration5 ); -// -// RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); -// TowerCalibration6->Detector("FEMC"); -// TowerCalibration6->TowerType(6); -// TowerCalibration6->Verbosity(verbosity); -// TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); -// TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 -// TowerCalibration6->set_pedstal_ADC(0); -// se->registerSubsystem( TowerCalibration6 ); - + se->registerSubsystem(TowerCalibration2); + + // // E864 towers (three types for three sizes) + // RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); + // TowerCalibration3->Detector("FEMC"); + // TowerCalibration3->TowerType(3); + // TowerCalibration3->Verbosity(verbosity); + // TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration3->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration3 ); + // + // RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); + // TowerCalibration4->Detector("FEMC"); + // TowerCalibration4->TowerType(4); + // TowerCalibration4->Verbosity(verbosity); + // TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration4->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration4 ); + // + // RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); + // TowerCalibration5->Detector("FEMC"); + // TowerCalibration5->TowerType(5); + // TowerCalibration5->Verbosity(verbosity); + // TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration5->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration5 ); + // + // RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); + // TowerCalibration6->Detector("FEMC"); + // TowerCalibration6->TowerType(6); + // TowerCalibration6->Verbosity(verbosity); + // TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration6->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration6 ); } -void FEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); +void FEMC_Clusters(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); + if (FemcMacro::Femc_clusterizer == FemcMacro::kFemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(ClusterBuilder); + } + else if (FemcMacro::Femc_clusterizer == FemcMacro::kFemcGraphClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - if ( Femc_clusterizer == kFemcTemplateClusterizer ) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if ( Femc_clusterizer == kFemcGraphClusterizer ) - { - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem( ClusterBuilder ); - } + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem(ClusterBuilder); + } else - { - cout << "FEMC_Clusters - unknown clusterizer setting!"<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; } From d0d41f385409b57fa550932fcce3daa48a79d922 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 14:24:12 -0400 Subject: [PATCH 0461/1222] add good max_radius and max_z --- macros/g4simulations/G4_FHCAL.C | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index 82247b333..b6881e0cc 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -1,6 +1,7 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include #include #include @@ -10,20 +11,30 @@ #include #include #include + R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -#endif -using namespace std; +namespace FhcalMacro +{ +// from ForwardHcal/mapping/towerMap_FHCAL_v005.txt +const double Gz0 = 400.; +const double Gdz = 100.; +const double outer_radius = 262.; +} void FHCALInit() { - if (BlackHoleGeometry::max_radius < 270) + if (BlackHoleGeometry::max_radius < FhcalMacro::outer_radius) + { + BlackHoleGeometry::max_radius = FhcalMacro::outer_radius; // eye balled, it can shrink a bit + } + if (BlackHoleGeometry::max_z < FhcalMacro::Gz0 + FhcalMacro::Gdz / 2.) { - BlackHoleGeometry::max_radius = 270; // eye balled, it can shrink a bit + BlackHoleGeometry::max_z = FhcalMacro::Gz0 + FhcalMacro::Gdz / 2.; } } @@ -76,8 +87,8 @@ void FHCAL_Towers(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") << - "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; //mapping_fhcal << "towerMap_FHCAL_latest.txt"; RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); From 30345b4324cd4bdb076103bd86345af5da3f34d0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 14:24:57 -0400 Subject: [PATCH 0462/1222] fix typo in worldsize setting. ax_zval -> final_zval --- macros/g4simulations/G4_WorldSize.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_WorldSize.C b/macros/g4simulations/G4_WorldSize.C index 88da54fe3..9d1058b92 100644 --- a/macros/g4simulations/G4_WorldSize.C +++ b/macros/g4simulations/G4_WorldSize.C @@ -17,13 +17,13 @@ void WorldSize(PHG4Reco *g4Reco, double radius) { g4Reco->SetWorldSizeX(world_radius+100); } -// our world is symmetric, pick the largest of abs(min_z) || abs(max_z) +// 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,-((g4Reco->GetWorldSizeZ()-100)/2.)); double max_zval = std::max(BlackHoleGeometry::max_z,(g4Reco->GetWorldSizeZ()-100)/2.); double final_zval = std::max(fabs(min_zval),fabs(max_zval))+100; // add 1m if (g4Reco->GetWorldSizeZ() < 2*(final_zval)) { - g4Reco->SetWorldSizeZ( 2*(max_zval)); + g4Reco->SetWorldSizeZ( 2*(final_zval)); } return; } From 7526660453ce702026c73bf20d1acb4b2fbf888f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 14:27:07 -0400 Subject: [PATCH 0463/1222] clang-format --- macros/g4simulations/G4_FHCAL.C | 69 ++++++++++++++++----------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index b6881e0cc..db3bf3cfa 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -2,16 +2,21 @@ #include "GlobalVariables.C" -#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) @@ -23,14 +28,13 @@ namespace FhcalMacro const double Gz0 = 400.; const double Gdz = 100.; const double outer_radius = 262.; -} +} // namespace FhcalMacro -void -FHCALInit() +void FHCALInit() { if (BlackHoleGeometry::max_radius < FhcalMacro::outer_radius) { - BlackHoleGeometry::max_radius = FhcalMacro::outer_radius; // eye balled, it can shrink a bit + BlackHoleGeometry::max_radius = FhcalMacro::outer_radius; } if (BlackHoleGeometry::max_z < FhcalMacro::Gz0 + FhcalMacro::Gdz / 2.) { @@ -38,8 +42,8 @@ FHCALInit() } } -void FHCAL_Cells(int verbosity = 0) { - +void FHCAL_Cells(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -47,14 +51,12 @@ void FHCAL_Cells(int verbosity = 0) { PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); hc->Detector("FHCAL"); se->registerSubsystem(hc); - - return; + + return; } -void -FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) +void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -65,22 +67,21 @@ FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_hhcal; /* path to central copy of calibrations repositry */ - mapping_hhcal << getenv("CALIBRATIONROOT") ; + mapping_hhcal << getenv("CALIBRATIONROOT"); mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; cout << mapping_hhcal.str() << endl; //mapping_hhcal << "towerMap_FHCAL_latest.txt"; - hhcal->SetTowerMappingFile( mapping_hhcal.str() ); + hhcal->SetTowerMappingFile(mapping_hhcal.str()); hhcal->OverlapCheck(overlapcheck); if (absorberactive) hhcal->SetAbsorberActive(); - g4Reco->registerSubsystem( hhcal ); - + g4Reco->registerSubsystem(hhcal); } -void FHCAL_Towers(int verbosity = 0) { - +void FHCAL_Towers(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4calo.so"); gSystem->Load("libcalo_reco.so"); @@ -88,13 +89,13 @@ void FHCAL_Towers(int verbosity = 0) { ostringstream mapping_fhcal; mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; //mapping_fhcal << "towerMap_FHCAL_latest.txt"; - RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); + 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() ); + tower_FHCAL->GeometryTableFile(mapping_fhcal.str()); se->registerSubsystem(tower_FHCAL); @@ -127,31 +128,29 @@ void FHCAL_Towers(int verbosity = 0) { TowerDigitizer->Detector("FHCAL"); TowerDigitizer->Verbosity(verbosity); TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer ); + 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_calib_const_GeV_ADC(1. / 0.03898); // calibrated with muons TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration ); - - + se->registerSubsystem(TowerCalibration); } -void FHCAL_Clusters(int verbosity = 0) { - +void FHCAL_Clusters(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); + + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); ClusterBuilder->Detector("FHCAL"); ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem( ClusterBuilder ); - + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); + return; } From 702c03a8a72490bda5c7ca1bcf72bb15066b568e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 14:28:31 -0400 Subject: [PATCH 0464/1222] add femc, fhcal --- macros/g4simulations/G4Setup_EICDetector.C | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 965a0416a..60a48f873 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -1,6 +1,7 @@ #pragma once #include "GlobalVariables.C" + #include "G4_Pipe_EIC.C" #include "G4_Tracking_EIC.C" #include "G4_PSTOF.C" @@ -27,6 +28,7 @@ #include #include #include + R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) @@ -37,9 +39,7 @@ void G4Init(bool do_svtx = true, bool do_hcalin = true, bool do_magnet = true, bool do_hcalout = true, - bool do_pipe = true, - bool do_FEMC = true, - bool do_FHCAL = true) + bool do_pipe = true) { // load detector/material macros and execute Init() function @@ -84,15 +84,13 @@ void G4Init(bool do_svtx = true, HCalOuterInit(); } - if (do_FEMC) + if (Enable::FEMC) { - gROOT->LoadMacro("G4_FEMC_EIC.C"); FEMCInit(); } - if (do_FHCAL) + if (Enable::FHCAL) { - gROOT->LoadMacro("G4_FHCAL.C"); FHCALInit(); } @@ -127,19 +125,13 @@ void G4Init(bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) const EDecayType decayType = EDecayType::kAll, -#else - const EDecayType decayType = TPythia6Decayer::kAll, -#endif 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_FEMC = false, - const bool do_FHCAL = false, const float magfield_rescale = 1.0) { //--------------- @@ -223,15 +215,18 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FEMC - if ( do_FEMC ) + if ( Enable::FEMC ) + { FEMCSetup(g4Reco, absorberactive); + } //---------------------------------------- // FHCAL - if ( do_FHCAL ) + if ( Enable::FHCAL ) + { FHCALSetup(g4Reco, absorberactive); - + } //---------------------------------------- // EEMC From f15fdca86d8dda8d5fed17c952d0c7dd473f5d9d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 16:41:04 -0400 Subject: [PATCH 0465/1222] add good max_radius and max_z --- macros/g4simulations/G4_HcalOut_ref.C | 30 +++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 007f8b5dd..28047ce52 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -17,10 +17,13 @@ R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) #endif +namespace HcalOutMacro +{ + const double outer_radius = 264.71; + const double size_z = 304.91 * 2; enum enu_HCalOut_clusterizer { kHCalOutGraphClusterizer, - kHCalOutTemplateClusterizer }; @@ -28,9 +31,24 @@ enum enu_HCalOut_clusterizer enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; +} // Init is called by G4Setup.C -void HCalOuterInit(){} +void HCalOuterInit() +{ + if (BlackHoleGeometry::max_radius < HcalOutMacro::outer_radius) + { + BlackHoleGeometry::max_radius = HcalOutMacro::outer_radius; + } + if (BlackHoleGeometry::max_z < HcalOutMacro::size_z/2.) + { + BlackHoleGeometry::max_z = HcalOutMacro::size_z/2.; + } + if (BlackHoleGeometry::min_z > -HcalOutMacro::size_z/2.) + { + BlackHoleGeometry::min_z = -HcalOutMacro::size_z/2.; + } +} double HCalOuter(PHG4Reco* g4Reco, double radius, @@ -53,7 +71,7 @@ double HCalOuter(PHG4Reco* g4Reco, // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); //----------------------------------------- - // hcal->set_double_param("outer_radius", 264.71); + // hcal->set_double_param("outer_radius", HcalOutMacro::outer_radius); // hcal->set_double_param("place_x", 0.); // hcal->set_double_param("place_y", 0.); // hcal->set_double_param("place_z", 0.); @@ -66,7 +84,7 @@ double HCalOuter(PHG4Reco* g4Reco, // 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", 304.91 * 2); + // hcal->set_double_param("size_z", HcalOutMacro::size_z); // hcal->set_double_param("steplimits", NAN); // hcal->set_double_param("tilt_angle", -11.23); @@ -164,7 +182,7 @@ void HCALOuter_Clusters(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); - if (HCalOut_clusterizer == kHCalOutTemplateClusterizer) + if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutTemplateClusterizer) { RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); @@ -172,7 +190,7 @@ void HCALOuter_Clusters(int verbosity = 0) { ClusterBuilder->Verbosity(verbosity); se->registerSubsystem( ClusterBuilder ); } - else if (HCalOut_clusterizer == kHCalOutGraphClusterizer) + else if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutGraphClusterizer) { RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALOUT"); From 609ff0d641dc7eeed143496507384617c2850c79 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 16:46:45 -0400 Subject: [PATCH 0466/1222] use min/max for black hole params --- macros/g4simulations/G4_HcalOut_ref.C | 130 +++++++++++++------------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 28047ce52..5d8bc5da4 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -1,26 +1,32 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.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) -#endif namespace HcalOutMacro { - const double outer_radius = 264.71; - const double size_z = 304.91 * 2; +const double outer_radius = 264.71; +const double size_z = 304.91 * 2; enum enu_HCalOut_clusterizer { kHCalOutGraphClusterizer, @@ -31,31 +37,23 @@ enum enu_HCalOut_clusterizer enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; -} +} // namespace HcalOutMacro + // Init is called by G4Setup.C void HCalOuterInit() { - if (BlackHoleGeometry::max_radius < HcalOutMacro::outer_radius) - { - BlackHoleGeometry::max_radius = HcalOutMacro::outer_radius; - } - if (BlackHoleGeometry::max_z < HcalOutMacro::size_z/2.) - { - BlackHoleGeometry::max_z = HcalOutMacro::size_z/2.; - } - if (BlackHoleGeometry::min_z > -HcalOutMacro::size_z/2.) - { - BlackHoleGeometry::min_z = -HcalOutMacro::size_z/2.; - } +BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,HcalOutMacro::outer_radius); +BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,HcalOutMacro::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z,-HcalOutMacro::size_z / 2.); } -double HCalOuter(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - +double HCalOuter(PHG4Reco *g4Reco, + double radius, + const int crossings, + const int absorberactive = 0, + int verbosity = 0) +{ gSystem->Load("libg4detectors.so"); gSystem->Load("libg4testbench.so"); @@ -97,38 +95,37 @@ double HCalOuter(PHG4Reco* g4Reco, // hcal->set_string_param("material", "Steel_1006"); - hcal->SetActive(); hcal->SuperDetector("HCALOUT"); if (absorberactive) - { - hcal->SetAbsorberActive(); - } + { + 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) { + 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 + // 0-999999999 // hc->checkenergy(); // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); + // 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); @@ -136,86 +133,85 @@ void HCALOuter_Cells(int verbosity = 0) { return; } -void HCALOuter_Towers(int verbosity = 0) { - +void HCALOuter_Towers(int verbosity = 0) +{ gSystem->Load("libg4calo.so"); gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - - HcalRawTowerBuilder* TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); TowerBuilder->Detector("HCALOUT"); TowerBuilder->set_sim_tower_node_prefix("SIM"); TowerBuilder->Verbosity(verbosity); - se->registerSubsystem( TowerBuilder ); + 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_raw_tower_node_prefix("RAW_LG"); TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); + 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_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->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 + 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_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 + TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression se->registerSubsystem(TowerCalibration); return; } -void HCALOuter_Clusters(int verbosity = 0) { +void HCALOuter_Clusters(int verbosity = 0) +{ gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutTemplateClusterizer) { - RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->SetCylindricalGeometry(); ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); + se->registerSubsystem(ClusterBuilder); } else if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutGraphClusterizer) { - RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALOUT"); ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); + se->registerSubsystem(ClusterBuilder); } else { - cout <<"HCALOuter_Clusters - unknown clusterizer setting!"<Load("libfun4all.so"); gSystem->Load("libg4eval.so"); Fun4AllServer *se = Fun4AllServer::instance(); - CaloEvaluator* eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile.c_str()); + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile.c_str()); eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - + se->registerSubsystem(eval); + return; } From fb659bb28aacba1a71c44453d58a937537a29323 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 16:47:12 -0400 Subject: [PATCH 0467/1222] clang-format --- macros/g4simulations/G4_HcalOut_ref.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 5d8bc5da4..b2bc3f81c 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -39,13 +39,12 @@ enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; } // namespace HcalOutMacro - // Init is called by G4Setup.C void HCalOuterInit() { -BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,HcalOutMacro::outer_radius); -BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,HcalOutMacro::size_z / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z,-HcalOutMacro::size_z / 2.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, HcalOutMacro::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalOutMacro::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalOutMacro::size_z / 2.); } double HCalOuter(PHG4Reco *g4Reco, From 06a3db56c93d91a038cdc2c65d25fe9c4e71f25b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:37:11 -0400 Subject: [PATCH 0468/1222] load libraries to run this macro --- macros/g4simulations/DisplayOn.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C index 7436916ca..3b4781365 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/macros/g4simulations/DisplayOn.C @@ -1,8 +1,11 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include #include -#endif + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + // This starts the QT based G4 gui which takes control // when x'ed out it will return a pointer to PHG4Reco so From 3da8c21c6d71e49e9781033716c7c2b9eed9d9f4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:38:20 -0400 Subject: [PATCH 0469/1222] add barrel hcals to Enable namespace --- macros/g4simulations/G4Setup_EICDetector.C | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 60a48f873..7dc7a7035 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -36,9 +36,7 @@ void RunLoadTest() {} 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) { @@ -67,9 +65,8 @@ void G4Init(bool do_svtx = true, CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations } - if (do_hcalin) + if (Enable::HCALIN) { - gROOT->LoadMacro("G4_HcalIn_ref.C"); HCalInnerInit(1); } @@ -78,9 +75,8 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_Magnet.C"); MagnetInit(); } - if (do_hcalout) + if (Enable::HCALOUT) { - gROOT->LoadMacro("G4_HcalOut_ref.C"); HCalOuterInit(); } @@ -128,9 +124,7 @@ int G4Setup(const int absorberactive = 0, const EDecayType decayType = EDecayType::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 float magfield_rescale = 1.0) { @@ -200,8 +194,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // HCALIN - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - + if (Enable::HCALIN) + { + radius = HCalInner(g4Reco, radius, 4, absorberactive); + } //---------------------------------------- // MAGNET @@ -210,8 +206,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // HCALOUT - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - + if (Enable::HCALOUT) + { + radius = HCalOuter(g4Reco, radius, 4, absorberactive); + } //---------------------------------------- // FEMC From 567754f6232fa2b60a0aaaa5dc4bdb5439173dc7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:38:52 -0400 Subject: [PATCH 0470/1222] obsolete --- macros/g4simulations/G4_HcalIn_EIC.C | 216 --------------------------- 1 file changed, 216 deletions(-) delete mode 100644 macros/g4simulations/G4_HcalIn_EIC.C diff --git a/macros/g4simulations/G4_HcalIn_EIC.C b/macros/g4simulations/G4_HcalIn_EIC.C deleted file mode 100644 index c3c70d6a5..000000000 --- a/macros/g4simulations/G4_HcalIn_EIC.C +++ /dev/null @@ -1,216 +0,0 @@ -//Inner HCal construction macro - -//EIC modification: Make support ring in h-going side smaller (larger inner ring diameter) to -//give room for PID detectors - -//Inner HCal absorber material selector: -//false - Default, absorber material is SS310 -//true - Choose if you want Aluminum -const bool inner_hcal_material_Al = false; - - -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; - - -// 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->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_e = 116.; - const double innerradius_h = 138.; - 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++) - { - double innerradius = innerradius_e; - if ( z_rings[i] > 0 ) - innerradius = innerradius_h; - - 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("libg4calo.so"); - gSystem->Load("libcalo_reco.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("libcalo_reco.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (HCalIn_clusterizer == kHCalInTemplateClusterizer) - { - RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); - ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->SetCylindricalGeometry(); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - } - else if (HCalIn_clusterizer == kHCalInGraphClusterizer) - { - RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); - ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - } - else - { - cout <<"HCalIn_Clusters - unknown clusterizer setting!"<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; -} From f5981da036eb8a0d7b28db061b9073eb2b81d8c9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:39:12 -0400 Subject: [PATCH 0471/1222] add barrel hcals to Enable namespace --- macros/g4simulations/Fun4All_G4_EICDetector.C | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 09f7b5a91..12bba1ce2 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -113,35 +113,35 @@ int Fun4All_G4_EICDetector( bool do_cemc_cluster = do_cemc_twr && true; bool do_cemc_eval = do_cemc_cluster && true; - bool do_hcalin = false; - bool do_hcalin_cell = do_hcalin && true; + Enable::HCALIN = true; + bool do_hcalin_cell = Enable::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 = false; - bool do_hcalout = false; - bool do_hcalout_cell = do_hcalout && true; + Enable::HCALOUT = false; + bool do_hcalout_cell = Enable::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 = false; + Enable::DIRC = false; // EICDetector geometry - 'hadron' direction - Enable::RICH = true; - Enable::Aerogel = false; + Enable::RICH = false; + Enable::AEROGEL = false; - bool do_FEMC = false; - bool do_FEMC_cell = do_FEMC && true; + Enable::FEMC = false; + bool do_FEMC_cell = Enable::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 = false; - bool do_FHCAL_cell = do_FHCAL && true; + Enable::FHCAL = false; + bool do_FHCAL_cell = Enable::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; @@ -153,7 +153,7 @@ int Fun4All_G4_EICDetector( bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; - Enable::PlugDoor = false; + Enable::PLUGDOOR = false; // Other options bool do_global = false; @@ -181,7 +181,7 @@ int Fun4All_G4_EICDetector( bool do_DSTReader = false; // new settings using Enable namespace in GlobalVariables.C - Enable::BlackHole = true; + Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; //--------------- @@ -196,7 +196,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FEMC,do_FHCAL,do_DIRC); + G4Init(do_tracking,do_cemc,do_magnet,do_pipe); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -401,18 +401,9 @@ int Fun4All_G4_EICDetector( // Detector description //--------------------- -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_DIRC, - magfield_rescale); -#else - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FEMC,do_FHCAL,do_DIRC, + do_tracking,do_cemc,do_magnet,do_pipe, magfield_rescale); -#endif - } //--------- @@ -584,15 +575,15 @@ int Fun4All_G4_EICDetector( /*int*/ absorberactive , /*bool*/ do_tracking , /*bool*/ do_cemc , - /*bool*/ do_hcalin , + /*bool*/ Enable::HCALIN , /*bool*/ do_magnet , - /*bool*/ do_hcalout , + /*bool*/ Enable::HCALOUT , /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , /*bool*/ do_hcalout_twr, - /*bool*/ do_FHCAL, + /*bool*/ Enable::FHCAL, /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, + /*bool*/ Enable::FEMC, /*bool*/ do_FEMC_twr, /*bool*/ Enable::EEMC, /*bool*/ do_EEMC_twr From 92339a30c1578cc8c17f6139436ca41d2e6be064 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:39:40 -0400 Subject: [PATCH 0472/1222] use min/max for black hole params --- macros/g4simulations/G4_HcalIn_ref.C | 54 +++++++++++++++++----------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 27a22ef78..bde065fbc 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -1,25 +1,38 @@ //Inner HCal reconstruction macro #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" -#include -#include -#include -#include + #include #include + #include #include #include + #include + #include -void HCalInner_SupportRing(PHG4Reco* g4Reco, - const int absorberactive = 0); + +#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) -#endif + +void HCalInner_SupportRing(PHG4Reco* g4Reco, + const int absorberactive = 0); + +namespace HcalInMacro +{ +const double support_ring_outer_radius = 178.0 - 0.001; +const double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; +const double dz = 25. / 10.; //Inner HCal absorber material selector: //false - old version, absorber material is SS310 @@ -39,14 +52,18 @@ enum enu_HCalIn_clusterizer enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; +} // Init is called by G4Setup.C void HCalInnerInit(const int iflag = 0) { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,HcalInMacro::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalInMacro::support_ring_z_ring2+HcalInMacro::dz/2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalInMacro::support_ring_z_ring2-HcalInMacro::dz/2.); if (iflag == 1) { - inner_hcal_eic = 1; + HcalInMacro::inner_hcal_eic = 1; } } @@ -64,7 +81,7 @@ double HCalInner(PHG4Reco* g4Reco, 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) + if(HcalInMacro::inner_hcal_material_Al) { cout <<"HCalInner - construct inner HCal absorber with G4_Al"<set_string_param("material","G4_Al"); @@ -134,20 +151,17 @@ void HCalInner_SupportRing(PHG4Reco* g4Reco, 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_sphenix = 116.; const double innerradius_ephenix_hadronside = 138.; - 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 }; + { -HcalInMacro::support_ring_z_ring2, -z_ring1, z_ring1, HcalInMacro::support_ring_z_ring2 }; PHG4CylinderSubsystem *cyl; for (int i = 0; i < 4; i++) { double innerradius = innerradius_sphenix; - if ( z_rings[i] > 0 && inner_hcal_eic == 1) + if ( z_rings[i] > 0 && HcalInMacro::inner_hcal_eic == 1) { innerradius = innerradius_ephenix_hadronside; } @@ -156,9 +170,9 @@ void HCalInner_SupportRing(PHG4Reco* g4Reco, cyl->SuperDetector("HCALIN_SPT"); cyl->set_double_param("radius",innerradius); cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",dz); + cyl->set_double_param("length",HcalInMacro::dz); cyl->set_string_param("material","SS310"); - cyl->set_double_param("thickness",maxradius - innerradius); + cyl->set_double_param("thickness",HcalInMacro::support_ring_outer_radius - innerradius); if (absorberactive) { cyl->SetActive(); @@ -220,7 +234,7 @@ void HCALInner_Towers(int verbosity = 0) { //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 + if(HcalInMacro::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); TowerCalibration->Detector("HCALIN"); @@ -240,7 +254,7 @@ void HCALInner_Clusters(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); - if (HCalIn_clusterizer == kHCalInTemplateClusterizer) + if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInTemplateClusterizer) { RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); @@ -249,7 +263,7 @@ void HCALInner_Clusters(int verbosity = 0) { se->registerSubsystem( ClusterBuilder ); } - else if (HCalIn_clusterizer == kHCalInGraphClusterizer) + else if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInGraphClusterizer) { RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALIN"); From c95fbbf58925a8a71bd79d5c2d9412bda6382113 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:40:33 -0400 Subject: [PATCH 0473/1222] clang-format --- macros/g4simulations/G4_HcalIn_ref.C | 175 +++++++++++++-------------- 1 file changed, 86 insertions(+), 89 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index bde065fbc..2cf9005b6 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -7,8 +7,8 @@ #include #include -#include #include +#include #include @@ -25,12 +25,12 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -void HCalInner_SupportRing(PHG4Reco* g4Reco, - const int absorberactive = 0); +void HCalInner_SupportRing(PHG4Reco *g4Reco, + const int absorberactive = 0); namespace HcalInMacro { -const double support_ring_outer_radius = 178.0 - 0.001; +const double support_ring_outer_radius = 178.0 - 0.001; const double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; const double dz = 25. / 10.; @@ -52,44 +52,43 @@ enum enu_HCalIn_clusterizer enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; -} - +} // namespace HcalInMacro // Init is called by G4Setup.C -void HCalInnerInit(const int iflag = 0) +void HCalInnerInit(const int iflag = 0) { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,HcalInMacro::support_ring_outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalInMacro::support_ring_z_ring2+HcalInMacro::dz/2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalInMacro::support_ring_z_ring2-HcalInMacro::dz/2.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, HcalInMacro::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalInMacro::support_ring_z_ring2 + HcalInMacro::dz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalInMacro::support_ring_z_ring2 - HcalInMacro::dz / 2.); if (iflag == 1) { HcalInMacro::inner_hcal_eic = 1; } } -double HCalInner(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - // all sizes are in cm! +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(HcalInMacro::inner_hcal_material_Al) + if (HcalInMacro::inner_hcal_material_Al) { - cout <<"HCalInner - construct inner HCal absorber with G4_Al"<set_string_param("material","G4_Al"); + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + hcal->set_string_param("material", "G4_Al"); } else { - cout <<"HCalInner - construct inner HCal absorber with SS310"<set_string_param("material","SS310"); + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + hcal->set_string_param("material", "SS310"); } // hcal->set_double_param("inner_radius", 117.27); //----------------------------------------- @@ -124,29 +123,29 @@ double HCalInner(PHG4Reco* g4Reco, // hcal->set_int_param("n_scinti_tiles", 12); // hcal->set_string_param("material", "SS310"); - + hcal->SetActive(); hcal->SuperDetector("HCALIN"); - if (absorberactive) - { - hcal->SetAbsorberActive(); - } + if (absorberactive) + { + hcal->SetAbsorberActive(); + } hcal->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem( hcal ); + g4Reco->registerSubsystem(hcal); radius = hcal->get_double_param("outer_radius"); - HCalInner_SupportRing(g4Reco,absorberactive); - + 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) { - +void HCalInner_SupportRing(PHG4Reco *g4Reco, + const int absorberactive = 0) +{ gSystem->Load("libg4detectors.so"); gSystem->Load("libg4testbench.so"); @@ -154,38 +153,37 @@ void HCalInner_SupportRing(PHG4Reco* g4Reco, const double innerradius_sphenix = 116.; const double innerradius_ephenix_hadronside = 138.; const double z_rings[] = - { -HcalInMacro::support_ring_z_ring2, -z_ring1, z_ring1, HcalInMacro::support_ring_z_ring2 }; + {-HcalInMacro::support_ring_z_ring2, -z_ring1, z_ring1, HcalInMacro::support_ring_z_ring2}; PHG4CylinderSubsystem *cyl; for (int i = 0; i < 4; i++) + { + double innerradius = innerradius_sphenix; + if (z_rings[i] > 0 && HcalInMacro::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", HcalInMacro::dz); + cyl->set_string_param("material", "SS310"); + cyl->set_double_param("thickness", HcalInMacro::support_ring_outer_radius - innerradius); + if (absorberactive) { - double innerradius = innerradius_sphenix; - if ( z_rings[i] > 0 && HcalInMacro::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",HcalInMacro::dz); - cyl->set_string_param("material","SS310"); - cyl->set_double_param("thickness",HcalInMacro::support_ring_outer_radius - innerradius); - if (absorberactive) - { - cyl->SetActive(); - } - g4Reco->registerSubsystem(cyl); + cyl->SetActive(); } - + g4Reco->registerSubsystem(cyl); + } + return; } - -void HCALInner_Cells(int verbosity = 0) { - +void HCALInner_Cells(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -194,100 +192,99 @@ void HCALInner_Cells(int verbosity = 0) { hc->Detector("HCALIN"); // hc->Verbosity(2); // check for energy conservation - needs modified "infinite" timing cuts - // 0-999999999 + // 0-999999999 // hc->checkenergy(); // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); + // 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) { + return; +} +void HCALInner_Towers(int verbosity = 0) +{ gSystem->Load("libg4calo.so"); gSystem->Load("libcalo_reco.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 ); + 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_raw_tower_node_prefix("RAW_LG"); TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); + 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_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->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 + 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(HcalInMacro::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen + if (HcalInMacro::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_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 + TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression se->registerSubsystem(TowerCalibration); return; } -void HCALInner_Clusters(int verbosity = 0) { +void HCALInner_Clusters(int verbosity = 0) +{ gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - + if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInTemplateClusterizer) { - RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->SetCylindricalGeometry(); ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - + se->registerSubsystem(ClusterBuilder); } else if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInGraphClusterizer) { - RawClusterBuilderGraph* ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALIN"); ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - + se->registerSubsystem(ClusterBuilder); } else { - cout <<"HCalIn_Clusters - unknown clusterizer setting!"<Load("libfun4all.so"); gSystem->Load("libg4eval.so"); Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator* eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile.c_str()); + + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile.c_str()); eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - + se->registerSubsystem(eval); + return; } From b66d12671bd114cd85c72c8deca3e1ddb60bb087 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:42:47 -0400 Subject: [PATCH 0474/1222] change DIRC namespace to DircMacro in line with others --- macros/g4simulations/G4_DIRC.C | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index b3507aae2..a03fc7208 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -20,7 +20,7 @@ R__LOAD_LIBRARY(libg4detectors.so) * \date $Date: 2013/10/09 01:08:17 $ */ -namespace DIRC +namespace DircMacro { const double radiator_R = 83.65; const double length = 400; @@ -28,21 +28,21 @@ const double z_shift = -75; //115 const double z_start = z_shift + length / 2.; const double z_end = z_shift - length / 2.; const double outer_skin_radius = 89.25; -} // namespace DIRC +} // namespace DircMacro void DIRCInit() { - if (BlackHoleGeometry::max_radius < DIRC::outer_skin_radius) + if (BlackHoleGeometry::max_radius < DircMacro::outer_skin_radius) { - BlackHoleGeometry::max_radius = DIRC::outer_skin_radius; // from default in code - needs changing + BlackHoleGeometry::max_radius = DircMacro::outer_skin_radius; // from default in code - needs changing } - if (BlackHoleGeometry::max_z < DIRC::z_start) + if (BlackHoleGeometry::max_z < DircMacro::z_start) { - BlackHoleGeometry::max_z = DIRC::z_start; + BlackHoleGeometry::max_z = DircMacro::z_start; } - if (BlackHoleGeometry::min_z > DIRC::z_end) + if (BlackHoleGeometry::min_z > DircMacro::z_end) { - BlackHoleGeometry::min_z = DIRC::z_end; + BlackHoleGeometry::min_z = DircMacro::z_end; } } @@ -55,8 +55,8 @@ double DIRCSetup(PHG4Reco *g4Reco) dirc = new PHG4SectorSubsystem("DIRC"); dirc->get_geometry().set_normal_polar_angle(M_PI / 2); dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(DIRC::radiator_R, DIRC::z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(DIRC::radiator_R, DIRC::z_end)); + dirc->get_geometry().set_min_polar_angle(atan2(DircMacro::radiator_R, DircMacro::z_start)); + dirc->get_geometry().set_max_polar_angle(atan2(DircMacro::radiator_R, DircMacro::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"); @@ -75,12 +75,12 @@ double DIRCSetup(PHG4Reco *g4Reco) // Inner skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10); cyl->set_double_param("radius", 81.71); - cyl->set_double_param("length", DIRC::length); + cyl->set_double_param("length", DircMacro::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", DIRC::z_shift); + cyl->set_double_param("place_z", DircMacro::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -89,13 +89,13 @@ double DIRCSetup(PHG4Reco *g4Reco) // Outer skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11); - cyl->set_double_param("radius", DIRC::outer_skin_radius - 0.076); - cyl->set_double_param("length", DIRC::length); + cyl->set_double_param("radius", DircMacro::outer_skin_radius - 0.076); + cyl->set_double_param("length", DircMacro::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", DIRC::z_shift); + cyl->set_double_param("place_z", DircMacro::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); From d5265f1f82a16ae01f54b85421adada904738335 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:47:02 -0400 Subject: [PATCH 0475/1222] use namespace for global variables - the file is included, they caollide all over the place --- macros/g4simulations/G4_PlugDoor_EIC.C | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 4ce1fe98c..824eaaf03 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -8,6 +8,8 @@ R__LOAD_LIBRARY(libg4detectors.so) +namespace PlugDoorEicMacro +{ // sPHENIX forward flux return(s) // define via four corners in the engineering drawing const double z_1 = 330.81; @@ -17,16 +19,17 @@ const double r_2 = 263.5; const double length = z_2 - z_1; const double place_z = -(z_1 + z_2) / 2.; +} void PlugDoorInit() { - if (BlackHoleGeometry::max_radius < r_2) + if (BlackHoleGeometry::max_radius < PlugDoorEicMacro::r_2) { - BlackHoleGeometry::max_radius = r_2; + BlackHoleGeometry::max_radius = PlugDoorEicMacro::r_2; } - if (BlackHoleGeometry::min_z > (place_z - length/2.)) + if (BlackHoleGeometry::min_z > (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length/2.)) { - BlackHoleGeometry::min_z = (place_z - length/2.); + BlackHoleGeometry::min_z = (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length/2.); } } @@ -40,10 +43,10 @@ void PlugDoor(PHG4Reco *g4Reco, PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); flux_return_minus->set_int_param("lengthviarapidity", 0); - flux_return_minus->set_double_param("length", length); - flux_return_minus->set_double_param("radius", r_1); - flux_return_minus->set_double_param("place_z", place_z); - flux_return_minus->set_double_param("thickness", r_2 - r_1); + flux_return_minus->set_double_param("length", PlugDoorEicMacro::length); + flux_return_minus->set_double_param("radius", PlugDoorEicMacro::r_1); + flux_return_minus->set_double_param("place_z", PlugDoorEicMacro::place_z); + flux_return_minus->set_double_param("thickness", PlugDoorEicMacro::r_2 - PlugDoorEicMacro::r_1); flux_return_minus->set_string_param("material", material); flux_return_minus->SetActive(flux_door_active); // flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); From e5f790de7217204695aec628891fb342bccdc08c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 19:47:19 -0400 Subject: [PATCH 0476/1222] clang-format --- macros/g4simulations/G4_PlugDoor_EIC.C | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 824eaaf03..ac3aa902b 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -7,29 +7,28 @@ R__LOAD_LIBRARY(libg4detectors.so) - namespace PlugDoorEicMacro { - // sPHENIX forward flux return(s) - // define via four corners in the engineering drawing -const double z_1 = 330.81; -const double z_2 = 360.81; -const double r_1 = 30; -const double r_2 = 263.5; +// sPHENIX forward flux return(s) +// define via four corners in the engineering drawing +const double z_1 = 330.81; +const double z_2 = 360.81; +const double r_1 = 30; +const double r_2 = 263.5; const double length = z_2 - z_1; -const double place_z = -(z_1 + z_2) / 2.; -} +const double place_z = -(z_1 + z_2) / 2.; +} // namespace PlugDoorEicMacro -void PlugDoorInit() +void PlugDoorInit() { if (BlackHoleGeometry::max_radius < PlugDoorEicMacro::r_2) { BlackHoleGeometry::max_radius = PlugDoorEicMacro::r_2; } - if (BlackHoleGeometry::min_z > (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length/2.)) + if (BlackHoleGeometry::min_z > (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length / 2.)) { - BlackHoleGeometry::min_z = (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length/2.); + BlackHoleGeometry::min_z = (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length / 2.); } } @@ -49,7 +48,7 @@ void PlugDoor(PHG4Reco *g4Reco, flux_return_minus->set_double_param("thickness", PlugDoorEicMacro::r_2 - PlugDoorEicMacro::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->SuperDetector("FLUXRET_ETA_MINUS"); flux_return_minus->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(flux_return_minus); From 1119ca969e1655ac8e602701c45bb4d606c8035e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 21:40:53 -0400 Subject: [PATCH 0477/1222] use min/max for black hole params --- macros/g4simulations/G4_CEmc_EIC.C | 69 +++++++++++++++++++----------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 8f4b29d2e..40cafcfe7 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -1,22 +1,30 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.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) -#endif +namespace CemcEicMacro +{ double cemcdepth = 9; // tungs to scint width ratio of ~10:1 // corresponds to approx 2% sampling fraction @@ -24,6 +32,7 @@ double cemcdepth = 9; // 18 radiation lengths for 40 layers double scint_width = 0.05; double tungs_width = 0.245; + double electronics_width = 0.5; int min_cemc_layer = 1; int max_cemc_layer = 41; @@ -47,8 +56,11 @@ enum enu_Cemc_clusterizer { enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph // enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; +} -void CEmcInit(const int nslats = 1) {} +void CEmcInit(const int nslats = 1) +{ +} double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { @@ -72,16 +84,16 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // as indicated in the loop below // eta = -ln(tan(theta/2)) - double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * posrapidity)); - double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * negrapidity)); + double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * CemcEicMacro::posrapidity)); + double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * CemcEicMacro::negrapidity)); // get the angle between the beam pipe and negative pseudorapidity axis theta2 = TMath::Pi() - theta2; - double z1 = topradius / TMath::Tan(theta1); - double z2 = topradius / TMath::Tan(theta2); + double z1 = CemcEicMacro::topradius / TMath::Tan(theta1); + double z2 = CemcEicMacro::topradius / TMath::Tan(theta2); - double z3 = bottomradius / TMath::Tan(theta1); - double z4 = bottomradius / TMath::Tan(theta2); + double z3 = CemcEicMacro::bottomradius / TMath::Tan(theta1); + double z4 = CemcEicMacro::bottomradius / TMath::Tan(theta2); // this is the top layer length double totaltoplength = z1 + z2; @@ -93,7 +105,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double layer_shift = 0; double height = 0; - for (int thislayer = min_cemc_layer; thislayer <= max_cemc_layer; + for (int thislayer = CemcEicMacro::min_cemc_layer; thislayer <= CemcEicMacro::max_cemc_layer; thislayer++) { // the length for a particular layer is determined from the bottom length @@ -102,7 +114,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "Spacal_W_Epoxy"); - cemc->set_double_param("thickness", tungs_width); + cemc->set_double_param("thickness", CemcEicMacro::tungs_width); cemc->set_double_param("length", thislength); cemc->set_int_param("lengthviarapidity", 0); @@ -122,10 +134,10 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, g4Reco->registerSubsystem(cemc); - radius += tungs_width; + radius += CemcEicMacro::tungs_width; radius += no_overlapp; - height += tungs_width; + height += CemcEicMacro::tungs_width; height += no_overlapp; //Added by Barak, 12/13/19 //Added by Barak, 12/13/19 @@ -134,7 +146,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc = new PHG4CylinderSubsystem("CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "PMMA"); - cemc->set_double_param("thickness", scint_width); + cemc->set_double_param("thickness", CemcEicMacro::scint_width); cemc->set_int_param("lightyield", 1); cemc->set_int_param("lengthviarapidity", 0); cemc->set_double_param("length", thislength); @@ -151,10 +163,10 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc); - radius += scint_width; + radius += CemcEicMacro::scint_width; radius += no_overlapp; - height += scint_width; + height += CemcEicMacro::scint_width; height += no_overlapp; //Added by Barak, 12/13/19 } @@ -162,7 +174,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); cemc_cyl->set_double_param("radius", radius); cemc_cyl->set_string_param("material", "G4_TEFLON"); - cemc_cyl->set_double_param("thickness", 0.5); + cemc_cyl->set_double_param("thickness", CemcEicMacro::electronics_width); double l1 = (radius + 0.5) / TMath::Tan(theta1); double l2 = (radius + 0.5) / TMath::Tan(theta2); @@ -179,6 +191,11 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc_cyl->SetActive(); cemc_cyl->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc_cyl); +// update black hole settings since we have the values here + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius+CemcEicMacro::electronics_width); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2)/2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift-(l1 + l2)/2.); + return radius; } @@ -192,11 +209,11 @@ void CEMC_Cells(int verbosity = 0) { cemc_cells->Detector("CEMC"); cemc_cells->Verbosity(verbosity); double radius = 95; - for (int i = min_cemc_layer; i <= max_cemc_layer; i++) { + for (int i = CemcEicMacro::min_cemc_layer; i <= CemcEicMacro::max_cemc_layer; i++) { //Added by Barak, 12/13/19 - radius += (tungs_width + no_overlapp); - if(i>1) radius += (scint_width + no_overlapp); + radius += (CemcEicMacro::tungs_width + no_overlapp); + if(i>1) radius += (CemcEicMacro::scint_width + no_overlapp); cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, 2. * TMath::Pi() / 256. * radius); @@ -256,7 +273,7 @@ void CEMC_Clusters(int verbosity = 0) { gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (Cemc_clusterizer == kCemcTemplateClusterizer) { + if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcTemplateClusterizer) { RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); cemc_clusterbuilder->Detector("CEMC"); @@ -268,7 +285,7 @@ void CEMC_Clusters(int verbosity = 0) { cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(cemc_clusterbuilder); - } else if (Cemc_clusterizer == kCemcGraphClusterizer) { + } else if ( CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcGraphClusterizer) { RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); cemc_clusterbuilder->Detector("CEMC"); From 52c3a9d01a510b5ff75be4ce4f75d0caf21fb2ed Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 21:41:10 -0400 Subject: [PATCH 0478/1222] clang-format --- macros/g4simulations/G4_CEmc_EIC.C | 89 ++++++++++++++++-------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 40cafcfe7..bcf43c5c5 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -32,20 +32,21 @@ double cemcdepth = 9; // 18 radiation lengths for 40 layers double scint_width = 0.05; double tungs_width = 0.245; - double electronics_width = 0.5; +double electronics_width = 0.5; int min_cemc_layer = 1; int max_cemc_layer = 41; -double topradius = 106.8; // cm -double bottomradius = 95; // cm +double topradius = 106.8; // cm +double bottomradius = 95; // cm double negrapidity = -1.5; double posrapidity = 1.24; // this is default set to -1.5 95) { + const int absorberactive = 0) +{ + if (radius > 95) + { cout << "inconsistency, radius: " << radius << " larger than allowed inner radius for CEMC = 95 cm" << endl; gSystem->Exit(-1); @@ -106,11 +108,11 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double height = 0; for (int thislayer = CemcEicMacro::min_cemc_layer; thislayer <= CemcEicMacro::max_cemc_layer; - thislayer++) { - + thislayer++) + { // the length for a particular layer is determined from the bottom length double thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); - + cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "Spacal_W_Epoxy"); @@ -121,10 +123,10 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // starts centered around IP // shift backwards 30 cm for total 370 cm length to cover -1.5set_double_param("place_z", -30); - + //Modified by Barak, 12/12/19 ztemp = radius / TMath::Tan(theta2); - layer_shift = -1. * (ztemp - (thislength/2.)); + layer_shift = -1. * (ztemp - (thislength / 2.)); cemc->set_double_param("place_z", layer_shift); cemc->SuperDetector("ABSORBER_CEMC"); @@ -138,7 +140,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, radius += no_overlapp; height += CemcEicMacro::tungs_width; - height += no_overlapp; //Added by Barak, 12/13/19 + height += no_overlapp; //Added by Barak, 12/13/19 //Added by Barak, 12/13/19 thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); @@ -153,7 +155,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // shift back -30 cm to cover -1.4set_double_param("place_z", -30); - + //Modified by Barak, 12/12/19 cemc->set_double_param("place_z", layer_shift); @@ -167,7 +169,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, radius += no_overlapp; height += CemcEicMacro::scint_width; - height += no_overlapp; //Added by Barak, 12/13/19 + height += no_overlapp; //Added by Barak, 12/13/19 } PHG4CylinderSubsystem *cemc_cyl = @@ -175,7 +177,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc_cyl->set_double_param("radius", radius); cemc_cyl->set_string_param("material", "G4_TEFLON"); cemc_cyl->set_double_param("thickness", CemcEicMacro::electronics_width); - + double l1 = (radius + 0.5) / TMath::Tan(theta1); double l2 = (radius + 0.5) / TMath::Tan(theta2); cemc_cyl->set_int_param("lengthviarapidity", 0); @@ -184,22 +186,23 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, //cemc_cyl->set_double_param("place_z", -30); //Modified by Barak, 12/12/19 - layer_shift = -1.*( (l2 - l1)/2. ); + layer_shift = -1. * ((l2 - l1) / 2.); cemc_cyl->set_double_param("place_z", layer_shift); if (absorberactive) cemc_cyl->SetActive(); cemc_cyl->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc_cyl); -// update black hole settings since we have the values here - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius+CemcEicMacro::electronics_width); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2)/2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift-(l1 + l2)/2.); + // update black hole settings since we have the values here + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + CemcEicMacro::electronics_width); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2) / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift - (l1 + l2) / 2.); return radius; } -void CEMC_Cells(int verbosity = 0) { +void CEMC_Cells(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -209,21 +212,21 @@ void CEMC_Cells(int verbosity = 0) { cemc_cells->Detector("CEMC"); cemc_cells->Verbosity(verbosity); double radius = 95; - for (int i = CemcEicMacro::min_cemc_layer; i <= CemcEicMacro::max_cemc_layer; i++) { - + for (int i = CemcEicMacro::min_cemc_layer; i <= CemcEicMacro::max_cemc_layer; i++) + { //Added by Barak, 12/13/19 radius += (CemcEicMacro::tungs_width + no_overlapp); - if(i>1) radius += (CemcEicMacro::scint_width + no_overlapp); + if (i > 1) radius += (CemcEicMacro::scint_width + no_overlapp); cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, 2. * TMath::Pi() / 256. * radius); - } se->registerSubsystem(cemc_cells); return; } -void CEMC_Towers(int verbosity = 0) { +void CEMC_Towers(int verbosity = 0) +{ gSystem->Load("libg4calo.so"); gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); @@ -235,7 +238,7 @@ void CEMC_Towers(int verbosity = 0) { se->registerSubsystem(CemcTowerBuilder); const double photoelectron_per_GeV = - 500; // 500 photon per total GeV deposition + 500; // 500 photon per total GeV deposition // just set a 4% sampling fraction - already tuned by tungs/scint width ratio double sampling_fraction = 4e-02; RawTowerDigitizer *CemcTowerDigitizer = @@ -245,12 +248,12 @@ void CEMC_Towers(int verbosity = 0) { CemcTowerDigitizer->set_digi_algorithm( RawTowerDigitizer::kSimple_photon_digitization); CemcTowerDigitizer->set_pedstal_central_ADC(0); - CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting CemcTowerDigitizer->set_photonelec_ADC( - 1); // not simulating ADC discretization error + 1); // not simulating ADC discretization error CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting se->registerSubsystem(CemcTowerDigitizer); RawTowerCalibration *CemcTowerCalibration = @@ -268,37 +271,43 @@ void CEMC_Towers(int verbosity = 0) { return; } -void CEMC_Clusters(int verbosity = 0) { - +void CEMC_Clusters(int verbosity = 0) +{ gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcTemplateClusterizer) { + if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcTemplateClusterizer) + { RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); - cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below std::string femc_prof = getenv("CALIBRATIONROOT"); femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(cemc_clusterbuilder); - } else if ( CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcGraphClusterizer) { + } + else if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcGraphClusterizer) + { RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); se->registerSubsystem(cemc_clusterbuilder); - } else { + } + else + { cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; exit(1); } return; } -void CEMC_Eval(std::string outputfile, int verbosity = 0) { +void CEMC_Eval(std::string outputfile, int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4eval.so"); Fun4AllServer *se = Fun4AllServer::instance(); From 45d5e1ec74dc846c78e4a45ab9fc96dcfde1e3cb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 22:01:37 -0400 Subject: [PATCH 0479/1222] use min/max for black hole params --- macros/g4simulations/G4_Pipe_EIC.C | 51 ++++++++++++++++++------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index bdacc8bec..b95291540 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -1,15 +1,34 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include + +#include "GlobalVariables.C" + #include #include + #include -#include "GlobalVariables.C" + +#include + R__LOAD_LIBRARY(libg4detectors.so) -#endif + +namespace PipeEicMacro +{ + // Central pipe dimension + // Extracted via mechanical model: Detector chamber 3-20-20 + // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. + // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here + static const double be_pipe_radius = 3.1000; + static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX + static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. + static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. +} void PipeInit() { +BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, PipeEicMacro::be_pipe_length_plus); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, PipeEicMacro::be_pipe_length_neg); + } //! construct beam pipe @@ -25,22 +44,14 @@ double Pipe(PHG4Reco* g4Reco, const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; - // Central pipe dimension - // Extracted via mechanical model: Detector chamber 3-20-20 - // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. - // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - static const double be_pipe_radius = 3.1000; - static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. - static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. - static const double be_pipe_length = be_pipe_length_plus - be_pipe_length_neg; // pipe length - static const double be_pipe_center = 0.5 * (be_pipe_length_plus + be_pipe_length_neg); + static const double be_pipe_length = PipeEicMacro::be_pipe_length_plus - PipeEicMacro::be_pipe_length_neg; // pipe length + static const double be_pipe_center = 0.5 * (PipeEicMacro::be_pipe_length_plus + PipeEicMacro::be_pipe_length_neg); - if (radius > be_pipe_radius) + if (radius > PipeEicMacro::be_pipe_radius) { cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << be_pipe_radius << endl; + << " larger than pipe inner radius: " << PipeEicMacro::be_pipe_radius << endl; gSystem->Exit(-1); } @@ -54,25 +65,25 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", be_pipe_radius); + cyl->set_double_param("thickness", PipeEicMacro::be_pipe_radius); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", be_pipe_radius); + cyl->set_double_param("radius", PipeEicMacro::be_pipe_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Be"); - cyl->set_double_param("thickness", be_pipe_thickness); + cyl->set_double_param("thickness", PipeEicMacro::be_pipe_thickness); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); - radius = be_pipe_radius + be_pipe_thickness; + radius = PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness; radius += no_overlapp; From 757763fba38b30a1005b6243d17a290a21ff7549 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 2 May 2020 22:01:57 -0400 Subject: [PATCH 0480/1222] clang-format --- macros/g4simulations/G4_Pipe_EIC.C | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index b95291540..45f9fb404 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -13,22 +13,21 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace PipeEicMacro { - // Central pipe dimension - // Extracted via mechanical model: Detector chamber 3-20-20 - // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. - // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - static const double be_pipe_radius = 3.1000; - static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. - static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. -} +// Central pipe dimension +// Extracted via mechanical model: Detector chamber 3-20-20 +// directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. +// The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here +static const double be_pipe_radius = 3.1000; +static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX +static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. +static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. +} // namespace PipeEicMacro void PipeInit() { -BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, PipeEicMacro::be_pipe_length_plus); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, PipeEicMacro::be_pipe_length_neg); - } //! construct beam pipe @@ -36,15 +35,13 @@ BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PipeEicM double Pipe(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, - int verbosity = 0 - ) + int verbosity = 0) { // process pipe extentions? bool use_forward_pipes = false; const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; - static const double be_pipe_length = PipeEicMacro::be_pipe_length_plus - PipeEicMacro::be_pipe_length_neg; // pipe length static const double be_pipe_center = 0.5 * (PipeEicMacro::be_pipe_length_plus + PipeEicMacro::be_pipe_length_neg); From 47a5b2b7ec7b22823255b7b6a419a2a327032742 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:42:22 -0400 Subject: [PATCH 0481/1222] move every G4 module to Enable namespace --- macros/g4simulations/Fun4All_G4_EICDetector.C | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 12bba1ce2..f2e9fdefc 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -1,5 +1,7 @@ #pragma once + #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include #include #include @@ -93,67 +95,65 @@ int Fun4All_G4_EICDetector( //====================== // sPHENIX barrel - bool do_bbc = false; + bool do_bbc = true; // whether to simulate the Be section of the beam pipe - bool do_pipe = false; + Enable::PIPE = true; // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C - bool do_tracking = false; - bool do_tracking_cell = do_tracking && true; - bool do_tracking_track = do_tracking_cell && true; + Enable::TRACKING = true; + bool do_tracking_cell = Enable::TRACKING && true; + bool do_tracking_track = do_tracking_cell && false; bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - bool do_pstof = false; - - bool do_cemc = false; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; + Enable::CEMC = true; + bool do_cemc_cell = Enable::CEMC && true; + bool do_cemc_twr = do_cemc_cell && false; bool do_cemc_cluster = do_cemc_twr && true; bool do_cemc_eval = do_cemc_cluster && true; Enable::HCALIN = true; bool do_hcalin_cell = Enable::HCALIN && true; - bool do_hcalin_twr = do_hcalin_cell && true; + bool do_hcalin_twr = do_hcalin_cell && false; bool do_hcalin_cluster = do_hcalin_twr && true; bool do_hcalin_eval = do_hcalin_cluster && true; - bool do_magnet = false; + Enable::MAGNET = true; - Enable::HCALOUT = false; + Enable::HCALOUT = true; bool do_hcalout_cell = Enable::HCALOUT && true; - bool do_hcalout_twr = do_hcalout_cell && true; + bool do_hcalout_twr = do_hcalout_cell && false; bool do_hcalout_cluster = do_hcalout_twr && true; bool do_hcalout_eval = do_hcalout_cluster && true; // EICDetector geometry - barrel - Enable::DIRC = false; + Enable::DIRC = true; // EICDetector geometry - 'hadron' direction - Enable::RICH = false; - Enable::AEROGEL = false; + Enable::RICH = true; + Enable::AEROGEL = true; - Enable::FEMC = false; + Enable::FEMC = true; bool do_FEMC_cell = Enable::FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && true; + bool do_FEMC_twr = do_FEMC_cell && false; bool do_FEMC_cluster = do_FEMC_twr && true; bool do_FEMC_eval = do_FEMC_cluster && true; - Enable::FHCAL = false; + Enable::FHCAL = true; bool do_FHCAL_cell = Enable::FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; + bool do_FHCAL_twr = do_FHCAL_cell && false; bool do_FHCAL_cluster = do_FHCAL_twr && true; bool do_FHCAL_eval = do_FHCAL_cluster && true; // EICDetector geometry - 'electron' direction - Enable::EEMC = false; - bool do_EEMC_cell = Enable::EEMC && false; - bool do_EEMC_twr = do_EEMC_cell && true; + Enable::EEMC = true; + bool do_EEMC_cell = Enable::EEMC && true; + bool do_EEMC_twr = do_EEMC_cell && false; bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; - Enable::PLUGDOOR = false; + Enable::PLUGDOOR = true; // Other options bool do_global = false; @@ -181,8 +181,8 @@ int Fun4All_G4_EICDetector( bool do_DSTReader = false; // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; + // Enable::BLACKHOLE = true; + // BlackHoleGeometry::visible = true; //--------------- // Load libraries @@ -196,7 +196,7 @@ int Fun4All_G4_EICDetector( // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_tracking,do_cemc,do_magnet,do_pipe); + G4Init(); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -221,7 +221,7 @@ int Fun4All_G4_EICDetector( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -402,7 +402,6 @@ int Fun4All_G4_EICDetector( //--------------------- G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking,do_cemc,do_magnet,do_pipe, magfield_rescale); } @@ -573,10 +572,10 @@ int Fun4All_G4_EICDetector( G4DSTreader_EICDetector( outputFile, // /*int*/ absorberactive , - /*bool*/ do_tracking , - /*bool*/ do_cemc , + /*bool*/ Enable::TRACKING , + /*bool*/ Enable::CEMC , /*bool*/ Enable::HCALIN , - /*bool*/ do_magnet , + /*bool*/ Enable::MAGNET , /*bool*/ Enable::HCALOUT , /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , @@ -590,9 +589,9 @@ int Fun4All_G4_EICDetector( ); } - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); //----------------- // Event processing From dfd81f4996b9cd4af734f543a0e77a6301e9c240 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:42:31 -0400 Subject: [PATCH 0482/1222] move every G4 module to Enable namespace --- macros/g4simulations/G4Setup_EICDetector.C | 52 ++++++++++------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 7dc7a7035..89bb4344d 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -34,17 +34,13 @@ R__LOAD_LIBRARY(libg4detectors.so) void RunLoadTest() {} -void G4Init(bool do_svtx = true, - bool do_cemc = true, - bool do_magnet = true, - bool do_pipe = true) +void G4Init() { // load detector/material macros and execute Init() function - if (do_pipe) + if (Enable::PIPE) { - gROOT->LoadMacro("G4_Pipe_EIC.C"); PipeInit(); } @@ -53,15 +49,13 @@ void G4Init(bool do_svtx = true, PlugDoorInit(); } - if (do_svtx) + if (Enable::TRACKING) { - //gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - gROOT->LoadMacro("G4_Tracking_EIC.C"); TrackingInit(); } - if (do_cemc) + + if (Enable::CEMC) { - gROOT->LoadMacro("G4_CEmc_EIC.C"); CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations } @@ -70,9 +64,8 @@ void G4Init(bool do_svtx = true, HCalInnerInit(1); } - if (do_magnet) + if (Enable::MAGNET) { - gROOT->LoadMacro("G4_Magnet.C"); MagnetInit(); } if (Enable::HCALOUT) @@ -122,10 +115,6 @@ void G4Init(bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", const EDecayType decayType = EDecayType::kAll, - const bool do_svtx = true, - const bool do_cemc = true, - const bool do_magnet = true, - const bool do_pipe = true, const float magfield_rescale = 1.0) { //--------------- @@ -151,11 +140,7 @@ int G4Setup(const int absorberactive = 0, // (default is QGSP_BERT for speed) // g4Reco->SetPhysicsList("QGSP_BERT_HP"); -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) if (decayType != EDecayType::kAll) -#else - if (decayType != TPythia6Decayer::kAll) -#endif { g4Reco->set_force_decay(decayType); } @@ -179,16 +164,23 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - + if (Enable::PIPE) + { + radius = Pipe(g4Reco, radius, absorberactive); + } //---------------------------------------- // SVTX - if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); - + if (Enable::TRACKING) + { + radius = Tracking(g4Reco, radius, absorberactive); + } //---------------------------------------- // CEMC // - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); + if (Enable::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 //---------------------------------------- @@ -201,8 +193,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // MAGNET - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - + if (Enable::MAGNET) + { + radius = Magnet(g4Reco, radius, 0, absorberactive); + } //---------------------------------------- // HCALOUT @@ -266,7 +260,7 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); // finally adjust the world size in case the default is too small - WorldSize(g4Reco, radius); +// WorldSize(g4Reco, radius); se->registerSubsystem( g4Reco ); return 0; From 12c0753f8028ad75dc0261b9649161e329bb5bbc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:45:17 -0400 Subject: [PATCH 0483/1222] Add Enable::MAGNET --- macros/g4simulations/GlobalVariables.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 235b2cf49..4ee699b39 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -13,11 +13,12 @@ namespace Enable static bool FHCAL = false; static bool HCALIN = false; static bool HCALOUT = false; + static bool MAGNET = false; static bool OVERLAPCHECK = false; static bool PIPE = false; + static bool PLUGDOOR = false; static bool PSTOF = false; static bool RICH = false; - static bool PLUGDOOR = false; static bool TRACKING = false; } From 8b5275eb57e70719190841a587e722eee3a11c32 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:45:58 -0400 Subject: [PATCH 0484/1222] Start with cleanup --- macros/g4simulations/G4_Tracking_EIC.C | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 9d2ff0aec..9bb25d5d8 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -1,22 +1,32 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include + +#include "GlobalVariables.C" + +#include "G4_GEM_EIC.C" +#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" + #include + #include + #include + #include + +#include + +#include + class SubsysReco; + R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) -#endif -#include -#include "G4_GEM_EIC.C" + // load the version of central travker macro with cylindrical approximation of the TPC // This is required for fast tracking to properly count hits in TPC -#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" void TrackingInit(int verbosity = 0) { From c9540f9080d9134c4099f881982a6aac414ac3f5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:46:54 -0400 Subject: [PATCH 0485/1222] add babar magnet namespace --- macros/g4simulations/G4_Magnet.C | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 19620dc8f..796af147f 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -1,12 +1,26 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include + #include + R__LOAD_LIBRARY(libg4detectors.so) -#endif -void MagnetInit() {} +namespace BabarMagnetMacro +{ +static double magnet_outer_cryostat_wall_radius = 174.5; +static double magnet_outer_cryostat_wall_thickness = 2.5; +static double magnet_length = 379.; +} + +void MagnetInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BabarMagnetMacro::magnet_outer_cryostat_wall_radius+BabarMagnetMacro::magnet_outer_cryostat_wall_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BabarMagnetMacro::magnet_length/2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -BabarMagnetMacro::magnet_length/2.); +} double Magnet(PHG4Reco* g4Reco, double radius, @@ -16,8 +30,6 @@ double Magnet(PHG4Reco* g4Reco, 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.; @@ -35,7 +47,7 @@ double Magnet(PHG4Reco* g4Reco, 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("length",BabarMagnetMacro::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"); @@ -53,23 +65,23 @@ cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for mag g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("MAGNET", 2); - cyl->set_double_param("radius",magnet_outer_cryostat_wall_radius); + cyl->set_double_param("radius",BabarMagnetMacro::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_double_param("length",BabarMagnetMacro::magnet_length); + cyl->set_double_param("thickness",BabarMagnetMacro::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 + radius = BabarMagnetMacro::magnet_outer_cryostat_wall_radius + BabarMagnetMacro::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 << " outer radius = " << BabarMagnetMacro::magnet_outer_cryostat_wall_radius + BabarMagnetMacro::magnet_outer_cryostat_wall_thickness << " cm" << endl; + cout << " length = " << BabarMagnetMacro::magnet_length << " cm" << endl; cout << "===========================================================================" << endl; } From 4b7ffb1f08bc75134b72dc92efa98cae76b7ba0d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:47:35 -0400 Subject: [PATCH 0486/1222] put verbosity around Al printout --- macros/g4simulations/G4_HcalIn_ref.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 2cf9005b6..5bdf8c4d1 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -82,12 +82,18 @@ double HCalInner(PHG4Reco *g4Reco, // hcal->set_string_param("material","SS310"); if (HcalInMacro::inner_hcal_material_Al) { - cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + } hcal->set_string_param("material", "G4_Al"); } else { - cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + 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); From 35a4d47d15cdf51e48650f4b0a0f98d98ce36f88 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:49:31 -0400 Subject: [PATCH 0487/1222] enable black hole and make visible for testing --- macros/g4simulations/Fun4All_G4_EICDetector.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index f2e9fdefc..516da7357 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -181,8 +181,8 @@ int Fun4All_G4_EICDetector( bool do_DSTReader = false; // new settings using Enable namespace in GlobalVariables.C - // Enable::BLACKHOLE = true; - // BlackHoleGeometry::visible = true; + Enable::BLACKHOLE = true; + BlackHoleGeometry::visible = true; //--------------- // Load libraries From 6016652a3d2bb06556ee205bab9113944e1e4a7b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 4 May 2020 15:49:53 -0400 Subject: [PATCH 0488/1222] resize world if default is too small --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 89bb4344d..dd9faeca3 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -260,7 +260,7 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); // finally adjust the world size in case the default is too small -// WorldSize(g4Reco, radius); + WorldSize(g4Reco, radius); se->registerSubsystem( g4Reco ); return 0; From 6e95ef6151d3b3c4262bfe8c8faf0fdc61502ea4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 5 May 2020 09:45:04 -0400 Subject: [PATCH 0489/1222] simplify, use loops and remove unused code --- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 198 +++++------------- 1 file changed, 54 insertions(+), 144 deletions(-) diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C index 34799ef4e..3ab487f12 100644 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C @@ -1,38 +1,36 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include -#include + +#include "GlobalVariables.C" + #include -#include -#include + #include #include + #include -#include "GlobalVariables.C" -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) -#endif +#include + +#include + +#include + +//#include + +#include #include -// ONLY if backward compatibility with hits files already generated with 8 inner TPC layers is needed, you can set this to "true" -bool tpc_layers_40 = false; +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) -// 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; +namespace TrackingEicMvtxMacro +{ const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers +} -// default setup for the INTT - please don't change this. The configuration can be redone later in the nacro if desired -int n_intt_layer = 0; -// default layer configuration -int laddertype[4] = {0, 1, 1, 1}; // default -int nladder[4] = {34, 30, 36, 42}; // default -double sensor_radius_inner[4] = {6.876, 8.987, 10.835, 12.676}; // inner staggered radius for layer default -double sensor_radius_outer[4] = {7.462, 9.545, 11.361, 13.179}; // outer staggered radius for layer default - +namespace TrackingEicTpcMacro +{ int n_tpc_layer_inner = 16; double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. int tpc_layer_rphi_count_inner = 1152; @@ -44,8 +42,7 @@ int tpc_layer_rphi_count_mid = 1536; int n_tpc_layer_outer = 16; double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm int tpc_layer_rphi_count_outer = 2304; - -int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; +} double inner_cage_radius = 20.; // double inner_readout_radius = 30.; - deprecated for EIC simulation @@ -102,11 +99,10 @@ double tpc_cell_z; double TPC_SmearRPhi; double TPC_SmearZ; -int Max_si_layer; +//} void SvtxInit(int verbosity = 0) { - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; switch (ether) { @@ -219,7 +215,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, int verbosity = 0) { gSystem->Load("libg4mvtx.so"); - if (n_maps_layer > 0) + int n_gas_layer = TrackingEicTpcMacro::n_tpc_layer_inner + TrackingEicTpcMacro::n_tpc_layer_mid + TrackingEicTpcMacro::n_tpc_layer_outer; + if (TrackingEicMvtxMacro::n_maps_layer > 0) { bool maps_overlapcheck = false; // set to true if you want to check for overlaps @@ -237,62 +234,29 @@ double Svtx(PHG4Reco* g4Reco, double radius, // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - static const double Degree2Rad = 180. / TMath::Pi(); - int ilyr = 0; - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", 18); - mvtx->set_double_param(ilyr, "layer_nominal_radius", 36.4); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); - mvtx->set_double_param(ilyr, "phi0", 0); - - // Then add a new mid layer that is extrapolation of the inner two. - ++ilyr; - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", 24); - mvtx->set_double_param(ilyr, "layer_nominal_radius", 48.1 ); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); - mvtx->set_double_param(ilyr, "phi0", 0); - - ++ilyr; - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", 30); - mvtx->set_double_param(ilyr, "layer_nominal_radius", 59.8 ); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); - mvtx->set_double_param(ilyr, "phi0", 0); - -// // Then add a new 3rd layer that is extrapolation of the inner two. -// ++ilyr; -// mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem -// mvtx->set_int_param(ilyr, "layer", ilyr); -// mvtx->set_int_param(ilyr, "N_staves", 42); -// mvtx->set_double_param(ilyr, "layer_nominal_radius", 83.2 ); // mm -// mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad + TMath::Pi()); -// mvtx->set_double_param(ilyr, "phi0", 0); + static const double Degree2Rad = 180. /M_PI; + int N_staves[3] = {18, 24, 30}; + double nom_radius[3] = {36.4, 48.1, 59.8}; + for (int ilyr = 0; ilyr<3; ilyr++) + { + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", nom_radius[ilyr]); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad +M_PI); + mvtx->set_double_param(ilyr, "phi0", 0); + } mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); - } // if (n_maps_layer > 0) - - assert(n_intt_layer == 0); + } // if (TrackingEicMvtxMacro::n_maps_layer > 0) // int verbosity = 1; // time projection chamber layers -------------------------------------------- - // switch ONLY for backward compatibility with 40 layer hits files! - if (tpc_layers_40) - { - n_tpc_layer_inner = 8; - tpc_layer_thick_inner = 1.25; - tpc_layer_rphi_count_inner = 1152; - cout << "Using 8 inner_layers for backward comatibility" << endl; - } - PHG4CylinderSubsystem* cyl; radius = inner_cage_radius; @@ -302,9 +266,8 @@ double Svtx(PHG4Reco* g4Reco, double radius, 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 = new PHG4CylinderSubsystem("SVTXSUPPORT", TrackingEicMvtxMacro::n_maps_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); @@ -319,88 +282,35 @@ double Svtx(PHG4Reco* g4Reco, double radius, // string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc // - // // Layer of inert TPC gas from 20-30 cm - // if (inner_readout_radius - 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.; - // Active layers of the TPC (inner layers) - - for (int ilayer = n_maps_layer + n_intt_layer; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_inner - 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", tpc_layer_thick_inner - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thick_inner; - } - - // Active layers of the TPC from 40-60 cm (mid layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid); ++ilayer) - { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_mid - 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", tpc_layer_thick_mid - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); + int n_tpc_layers[3] = {16,16,16}; + int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; - radius += tpc_layer_thick_mid; - } - - // Active layers of the TPC from 60-80 cm (outer layers) - - for (int ilayer = n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid; ilayer < (n_maps_layer + n_intt_layer + n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer); ++ilayer) + double tpc_region_thickness[3] = { 20., 20., 18.}; + // Active layers of the TPC (inner layers) +int nlayer = TrackingEicMvtxMacro::n_maps_layer; +for (int irange=0; irange<3; irange++) +{ + double tpc_layer_thickness = tpc_region_thickness[irange]/n_tpc_layers[irange]; // thickness per layer + for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) { - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with inner radius " << radius << " cm " - << " thickness " << tpc_layer_thick_outer - 0.01 << " length " << cage_length << endl; - - cyl = new PHG4CylinderSubsystem("SVTX", ilayer); + cyl = new PHG4CylinderSubsystem("SVTX", nlayer); 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", tpc_layer_thick_outer - 0.01); + cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); cyl->SetActive(); cyl->SuperDetector("SVTX"); g4Reco->registerSubsystem(cyl); - radius += tpc_layer_thick_outer; + radius += tpc_layer_thickness; + nlayer++; } +} // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + n_gas_layer); + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", nlayer); cyl->set_double_param("radius", radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", cage_length); From 64c7c854d1b5aaba949a9b9d0d030cb4f362c62a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 5 May 2020 09:48:51 -0400 Subject: [PATCH 0490/1222] disable fixed seed so it can be used for real --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 516da7357..8107e9c45 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -221,7 +221,7 @@ int Fun4All_G4_EICDetector( // 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); + // rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation From d9346a623f5288cc4f091608c1f5f5e421c09b10 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 May 2020 14:54:21 -0400 Subject: [PATCH 0491/1222] move PIPE Enable flag to pipe macro --- macros/g4simulations/G4_Pipe_EIC.C | 48 +++++++++++++++++------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 45f9fb404..fc3db019e 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -11,23 +11,29 @@ R__LOAD_LIBRARY(libg4detectors.so) -namespace PipeEicMacro +// This creates the Enable Flag to be used in the main steering macro +namespace Enable { -// Central pipe dimension -// Extracted via mechanical model: Detector chamber 3-20-20 -// directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. -// The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here -static const double be_pipe_radius = 3.1000; -static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX -static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. -static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. -} // namespace PipeEicMacro + static bool PIPE = false; +} + +namespace PIPE +{ + // Central pipe dimension + // Extracted via mechanical model: Detector chamber 3-20-20 + // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. + // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here + static const double be_pipe_radius = 3.1000; + static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX + static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. + static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. +} // namespace PIPE void PipeInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, PipeEicMacro::be_pipe_length_plus); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, PipeEicMacro::be_pipe_length_neg); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PIPE::be_pipe_radius + PIPE::be_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, PIPE::be_pipe_length_plus); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, PIPE::be_pipe_length_neg); } //! construct beam pipe @@ -42,13 +48,13 @@ double Pipe(PHG4Reco* g4Reco, const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; - static const double be_pipe_length = PipeEicMacro::be_pipe_length_plus - PipeEicMacro::be_pipe_length_neg; // pipe length - static const double be_pipe_center = 0.5 * (PipeEicMacro::be_pipe_length_plus + PipeEicMacro::be_pipe_length_neg); + static const double be_pipe_length = PIPE::be_pipe_length_plus - PIPE::be_pipe_length_neg; // pipe length + static const double be_pipe_center = 0.5 * (PIPE::be_pipe_length_plus + PIPE::be_pipe_length_neg); - if (radius > PipeEicMacro::be_pipe_radius) + if (radius > PIPE::be_pipe_radius) { cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << PipeEicMacro::be_pipe_radius << endl; + << " larger than pipe inner radius: " << PIPE::be_pipe_radius << endl; gSystem->Exit(-1); } @@ -62,25 +68,25 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", PipeEicMacro::be_pipe_radius); + cyl->set_double_param("thickness", PIPE::be_pipe_radius); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", PipeEicMacro::be_pipe_radius); + cyl->set_double_param("radius", PIPE::be_pipe_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Be"); - cyl->set_double_param("thickness", PipeEicMacro::be_pipe_thickness); + cyl->set_double_param("thickness", PIPE::be_pipe_thickness); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); - radius = PipeEicMacro::be_pipe_radius + PipeEicMacro::be_pipe_thickness; + radius = PIPE::be_pipe_radius + PIPE::be_pipe_thickness; radius += no_overlapp; From 496919015b92607026332d1e023ec7fe814c7e1d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 May 2020 16:25:08 -0400 Subject: [PATCH 0492/1222] indent namespaces --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index fd3e684e0..4f197fbf6 100644 --- a/.clang-format +++ b/.clang-format @@ -60,7 +60,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None +NamespaceIndentation: All ObjCBlockIndentWidth: 2 ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: false From a019d9e111ceb9fcba214f4bd8be4bdcbf22f9e9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 May 2020 17:39:50 -0400 Subject: [PATCH 0493/1222] add enable flags, set black hole parameters --- macros/g4simulations/G4_GEM_EIC.C | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 32eb7b92b..b780ae479 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,27 +1,40 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include + +#include "GlobalVariables.C" + #include + #include + +#include + #include -#include "GlobalVariables.C" -using namespace std; +R__LOAD_LIBRARY(libg4detectors.so) int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, double Rmax); -R__LOAD_LIBRARY(libg4detectors.so) -#endif + +namespace Enable +{ + static bool EGEM = false; + static bool FGEM = false; +} void EGEM_Init() { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); +// extends only to -z + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z,-160. ); } void FGEM_Init() { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } void EGEMSetup(PHG4Reco *g4Reco) From add738511c19a8364c0c137640598611a59a6595 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 May 2020 19:18:05 -0400 Subject: [PATCH 0494/1222] separate egem/fgem from tracking --- macros/g4simulations/G4Setup_EICDetector.C | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index dd9faeca3..b303abfb1 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -12,6 +12,7 @@ #include "G4_PlugDoor_EIC.C" #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" +#include "G4_GEM_EIC.C" #include "G4_EEMC.C" #include "G4_DIRC.C" #include "G4_RICH.C" @@ -49,6 +50,15 @@ void G4Init() PlugDoorInit(); } + if (Enable::EGEM) + { + EGEM_Init(); + } + + if (Enable::FGEM) + { + FGEM_Init(); + } if (Enable::TRACKING) { TrackingInit(); @@ -73,6 +83,7 @@ void G4Init() HCalOuterInit(); } + if (Enable::FEMC) { FEMCInit(); @@ -169,7 +180,17 @@ int G4Setup(const int absorberactive = 0, radius = Pipe(g4Reco, radius, absorberactive); } //---------------------------------------- - // SVTX + + if (Enable::EGEM) + { + EGEMSetup(g4Reco); + } + + if (Enable::FGEM) + { + FGEMSetup(g4Reco); + } + if (Enable::TRACKING) { radius = Tracking(g4Reco, radius, absorberactive); @@ -260,7 +281,7 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); // finally adjust the world size in case the default is too small - WorldSize(g4Reco, radius); +// WorldSize(g4Reco, radius); se->registerSubsystem( g4Reco ); return 0; From 677826dbecdfee2aaf819685c11087b578ed974a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 May 2020 22:59:52 -0400 Subject: [PATCH 0495/1222] move Mvtx to its own macro --- macros/g4simulations/G4_Mvtx.C | 119 +++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 macros/g4simulations/G4_Mvtx.C diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C new file mode 100644 index 000000000..1c8f0bc20 --- /dev/null +++ b/macros/g4simulations/G4_Mvtx.C @@ -0,0 +1,119 @@ +#pragma once + +#include "GlobalVariables.C" + +#include +#include + +#include + +#include + + +#include +#include + +R__LOAD_LIBRARY(libg4mvtx.so) + +namespace Enable +{ + static bool MVTX = false; +} + +namespace MVTX +{ +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_staves[MVTX::n_maps_layer] = {18, 24, 30}; +const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; +} + +void MvtxInit(int verbosity = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer-1]/10.+0.7); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +} + +double Mvtx(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + gSystem->Load("libg4mvtx.so"); + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + // H?kan Wennl?f : + // Without time-stamping layer: + // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves + // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 + // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 + // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 + // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 + + +// int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; +// double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + for (int ilyr = 0; ilyrset_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0*180./M_PI +M_PI); + mvtx->set_double_param(ilyr, "phi0", 0); + } + + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + return MVTX::nom_radius[MVTX::n_maps_layer-1]/10.; // return cm +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +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 + //----------- + + return; +} + +// Central detector reco is disabled as EIC setup use the fast tracking sim for now +void Svtx_Reco(int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + return; +} From 33d868965e628f46eaf67e49d7a238b23fb42a03 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 12 May 2020 23:00:22 -0400 Subject: [PATCH 0496/1222] clang-format --- macros/g4simulations/G4_Mvtx.C | 76 +++++++++++++++++----------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index 1c8f0bc20..ce214014c 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -9,7 +9,6 @@ #include - #include #include @@ -22,14 +21,14 @@ namespace Enable namespace MVTX { -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_staves[MVTX::n_maps_layer] = {18, 24, 30}; -const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; -} + 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_staves[MVTX::n_maps_layer] = {18, 24, 30}; + const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; +} // namespace MVTX void MvtxInit(int verbosity = 0) { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer-1]/10.+0.7); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10. + 0.7); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -39,39 +38,38 @@ double Mvtx(PHG4Reco* g4Reco, double radius, int verbosity = 0) { gSystem->Load("libg4mvtx.so"); - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - // H?kan Wennl?f : - // Without time-stamping layer: - // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves - // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 - // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 - // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 - // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - - -// int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; -// double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; - for (int ilyr = 0; ilyrset_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0*180./M_PI +M_PI); - mvtx->set_double_param(ilyr, "phi0", 0); - } - - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - return MVTX::nom_radius[MVTX::n_maps_layer-1]/10.; // return cm + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + // H?kan Wennl?f : + // Without time-stamping layer: + // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves + // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 + // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 + // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 + // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 + + // int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; + // double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + for (int ilyr = 0; ilyr < MVTX::n_maps_layer; ilyr++) + { + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); + mvtx->set_double_param(ilyr, "phi0", 0); + } + + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + return MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10.; // return cm } // Central detector cell reco is disabled as EIC setup use the fast tracking sim for now From 900edd57ca5a08813f5588982fb781cb229be93d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 14:22:34 -0400 Subject: [PATCH 0497/1222] first rough version --- macros/g4simulations/G4_TPC_EIC.C | 288 ++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 macros/g4simulations/G4_TPC_EIC.C diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C new file mode 100644 index 000000000..e008a5899 --- /dev/null +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -0,0 +1,288 @@ +#pragma once + +#include "GlobalVariables.C" +#include "G4_Mvtx.C" + +#include + +#include + +#include + +#include + + +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) + +namespace Enable +{ + static bool TPC = false; +} + +namespace G4TPC +{ + int n_tpc_layer_inner = 16; + double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. + int tpc_layer_rphi_count_inner = 1152; + + int n_tpc_layer_mid = 16; + double tpc_layer_thick_mid = 1.25; + int tpc_layer_rphi_count_mid = 1536; + + int n_tpc_layer_outer = 16; + double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm + int tpc_layer_rphi_count_outer = 2304; + + + double inner_cage_radius = 20.; + 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 +// double inner_readout_radius = 30.; - deprecated for EIC simulation + +// TPC gas parameters +// These are set for a variety of gas choices... +//============================================== + enum TPC_Gas + { + Ne2K_100, + Ne2K_400, + NeCF4_100, + NeCF4_300, + NeCF4_400, + ByHand + }; + TPC_Gas tpc_gas = TPC_Gas::NeCF4_400; +//TPC_Gas tpc_gas = TPC_Gas::ByHand; + +// Data on gasses @20 C and 760 Torr from the following source: +// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf + double Ne_dEdx = 1.56; // keV/cm + double CF4_dEdx = 7.00; // keV/cm + double iBut_dEdx = 5.93; // keV/cm + + double Ne_NPrimary = 12; // Number/cm + double CF4_NPrimary = 51; // Number/cm + double iBut_NPrimary = 84; // Number/cm + + double Ne_NTotal = 43; // Number/cm + double CF4_NTotal = 100; // Number/cm + double iBut_NTotal = 195; // Number/cm + +// TPC Performance Parameter (applies extra smear to mimic the avalanche): + double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... + +// to be overwritten... + double TPCDriftVelocity; + double TPC_Trans_Diffusion; + double TPC_Long_Diffusion; + double TPC_dEdx; + double TPC_NPri; + double TPC_NTot; + double TPC_ElectronsPerKeV; + +// TPC readout shaping time and ADC clock parameters +// these set the Z size of the TPC cells +// These need to be set in the init since some of them require the drift velocity... +//======================================= + double TPCADCClock; + double TPCShapingRMSLead; + double TPCShapingRMSTail; + double tpc_cell_z; + double TPC_SmearRPhi; + double TPC_SmearZ; +} + +void TPCInit(int verbosity = 0) +{ + + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length/2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length/2.); + + // TPC readout shaping time and ADC clock parameters + // these set the Z size of the TPC cells + //======================================= + // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA + // TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz + // tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm + + // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time +// TPC_SmearRPhi = 0.25; +// TPC_SmearZ = 0.15; +} + +double TPC(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ +/* + switch (G4TPC::tpc_gas) + { + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html + case G4TPC::TPC_Gas::Ne2K_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; + G4TPC::TPCDriftVelocity = 3.2 / 1000.0; // cm/ns + G4TPC::TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) + G4TPC::TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + case TPC_Gas::Ne2K_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; + TPCDriftVelocity = 5.5 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) + TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; + TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; + TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; + break; + } + // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html + case TPC_Gas::NeCF4_100: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; + TPCDriftVelocity = 4.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_300: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; + TPCDriftVelocity = 7.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::NeCF4_400: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + case TPC_Gas::ByHand: + { + if (verbosity) + cout << "Gas Choice: TPC_Gas::ByHand" << endl; + TPCDriftVelocity = 6.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) + TPC_ElectronsPerKeV = 28.0; + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; + break; + } + default: // defaults to NeCF4_400 + { + if (verbosity) + cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; + TPCDriftVelocity = 8.0 / 1000.0; // cm/ns + TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) + TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) + TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; + TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; + TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; + break; + } + } + + G4TPC::TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; +*/ + +// int n_gas_layer = TrackingEicTpcMacro::n_tpc_layer_inner + TrackingEicTpcMacro::n_tpc_layer_mid + TrackingEicTpcMacro::n_tpc_layer_outer; + // time projection chamber layers -------------------------------------------- + + PHG4CylinderSubsystem* cyl; + + radius = G4TPC::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", MVTX::n_maps_layer); + cyl->set_double_param("radius", radius); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", "G4_KAPTON"); + cyl->set_double_param("thickness", G4TPC::cage_thickness); + cyl->SuperDetector("SVTXSUPPORT"); + cyl->Verbosity(0); + g4Reco->registerSubsystem(cyl); + + radius += G4TPC::cage_thickness; + + // double inner_readout_radius = radius; + // if (inner_readout_radius < radius) inner_readout_radius = radius; + // + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc + // + double outer_radius = 78.; + + int n_tpc_layers[3] = {16,16,16}; + int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; + + double tpc_region_thickness[3] = { 20., 20., 18.}; + // Active layers of the TPC (inner layers) + int nlayer = MVTX::n_maps_layer; + for (int irange=0; irange<3; irange++) + { + double tpc_layer_thickness = tpc_region_thickness[irange]/n_tpc_layers[irange]; // thickness per layer + for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) + { + cyl = new PHG4CylinderSubsystem("SVTX", nlayer); + cyl->set_double_param("radius", radius); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", tpcgas.c_str()); + cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); + cyl->SetActive(); + cyl->SuperDetector("SVTX"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thickness; + nlayer++; + } + } + + // outer field cage + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", nlayer); + cyl->set_double_param("radius", radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", "G4_KAPTON"); + cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm + cyl->SuperDetector("SVTXSUPPORT"); + g4Reco->registerSubsystem(cyl); + + radius += G4TPC::cage_thickness; + + return radius; +} + From 52f8c26fc7a33bd9184d89af9ccec81e634fec85 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 14:35:07 -0400 Subject: [PATCH 0498/1222] black hole parameters set --- macros/g4simulations/G4_TPC_EIC.C | 169 +----------------------------- 1 file changed, 5 insertions(+), 164 deletions(-) diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index e008a5899..c01bbb85c 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -38,195 +38,35 @@ namespace G4TPC int tpc_layer_rphi_count_outer = 2304; + double outer_radius = 78.; double inner_cage_radius = 20.; 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 // double inner_readout_radius = 30.; - deprecated for EIC simulation -// TPC gas parameters -// These are set for a variety of gas choices... -//============================================== - enum TPC_Gas - { - Ne2K_100, - Ne2K_400, - NeCF4_100, - NeCF4_300, - NeCF4_400, - ByHand - }; - TPC_Gas tpc_gas = TPC_Gas::NeCF4_400; -//TPC_Gas tpc_gas = TPC_Gas::ByHand; - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf - double Ne_dEdx = 1.56; // keV/cm - double CF4_dEdx = 7.00; // keV/cm - double iBut_dEdx = 5.93; // keV/cm - - double Ne_NPrimary = 12; // Number/cm - double CF4_NPrimary = 51; // Number/cm - double iBut_NPrimary = 84; // Number/cm - - double Ne_NTotal = 43; // Number/cm - double CF4_NTotal = 100; // Number/cm - double iBut_NTotal = 195; // Number/cm - -// TPC Performance Parameter (applies extra smear to mimic the avalanche): - double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... - double TPCDriftVelocity; - double TPC_Trans_Diffusion; - double TPC_Long_Diffusion; - double TPC_dEdx; - double TPC_NPri; - double TPC_NTot; - double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= - double TPCADCClock; - double TPCShapingRMSLead; - double TPCShapingRMSTail; - double tpc_cell_z; - double TPC_SmearRPhi; - double TPC_SmearZ; } void TPCInit(int verbosity = 0) { +// set at the end of the TPC function +// BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length/2.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length/2.); - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells - //======================================= - // TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - // TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - // tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time -// TPC_SmearRPhi = 0.25; -// TPC_SmearZ = 0.15; } double TPC(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { -/* - switch (G4TPC::tpc_gas) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case G4TPC::TPC_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - G4TPC::TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - G4TPC::TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - G4TPC::TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - case TPC_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - } - - G4TPC::TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; -*/ - -// int n_gas_layer = TrackingEicTpcMacro::n_tpc_layer_inner + TrackingEicTpcMacro::n_tpc_layer_mid + TrackingEicTpcMacro::n_tpc_layer_outer; // time projection chamber layers -------------------------------------------- PHG4CylinderSubsystem* cyl; radius = G4TPC::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", MVTX::n_maps_layer); cyl->set_double_param("radius", radius); @@ -244,7 +84,6 @@ double TPC(PHG4Reco* g4Reco, double radius, // string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc // - double outer_radius = 78.; int n_tpc_layers[3] = {16,16,16}; int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; @@ -283,6 +122,8 @@ double TPC(PHG4Reco* g4Reco, double radius, radius += G4TPC::cage_thickness; +// update now that we know the outer radius + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); return radius; } From 449bba56ba759de683bb5a44e79d1f3b962cb2b6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:29:19 -0400 Subject: [PATCH 0499/1222] all detectors converted to new Enale scheme --- macros/g4simulations/Fun4All_G4_EICDetector.C | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 8107e9c45..677900e6b 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -101,21 +101,26 @@ int Fun4All_G4_EICDetector( Enable::PIPE = true; // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C + Enable::EGEM = true; + Enable::FGEM = true; + Enable::MVTX = true; + Enable::TPC = true; Enable::TRACKING = true; bool do_tracking_cell = Enable::TRACKING && true; - bool do_tracking_track = do_tracking_cell && false; - bool do_tracking_eval = do_tracking_track && true; // in order to use this evaluation, please build this analysis module analysis/blob/master/Tracking/FastTrackingEval/ + bool do_tracking_track = do_tracking_cell && true; + bool do_tracking_eval = do_tracking_track && true; bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes + Enable::CEMC = true; bool do_cemc_cell = Enable::CEMC && true; - bool do_cemc_twr = do_cemc_cell && false; + bool do_cemc_twr = do_cemc_cell && true; bool do_cemc_cluster = do_cemc_twr && true; bool do_cemc_eval = do_cemc_cluster && true; Enable::HCALIN = true; bool do_hcalin_cell = Enable::HCALIN && true; - bool do_hcalin_twr = do_hcalin_cell && false; + bool do_hcalin_twr = do_hcalin_cell && true; bool do_hcalin_cluster = do_hcalin_twr && true; bool do_hcalin_eval = do_hcalin_cluster && true; @@ -123,7 +128,7 @@ int Fun4All_G4_EICDetector( Enable::HCALOUT = true; bool do_hcalout_cell = Enable::HCALOUT && true; - bool do_hcalout_twr = do_hcalout_cell && false; + bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; bool do_hcalout_eval = do_hcalout_cluster && true; @@ -136,28 +141,28 @@ int Fun4All_G4_EICDetector( Enable::FEMC = true; bool do_FEMC_cell = Enable::FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && false; + bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; bool do_FEMC_eval = do_FEMC_cluster && true; Enable::FHCAL = true; bool do_FHCAL_cell = Enable::FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && false; + 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 Enable::EEMC = true; bool do_EEMC_cell = Enable::EEMC && true; - bool do_EEMC_twr = do_EEMC_cell && false; + bool do_EEMC_twr = do_EEMC_cell && true; bool do_EEMC_cluster = do_EEMC_twr && true; bool do_EEMC_eval = do_EEMC_cluster && true; Enable::PLUGDOOR = true; // Other options - bool do_global = false; - bool do_global_fastsim = false; + bool do_global = true; + bool do_global_fastsim = true; bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; @@ -181,8 +186,8 @@ int Fun4All_G4_EICDetector( bool do_DSTReader = false; // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; + Enable::BLACKHOLE = true; + BlackHoleGeometry::visible = true; //--------------- // Load libraries @@ -221,7 +226,7 @@ int Fun4All_G4_EICDetector( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation From 80726a38bf1d5a3d54f2f119f7593c3190987214 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:30:00 -0400 Subject: [PATCH 0500/1222] all detectors converted to new Enable scheme --- macros/g4simulations/G4Setup_EICDetector.C | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index b303abfb1..d3a86bfd4 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -17,6 +17,8 @@ #include "G4_DIRC.C" #include "G4_RICH.C" #include "G4_Aerogel.C" +#include "G4_TPC_EIC.C" +#include "G4_Mvtx.C" #include "G4_BlackHole.C" #include "G4_WorldSize.C" #include @@ -59,6 +61,14 @@ void G4Init() { FGEM_Init(); } + if (Enable::MVTX) + { + MvtxInit(); + } + if (Enable::TPC) + { + TPCInit(); + } if (Enable::TRACKING) { TrackingInit(); @@ -191,9 +201,17 @@ int G4Setup(const int absorberactive = 0, FGEMSetup(g4Reco); } + if (Enable::MVTX) + { + radius = Mvtx(g4Reco, radius, absorberactive); + } + if (Enable::TPC) + { + radius = TPC(g4Reco, radius, absorberactive); + } if (Enable::TRACKING) { - radius = Tracking(g4Reco, radius, absorberactive); +// radius = Tracking(g4Reco, radius, absorberactive); } //---------------------------------------- // CEMC @@ -281,7 +299,7 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); // finally adjust the world size in case the default is too small -// WorldSize(g4Reco, radius); + WorldSize(g4Reco, radius); se->registerSubsystem( g4Reco ); return 0; From 2f8755c5a91cb89a83ffc7da29ad837706d52bf7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:31:11 -0400 Subject: [PATCH 0501/1222] cleanup --- macros/g4simulations/G4_Mvtx.C | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index ce214014c..ad0471a16 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -37,7 +37,6 @@ double Mvtx(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { - gSystem->Load("libg4mvtx.so"); bool maps_overlapcheck = false; // set to true if you want to check for overlaps // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker From 4fcc84006fb281f81d2f043134ad04dd811df5f3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:31:30 -0400 Subject: [PATCH 0502/1222] cleanup --- macros/g4simulations/G4_TPC_EIC.C | 44 +++++++++++++------------------ 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index c01bbb85c..8d28bdbed 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -1,7 +1,7 @@ #pragma once -#include "GlobalVariables.C" #include "G4_Mvtx.C" +#include "GlobalVariables.C" #include @@ -11,7 +11,6 @@ #include - #include #include @@ -37,29 +36,26 @@ namespace G4TPC double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm int tpc_layer_rphi_count_outer = 2304; - double outer_radius = 78.; double inner_cage_radius = 20.; 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 -// double inner_readout_radius = 30.; - deprecated for EIC simulation -} + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc + +} // namespace G4TPC void TPCInit(int verbosity = 0) { -// set at the end of the TPC function -// BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); - - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length/2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length/2.); - + // BlackHoleGeometry::max_radius set at the end of the TPC function + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length / 2.); } double TPC(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0, + int verbosity = 0) { // time projection chamber layers -------------------------------------------- @@ -79,27 +75,26 @@ double TPC(PHG4Reco* g4Reco, double radius, radius += G4TPC::cage_thickness; - // double inner_readout_radius = radius; + // double inner_readout_radius = radius; // if (inner_readout_radius < radius) inner_readout_radius = radius; // - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - // + // - int n_tpc_layers[3] = {16,16,16}; - int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; + int n_tpc_layers[3] = {16, 16, 16}; + int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; - double tpc_region_thickness[3] = { 20., 20., 18.}; + double tpc_region_thickness[3] = {20., 20., 18.}; // Active layers of the TPC (inner layers) int nlayer = MVTX::n_maps_layer; - for (int irange=0; irange<3; irange++) + for (int irange = 0; irange < 3; irange++) { - double tpc_layer_thickness = tpc_region_thickness[irange]/n_tpc_layers[irange]; // thickness per layer + double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) { cyl = new PHG4CylinderSubsystem("SVTX", nlayer); cyl->set_double_param("radius", radius); cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", tpcgas.c_str()); + cyl->set_string_param("material", G4TPC::tpcgas); cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); cyl->SetActive(); cyl->SuperDetector("SVTX"); @@ -120,10 +115,9 @@ double TPC(PHG4Reco* g4Reco, double radius, cyl->SuperDetector("SVTXSUPPORT"); g4Reco->registerSubsystem(cyl); - radius += G4TPC::cage_thickness; + radius += G4TPC::cage_thickness; -// update now that we know the outer radius + // update now that we know the outer radius BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); return radius; } - From 13870a54edf20ea6c5616281f9b7794ddf6ce3e1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:40:23 -0400 Subject: [PATCH 0503/1222] all detectors converted to new Enable scheme --- macros/g4simulations/G4_Tracking_EIC.C | 123 +++++++++---------------- 1 file changed, 44 insertions(+), 79 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 9bb25d5d8..790a572bf 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -3,9 +3,8 @@ #include "GlobalVariables.C" #include "G4_GEM_EIC.C" -#include "G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C" - -#include +#include "G4_Mvtx.C" +#include "G4_TPC_EIC.C" #include @@ -23,49 +22,15 @@ R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) - - -// load the version of central travker macro with cylindrical approximation of the TPC -// This is required for fast tracking to properly count hits in TPC - -void TrackingInit(int verbosity = 0) +namespace Enable { - /* electron-going side detectors */ - EGEM_Init(); - - /* hadron-going side detectors */ - FGEM_Init(); - - /* central detectors */ - SvtxInit(); + static bool TRACKING = false; } -double Tracking(PHG4Reco *g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - /* Place electron-going side tracking detectors */ - EGEMSetup(g4Reco); - - /* Place hadron-going side tracking detectors */ - FGEMSetup(g4Reco); - - /* Place central tracking detectors */ - Svtx(g4Reco, radius); - - return radius; -} +void TrackingInit() {} void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4trackfastsim.so"); - gSystem->Load("libtrack_reco.so"); - //--------------- // Fun4All server //--------------- @@ -73,8 +38,8 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(verbosity); - +// kalman->Verbosity(); +// kalman->Smearing(false); if (displaced_vertex) { //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex @@ -95,6 +60,8 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); + if (Enable::MVTX) + { // MAPS kalman->add_phg4hits( "G4HIT_MVTX", // const std::string& phg4hitsNames, @@ -105,7 +72,23 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); - + } + // + // TPC + if (Enable::TPC) + { + kalman->add_phg4hits( + "G4HIT_SVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + if (Enable::EGEM) + { // GEM0, 70um azimuthal resolution, 1cm radial strips kalman->add_phg4hits( "G4HIT_EGEM_0", // const std::string& phg4hitsNames, @@ -146,7 +129,10 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); + } + if (Enable::FGEM) + { // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. kalman->add_phg4hits( "G4HIT_FST_0", // const std::string& phg4hitsNames, @@ -167,17 +153,6 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); - // - // TPC - kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. kalman->add_phg4hits( @@ -255,21 +230,24 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 1, // const float eff, 0 // const float noise ); + } + // Saved track states (projections) - kalman->add_state_name("FEMC"); - kalman->add_state_name("FHCAL"); + if (Enable::FEMC) + { +// kalman->add_state_name("FEMC"); + } + if (Enable::FHCAL) + { +// kalman->add_state_name("FHCAL"); + } + if (Enable::CEMC) + { +// kalman->add_state_name("CEMC"); + } se->registerSubsystem(kalman); -// if (displaced_vertex) -// { -// PHRaveVertexing * rave = new PHRaveVertexing (); -// rave->set_vertexing_method("kalman-smoothing:1"); -// rave -> set_over_write_svtxvertexmap(true); -// rave->Verbosity(10); -// se->registerSubsystem(rave); -// } - return; } @@ -291,22 +269,9 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) Fun4AllServer *se = Fun4AllServer::instance(); //---------------- - // SVTX evaluation + // Fast Tracking evaluation //---------------- - // SvtxEvaluator* eval; - // eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - // eval->do_cluster_eval(false); - // eval->do_g4hit_eval(false); - // eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... - // 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); - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); fast_sim_eval->set_filename(outputfile.c_str()); se->registerSubsystem(fast_sim_eval); From 24b487f5a873824fa36dedf80f41120b39c6c058 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 May 2020 15:40:57 -0400 Subject: [PATCH 0504/1222] all detectors converted to new Enable scheme --- macros/g4simulations/GlobalVariables.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 4ee699b39..f225b9292 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -15,11 +15,9 @@ namespace Enable static bool HCALOUT = false; static bool MAGNET = false; static bool OVERLAPCHECK = false; - static bool PIPE = false; static bool PLUGDOOR = false; static bool PSTOF = false; static bool RICH = false; - static bool TRACKING = false; } namespace BlackHoleGeometry From 04b3a7e5fb6d7309fff2a935c380ff6944f75abf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 12:02:24 -0400 Subject: [PATCH 0505/1222] cleanup, move Enable namespace in here, clang-format --- macros/g4simulations/G4_Aerogel.C | 46 ++++++++++--------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index 882771a33..eeeab5907 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -1,11 +1,8 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" + #include #include -R__LOAD_LIBRARY(libg4detectors.so) -#endif -// $Id: G4_Aerogel.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ +#include "GlobalVariables.C" /*! * \file G4_Aerogel.C @@ -15,35 +12,22 @@ R__LOAD_LIBRARY(libg4detectors.so) * \date $Date: 2013/10/09 01:08:17 $ */ -void -AerogelInit() +void AerogelInit() { - if (BlackHoleGeometry::max_radius < 164) - { - BlackHoleGeometry::max_radius = 164; // magnet outer radius generous value from display - } - if (BlackHoleGeometry::max_z < 287.) - { - BlackHoleGeometry::max_z = 287; - } - + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 164.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 287.); } -void -AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.242 - ) +void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // + const double min_eta = 1.242) { - - PHG4SectorSubsystem *ag; - ag = new PHG4SectorSubsystem("Aerogel"); + PHG4SectorSubsystem* 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); + (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 + 280 * PHG4Sector::Sector_Geometry::Unit_cm()); // 307 ag->get_geometry().set_min_polar_angle( PHG4Sector::Sector_Geometry::eta_to_polar_angle(1.85)); ag->get_geometry().set_max_polar_angle( @@ -56,11 +40,9 @@ AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // // Aerogel dimensions ins cm double radiator_length = 2.; - double expansion_length = 18.;// 10.; + double expansion_length = 18.; // 10.; - ag->get_geometry().AddLayers_AeroGel_ePHENIX( radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), - expansion_length * PHG4Sector::Sector_Geometry::Unit_cm() ); + ag->get_geometry().AddLayers_AeroGel_ePHENIX(radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), + expansion_length * PHG4Sector::Sector_Geometry::Unit_cm()); g4Reco->registerSubsystem(ag); - } - From 5860a34c6a99ae5c7ce2cb8eb18916c538211206 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 14:40:21 -0400 Subject: [PATCH 0506/1222] Add User interface --- macros/g4simulations/G4_User.C | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 macros/g4simulations/G4_User.C diff --git a/macros/g4simulations/G4_User.C b/macros/g4simulations/G4_User.C new file mode 100644 index 000000000..b23de91b3 --- /dev/null +++ b/macros/g4simulations/G4_User.C @@ -0,0 +1,27 @@ +#pragma once + +namespace Enable +{ + static bool USER = false; +} + +namespace G4USER +{ + static int myparam = 0; +} + +void UserInit(int verbosity = 0) +{ + // 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); +} + +void UserDetector(PHG4Reco *g4Reco) +{ + return; +} From 6748db0a32893c5cbf7c8f29109e371713d2818f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 14:44:31 -0400 Subject: [PATCH 0507/1222] fix typo --- macros/g4simulations/G4_Aerogel.C | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index eeeab5907..0fc1535d8 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -21,19 +21,16 @@ void AerogelInit() void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // const double min_eta = 1.242) { - PHG4SectorSubsystem* ag new PHG4SectorSubsystem("Aerogel"); + PHG4SectorSubsystem* 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((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.85)); - 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_normal_start(280 * PHG4Sector::Sector_Geometry::Unit_cm()); // 307 + ag->get_geometry().set_min_polar_angle(PHG4Sector::Sector_Geometry::eta_to_polar_angle(1.85)); + 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); From 967f470b0e077bcc41520f3cbf9af9ec07eae95f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:15:28 -0400 Subject: [PATCH 0508/1222] cleanup --- macros/g4simulations/G4_CEmc_EIC.C | 105 ++++++++++++----------------- 1 file changed, 42 insertions(+), 63 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index bcf43c5c5..63b4f4a5a 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -23,7 +23,12 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -namespace CemcEicMacro +namespace Enable +{ + static bool CEMC = false; +} + +namespace G4CEMC { double cemcdepth = 9; // tungs to scint width ratio of ~10:1 @@ -57,7 +62,7 @@ enum enu_Cemc_clusterizer enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph // enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; -} // namespace CemcEicMacro +} // namespace G4CEMC void CEmcInit(const int nslats = 1) { @@ -86,16 +91,16 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, // as indicated in the loop below // eta = -ln(tan(theta/2)) - double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * CemcEicMacro::posrapidity)); - double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * CemcEicMacro::negrapidity)); + double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::posrapidity)); + double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::negrapidity)); // get the angle between the beam pipe and negative pseudorapidity axis theta2 = TMath::Pi() - theta2; - double z1 = CemcEicMacro::topradius / TMath::Tan(theta1); - double z2 = CemcEicMacro::topradius / TMath::Tan(theta2); + double z1 = G4CEMC::topradius / TMath::Tan(theta1); + double z2 = G4CEMC::topradius / TMath::Tan(theta2); - double z3 = CemcEicMacro::bottomradius / TMath::Tan(theta1); - double z4 = CemcEicMacro::bottomradius / TMath::Tan(theta2); + double z3 = G4CEMC::bottomradius / TMath::Tan(theta1); + double z4 = G4CEMC::bottomradius / TMath::Tan(theta2); // this is the top layer length double totaltoplength = z1 + z2; @@ -107,7 +112,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double layer_shift = 0; double height = 0; - for (int thislayer = CemcEicMacro::min_cemc_layer; thislayer <= CemcEicMacro::max_cemc_layer; + for (int thislayer = G4CEMC::min_cemc_layer; thislayer <= G4CEMC::max_cemc_layer; thislayer++) { // the length for a particular layer is determined from the bottom length @@ -116,7 +121,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "Spacal_W_Epoxy"); - cemc->set_double_param("thickness", CemcEicMacro::tungs_width); + cemc->set_double_param("thickness", G4CEMC::tungs_width); cemc->set_double_param("length", thislength); cemc->set_int_param("lengthviarapidity", 0); @@ -130,16 +135,15 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->set_double_param("place_z", layer_shift); cemc->SuperDetector("ABSORBER_CEMC"); - if (absorberactive) - cemc->SetActive(); + if (absorberactive) cemc->SetActive(); cemc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc); - radius += CemcEicMacro::tungs_width; + radius += G4CEMC::tungs_width; radius += no_overlapp; - height += CemcEicMacro::tungs_width; + height += G4CEMC::tungs_width; height += no_overlapp; //Added by Barak, 12/13/19 //Added by Barak, 12/13/19 @@ -148,7 +152,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc = new PHG4CylinderSubsystem("CEMC", thislayer); cemc->set_double_param("radius", radius); cemc->set_string_param("material", "PMMA"); - cemc->set_double_param("thickness", CemcEicMacro::scint_width); + cemc->set_double_param("thickness", G4CEMC::scint_width); cemc->set_int_param("lightyield", 1); cemc->set_int_param("lengthviarapidity", 0); cemc->set_double_param("length", thislength); @@ -165,18 +169,17 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc); - radius += CemcEicMacro::scint_width; + radius += G4CEMC::scint_width; radius += no_overlapp; - height += CemcEicMacro::scint_width; + height += G4CEMC::scint_width; height += no_overlapp; //Added by Barak, 12/13/19 } - PHG4CylinderSubsystem *cemc_cyl = - new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); cemc_cyl->set_double_param("radius", radius); cemc_cyl->set_string_param("material", "G4_TEFLON"); - cemc_cyl->set_double_param("thickness", CemcEicMacro::electronics_width); + cemc_cyl->set_double_param("thickness", G4CEMC::electronics_width); double l1 = (radius + 0.5) / TMath::Tan(theta1); double l2 = (radius + 0.5) / TMath::Tan(theta2); @@ -189,12 +192,11 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, layer_shift = -1. * ((l2 - l1) / 2.); cemc_cyl->set_double_param("place_z", layer_shift); - if (absorberactive) - cemc_cyl->SetActive(); + if (absorberactive) cemc_cyl->SetActive(); cemc_cyl->OverlapCheck(overlapcheck); g4Reco->registerSubsystem(cemc_cyl); // update black hole settings since we have the values here - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + CemcEicMacro::electronics_width); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + G4CEMC::electronics_width); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2) / 2.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift - (l1 + l2) / 2.); @@ -203,20 +205,17 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, void CEMC_Cells(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - PHG4CylinderCellReco *cemc_cells = - new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); cemc_cells->Detector("CEMC"); cemc_cells->Verbosity(verbosity); double radius = 95; - for (int i = CemcEicMacro::min_cemc_layer; i <= CemcEicMacro::max_cemc_layer; i++) + for (int i = G4CEMC::min_cemc_layer; i <= G4CEMC::max_cemc_layer; i++) { //Added by Barak, 12/13/19 - radius += (CemcEicMacro::tungs_width + no_overlapp); - if (i > 1) radius += (CemcEicMacro::scint_width + no_overlapp); + radius += (G4CEMC::tungs_width + no_overlapp); + if (i > 1) radius += (G4CEMC::scint_width + no_overlapp); cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, 2. * TMath::Pi() / 256. * radius); } @@ -227,8 +226,6 @@ void CEMC_Cells(int verbosity = 0) void CEMC_Towers(int verbosity = 0) { - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); @@ -237,33 +234,25 @@ void CEMC_Towers(int verbosity = 0) CemcTowerBuilder->Verbosity(verbosity); se->registerSubsystem(CemcTowerBuilder); - const double photoelectron_per_GeV = - 500; // 500 photon per total GeV deposition + const double photoelectron_per_GeV = 500; // 500 photon per total GeV deposition // just set a 4% sampling fraction - already tuned by tungs/scint width ratio double sampling_fraction = 4e-02; - RawTowerDigitizer *CemcTowerDigitizer = - new RawTowerDigitizer("EmcRawTowerDigitizer"); + RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); CemcTowerDigitizer->Detector("CEMC"); CemcTowerDigitizer->Verbosity(verbosity); - CemcTowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitization); + CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); CemcTowerDigitizer->set_pedstal_central_ADC(0); CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - CemcTowerDigitizer->set_photonelec_ADC( - 1); // not simulating ADC discretization error - CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / - sampling_fraction); + CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error + CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting se->registerSubsystem(CemcTowerDigitizer); - RawTowerCalibration *CemcTowerCalibration = - new RawTowerCalibration("EmcRawTowerCalibration"); + RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); CemcTowerCalibration->Detector("CEMC"); CemcTowerCalibration->Verbosity(verbosity); - CemcTowerCalibration->set_calib_algorithm( - RawTowerCalibration::kSimple_linear_calibration); - CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / - 0.9715); + CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); CemcTowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(CemcTowerCalibration); @@ -273,13 +262,11 @@ void CEMC_Towers(int verbosity = 0) void CEMC_Clusters(int verbosity = 0) { - gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcTemplateClusterizer) + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) { - RawClusterBuilderTemplate *cemc_clusterbuilder = - new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); @@ -287,16 +274,13 @@ void CEMC_Clusters(int verbosity = 0) std::string femc_prof = getenv("CALIBRATIONROOT"); femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(cemc_clusterbuilder); } - else if (CemcEicMacro::Cemc_clusterizer == CemcEicMacro::kCemcGraphClusterizer) + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) { - RawClusterBuilderGraph *cemc_clusterbuilder = - new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); cemc_clusterbuilder->Detector("CEMC"); cemc_clusterbuilder->Verbosity(verbosity); - se->registerSubsystem(cemc_clusterbuilder); } else @@ -308,14 +292,9 @@ void CEMC_Clusters(int verbosity = 0) } 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()); + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile.c_str()); eval->Verbosity(verbosity); se->registerSubsystem(eval); - return; } From 12979c236b847d0b55d50797346987cafc4965d1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:17:08 -0400 Subject: [PATCH 0509/1222] replace TMath::Pi() by M_PI --- macros/g4simulations/G4_CEmc_EIC.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 63b4f4a5a..38f9d6fbb 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -18,6 +18,8 @@ #include +#include + R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) @@ -94,7 +96,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::posrapidity)); double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::negrapidity)); // get the angle between the beam pipe and negative pseudorapidity axis - theta2 = TMath::Pi() - theta2; + theta2 = M_PI - theta2; double z1 = G4CEMC::topradius / TMath::Tan(theta1); double z2 = G4CEMC::topradius / TMath::Tan(theta2); @@ -217,7 +219,7 @@ void CEMC_Cells(int verbosity = 0) radius += (G4CEMC::tungs_width + no_overlapp); if (i > 1) radius += (G4CEMC::scint_width + no_overlapp); - cemc_cells->cellsize(i, 2. * TMath::Pi() / 256. * radius, 2. * TMath::Pi() / 256. * radius); + cemc_cells->cellsize(i, 2. * M_PI / 256. * radius, 2. * M_PI / 256. * radius); } se->registerSubsystem(cemc_cells); From f30dfd89403e5d760cfe09b4ba36021d51482013 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:17:46 -0400 Subject: [PATCH 0510/1222] clang-format --- macros/g4simulations/G4_CEmc_EIC.C | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 38f9d6fbb..0c5f916b8 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -32,38 +32,38 @@ namespace Enable namespace G4CEMC { -double cemcdepth = 9; -// tungs to scint width ratio of ~10:1 -// corresponds to approx 2% sampling fraction - -// 18 radiation lengths for 40 layers -double scint_width = 0.05; -double tungs_width = 0.245; -double electronics_width = 0.5; - -int min_cemc_layer = 1; -int max_cemc_layer = 41; - -double topradius = 106.8; // cm -double bottomradius = 95; // cm -double negrapidity = -1.5; -double posrapidity = 1.24; -// this is default set to -1.5set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); CemcTowerDigitizer->set_pedstal_central_ADC(0); CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error + CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting se->registerSubsystem(CemcTowerDigitizer); From 8bd3f16f9a89eb3af03ea55df25605fc372ac9a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:25:38 -0400 Subject: [PATCH 0511/1222] cleanup --- macros/g4simulations/G4_Aerogel.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index 0fc1535d8..fe02bf441 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -1,8 +1,10 @@ #pragma once +#include "GlobalVariables.C" + #include + #include -#include "GlobalVariables.C" /*! * \file G4_Aerogel.C @@ -12,6 +14,11 @@ * \date $Date: 2013/10/09 01:08:17 $ */ +namespace Enable +{ + static bool AEROGEL = false; +} + void AerogelInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 164.); From e130f8b7d89578b8c3743705bbc67170e68314dd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:25:44 -0400 Subject: [PATCH 0512/1222] cleanup --- macros/g4simulations/G4_DIRC.C | 46 +++++++++++++++------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index a03fc7208..4a3d901b9 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -4,14 +4,13 @@ #include #include + #include #include R__LOAD_LIBRARY(libg4detectors.so) -// $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 @@ -20,7 +19,12 @@ R__LOAD_LIBRARY(libg4detectors.so) * \date $Date: 2013/10/09 01:08:17 $ */ -namespace DircMacro +namespace Enable +{ + static bool DIRC = false; +} + +namespace G4DIRC { const double radiator_R = 83.65; const double length = 400; @@ -28,22 +32,13 @@ const double z_shift = -75; //115 const double z_start = z_shift + length / 2.; const double z_end = z_shift - length / 2.; const double outer_skin_radius = 89.25; -} // namespace DircMacro +} // namespace G4DIRC void DIRCInit() { - if (BlackHoleGeometry::max_radius < DircMacro::outer_skin_radius) - { - BlackHoleGeometry::max_radius = DircMacro::outer_skin_radius; // from default in code - needs changing - } - if (BlackHoleGeometry::max_z < DircMacro::z_start) - { - BlackHoleGeometry::max_z = DircMacro::z_start; - } - if (BlackHoleGeometry::min_z > DircMacro::z_end) - { - BlackHoleGeometry::min_z = DircMacro::z_end; - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4DIRC::outer_skin_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4DIRC::z_start); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4DIRC::z_end); } //! Babar DIRC (Without most of support structure) @@ -55,15 +50,14 @@ double DIRCSetup(PHG4Reco *g4Reco) dirc = new PHG4SectorSubsystem("DIRC"); dirc->get_geometry().set_normal_polar_angle(M_PI / 2); dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(DircMacro::radiator_R, DircMacro::z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(DircMacro::radiator_R, DircMacro::z_end)); + dirc->get_geometry().set_min_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::z_start)); + dirc->get_geometry().set_max_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::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); + dirc->get_geometry().AddLayer("Radiator", "Quartz", 1.7 * PHG4Sector::Sector_Geometry::Unit_cm(), true); g4Reco->registerSubsystem(dirc); PHG4CylinderSubsystem *cyl; @@ -75,12 +69,12 @@ double DIRCSetup(PHG4Reco *g4Reco) // Inner skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10); cyl->set_double_param("radius", 81.71); - cyl->set_double_param("length", DircMacro::length); + cyl->set_double_param("length", G4DIRC::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", DircMacro::z_shift); + cyl->set_double_param("place_z", G4DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -89,13 +83,13 @@ double DIRCSetup(PHG4Reco *g4Reco) // Outer skin: cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11); - cyl->set_double_param("radius", DircMacro::outer_skin_radius - 0.076); - cyl->set_double_param("length", DircMacro::length); + cyl->set_double_param("radius", G4DIRC::outer_skin_radius - 0.076); + cyl->set_double_param("length", G4DIRC::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", DircMacro::z_shift); + cyl->set_double_param("place_z", G4DIRC::z_shift); cyl->SetActive(0); cyl->SuperDetector("DIRC"); cyl->OverlapCheck(overlapcheck); @@ -103,5 +97,5 @@ double DIRCSetup(PHG4Reco *g4Reco) g4Reco->registerSubsystem(cyl); // Done - return 89.25; + return G4DIRC::outer_skin_radius; } From 38e8cec9292dfa5ca7317eeff1bcaefad58e476e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:26:27 -0400 Subject: [PATCH 0513/1222] clang-format --- macros/g4simulations/G4_DIRC.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index 4a3d901b9..ee10e6cf3 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -26,17 +26,17 @@ namespace Enable namespace G4DIRC { -const double radiator_R = 83.65; -const double length = 400; -const double z_shift = -75; //115 -const double z_start = z_shift + length / 2.; -const double z_end = z_shift - length / 2.; -const double outer_skin_radius = 89.25; + const double radiator_R = 83.65; + const double length = 400; + const double z_shift = -75; //115 + const double z_start = z_shift + length / 2.; + const double z_end = z_shift - length / 2.; + const double outer_skin_radius = 89.25; } // namespace G4DIRC void DIRCInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4DIRC::outer_skin_radius); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4DIRC::outer_skin_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4DIRC::z_start); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4DIRC::z_end); } From 57e83f554a7357be4682e5a8fb7b9d3f5635ffdb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:31:50 -0400 Subject: [PATCH 0514/1222] cleanup --- macros/g4simulations/G4_EEMC.C | 68 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 176c87e35..745c5a34d 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -1,56 +1,49 @@ #pragma once #include "GlobalVariables.C" -#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 +{ + static bool EEMC = false; +} +namespace G4EEMC +{ const int use_projective_geometry = 0; - const double Gdz = 18.+0.0001; const double Gz0 = -170.; +} void EEMCInit() { - if (BlackHoleGeometry::max_radius < 65.6) - { - BlackHoleGeometry::max_radius = 65.6; // from towerMap_EEMC_v006.txt - } - if (BlackHoleGeometry::min_z > Gz0 - Gdz/2.) - { - BlackHoleGeometry::min_z = Gz0 - Gdz/2.; - } -} - -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; + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,G4EEMC::Gz0 - G4EEMC::Gdz/2. ); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz/2.); } void EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) { - gSystem->Load("libg4detectors.so"); /** Use dedicated EEMC module */ PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); @@ -59,7 +52,7 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_eemc; /* Use non-projective geometry */ - if(!use_projective_geometry) + if(!G4EEMC::use_projective_geometry) { mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; eemc->SetTowerMappingFile( mapping_eemc.str() ); @@ -85,15 +78,24 @@ EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) } +void EEMC_Cells(int verbosity = 0) { + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); + hc->Detector("EEMC"); + se->registerSubsystem(hc); + + return; +} + + 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_v006.txt"; + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); tower_EEMC->Detector("EEMC"); @@ -137,8 +139,6 @@ void EEMC_Towers(int verbosity = 0) { void EEMC_Clusters(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); @@ -151,8 +151,6 @@ void EEMC_Clusters(int verbosity = 0) { 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()); From 76aba9fba81f7273b5bd4c8aeb7cc84f6326c061 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:32:11 -0400 Subject: [PATCH 0515/1222] clang-format --- macros/g4simulations/G4_EEMC.C | 94 ++++++++++++++++------------------ 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 745c5a34d..0e7464d40 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -28,58 +28,54 @@ namespace Enable namespace G4EEMC { -const int use_projective_geometry = 0; -const double Gdz = 18.+0.0001; -const double Gz0 = -170.; -} + const int use_projective_geometry = 0; + const double Gdz = 18. + 0.0001; + const double Gz0 = -170.; +} // namespace G4EEMC void EEMCInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,G4EEMC::Gz0 - G4EEMC::Gdz/2. ); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz/2.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); } -void -EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) +void EEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { - - - /** Use dedicated EEMC module */ + /** Use dedicated EEMC module */ PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); /* path to central copy of calibrations repositry */ ostringstream mapping_eemc; /* Use non-projective geometry */ - if(!G4EEMC::use_projective_geometry) - { - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - eemc->SetTowerMappingFile( mapping_eemc.str() ); - } + if (!G4EEMC::use_projective_geometry) + { + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; + eemc->SetTowerMappingFile(mapping_eemc.str()); + } - /* use projective geometry */ + /* use projective geometry */ else - { - ostringstream mapping_eemc_4x4construct; - - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; - mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; - eemc->SetProjectiveGeometry ( mapping_eemc.str() , mapping_eemc_4x4construct.str() ); - } + { + ostringstream mapping_eemc_4x4construct; + + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; + mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; + eemc->SetProjectiveGeometry(mapping_eemc.str(), mapping_eemc_4x4construct.str()); + } eemc->OverlapCheck(overlapcheck); -// SetAbsorberActive method not implemented -// if (absorberactive) eemc->SetAbsorberActive(); + // SetAbsorberActive method not implemented + // if (absorberactive) eemc->SetAbsorberActive(); /* register Ecal module */ - g4Reco->registerSubsystem( eemc ); - + g4Reco->registerSubsystem(eemc); } -void EEMC_Cells(int verbosity = 0) { - +void EEMC_Cells(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); @@ -89,22 +85,20 @@ void EEMC_Cells(int verbosity = 0) { return; } - -void EEMC_Towers(int verbosity = 0) { - +void EEMC_Towers(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_eemc; mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); + 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() ); + 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 @@ -116,13 +110,12 @@ void EEMC_Towers(int verbosity = 0) { 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 ); + 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 */ @@ -130,21 +123,20 @@ void EEMC_Towers(int verbosity = 0) { 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 ); + 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) { - +void EEMC_Clusters(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); ClusterBuilder->Detector("EEMC"); ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); + se->registerSubsystem(ClusterBuilder); return; } From 511b67dc49c98e2fd75b8ee969e8a5e3a85e1440 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:51:32 -0400 Subject: [PATCH 0516/1222] cleanup --- macros/g4simulations/G4_FEMC_EIC.C | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index ab8144857..a1a5d94dc 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -18,7 +18,12 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -namespace FemcMacro +namespace Enable +{ + static bool FEMC = false; +} + +namespace G4FEMC { // from ForwardEcal/mapping/towerMap_FEMC_v007.txt const double Gz0 = 310.; @@ -33,18 +38,12 @@ enum enu_Femc_clusterizer enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; -} // namespace FemcMacro +} // namespace G4FEMC void FEMCInit() { - if (BlackHoleGeometry::max_radius < FemcMacro::outer_radius) - { - BlackHoleGeometry::max_radius = FemcMacro::outer_radius; - } - if (BlackHoleGeometry::max_z < FemcMacro::Gz0 + FemcMacro::Gdz / 2.) - { - BlackHoleGeometry::max_z = FemcMacro::Gz0 + FemcMacro::Gdz / 2.; - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } void FEMC_Cells(int verbosity = 0) @@ -210,7 +209,7 @@ void FEMC_Clusters(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); - if (FemcMacro::Femc_clusterizer == FemcMacro::kFemcTemplateClusterizer) + if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); @@ -221,7 +220,7 @@ void FEMC_Clusters(int verbosity = 0) ClusterBuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(ClusterBuilder); } - else if (FemcMacro::Femc_clusterizer == FemcMacro::kFemcGraphClusterizer) + else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) { RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); From bc65224866d65ff90676818a46a5f725e35d80f6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 15:51:51 -0400 Subject: [PATCH 0517/1222] clang-format --- macros/g4simulations/G4_FEMC_EIC.C | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index a1a5d94dc..b918a3f7d 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -25,19 +25,19 @@ namespace Enable namespace G4FEMC { -// from ForwardEcal/mapping/towerMap_FEMC_v007.txt -const double Gz0 = 310.; -const double Gdz = 36.5; -const double outer_radius = 182.655; -enum enu_Femc_clusterizer -{ - kFemcGraphClusterizer, - kFemcTemplateClusterizer -}; -//template clusterizer, as developed by Sasha Bazilevsky -enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; -// graph clusterizer -//enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; + // from ForwardEcal/mapping/towerMap_FEMC_v007.txt + const double Gz0 = 310.; + const double Gdz = 36.5; + const double outer_radius = 182.655; + enum enu_Femc_clusterizer + { + kFemcGraphClusterizer, + kFemcTemplateClusterizer + }; + //template clusterizer, as developed by Sasha Bazilevsky + enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; + // graph clusterizer + //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; } // namespace G4FEMC void FEMCInit() From 79975af1036ca48775af5ec995e62ff41d0566c6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:10:09 -0400 Subject: [PATCH 0518/1222] clang-format --- macros/g4simulations/G4_FHCAL.C | 40 ++- macros/g4simulations/G4_HcalIn_ref.C | 84 +++---- macros/g4simulations/G4_HcalOut_ref.C | 43 ++-- macros/g4simulations/G4_Tracking_EIC.C | 329 +++++++++++++------------ 4 files changed, 240 insertions(+), 256 deletions(-) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index db3bf3cfa..fb2d42490 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -22,30 +22,27 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -namespace FhcalMacro +namespace Enable { -// from ForwardHcal/mapping/towerMap_FHCAL_v005.txt -const double Gz0 = 400.; -const double Gdz = 100.; -const double outer_radius = 262.; -} // namespace FhcalMacro + static bool FHCAL = false; +} + +namespace G4FHCAL +{ + // from ForwardHcal/mapping/towerMap_FHCAL_v005.txt + const double Gz0 = 400.; + const double Gdz = 100.; + const double outer_radius = 262.; +} // namespace G4FHCAL void FHCALInit() { - if (BlackHoleGeometry::max_radius < FhcalMacro::outer_radius) - { - BlackHoleGeometry::max_radius = FhcalMacro::outer_radius; - } - if (BlackHoleGeometry::max_z < FhcalMacro::Gz0 + FhcalMacro::Gdz / 2.) - { - BlackHoleGeometry::max_z = FhcalMacro::Gz0 + FhcalMacro::Gdz / 2.; - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); } void FHCAL_Cells(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); @@ -57,8 +54,6 @@ void FHCAL_Cells(int verbosity = 0) void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FHCAL module */ @@ -69,7 +64,7 @@ void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) /* path to central copy of calibrations repositry */ mapping_hhcal << getenv("CALIBRATIONROOT"); mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; - cout << mapping_hhcal.str() << endl; + // cout << mapping_hhcal.str() << endl; //mapping_hhcal << "towerMap_FHCAL_latest.txt"; hhcal->SetTowerMappingFile(mapping_hhcal.str()); @@ -82,9 +77,6 @@ void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) void FHCAL_Towers(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; @@ -141,8 +133,6 @@ void FHCAL_Towers(int verbosity = 0) void FHCAL_Clusters(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); @@ -156,8 +146,6 @@ void FHCAL_Clusters(int verbosity = 0) 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()); diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 5bdf8c4d1..6b49d2b43 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -28,41 +28,46 @@ R__LOAD_LIBRARY(libg4eval.so) void HCalInner_SupportRing(PHG4Reco *g4Reco, const int absorberactive = 0); -namespace HcalInMacro +namespace Enable { -const double support_ring_outer_radius = 178.0 - 0.001; -const double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; -const double dz = 25. / 10.; + static bool HCALIN = false; +} + +namespace G4HCALIN +{ + const double support_ring_outer_radius = 178.0 - 0.001; + const double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; + const double dz = 25. / 10.; -//Inner HCal absorber material selector: -//false - old version, absorber material is SS310 -//true - default Choose if you want Aluminum -const bool inner_hcal_material_Al = true; + //Inner HCal absorber material selector: + //false - old version, absorber material is SS310 + //true - default Choose if you want Aluminum + const bool inner_hcal_material_Al = true; -static int inner_hcal_eic = 0; + static int inner_hcal_eic = 0; -enum enu_HCalIn_clusterizer -{ - kHCalInGraphClusterizer, + enum enu_HCalIn_clusterizer + { + kHCalInGraphClusterizer, - kHCalInTemplateClusterizer -}; + 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 HcalInMacro + //! 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, HcalInMacro::support_ring_outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalInMacro::support_ring_z_ring2 + HcalInMacro::dz / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalInMacro::support_ring_z_ring2 - HcalInMacro::dz / 2.); + 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) { - HcalInMacro::inner_hcal_eic = 1; + G4HCALIN::inner_hcal_eic = 1; } } @@ -74,13 +79,10 @@ double HCalInner(PHG4Reco *g4Reco, { // 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 (HcalInMacro::inner_hcal_material_Al) + if (G4HCALIN::inner_hcal_material_Al) { if (verbosity > 0) { @@ -152,21 +154,18 @@ double HCalInner(PHG4Reco *g4Reco, 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 innerradius_sphenix = 116.; const double innerradius_ephenix_hadronside = 138.; const double z_rings[] = - {-HcalInMacro::support_ring_z_ring2, -z_ring1, z_ring1, HcalInMacro::support_ring_z_ring2}; + {-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 && HcalInMacro::inner_hcal_eic == 1) + if (z_rings[i] > 0 && G4HCALIN::inner_hcal_eic == 1) { innerradius = innerradius_ephenix_hadronside; } @@ -175,9 +174,9 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, cyl->SuperDetector("HCALIN_SPT"); cyl->set_double_param("radius", innerradius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", HcalInMacro::dz); + cyl->set_double_param("length", G4HCALIN::dz); cyl->set_string_param("material", "SS310"); - cyl->set_double_param("thickness", HcalInMacro::support_ring_outer_radius - innerradius); + cyl->set_double_param("thickness", G4HCALIN::support_ring_outer_radius - innerradius); if (absorberactive) { cyl->SetActive(); @@ -190,8 +189,6 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, void HCALInner_Cells(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); @@ -212,8 +209,6 @@ void HCALInner_Cells(int verbosity = 0) void HCALInner_Towers(int verbosity = 0) { - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); @@ -226,8 +221,7 @@ void HCALInner_Towers(int verbosity = 0) 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_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.); @@ -238,7 +232,7 @@ void HCALInner_Towers(int verbosity = 0) //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 (HcalInMacro::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen + 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"); @@ -255,11 +249,9 @@ void HCALInner_Towers(int verbosity = 0) void HCALInner_Clusters(int verbosity = 0) { - gSystem->Load("libcalo_reco.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInTemplateClusterizer) + if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); @@ -267,7 +259,7 @@ void HCALInner_Clusters(int verbosity = 0) ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } - else if (HcalInMacro::HCalIn_clusterizer == HcalInMacro::kHCalInGraphClusterizer) + else if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInGraphClusterizer) { RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALIN"); @@ -284,8 +276,6 @@ void HCALInner_Clusters(int verbosity = 0) 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()); diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index b2bc3f81c..fef1dbce5 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -23,28 +23,33 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -namespace HcalOutMacro +namespace Enable { -const double outer_radius = 264.71; -const double size_z = 304.91 * 2; -enum enu_HCalOut_clusterizer + static bool HCALOUT = false; +} + +namespace G4HCALOUT { - kHCalOutGraphClusterizer, - kHCalOutTemplateClusterizer -}; + const double outer_radius = 264.71; + const double size_z = 304.91 * 2; + 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 HcalOutMacro + //! 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, HcalOutMacro::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, HcalOutMacro::size_z / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -HcalOutMacro::size_z / 2.); + 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, @@ -68,7 +73,7 @@ double HCalOuter(PHG4Reco *g4Reco, // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); //----------------------------------------- - // hcal->set_double_param("outer_radius", HcalOutMacro::outer_radius); + // 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.); @@ -81,7 +86,7 @@ double HCalOuter(PHG4Reco *g4Reco, // 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", HcalOutMacro::size_z); + // hcal->set_double_param("size_z", G4HCALOUT::size_z); // hcal->set_double_param("steplimits", NAN); // hcal->set_double_param("tilt_angle", -11.23); @@ -178,7 +183,7 @@ void HCALOuter_Clusters(int verbosity = 0) Fun4AllServer *se = Fun4AllServer::instance(); - if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutTemplateClusterizer) + if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); @@ -186,7 +191,7 @@ void HCALOuter_Clusters(int verbosity = 0) ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } - else if (HcalOutMacro::HCalOut_clusterizer == HcalOutMacro::kHCalOutGraphClusterizer) + else if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutGraphClusterizer) { RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); ClusterBuilder->Detector("HCALOUT"); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 790a572bf..99d78b602 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -2,6 +2,9 @@ #include "GlobalVariables.C" +#include "G4_CEmc_EIC.C" +#include "G4_FEMC_EIC.C" +#include "G4_FHCAL.C" #include "G4_GEM_EIC.C" #include "G4_Mvtx.C" #include "G4_TPC_EIC.C" @@ -21,13 +24,12 @@ class SubsysReco; R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) - namespace Enable { static bool TRACKING = false; } -void TrackingInit() {} +void TrackingInit() {} void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) { @@ -38,8 +40,8 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); -// kalman->Verbosity(); -// kalman->Smearing(false); + // kalman->Verbosity(); + // kalman->Smearing(false); if (displaced_vertex) { //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex @@ -56,195 +58,194 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) kalman->set_vertex_z_resolution(50e-4); } - kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); if (Enable::MVTX) { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + // MAPS + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); } // // TPC if (Enable::TPC) { - kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + kalman->add_phg4hits( + "G4HIT_SVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); } if (Enable::EGEM) { - // GEM0, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM1, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_EGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); } if (Enable::FGEM) { - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM4, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_5", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM4, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + kalman->add_phg4hits( + "G4HIT_FST_5", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0 // const float noise + ); } // Saved track states (projections) if (Enable::FEMC) { -// kalman->add_state_name("FEMC"); + // kalman->add_state_name("FEMC"); } if (Enable::FHCAL) { -// kalman->add_state_name("FHCAL"); + // kalman->add_state_name("FHCAL"); } if (Enable::CEMC) { -// kalman->add_state_name("CEMC"); + // kalman->add_state_name("CEMC"); } se->registerSubsystem(kalman); From 680791fe11a99d0fe966d396a1df36ad51564c29 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:10:53 -0400 Subject: [PATCH 0519/1222] Add G4_User.C --- macros/g4simulations/G4Setup_EICDetector.C | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index d3a86bfd4..91f635997 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -19,6 +19,7 @@ #include "G4_Aerogel.C" #include "G4_TPC_EIC.C" #include "G4_Mvtx.C" +#include "G4_User.C" #include "G4_BlackHole.C" #include "G4_WorldSize.C" #include @@ -123,6 +124,10 @@ void G4Init() { AerogelInit(); } + if (Enable::USER) + { + UserInit(); + } if (Enable::BLACKHOLE) { @@ -289,6 +294,10 @@ int G4Setup(const int absorberactive = 0, { PlugDoor(g4Reco, absorberactive); } + if (Enable::USER) + { + UserDetector(g4Reco); + } //---------------------------------------- // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions if (Enable::BLACKHOLE) From 762e9e51a6374ee2c315bec0606f9d1ccb4e892e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:11:17 -0400 Subject: [PATCH 0520/1222] clang-format --- macros/g4simulations/G4Setup_EICDetector.C | 196 +++++++++++---------- 1 file changed, 99 insertions(+), 97 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 91f635997..7c05abf94 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -2,36 +2,36 @@ #include "GlobalVariables.C" -#include "G4_Pipe_EIC.C" -#include "G4_Tracking_EIC.C" -#include "G4_PSTOF.C" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "G4_Aerogel.C" +#include "G4_BlackHole.C" #include "G4_CEmc_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_Magnet.C" -#include "G4_HcalOut_ref.C" -#include "G4_PlugDoor_EIC.C" +#include "G4_DIRC.C" +#include "G4_EEMC.C" #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" #include "G4_GEM_EIC.C" -#include "G4_EEMC.C" -#include "G4_DIRC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_Mvtx.C" +#include "G4_PSTOF.C" +#include "G4_Pipe_EIC.C" +#include "G4_PlugDoor_EIC.C" #include "G4_RICH.C" -#include "G4_Aerogel.C" #include "G4_TPC_EIC.C" -#include "G4_Mvtx.C" +#include "G4_Tracking_EIC.C" #include "G4_User.C" -#include "G4_BlackHole.C" #include "G4_WorldSize.C" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) @@ -40,18 +40,17 @@ void RunLoadTest() {} void G4Init() { - // load detector/material macros and execute Init() function if (Enable::PIPE) - { - PipeInit(); - } + { + PipeInit(); + } if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } + { + PlugDoorInit(); + } if (Enable::EGEM) { @@ -71,59 +70,58 @@ void G4Init() TPCInit(); } if (Enable::TRACKING) - { - TrackingInit(); - } + { + TrackingInit(); + } if (Enable::CEMC) - { - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } + { + CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations + } if (Enable::HCALIN) - { - HCalInnerInit(1); - } + { + HCalInnerInit(1); + } if (Enable::MAGNET) - { - MagnetInit(); - } + { + MagnetInit(); + } if (Enable::HCALOUT) - { - HCalOuterInit(); - } - + { + HCalOuterInit(); + } if (Enable::FEMC) - { - FEMCInit(); - } + { + FEMCInit(); + } if (Enable::FHCAL) - { - FHCALInit(); - } + { + FHCALInit(); + } - if ( Enable::EEMC) - { - EEMCInit(); - } + if (Enable::EEMC) + { + EEMCInit(); + } if (Enable::DIRC) - { - DIRCInit(); - } + { + DIRCInit(); + } if (Enable::RICH) - { - RICHInit(); - } + { + RICHInit(); + } if (Enable::AEROGEL) - { - AerogelInit(); - } + { + AerogelInit(); + } if (Enable::USER) { UserInit(); @@ -133,16 +131,13 @@ void G4Init() { BlackHoleInit(); } - - } - int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = EDecayType::kAll, - const float magfield_rescale = 1.0) { - + const string &field = "1.5", + const EDecayType decayType = EDecayType::kAll, + const float magfield_rescale = 1.0) +{ //--------------- // Load libraries //--------------- @@ -160,13 +155,13 @@ int G4Setup(const int absorberactive = 0, HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); - 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 != EDecayType::kAll) + 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 != EDecayType::kAll) { g4Reco->set_force_decay(decayType); } @@ -174,15 +169,21 @@ int G4Setup(const int absorberactive = 0, double fieldstrength; istringstream stringline(field); stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string + if (stringline.fail()) + { // conversion to double fails -> we have a string - if (field.find("sPHENIX.root") != string::npos) { + if (field.find("sPHENIX.root") != string::npos) + { g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); - } else { + } + else + { g4Reco->set_field_map(field, PHFieldConfig::kField2D); } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field + } + else + { + g4Reco->set_field(fieldstrength); // use const soleniodal field } g4Reco->set_field_rescale(magfield_rescale); @@ -195,7 +196,7 @@ int G4Setup(const int absorberactive = 0, radius = Pipe(g4Reco, radius, absorberactive); } //---------------------------------------- - + if (Enable::EGEM) { EGEMSetup(g4Reco); @@ -216,7 +217,7 @@ int G4Setup(const int absorberactive = 0, } if (Enable::TRACKING) { -// radius = Tracking(g4Reco, radius, absorberactive); + // radius = Tracking(g4Reco, radius, absorberactive); } //---------------------------------------- // CEMC @@ -237,7 +238,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // MAGNET - if (Enable::MAGNET) + if (Enable::MAGNET) { radius = Magnet(g4Reco, radius, 0, absorberactive); } @@ -251,7 +252,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FEMC - if ( Enable::FEMC ) + if (Enable::FEMC) { FEMCSetup(g4Reco, absorberactive); } @@ -259,14 +260,14 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FHCAL - if ( Enable::FHCAL ) + if (Enable::FHCAL) { FHCALSetup(g4Reco, absorberactive); } //---------------------------------------- // EEMC - if ( Enable::EEMC ) + if (Enable::EEMC) { EEMCSetup(g4Reco, absorberactive); } @@ -307,22 +308,21 @@ int G4Setup(const int absorberactive = 0, PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); -// finally adjust the world size in case the default is too small + // finally adjust the world size in case the default is too small WorldSize(g4Reco, radius); - se->registerSubsystem( g4Reco ); + se->registerSubsystem(g4Reco); return 0; } - -void ShowerCompress(int verbosity = 0) { - +void ShowerCompress(int verbosity = 0) +{ gSystem->Load("libfun4all.so"); gSystem->Load("libg4eval.so"); Fun4AllServer *se = Fun4AllServer::instance(); - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); compress->AddHitContainer("G4HIT_PIPE"); compress->AddHitContainer("G4HIT_SVTXSUPPORT"); compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); @@ -376,8 +376,10 @@ void ShowerCompress(int verbosity = 0) { return; } -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { +void DstCompress(Fun4AllDstOutputManager *out) +{ + if (out) + { out->StripNode("G4HIT_PIPE"); out->StripNode("G4HIT_SVTXSUPPORT"); out->StripNode("G4HIT_CEMC_ELECTRONICS"); From 20936d62c3dc82d4f36479a41aeaf492c6ad6b75 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:30:09 -0400 Subject: [PATCH 0521/1222] cleanup --- macros/g4simulations/G4_Magnet.C | 30 ++++++++++---------- macros/g4simulations/G4_PSTOF.C | 4 +++ macros/g4simulations/G4_PlugDoor_EIC.C | 28 +++++++++---------- macros/g4simulations/G4_RICH.C | 38 +++++++++++--------------- macros/g4simulations/GlobalVariables.C | 16 ++--------- 5 files changed, 53 insertions(+), 63 deletions(-) diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 796af147f..8bbf903dd 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -8,7 +8,12 @@ R__LOAD_LIBRARY(libg4detectors.so) -namespace BabarMagnetMacro +namespace Enable +{ + static bool MAGNET = false; +} + +namespace G4MAGNET { static double magnet_outer_cryostat_wall_radius = 174.5; static double magnet_outer_cryostat_wall_thickness = 2.5; @@ -17,9 +22,9 @@ static double magnet_length = 379.; void MagnetInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BabarMagnetMacro::magnet_outer_cryostat_wall_radius+BabarMagnetMacro::magnet_outer_cryostat_wall_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BabarMagnetMacro::magnet_length/2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -BabarMagnetMacro::magnet_length/2.); + 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, @@ -40,14 +45,11 @@ double Magnet(PHG4Reco* g4Reco, 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",BabarMagnetMacro::magnet_length); + 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"); @@ -65,23 +67,23 @@ cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for mag g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("MAGNET", 2); - cyl->set_double_param("radius",BabarMagnetMacro::magnet_outer_cryostat_wall_radius); + cyl->set_double_param("radius",G4MAGNET::magnet_outer_cryostat_wall_radius); cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",BabarMagnetMacro::magnet_length); - cyl->set_double_param("thickness",BabarMagnetMacro::magnet_outer_cryostat_wall_thickness); + 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(); g4Reco->registerSubsystem( cyl ); - radius = BabarMagnetMacro::magnet_outer_cryostat_wall_radius + BabarMagnetMacro::magnet_outer_cryostat_wall_thickness; // outside of magnet + 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 = " << BabarMagnetMacro::magnet_outer_cryostat_wall_radius + BabarMagnetMacro::magnet_outer_cryostat_wall_thickness << " cm" << endl; - cout << " length = " << BabarMagnetMacro::magnet_length << " 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; } diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C index 703bee08b..dc3811b4f 100644 --- a/macros/g4simulations/G4_PSTOF.C +++ b/macros/g4simulations/G4_PSTOF.C @@ -13,6 +13,10 @@ R__LOAD_LIBRARY(libg4detectors.so) * \version $Revision$ * \date $Date$ */ +namespace Enable +{ + static bool PSTOF = false; +} void PSTOFInit() {} diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index ac3aa902b..da2443268 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -3,11 +3,17 @@ #include "GlobalVariables.C" #include + #include R__LOAD_LIBRARY(libg4detectors.so) -namespace PlugDoorEicMacro +namespace Enable +{ + static bool PLUGDOOR = false; +} + +namespace G4PLUGDOOR { // sPHENIX forward flux return(s) // define via four corners in the engineering drawing @@ -18,18 +24,12 @@ const double r_2 = 263.5; const double length = z_2 - z_1; const double place_z = -(z_1 + z_2) / 2.; -} // namespace PlugDoorEicMacro +} // namespace G4PLUGDOOR void PlugDoorInit() { - if (BlackHoleGeometry::max_radius < PlugDoorEicMacro::r_2) - { - BlackHoleGeometry::max_radius = PlugDoorEicMacro::r_2; - } - if (BlackHoleGeometry::min_z > (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length / 2.)) - { - BlackHoleGeometry::min_z = (PlugDoorEicMacro::place_z - PlugDoorEicMacro::length / 2.); - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4PLUGDOOR::r_2); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); } void PlugDoor(PHG4Reco *g4Reco, @@ -42,10 +42,10 @@ void PlugDoor(PHG4Reco *g4Reco, PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); flux_return_minus->set_int_param("lengthviarapidity", 0); - flux_return_minus->set_double_param("length", PlugDoorEicMacro::length); - flux_return_minus->set_double_param("radius", PlugDoorEicMacro::r_1); - flux_return_minus->set_double_param("place_z", PlugDoorEicMacro::place_z); - flux_return_minus->set_double_param("thickness", PlugDoorEicMacro::r_2 - PlugDoorEicMacro::r_1); + 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"); diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index a4e25ac2d..50f5f66d0 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -1,13 +1,3 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -// $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 @@ -15,22 +5,26 @@ R__LOAD_LIBRARY(libg4detectors.so) * \version $Revision: 1.2 $ * \date $Date: 2013/10/09 01:08:17 $ */ +#pragma once -using namespace std; +#include "GlobalVariables.C" -// global macro parameters +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + static bool RICH = false; +} void RICHInit() { - if (BlackHoleGeometry::max_radius < 135) - { - BlackHoleGeometry::max_radius = 135; - } - if (BlackHoleGeometry::max_z < 268.) - { - BlackHoleGeometry::max_z = 268; - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 135.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 268.); } //! ePHENIX Gas RICH. Ref to Geometry parameter defined in ePHENIXRICH::RICH_Geometry @@ -64,9 +58,9 @@ RICHSetup(PHG4Reco* g4Reco, // rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); - /* Register RICH module */ - rich->OverlapCheck( overlapcheck ); + rich->OverlapCheck( Enable::OVERLAPCHECK ); + /* Register RICH module */ g4Reco->registerSubsystem( rich ); } diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index f225b9292..e699f7711 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -4,22 +4,12 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volum namespace Enable { - static bool AEROGEL = false; - static bool BLACKHOLE = false; - static bool CEMC = false; - static bool DIRC = false; - static bool EEMC = false; - static bool FEMC = false; - static bool FHCAL = false; - static bool HCALIN = false; - static bool HCALOUT = false; - static bool MAGNET = false; static bool OVERLAPCHECK = false; - static bool PLUGDOOR = false; - static bool PSTOF = false; - static bool RICH = false; } +// every G4 subsystem needs to implement this +// rather than forcing another include file, +// let's put this into the GlobalVariables.C namespace BlackHoleGeometry { static double max_radius = 0.; // this is needed for the overall dimension of the black hole From 7acea78a9ff4f35312a1aecd700fc99816c9b7af Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:30:43 -0400 Subject: [PATCH 0522/1222] clang-format --- macros/g4simulations/G4_Magnet.C | 90 +++++++++++++------------- macros/g4simulations/G4_PSTOF.C | 16 ++--- macros/g4simulations/G4_PlugDoor_EIC.C | 20 +++--- macros/g4simulations/G4_RICH.C | 30 ++++----- macros/g4simulations/GlobalVariables.C | 8 +-- 5 files changed, 81 insertions(+), 83 deletions(-) diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 8bbf903dd..531f97fa7 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -15,70 +15,72 @@ namespace Enable namespace G4MAGNET { -static double magnet_outer_cryostat_wall_radius = 174.5; -static double magnet_outer_cryostat_wall_thickness = 2.5; -static double magnet_length = 379.; -} + static double magnet_outer_cryostat_wall_radius = 174.5; + static double magnet_outer_cryostat_wall_thickness = 2.5; + static double magnet_length = 379.; +} // namespace G4MAGNET -void MagnetInit() +void MagnetInit() { - 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.); + 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, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) { - + 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_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; + 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 + 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(); - g4Reco->registerSubsystem( cyl ); + 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->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 ); + if (absorberactive) cyl->SetActive(); + 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->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(); - g4Reco->registerSubsystem( cyl ); + if (absorberactive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius = G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness; // outside of magnet - radius = G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness; // outside of magnet - - if (verbosity > 0) { + if (verbosity > 0) + { cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; cout << " MAGNET Material Description:" << endl; cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl; @@ -88,6 +90,6 @@ cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for mag } radius += no_overlapp; - - return radius; + + return radius; } diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C index dc3811b4f..ffc03c681 100644 --- a/macros/g4simulations/G4_PSTOF.C +++ b/macros/g4simulations/G4_PSTOF.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) #include #include R__LOAD_LIBRARY(libg4detectors.so) @@ -19,19 +19,19 @@ namespace Enable } 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" ); + PHG4PSTOFSubsystem* pstof = new PHG4PSTOFSubsystem("PSTOF"); pstof->SuperDetector("PSTOF"); -// pstof->SetActive(-1,1); // set all modules active - g4Reco->registerSubsystem( 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.; + // returns the outer radius to check for overlaps with next detector + return 90.; } diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index da2443268..ddc70458d 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -15,20 +15,20 @@ namespace Enable namespace G4PLUGDOOR { -// sPHENIX forward flux return(s) -// define via four corners in the engineering drawing -const double z_1 = 330.81; -const double z_2 = 360.81; -const double r_1 = 30; -const double r_2 = 263.5; - -const double length = z_2 - z_1; -const double place_z = -(z_1 + z_2) / 2.; + // sPHENIX forward flux return(s) + // define via four corners in the engineering drawing + const double z_1 = 330.81; + const double z_2 = 360.81; + const double r_1 = 30; + const double r_2 = 263.5; + + const double length = z_2 - z_1; + const double place_z = -(z_1 + z_2) / 2.; } // namespace G4PLUGDOOR void PlugDoorInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4PLUGDOOR::r_2); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); } diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 50f5f66d0..7ab61c8e6 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -20,8 +20,7 @@ namespace Enable static bool RICH = false; } -void -RICHInit() +void RICHInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 135.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 268.); @@ -31,20 +30,18 @@ RICHInit() //! \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.3, // - const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) - const double z_shift = 75, // cm - const double R_shift = 18.5, // cm - const double R_beampipe_front = 8, // clearance for EIC beam pipe flange - const double R_beampipe_back = 27 // clearance for EIC beam pipe flange - ) +void RICHSetup(PHG4Reco* g4Reco, // + const int N_RICH_Sector = 8, // + const double min_eta = 1.3, // + const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) + const double z_shift = 75, // cm + const double R_shift = 18.5, // cm + const double R_beampipe_front = 8, // clearance for EIC beam pipe flange + const double R_beampipe_back = 27 // clearance for EIC beam pipe flange +) { - /* Use dedicated RICH subsystem */ - PHG4RICHSubsystem *rich = new PHG4RICHSubsystem("RICH"); + 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); @@ -58,9 +55,8 @@ RICHSetup(PHG4Reco* g4Reco, // rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); - rich->OverlapCheck( Enable::OVERLAPCHECK ); + rich->OverlapCheck(Enable::OVERLAPCHECK); /* Register RICH module */ - g4Reco->registerSubsystem( rich ); - + g4Reco->registerSubsystem(rich); } diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index e699f7711..b8161e54a 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -1,6 +1,6 @@ #pragma once static bool overlapcheck = false; -static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes namespace Enable { @@ -8,13 +8,13 @@ namespace Enable } // every G4 subsystem needs to implement this -// rather than forcing another include file, +// rather than forcing another include file, // let's put this into the GlobalVariables.C namespace BlackHoleGeometry { - static double max_radius = 0.; // this is needed for the overall dimension of the black hole + static double max_radius = 0.; // this is needed for the overall dimension of the black hole static double min_z = 0.; static double max_z = 0.; static double gap = no_overlapp; static bool visible = false; -}; +}; // namespace BlackHoleGeometry From b276cf723495279fbb29d412cac98f25fcc83bd9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:49:02 -0400 Subject: [PATCH 0523/1222] clang-format --- macros/g4simulations/Fun4All_G4_EICDetector.C | 488 +++++++++--------- 1 file changed, 242 insertions(+), 246 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 677900e6b..7c4028750 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -1,39 +1,39 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#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 "DisplayOn.C" #include "G4Setup_EICDetector.C" #include "G4_Bbc.C" -#include "G4_Global.C" #include "G4_CaloTrigger.C" -#include "G4_Jets.C" -#include "G4_HIJetReco.C" -#include "G4_FwdJets.C" #include "G4_DSTReader_EICDetector.C" -#include "DisplayOn.C" +#include "G4_FwdJets.C" +#include "G4_Global.C" +#include "G4_HIJetReco.C" +#include "G4_Jets.C" R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libPHPythia6.so) @@ -44,10 +44,9 @@ R__LOAD_LIBRARY(libPHSartre.so) using namespace std; 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" - ) + 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") { //=============== // Input options @@ -63,7 +62,7 @@ int Fun4All_G4_EICDetector( 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 + const bool readhepmc = false; // read HepMC files // Or: // read files in EICTree format generated by eicsmear package const bool readeictree = false; @@ -80,8 +79,6 @@ int Fun4All_G4_EICDetector( // 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 = true && !readhits; @@ -109,8 +106,7 @@ int Fun4All_G4_EICDetector( bool do_tracking_cell = Enable::TRACKING && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; - bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - + bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes Enable::CEMC = true; bool do_cemc_cell = Enable::CEMC && true; @@ -185,9 +181,9 @@ int Fun4All_G4_EICDetector( //Option to convert DST to human command readable TTree for quick poke around the outputs bool do_DSTReader = false; -// new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + BlackHoleGeometry::visible = true; //--------------- // Load libraries @@ -203,10 +199,10 @@ int Fun4All_G4_EICDetector( gROOT->LoadMacro("G4Setup_EICDetector.C"); G4Init(); - int absorberactive = 0; // set to 1 to make all absorbers active volumes + int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4/1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE //--------------- // Fun4All server @@ -233,41 +229,41 @@ int Fun4All_G4_EICDetector( //----------------- if (readhits) - { - // Get the hits from a file - // The input manager is declared later - } + { + // Get the hits from a file + // The input manager is declared later + } else if (readhepmc) - { + { // action is performed in later stage at the input manager level - } + } else if (readeictree) - { - // this module is needed to read the EICTree style records into our G4 sims - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(inputFile); + { + // this module is needed to read the EICTree style records into our G4 sims + ReadEICFiles *eicr = new ReadEICFiles(); + eicr->OpenInputFile(inputFile); - se->registerSubsystem(eicr); - } + se->registerSubsystem(eicr); + } else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); + { + gSystem->Load("libPHPythia8.so"); - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - } + PHPythia8 *pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + pythia8->set_config_file("phpythia8.cfg"); + se->registerSubsystem(pythia8); + } else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); + { + 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); - } -/* + PHPythia6 *pythia6 = new PHPythia6(); + // see coresoftware/generators/PHPythia6 for example config + pythia6->set_config_file("phpythia6_ep.cfg"); + se->registerSubsystem(pythia6); + } + /* else if (runhepgen) { gSystem->Load("libsHEPGen.so"); @@ -282,144 +278,144 @@ int Fun4All_G4_EICDetector( } */ 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); - } + { + // 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); + } // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) + 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) { - // 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(-3, 3); - 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); + gen->set_reuse_existing_vertex(true); + gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); } - if (usegun) + else { - // 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("mu-"); - pgen->set_z_range(0,0); - pgen->set_eta_range(-4.0,0.0); - pgen->set_mom_range(30,30); - pgen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - se->registerSubsystem(pgen); + 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(-3, 3); + 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("mu-"); + pgen->set_z_range(0, 0); + pgen->set_eta_range(-4.0, 0.0); + pgen->set_mom_range(30, 30); + 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) + 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) { - // 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); - } - - // 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; + vgen->set_reuse_existing_vertex(true); } - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- + // 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; - G4Setup(absorberactive, magfield, EDecayType::kAll, - magfield_rescale); + 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, EDecayType::kAll, + magfield_rescale); + } //--------- // BBC Reco //--------- if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } + { + gROOT->LoadMacro("G4_Bbc.C"); + BbcInit(); + Bbc_Reco(); + } //------------------ // Detector Division @@ -482,47 +478,48 @@ int Fun4All_G4_EICDetector( //----------------- if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } + { + gROOT->LoadMacro("G4_Global.C"); + Global_Reco(); + } else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } + { + gROOT->LoadMacro("G4_Global.C"); + Global_FastSim(); + } //----------------- // Calo Trigger Simulation //----------------- if (do_calotrigger) - { - gROOT->LoadMacro("G4_CaloTrigger.C"); - CaloTrigger_Sim(); - } + { + gROOT->LoadMacro("G4_CaloTrigger.C"); + CaloTrigger_Sim(); + } //--------- // Jet reco //--------- if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } + { + gROOT->LoadMacro("G4_Jets.C"); + Jet_Reco(); + } - if (do_HIjetreco) { + if (do_HIjetreco) + { gROOT->LoadMacro("G4_HIJetReco.C"); HIJetReco(); } if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } + { + gROOT->LoadMacro("G4_FwdJets.C"); + Jet_FwdReco(); + } //---------------------- // Simulation evaluation @@ -550,49 +547,48 @@ int Fun4All_G4_EICDetector( //-------------- if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } + { + // 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 ); - } + { + 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 ); - } + { + // 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*/ Enable::TRACKING , - /*bool*/ Enable::CEMC , - /*bool*/ Enable::HCALIN , - /*bool*/ Enable::MAGNET , - /*bool*/ Enable::HCALOUT , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_hcalout_twr, - /*bool*/ Enable::FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ Enable::FEMC, - /*bool*/ do_FEMC_twr, - /*bool*/ Enable::EEMC, - /*bool*/ do_EEMC_twr - ); - } + { + //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*/ Enable::TRACKING, + /*bool*/ Enable::CEMC, + /*bool*/ Enable::HCALIN, + /*bool*/ Enable::MAGNET, + /*bool*/ Enable::HCALOUT, + /*bool*/ do_cemc_twr, + /*bool*/ do_hcalin_twr, + /*bool*/ do_hcalout_twr, + /*bool*/ Enable::FHCAL, + /*bool*/ do_FHCAL_twr, + /*bool*/ Enable::FEMC, + /*bool*/ do_FEMC_twr, + /*bool*/ Enable::EEMC, + /*bool*/ do_EEMC_twr); + } Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); if (do_dst_compress) DstCompress(out); @@ -602,16 +598,16 @@ int Fun4All_G4_EICDetector( // Event processing //----------------- if (nEvents < 0) - { - return 0; - } + { + return 0; + } // 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 0; - } + { + 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); From edb7c0d13cb71e8c1e1cc4c37f5ae16573a455f5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:58:19 -0400 Subject: [PATCH 0524/1222] clean up root5 remnants --- macros/g4simulations/Fun4All_G4_EICDetector.C | 44 +++++-------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 7c4028750..41f97ae60 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -1,6 +1,14 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) +#include "DisplayOn.C" +#include "G4Setup_EICDetector.C" +#include "G4_Bbc.C" +#include "G4_CaloTrigger.C" +#include "G4_DSTReader_EICDetector.C" +#include "G4_FwdJets.C" +#include "G4_Global.C" +#include "G4_HIJetReco.C" +#include "G4_Jets.C" #include #include @@ -25,23 +33,12 @@ #include #include #include -#include "DisplayOn.C" -#include "G4Setup_EICDetector.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_EICDetector.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_HIJetReco.C" -#include "G4_Jets.C" + 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) -#endif - -using namespace std; int Fun4All_G4_EICDetector( const int nEvents = 1, @@ -189,14 +186,7 @@ int Fun4All_G4_EICDetector( // Load libraries //--------------- - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4eval.so"); - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_EICDetector.C"); G4Init(); int absorberactive = 0; // set to 1 to make all absorbers active volumes @@ -247,8 +237,6 @@ int Fun4All_G4_EICDetector( } else if (runpythia8) { - gSystem->Load("libPHPythia8.so"); - PHPythia8 *pythia8 = new PHPythia8(); // see coresoftware/generators/PHPythia8 for example config pythia8->set_config_file("phpythia8.cfg"); @@ -256,8 +244,6 @@ int Fun4All_G4_EICDetector( } 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"); @@ -282,7 +268,6 @@ int Fun4All_G4_EICDetector( // 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 @@ -412,7 +397,6 @@ int Fun4All_G4_EICDetector( if (do_bbc) { - gROOT->LoadMacro("G4_Bbc.C"); BbcInit(); Bbc_Reco(); } @@ -479,13 +463,11 @@ int Fun4All_G4_EICDetector( if (do_global) { - gROOT->LoadMacro("G4_Global.C"); Global_Reco(); } else if (do_global_fastsim) { - gROOT->LoadMacro("G4_Global.C"); Global_FastSim(); } @@ -495,7 +477,6 @@ int Fun4All_G4_EICDetector( if (do_calotrigger) { - gROOT->LoadMacro("G4_CaloTrigger.C"); CaloTrigger_Sim(); } @@ -505,19 +486,16 @@ int Fun4All_G4_EICDetector( 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(); } @@ -570,8 +548,6 @@ int Fun4All_G4_EICDetector( 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*/ Enable::TRACKING, From 3617d4151b97a59e148cbdc55d262554b798a299 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:58:56 -0400 Subject: [PATCH 0525/1222] add Enable namespace --- macros/g4simulations/G4_BlackHole.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C index 91f386327..f4ca08ba5 100644 --- a/macros/g4simulations/G4_BlackHole.C +++ b/macros/g4simulations/G4_BlackHole.C @@ -7,6 +7,10 @@ R__LOAD_LIBRARY(libg4detectors.so) +namespace Enable +{ + static bool BLACKHOLE = false; +} void BlackHoleInit() {} From b9be8a6c4bdf36cdefd6c75e62bc48810784899e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 16:59:43 -0400 Subject: [PATCH 0526/1222] only set min black hole z --- macros/g4simulations/G4_EEMC.C | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 0e7464d40..f0e857524 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -36,7 +36,6 @@ namespace G4EEMC void EEMCInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); } From 188197d222fed3bf4f09bf5045217a4787def7da Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 17:00:49 -0400 Subject: [PATCH 0527/1222] Add missing include file --- macros/g4simulations/G4_FwdJets.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C index 3eef1d79a..59b78cc1b 100644 --- a/macros/g4simulations/G4_FwdJets.C +++ b/macros/g4simulations/G4_FwdJets.C @@ -1,20 +1,22 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + #include #include #include +#include + #include + +#include + R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libg4eval.so) -#endif + void Jet_FwdRecoInit() {} void Jet_FwdReco(int verbosity = 0) { - gSystem->Load("libg4jets.so"); - Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets @@ -57,8 +59,6 @@ void Jet_FwdReco(int verbosity = 0) { 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", From 2a80bf72ab3521e82b66503f398f8078739267f8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 17:01:19 -0400 Subject: [PATCH 0528/1222] clang-format --- macros/g4simulations/G4_FwdJets.C | 33 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C index 59b78cc1b..d3fe3c169 100644 --- a/macros/g4simulations/G4_FwdJets.C +++ b/macros/g4simulations/G4_FwdJets.C @@ -12,22 +12,21 @@ R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libg4eval.so) - void Jet_FwdRecoInit() {} -void Jet_FwdReco(int verbosity = 0) { - +void Jet_FwdReco(int verbosity = 0) +{ 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.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.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.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"); @@ -42,31 +41,31 @@ void Jet_FwdReco(int verbosity = 0) { 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.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.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.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; + return; } void Jet_FwdEval(std::string outfilename = "g4fwdjets_eval.root", - int verbosity = 0) { - + int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); - JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r05", - "AntiKt_Truth_r05", - outfilename); + JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", + "AntiKt_Tower_r05", + "AntiKt_Truth_r05", + outfilename); eval->Verbosity(verbosity); se->registerSubsystem(eval); - + return; } From 7fb5a9c637b538f81911742b3790c4b759a9bc85 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 May 2020 18:28:35 -0400 Subject: [PATCH 0529/1222] remove gSystem->Load() --- macros/g4simulations/G4_Pipe_EIC.C | 3 --- macros/g4simulations/G4_Tracking_EIC.C | 9 --------- 2 files changed, 12 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index fc3db019e..6afe1896a 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -58,9 +58,6 @@ double Pipe(PHG4Reco* g4Reco, 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); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 99d78b602..0f368ea23 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -254,15 +254,6 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) void Tracking_Eval(std::string outputfile, int verbosity = 0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4trackfastsim.so"); - gSystem->Load("libg4eval.so"); - //--------------- // Fun4All server //--------------- From 35f2d73bf775eaebf27eec0fcfc073881af78358 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 20 May 2020 16:57:18 -0400 Subject: [PATCH 0530/1222] put old version back so fsPHENIX does not change --- macros/g4simulations/G4Setup_fsPHENIX.C | 89 +++++++++++++++++++------ 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index bd44ff993..87f724030 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -10,9 +10,6 @@ #include "G4_FGEM_fsPHENIX.C" #include "G4_FEMC.C" #include "G4_FHCAL.C" -#include "G4_PlugDoor_fsPHENIX.C" -#include "G4_BlackHole.C" -#include "G4_WorldSize.C" #include #include #include @@ -94,14 +91,6 @@ void G4Init(bool do_svtx = true, gROOT->LoadMacro("G4_FHCAL.C"); FHCALInit(); } - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } } @@ -219,25 +208,81 @@ int G4Setup(const int absorberactive = 0, if ( do_FHCAL ) FHCALSetup(g4Reco, absorberactive); - if (Enable::PLUGDOOR) - { - PlugDoor(g4Reco, absorberactive); - } + // sPHENIX forward flux return(s) with reduced thickness + 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 if enabled, needs info from all previous sub detectors for dimensions - if (Enable::BLACKHOLE) - { - BlackHole(g4Reco, radius); - } + // BLACKHOLE + // minimal space for forward instrumentation + if (radius<270) radius = 270; + + // 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); -// finally adjust the world size in case the default is too small - WorldSize(g4Reco, radius); se->registerSubsystem( g4Reco ); return 0; } From ef4eb2df045340fa8564fe93d52b54c3eaa6c7fc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 23 May 2020 19:45:50 -0400 Subject: [PATCH 0531/1222] add flag to write output instead of commenting output manager --- macros/g4simulations/Fun4All_G4_EICDetector.C | 11 ++++++++--- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 11 +++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 41f97ae60..455ac8dfe 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -83,6 +83,8 @@ int Fun4All_G4_EICDetector( 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; + // Write the DST + const bool do_write_output = false; //====================== // What to run @@ -566,9 +568,12 @@ int Fun4All_G4_EICDetector( /*bool*/ do_EEMC_twr); } - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (do_dst_compress) DstCompress(out); - se->registerOutputManager(out); + if(do_write_output) + { + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); + } //----------------- // Event processing diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index f64351d05..0a654a0a0 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -63,7 +63,8 @@ int Fun4All_G4_fsPHENIX( // 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; - + // Write the DST + const bool do_write_output = false; //====================== // What to run //====================== @@ -433,9 +434,11 @@ int Fun4All_G4_fsPHENIX( ); } - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); + if(do_write_output) { + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); + } //----------------- // Event processing From 0b4863782b0e617ee7004abd4a262aca708ef060 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 23 May 2020 21:34:26 -0400 Subject: [PATCH 0532/1222] use existing Enable subsystems --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 53 ++++++++++------------ macros/g4simulations/G4Setup_fsPHENIX.C | 46 ++++++++----------- 2 files changed, 42 insertions(+), 57 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 0a654a0a0..18465fa38 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -64,65 +64,65 @@ int Fun4All_G4_fsPHENIX( // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ const bool do_embedding = false; // Write the DST - const bool do_write_output = false; + const bool do_write_output = true; //====================== // What to run //====================== - bool do_bbc = true; + bool do_bbc = false; bool do_pipe = true; // central tracking bool do_tracking = true; bool do_tracking_cell = do_tracking && true; - bool do_tracking_cluster = do_tracking_cell && true; + bool do_tracking_cluster = do_tracking_cell && false; bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; + bool do_cemc_cell = do_cemc && false; 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; + Enable::HCALIN = true; + bool do_hcalin_cell = Enable::HCALIN && false; 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; + Enable::MAGNET = true; - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; + Enable::HCALOUT = true; + bool do_hcalout_cell = Enable::HCALOUT && false; 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 = false; 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_reco = false; 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_FGEM_track = do_FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && true; + bool do_FEMC_cell = do_FEMC && false; 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; + Enable::FHCAL = true; + bool do_FHCAL_cell = Enable::FHCAL && false; bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; @@ -142,7 +142,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_FEMC,do_FHCAL,n_TPC_layers); + G4Init(do_tracking,do_cemc,do_pipe,do_FGEM,do_FEMC,n_TPC_layers); int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) @@ -172,7 +172,7 @@ int Fun4All_G4_fsPHENIX( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -244,17 +244,10 @@ int Fun4All_G4_fsPHENIX( // Detector description //--------------------- -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, - do_FGEM, do_FEMC, do_FHCAL, - magfield_rescale); -#else - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, - do_FGEM, do_FEMC, do_FHCAL, + do_tracking, do_cemc, do_pipe, + do_FGEM, do_FEMC, magfield_rescale); -#endif } //--------- @@ -420,14 +413,14 @@ int Fun4All_G4_fsPHENIX( /*int*/ absorberactive , /*bool*/ do_tracking , /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , + /*bool*/ Enable::HCALIN, + /*bool*/ Enable::MAGNET, + /*bool*/ Enable::HCALOUT, /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , /*bool*/ do_hcalout_twr, /*bool*/ do_FGEM, - /*bool*/ do_FHCAL, + /*bool*/ Enable::FHCAL, /*bool*/ do_FHCAL_twr, /*bool*/ do_FEMC, /*bool*/ do_FEMC_twr diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 87f724030..bc8658729 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -29,13 +29,9 @@ void RunLoadTest() {} 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 @@ -57,20 +53,17 @@ void G4Init(bool do_svtx = true, CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations } - if (do_hcalin) + if (Enable::HCALIN) { - gROOT->LoadMacro("G4_HcalIn_ref.C"); HCalInnerInit(); } - if (do_magnet) + if (Enable::MAGNET) { - gROOT->LoadMacro("G4_Magnet.C"); MagnetInit(); } - if (do_hcalout) + if (Enable::HCALOUT) { - gROOT->LoadMacro("G4_HcalOut_ref.C"); HCalOuterInit(); } @@ -86,9 +79,8 @@ void G4Init(bool do_svtx = true, FEMCInit(); } - if (do_FHCAL) + if (Enable::FHCAL) { - gROOT->LoadMacro("G4_FHCAL.C"); FHCALInit(); } } @@ -103,22 +95,11 @@ int G4Setup(const int absorberactive = 0, #endif 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 //--------------- @@ -178,17 +159,26 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // HCALIN - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); + if (Enable::HCALIN) + { + radius = HCalInner(g4Reco, radius, 4, absorberactive); + } //---------------------------------------- // MAGNET - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); + if (Enable::MAGNET) + { + radius = Magnet(g4Reco, radius, 0, absorberactive); + } //---------------------------------------- // HCALOUT - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); + if (Enable::HCALOUT) + { + radius = HCalOuter(g4Reco, radius, 4, absorberactive); + } //---------------------------------------- // Forward tracking @@ -205,8 +195,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FHCAL - if ( do_FHCAL ) + if (Enable::FHCAL) + { FHCALSetup(g4Reco, absorberactive); + } // sPHENIX forward flux return(s) with reduced thickness PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); From d27450566482cb12522fecd3f633cfa902b6308b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 11:25:36 -0400 Subject: [PATCH 0533/1222] use namespaces --- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C index 40aab91d4..f442744fa 100644 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -7,25 +7,25 @@ R__LOAD_LIBRARY(libg4detectors.so) +namespace Enable +{ + static bool PLUGDOOR = false; + static bool PLUGDOOR_ABSORBER = false; +} + +namespace G4PLUGDOOR +{ const double place_z = 335.9; const double length = 10.2; const double inner_radius = 2.1; const double thickness = 258.5; +} void PlugDoorInit() { - if (BlackHoleGeometry::max_radius < (inner_radius+thickness)) - { - BlackHoleGeometry::max_radius = inner_radius+thickness; - } - if (BlackHoleGeometry::max_z < (place_z + length/2.)) - { - BlackHoleGeometry::max_z = place_z + length/2.; - } - if (BlackHoleGeometry::min_z > -(place_z + length/2.)) - { - BlackHoleGeometry::min_z = -(place_z + length/2.); - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4PLUGDOOR::inner_radius+G4PLUGDOOR::thickness); + 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.)); } void PlugDoor(PHG4Reco *g4Reco, @@ -35,24 +35,24 @@ void PlugDoor(PHG4Reco *g4Reco, //---------------------------------------- // fsPHENIX forward flux return(s) const string material("Steel_1006"); - const int flux_door_active = false; + const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER ; PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_double_param("length", length); - flux_return_plus->set_double_param("radius", inner_radius); - flux_return_plus->set_double_param("place_z", place_z); - flux_return_plus->set_double_param("thickness", thickness); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::inner_radius); + flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); + 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); g4Reco->registerSubsystem(flux_return_plus); - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 1); - flux_return_minus->set_double_param("length", length); - flux_return_minus->set_double_param("radius", inner_radius); - flux_return_minus->set_double_param("place_z", -place_z); - flux_return_minus->set_double_param("thickness", thickness); + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::inner_radius); + flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); + 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"); From abb7f3570d826b2a4b7aa072435447adc6a3397b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 11:26:01 -0400 Subject: [PATCH 0534/1222] Add ABSORBER to Enable namespace --- macros/g4simulations/GlobalVariables.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index b8161e54a..281028372 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -5,6 +5,7 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volu namespace Enable { static bool OVERLAPCHECK = false; + static bool ABSORBER = false; } // every G4 subsystem needs to implement this From a0451ac4543d88b923c36f890e19853c8399a173 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 11:27:19 -0400 Subject: [PATCH 0535/1222] move plugdoor to G4_Plugdoor_fsPHENIX.C --- macros/g4simulations/G4Setup_fsPHENIX.C | 35 ++++++++----------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index bc8658729..e3112c332 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -2,6 +2,7 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" #include "G4_Pipe.C" +#include "G4_PlugDoor_fsPHENIX.C" #include "G4_Tracking.C" #include "G4_CEmc_Spacal.C" #include "G4_HcalIn_ref.C" @@ -83,6 +84,12 @@ void G4Init(bool do_svtx = true, { FHCALInit(); } + + if (Enable::PLUGDOOR) + { + PlugDoorInit(); + } + } @@ -200,30 +207,10 @@ int G4Setup(const int absorberactive = 0, FHCALSetup(g4Reco, absorberactive); } - // sPHENIX forward flux return(s) with reduced thickness - 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); + if (Enable::PLUGDOOR) + { + PlugDoor(g4Reco, absorberactive); + } //---------------------------------------- // piston magnet From b2268a2874271c13aad881a45bb866b78313fdb0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 11:28:38 -0400 Subject: [PATCH 0536/1222] start to drop root5, move plugdoor to its own G4 macro, no change in results --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 18465fa38..335c5eeb6 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include #include #include @@ -31,7 +31,6 @@ R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libPHPythia6.so) R__LOAD_LIBRARY(libPHPythia8.so) -#endif int Fun4All_G4_fsPHENIX( const int nEvents = 2, @@ -63,39 +62,37 @@ int Fun4All_G4_fsPHENIX( // 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; - // Write the DST - const bool do_write_output = true; //====================== // What to run //====================== bool do_bbc = false; - bool do_pipe = true; + bool do_pipe = false; // central tracking - bool do_tracking = true; + bool do_tracking = false; bool do_tracking_cell = do_tracking && true; bool do_tracking_cluster = do_tracking_cell && false; bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - bool do_cemc = true; + bool do_cemc = false; bool do_cemc_cell = do_cemc && false; bool do_cemc_twr = do_cemc_cell && true; bool do_cemc_cluster = do_cemc_twr && true; bool do_cemc_eval = do_cemc_cluster && false; - Enable::HCALIN = true; + Enable::HCALIN = false; bool do_hcalin_cell = Enable::HCALIN && false; bool do_hcalin_twr = do_hcalin_cell && true; bool do_hcalin_cluster = do_hcalin_twr && true; bool do_hcalin_eval = do_hcalin_cluster && false; - Enable::MAGNET = true; + Enable::MAGNET = false; - Enable::HCALOUT = true; + Enable::HCALOUT = false; bool do_hcalout_cell = Enable::HCALOUT && false; bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; @@ -112,24 +109,29 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry - bool do_FGEM = true; + bool do_FGEM = false; bool do_FGEM_track = do_FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; - bool do_FEMC = true; + bool do_FEMC = false; bool do_FEMC_cell = do_FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; - Enable::FHCAL = true; + Enable::FHCAL = false; bool do_FHCAL_cell = Enable::FHCAL && false; bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; - bool do_dst_compress = false; + Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; + + // Write the DST + const bool do_write_output = true; + const bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = false; + const bool do_DSTReader = false; //--------------- // Load libraries //--------------- From c8a998f63946e03689e6cc733a9fb847b632d341 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 11:34:40 -0400 Subject: [PATCH 0537/1222] remove unused absorberactive function param --- macros/g4simulations/G4Setup_fsPHENIX.C | 2 +- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 24 ++++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index e3112c332..d875a0c8f 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -209,7 +209,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::PLUGDOOR) { - PlugDoor(g4Reco, absorberactive); + PlugDoor(g4Reco); } //---------------------------------------- diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C index f442744fa..1c41ec7c2 100644 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -11,31 +11,29 @@ namespace Enable { static bool PLUGDOOR = false; static bool PLUGDOOR_ABSORBER = false; -} +} // namespace Enable namespace G4PLUGDOOR { -const double place_z = 335.9; -const double length = 10.2; -const double inner_radius = 2.1; -const double thickness = 258.5; -} + const double place_z = 335.9; + const double length = 10.2; + const double inner_radius = 2.1; + const double thickness = 258.5; +} // namespace G4PLUGDOOR void PlugDoorInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4PLUGDOOR::inner_radius+G4PLUGDOOR::thickness); - 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.)); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::inner_radius + G4PLUGDOOR::thickness); + 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.)); } -void PlugDoor(PHG4Reco *g4Reco, - const int absorberactive = 0, - int verbosity = 0) +void PlugDoor(PHG4Reco *g4Reco) { //---------------------------------------- // fsPHENIX forward flux return(s) const string material("Steel_1006"); - const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER ; + const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); flux_return_plus->set_double_param("length", G4PLUGDOOR::length); From dc2687fa96bffcb6ea9ff1d50ca5ee0eb2d7913e Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 25 May 2020 13:46:49 -0400 Subject: [PATCH 0538/1222] change output file prefix --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 41f97ae60..b0f43b5da 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -43,7 +43,7 @@ R__LOAD_LIBRARY(libPHSartre.so) 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") + const char *outputFile = "G4EICDetector") //"G4EICDetector.root") { //=============== // Input options From 96766985fade2ba2870dda8a1ee90aa360cb0124 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 14:10:15 -0400 Subject: [PATCH 0539/1222] add world resizing, black hole from macro, start removing root5 --- macros/g4simulations/G4Setup_fsPHENIX.C | 67 +++++++++---------------- 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index d875a0c8f..68f2e6f5d 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -1,6 +1,6 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "GlobalVariables.C" +#include "G4_BlackHole.C" #include "G4_Pipe.C" #include "G4_PlugDoor_fsPHENIX.C" #include "G4_Tracking.C" @@ -11,6 +11,8 @@ #include "G4_FGEM_fsPHENIX.C" #include "G4_FEMC.C" #include "G4_FHCAL.C" +#include "G4_User.C" +#include "G4_WorldSize.C" #include #include #include @@ -21,10 +23,6 @@ class SubsysReco; R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) int make_piston(string name, PHG4Reco* g4Reco); -#else -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 -#endif void RunLoadTest() {} @@ -89,6 +87,15 @@ void G4Init(bool do_svtx = true, { PlugDoorInit(); } + if (Enable::USER) + { + UserInit(); + } + + if (Enable::BLACKHOLE) + { + BlackHoleInit(); + } } @@ -217,51 +224,25 @@ int G4Setup(const int absorberactive = 0, // make_piston("magpiston", g4Reco); //---------------------------------------- + if (Enable::USER) + { + UserDetector(g4Reco); + } // BLACKHOLE // minimal space for forward instrumentation if (radius<270) radius = 270; - // 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); + 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; } From 996577716fce2fe376a6a5d92ee62944f5cda382 Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 25 May 2020 14:10:17 -0400 Subject: [PATCH 0540/1222] switch on LANL FST only --- macros/g4simulations/Fun4All_G4_EICDetector.C | 26 +++++++++---------- macros/g4simulations/G4_GEM_EIC.C | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index b0f43b5da..e5de52600 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -92,26 +92,26 @@ int Fun4All_G4_EICDetector( bool do_bbc = true; // whether to simulate the Be section of the beam pipe - Enable::PIPE = true; + Enable::PIPE = false; // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C - Enable::EGEM = true; + Enable::EGEM = false; Enable::FGEM = true; Enable::MVTX = true; - Enable::TPC = true; + Enable::TPC = false; Enable::TRACKING = true; bool do_tracking_cell = Enable::TRACKING && true; bool do_tracking_track = do_tracking_cell && true; bool do_tracking_eval = do_tracking_track && true; bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - Enable::CEMC = true; + Enable::CEMC = false; bool do_cemc_cell = Enable::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; - Enable::HCALIN = true; + Enable::HCALIN = false; bool do_hcalin_cell = Enable::HCALIN && true; bool do_hcalin_twr = do_hcalin_cell && true; bool do_hcalin_cluster = do_hcalin_twr && true; @@ -119,39 +119,39 @@ int Fun4All_G4_EICDetector( Enable::MAGNET = true; - Enable::HCALOUT = true; + Enable::HCALOUT = false; bool do_hcalout_cell = Enable::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 - Enable::DIRC = true; + Enable::DIRC = false; // EICDetector geometry - 'hadron' direction - Enable::RICH = true; - Enable::AEROGEL = true; + Enable::RICH = false; + Enable::AEROGEL = false; - Enable::FEMC = true; + Enable::FEMC = false; bool do_FEMC_cell = Enable::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; - Enable::FHCAL = true; + Enable::FHCAL = false; bool do_FHCAL_cell = Enable::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 - Enable::EEMC = true; + Enable::EEMC = false; bool do_EEMC_cell = Enable::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; - Enable::PLUGDOOR = true; + Enable::PLUGDOOR = false; // Other options bool do_global = true; diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index b780ae479..1c1c4e763 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -105,7 +105,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // gem->OverlapCheck(overlapcheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); + //g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -140,8 +140,8 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); - + //g4Reco->registerSubsystem(gem); + /////////////////////////////////////////////////////////////////////////// make_LANL_FST_station("FST_4", g4Reco, 160, 12, 41); @@ -169,7 +169,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // gem->OverlapCheck(overlapcheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); + //g4Reco->registerSubsystem(gem); zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) * sin(tilt); @@ -193,7 +193,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); + //g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// From a988cd340bf58ec9a0c44396f1291b65e320b1da Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 14:10:35 -0400 Subject: [PATCH 0541/1222] add world resizing, black hole from macro, start removing root5 --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 335c5eeb6..625f82f0d 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -126,12 +126,17 @@ int Fun4All_G4_fsPHENIX( Enable::PLUGDOOR = true; Enable::PLUGDOOR_ABSORBER = true; + // new settings using Enable namespace in GlobalVariables.C + //Enable::BLACKHOLE = true; + BlackHoleGeometry::visible = true; + // Write the DST const bool do_write_output = true; const bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs const bool do_DSTReader = false; + //--------------- // Load libraries //--------------- From 2d1773541ee93a58c5b2b10eb4be83038c36e33d Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 25 May 2020 14:40:21 -0400 Subject: [PATCH 0542/1222] simplify the macro and skip FGEM in track reconstruction --- macros/g4simulations/G4_Tracking_EIC.C | 127 ++++++------------------- 1 file changed, 29 insertions(+), 98 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 0f368ea23..802bca896 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -20,7 +20,6 @@ #include class SubsysReco; - R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) @@ -33,6 +32,7 @@ void TrackingInit() {} void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) { + int i; //--------------- // Fun4All server //--------------- @@ -134,103 +134,34 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) if (Enable::FGEM) { - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM4, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_5", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + bool do_FST=true; + bool do_FGEM=false; //Ping: don't need GEM at the moment + + if (do_FST) { + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + for (i=0;i<6;i++) { + kalman->add_phg4hits(Form("G4HIT_FST_%d",i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } + + if (do_FGEM) { + // GEM2, 70um azimuthal resolution, 1cm radial strips + for (i=2;i<5;i++) { + kalman->add_phg4hits(Form("G4HIT_FGEM_%d",i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } } // Saved track states (projections) From 234b4c35391b2a4771875ede001c99d391551a31 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 17:09:14 -0400 Subject: [PATCH 0543/1222] move absorberactive to Enable namespace --- macros/g4simulations/G4Setup_EICDetector.C | 4 ++-- macros/g4simulations/G4Setup_fsPHENIX.C | 4 ++-- macros/g4simulations/G4_FHCAL.C | 6 ++++-- macros/g4simulations/G4_PlugDoor_EIC.C | 7 +++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 7c05abf94..4937c0635 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -262,7 +262,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::FHCAL) { - FHCALSetup(g4Reco, absorberactive); + FHCALSetup(g4Reco); } //---------------------------------------- // EEMC @@ -293,7 +293,7 @@ int G4Setup(const int absorberactive = 0, // sPHENIX forward flux return door if (Enable::PLUGDOOR) { - PlugDoor(g4Reco, absorberactive); + PlugDoor(g4Reco); } if (Enable::USER) { diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 68f2e6f5d..48ae307e4 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -211,7 +211,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::FHCAL) { - FHCALSetup(g4Reco, absorberactive); + FHCALSetup(g4Reco); } if (Enable::PLUGDOOR) @@ -230,7 +230,7 @@ int G4Setup(const int absorberactive = 0, } // BLACKHOLE // minimal space for forward instrumentation - if (radius<270) radius = 270; + // if (radius<270) radius = 270; if (Enable::BLACKHOLE) { diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index fb2d42490..fa6f4dbc2 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -25,6 +25,7 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { static bool FHCAL = false; + static bool FHCAL_ABSORBER = false; } namespace G4FHCAL @@ -52,8 +53,9 @@ void FHCAL_Cells(int verbosity = 0) return; } -void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +void FHCALSetup(PHG4Reco *g4Reco) { + const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FHCAL module */ @@ -70,7 +72,7 @@ void FHCALSetup(PHG4Reco *g4Reco, const int absorberactive = 0) hhcal->SetTowerMappingFile(mapping_hhcal.str()); hhcal->OverlapCheck(overlapcheck); - if (absorberactive) hhcal->SetAbsorberActive(); + if (AbsorberActive) hhcal->SetAbsorberActive(); g4Reco->registerSubsystem(hhcal); } diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index ddc70458d..1ebd35533 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -11,6 +11,7 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { static bool PLUGDOOR = false; + static bool PLUGDOOR_ABSORBER = false; } namespace G4PLUGDOOR @@ -32,13 +33,11 @@ void PlugDoorInit() BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); } -void PlugDoor(PHG4Reco *g4Reco, - const int absorberactive = 0, - int verbosity = 0) +void PlugDoor(PHG4Reco *g4Reco) { //---------------------------------------- const string material("Steel_1006"); - const int flux_door_active = false; + const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); flux_return_minus->set_int_param("lengthviarapidity", 0); From bde7905ffc1b964ddde2130fc7234324be48dcb5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 21:52:27 -0400 Subject: [PATCH 0544/1222] Add namespaces --- macros/g4simulations/G4_FEMC.C | 69 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 5e166c20d..94998e498 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -1,5 +1,5 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" #include #include @@ -15,10 +15,21 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -#endif +namespace Enable +{ + static bool FEMC = false; + static bool FEMC_ABSORBER = false; +} +namespace G4FEMC +{ +// from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt + const double Gz0 = 305.; + const double Gdz = 40.; + const double outer_radius = 180.; + string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; enum enu_Femc_clusterizer { kFemcGraphClusterizer, @@ -29,37 +40,19 @@ enum enu_Femc_clusterizer enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +} void FEMCInit() { - if (BlackHoleGeometry::max_radius < 180) - { - BlackHoleGeometry::max_radius = 180; // eye balled - } -} - -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; + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } void FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); - + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FEMC module */ @@ -69,23 +62,33 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) // fsPHENIX ECAL femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + mapping_femc<< getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - cout << mapping_femc.str() << endl; +// cout << mapping_femc.str() << endl; femc->SetTowerMappingFile( mapping_femc.str() ); femc->OverlapCheck(overlapcheck); femc->SetActive(); femc->SuperDetector("FEMC"); - if (absorberactive) femc->SetAbsorberActive(); + if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); g4Reco->registerSubsystem( femc ); } +void FEMC_Cells(int verbosity = 0) +{ + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); + hc->Detector("FEMC"); + se->registerSubsystem(hc); + + return; +} + void FEMC_Towers(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; @@ -207,12 +210,10 @@ void FEMC_Towers(int verbosity = 0) { void FEMC_Clusters(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if ( Femc_clusterizer == kFemcTemplateClusterizer ) + if ( G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer ) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); @@ -223,7 +224,7 @@ void FEMC_Clusters(int verbosity = 0) { ClusterBuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(ClusterBuilder); } - else if ( Femc_clusterizer == kFemcGraphClusterizer ) + else if ( G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer ) { RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); @@ -244,8 +245,6 @@ void FEMC_Clusters(int verbosity = 0) { 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()); From 92652c0f4bcf56671110fa3b877f5e8ff0609e07 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 21:53:03 -0400 Subject: [PATCH 0545/1222] Add Enable for FEMC --- macros/g4simulations/G4Setup_fsPHENIX.C | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 48ae307e4..5bcc414a7 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -30,7 +30,6 @@ void G4Init(bool do_svtx = true, bool do_cemc = true, bool do_pipe = true, bool do_FGEM = true, - bool do_FEMC = true, int n_TPC_layers = 40) { // load detector/material macros and execute Init() function @@ -72,9 +71,8 @@ void G4Init(bool do_svtx = true, FGEM_Init(); } - if (do_FEMC) + if (Enable::FEMC) { - gROOT->LoadMacro("G4_FEMC.C"); FEMCInit(); } @@ -111,7 +109,6 @@ int G4Setup(const int absorberactive = 0, const bool do_cemc = true, const bool do_pipe = true, const bool do_FGEM = true, - const bool do_FEMC = false, const float magfield_rescale = 1.0) { //--------------- @@ -203,9 +200,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FEMC - if ( do_FEMC ) - FEMCSetup(g4Reco, absorberactive); - + if ( Enable::FEMC ) + { + FEMCSetup(g4Reco); + } //---------------------------------------- // FHCAL From 3d01ceb21fe756f597b77bd220de26058f59d8a7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 21:53:38 -0400 Subject: [PATCH 0546/1222] Add Enable for FEMC --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 625f82f0d..4c34ae794 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -65,6 +65,7 @@ int Fun4All_G4_fsPHENIX( //====================== // What to run //====================== +// Enable::ABSORBER = true; bool do_bbc = false; @@ -113,8 +114,9 @@ int Fun4All_G4_fsPHENIX( bool do_FGEM_track = do_FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; - bool do_FEMC = false; - bool do_FEMC_cell = do_FEMC && false; + Enable::FEMC = true; + Enable::FEMC_ABSORBER = true; + bool do_FEMC_cell = Enable::FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; @@ -123,11 +125,11 @@ int Fun4All_G4_fsPHENIX( bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; - Enable::PLUGDOOR = true; + Enable::PLUGDOOR = false; Enable::PLUGDOOR_ABSORBER = true; // new settings using Enable namespace in GlobalVariables.C - //Enable::BLACKHOLE = true; +// Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; // Write the DST @@ -149,9 +151,9 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,do_cemc,do_pipe,do_FGEM,do_FEMC,n_TPC_layers); + G4Init(do_tracking,do_cemc,do_pipe,do_FGEM,n_TPC_layers); - int absorberactive = 0; // set to 1 to make all absorbers active volumes + int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = -1.4/1.5; // make consistent with Fun4All_G4_sPHENIX() @@ -253,7 +255,7 @@ int Fun4All_G4_fsPHENIX( G4Setup(absorberactive, magfield, EDecayType::kAll, do_tracking, do_cemc, do_pipe, - do_FGEM, do_FEMC, + do_FGEM, magfield_rescale); } @@ -429,7 +431,7 @@ int Fun4All_G4_fsPHENIX( /*bool*/ do_FGEM, /*bool*/ Enable::FHCAL, /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, + /*bool*/ Enable::FEMC, /*bool*/ do_FEMC_twr ); } From 8fb7086cb21903d54f8d5c83e6d2cd0d27db6eea Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 May 2020 23:35:16 -0400 Subject: [PATCH 0547/1222] clang-format, introduce in FEMC_VERBOSITY --- macros/g4simulations/G4_FEMC.C | 198 ++++++++++++++++----------------- 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 94998e498..b6101eaa8 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -1,16 +1,23 @@ #pragma once #include "GlobalVariables.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) @@ -20,37 +27,35 @@ namespace Enable { static bool FEMC = false; static bool FEMC_ABSORBER = false; -} - + static int FEMC_VERBOSITY = 0; +} // namespace Enable namespace G4FEMC { -// from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt + // from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt const double Gz0 = 305.; const double Gdz = 40.; const double outer_radius = 180.; string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; -enum enu_Femc_clusterizer -{ - kFemcGraphClusterizer, - kFemcTemplateClusterizer -}; - -//template clusterizer, as developed by Sasha Bazilevsky -enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; -// graph clusterizer -//enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; -} - -void -FEMCInit() + enum enu_Femc_clusterizer + { + kFemcGraphClusterizer, + kFemcTemplateClusterizer + }; + + //template clusterizer, as developed by Sasha Bazilevsky + enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; + // graph clusterizer + //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +} // namespace G4FEMC + +void FEMCInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) +void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; Fun4AllServer *se = Fun4AllServer::instance(); @@ -61,23 +66,21 @@ FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) ostringstream mapping_femc; // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << G4FEMC::calibfile; + femc->SetfsPHENIXDetector(); + mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; -// cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile( mapping_femc.str() ); + // cout << mapping_femc.str() << endl; + femc->SetTowerMappingFile(mapping_femc.str()); femc->OverlapCheck(overlapcheck); femc->SetActive(); femc->SuperDetector("FEMC"); - if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); - - g4Reco->registerSubsystem( femc ); + if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); + g4Reco->registerSubsystem(femc); } -void FEMC_Cells(int verbosity = 0) +void FEMC_Cells() { - Fun4AllServer *se = Fun4AllServer::instance(); PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); @@ -87,73 +90,72 @@ void FEMC_Cells(int verbosity = 0) return; } -void FEMC_Towers(int verbosity = 0) { - +void FEMC_Towers() +{ Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); + 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() ); + 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->TowerType(1); + //TowerDigitizer1->Verbosity(Enable::FEMC_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->TowerType(2); + //TowerDigitizer2->Verbosity(Enable::FEMC_VERBOSITY); //TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); //se->registerSubsystem( TowerDigitizer2 ); // E864 towers (three types for three sizes) RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); TowerDigitizer3->Detector("FEMC"); - TowerDigitizer3->TowerType(3); - TowerDigitizer3->Verbosity(verbosity); + TowerDigitizer3->TowerType(3); + TowerDigitizer3->Verbosity(Enable::FEMC_VERBOSITY); TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer3 ); + se->registerSubsystem(TowerDigitizer3); RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); TowerDigitizer4->Detector("FEMC"); - TowerDigitizer4->TowerType(4); - TowerDigitizer4->Verbosity(verbosity); + TowerDigitizer4->TowerType(4); + TowerDigitizer4->Verbosity(Enable::FEMC_VERBOSITY); TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer4 ); + se->registerSubsystem(TowerDigitizer4); RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); TowerDigitizer5->Detector("FEMC"); - TowerDigitizer5->TowerType(5); - TowerDigitizer5->Verbosity(verbosity); + TowerDigitizer5->TowerType(5); + TowerDigitizer5->Verbosity(Enable::FEMC_VERBOSITY); TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer5 ); + se->registerSubsystem(TowerDigitizer5); RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); TowerDigitizer6->Detector("FEMC"); - TowerDigitizer6->TowerType(6); - TowerDigitizer6->Verbosity(verbosity); + TowerDigitizer6->TowerType(6); + TowerDigitizer6->Verbosity(Enable::FEMC_VERBOSITY); TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer6 ); + se->registerSubsystem(TowerDigitizer6); // PbW crystals //RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); //TowerCalibration1->Detector("FEMC"); //TowerCalibration1->TowerType(1); - //TowerCalibration1->Verbosity(verbosity); + //TowerCalibration1->Verbosity(Enable::FEMC_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); @@ -163,7 +165,7 @@ void FEMC_Towers(int verbosity = 0) { //RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); //TowerCalibration2->Detector("FEMC"); //TowerCalibration2->TowerType(2); - //TowerCalibration2->Verbosity(verbosity); + //TowerCalibration2->Verbosity(Enable::FEMC_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); @@ -173,84 +175,80 @@ void FEMC_Towers(int verbosity = 0) { RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); TowerCalibration3->Detector("FEMC"); TowerCalibration3->TowerType(3); - TowerCalibration3->Verbosity(verbosity); + TowerCalibration3->Verbosity(Enable::FEMC_VERBOSITY); TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration3->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration3->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration3 ); + se->registerSubsystem(TowerCalibration3); RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); TowerCalibration4->Detector("FEMC"); TowerCalibration4->TowerType(4); - TowerCalibration4->Verbosity(verbosity); + TowerCalibration4->Verbosity(Enable::FEMC_VERBOSITY); TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration4->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration4->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration4 ); + se->registerSubsystem(TowerCalibration4); RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); TowerCalibration5->Detector("FEMC"); TowerCalibration5->TowerType(5); - TowerCalibration5->Verbosity(verbosity); + TowerCalibration5->Verbosity(Enable::FEMC_VERBOSITY); TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration5->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration5->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration5 ); + se->registerSubsystem(TowerCalibration5); RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); TowerCalibration6->Detector("FEMC"); TowerCalibration6->TowerType(6); - TowerCalibration6->Verbosity(verbosity); + TowerCalibration6->Verbosity(Enable::FEMC_VERBOSITY); TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + TowerCalibration6->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration6->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration6 ); - + se->registerSubsystem(TowerCalibration6); } -void FEMC_Clusters(int verbosity = 0) { - +void FEMC_Clusters() +{ Fun4AllServer *se = Fun4AllServer::instance(); - - if ( G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer ) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if ( G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer ) - { - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem( ClusterBuilder ); - } + if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(Enable::FEMC_VERBOSITY); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(ClusterBuilder); + } + else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); + + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(Enable::FEMC_VERBOSITY); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem(ClusterBuilder); + } else - { - cout << "FEMC_Clusters - unknown clusterizer setting!"<Verbosity(verbosity); + eval->Verbosity(Enable::FEMC_VERBOSITY); se->registerSubsystem(eval); - return; } From b6258ef09e374cb2955c8cb7a26ed529655d5cfd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 26 May 2020 21:37:38 -0400 Subject: [PATCH 0548/1222] add Verbosity --- macros/g4simulations/GlobalVariables.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 281028372..6c9ff3ffd 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -6,6 +6,7 @@ namespace Enable { static bool OVERLAPCHECK = false; static bool ABSORBER = false; + static int VERBOSITY = 0; } // every G4 subsystem needs to implement this From 8fca3f213a9f594cf6b5930830dd52596bfa056e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 16:50:01 -0400 Subject: [PATCH 0549/1222] Set world parameters in G4_World.C --- macros/g4simulations/G4Setup_EICDetector.C | 6 ++-- macros/g4simulations/G4_World.C | 33 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 macros/g4simulations/G4_World.C diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 4937c0635..a7acb7a85 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -31,7 +31,7 @@ #include "G4_TPC_EIC.C" #include "G4_Tracking_EIC.C" #include "G4_User.C" -#include "G4_WorldSize.C" +#include "G4_World.C" R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) @@ -41,7 +41,6 @@ void RunLoadTest() {} void G4Init() { // load detector/material macros and execute Init() function - if (Enable::PIPE) { PipeInit(); @@ -156,6 +155,9 @@ int G4Setup(const int absorberactive = 0, se->registerSubsystem(hr); PHG4Reco *g4Reco = new PHG4Reco(); + + WorldInit(g4Reco); + 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) diff --git a/macros/g4simulations/G4_World.C b/macros/g4simulations/G4_World.C new file mode 100644 index 000000000..ac9026b3e --- /dev/null +++ b/macros/g4simulations/G4_World.C @@ -0,0 +1,33 @@ +#pragma once + +#include "GlobalVariables.C" + +#include + +R__LOAD_LIBRARY(libg4testbench.so) + +namespace G4WORLD +{ + static double AddSpace = 100.; // add this much space in cm around edge of detector + static string WorldMaterial = "G4_Air"; // default world material, use G4_Galactic for material scan + static string PhysicsList = "QGSP_BERT"; // for calorimeters use HP lists +} + +void WorldInit(PHG4Reco *g4Reco) +{ + g4Reco->SetWorldMaterial(G4WORLD::WorldMaterial); + g4Reco->SetPhysicsList(G4WORLD::PhysicsList); +} + + +void WorldSize(PHG4Reco *g4Reco, double radius) +{ + double world_radius = std::max(radius,BlackHoleGeometry::max_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,-((g4Reco->GetWorldSizeZ()-100)/2.)); + double max_zval = std::max(BlackHoleGeometry::max_z,(g4Reco->GetWorldSizeZ()-100)/2.); + double final_zval = std::max(fabs(min_zval),fabs(max_zval))+G4WORLD::AddSpace; // add 1m + g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2*(final_zval))) + return; +} From 7fc8eebf3afcbf1f6c7a91d6cd14b4a2d5dca6d6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 16:50:42 -0400 Subject: [PATCH 0550/1222] clang-format --- macros/g4simulations/G4_World.C | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_World.C b/macros/g4simulations/G4_World.C index ac9026b3e..d03750e6a 100644 --- a/macros/g4simulations/G4_World.C +++ b/macros/g4simulations/G4_World.C @@ -8,10 +8,10 @@ R__LOAD_LIBRARY(libg4testbench.so) namespace G4WORLD { - static double AddSpace = 100.; // add this much space in cm around edge of detector - static string WorldMaterial = "G4_Air"; // default world material, use G4_Galactic for material scan - static string PhysicsList = "QGSP_BERT"; // for calorimeters use HP lists -} + static double AddSpace = 100.; // add this much space in cm around edge of detector + static string WorldMaterial = "G4_Air"; // default world material, use G4_Galactic for material scan + static string PhysicsList = "QGSP_BERT"; // for calorimeters use HP lists +} // namespace G4WORLD void WorldInit(PHG4Reco *g4Reco) { @@ -19,10 +19,9 @@ void WorldInit(PHG4Reco *g4Reco) g4Reco->SetPhysicsList(G4WORLD::PhysicsList); } - void WorldSize(PHG4Reco *g4Reco, double radius) { - double world_radius = std::max(radius,BlackHoleGeometry::max_radius); + double world_radius = std::max(radius, BlackHoleGeometry::max_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,-((g4Reco->GetWorldSizeZ()-100)/2.)); From d442addae8b09cae8f1c07dd5c681d539a78ba40 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 17:23:45 -0400 Subject: [PATCH 0551/1222] fix world material name --- macros/g4simulations/G4_World.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_World.C b/macros/g4simulations/G4_World.C index d03750e6a..de7f21534 100644 --- a/macros/g4simulations/G4_World.C +++ b/macros/g4simulations/G4_World.C @@ -9,7 +9,7 @@ R__LOAD_LIBRARY(libg4testbench.so) namespace G4WORLD { static double AddSpace = 100.; // add this much space in cm around edge of detector - static string WorldMaterial = "G4_Air"; // default world material, use G4_Galactic for material scan + static string WorldMaterial = "G4_AIR"; // default world material, use G4_Galactic for material scan static string PhysicsList = "QGSP_BERT"; // for calorimeters use HP lists } // namespace G4WORLD @@ -22,11 +22,11 @@ void WorldInit(PHG4Reco *g4Reco) void WorldSize(PHG4Reco *g4Reco, double radius) { double world_radius = std::max(radius, BlackHoleGeometry::max_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,-((g4Reco->GetWorldSizeZ()-100)/2.)); - double max_zval = std::max(BlackHoleGeometry::max_z,(g4Reco->GetWorldSizeZ()-100)/2.); - double final_zval = std::max(fabs(min_zval),fabs(max_zval))+G4WORLD::AddSpace; // add 1m - g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2*(final_zval))) + 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, -((g4Reco->GetWorldSizeZ() - 100) / 2.)); + double max_zval = std::max(BlackHoleGeometry::max_z, (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; } From 7540564f29f645fc68c2c06da27190514f2bc3a4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 22:10:46 -0400 Subject: [PATCH 0552/1222] use new Enable::Verbosity --- macros/g4simulations/G4_FEMC.C | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index b6101eaa8..d8e7ad239 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -92,6 +92,7 @@ void FEMC_Cells() void FEMC_Towers() { + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; @@ -110,7 +111,7 @@ void FEMC_Towers() //RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1"); //TowerDigitizer1->Detector("FEMC"); //TowerDigitizer1->TowerType(1); - //TowerDigitizer1->Verbosity(Enable::FEMC_VERBOSITY); + //TowerDigitizer1->Verbosity(verbosity); //TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); //se->registerSubsystem( TowerDigitizer1 ); @@ -118,7 +119,7 @@ void FEMC_Towers() //RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); //TowerDigitizer2->Detector("FEMC"); //TowerDigitizer2->TowerType(2); - //TowerDigitizer2->Verbosity(Enable::FEMC_VERBOSITY); + //TowerDigitizer2->Verbosity(verbosity); //TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); //se->registerSubsystem( TowerDigitizer2 ); @@ -126,28 +127,28 @@ void FEMC_Towers() RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); TowerDigitizer3->Detector("FEMC"); TowerDigitizer3->TowerType(3); - TowerDigitizer3->Verbosity(Enable::FEMC_VERBOSITY); + TowerDigitizer3->Verbosity(verbosity); TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer3); RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); TowerDigitizer4->Detector("FEMC"); TowerDigitizer4->TowerType(4); - TowerDigitizer4->Verbosity(Enable::FEMC_VERBOSITY); + TowerDigitizer4->Verbosity(verbosity); TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer4); RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); TowerDigitizer5->Detector("FEMC"); TowerDigitizer5->TowerType(5); - TowerDigitizer5->Verbosity(Enable::FEMC_VERBOSITY); + TowerDigitizer5->Verbosity(verbosity); TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer5); RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); TowerDigitizer6->Detector("FEMC"); TowerDigitizer6->TowerType(6); - TowerDigitizer6->Verbosity(Enable::FEMC_VERBOSITY); + TowerDigitizer6->Verbosity(verbosity); TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer6); @@ -155,7 +156,7 @@ void FEMC_Towers() //RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); //TowerCalibration1->Detector("FEMC"); //TowerCalibration1->TowerType(1); - //TowerCalibration1->Verbosity(Enable::FEMC_VERBOSITY); + //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); @@ -165,7 +166,7 @@ void FEMC_Towers() //RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); //TowerCalibration2->Detector("FEMC"); //TowerCalibration2->TowerType(2); - //TowerCalibration2->Verbosity(Enable::FEMC_VERBOSITY); + //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); @@ -175,7 +176,7 @@ void FEMC_Towers() RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); TowerCalibration3->Detector("FEMC"); TowerCalibration3->TowerType(3); - TowerCalibration3->Verbosity(Enable::FEMC_VERBOSITY); + TowerCalibration3->Verbosity(verbosity); TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); TowerCalibration3->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration3->set_pedstal_ADC(0); @@ -184,7 +185,7 @@ void FEMC_Towers() RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); TowerCalibration4->Detector("FEMC"); TowerCalibration4->TowerType(4); - TowerCalibration4->Verbosity(Enable::FEMC_VERBOSITY); + TowerCalibration4->Verbosity(verbosity); TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); TowerCalibration4->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration4->set_pedstal_ADC(0); @@ -193,7 +194,7 @@ void FEMC_Towers() RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); TowerCalibration5->Detector("FEMC"); TowerCalibration5->TowerType(5); - TowerCalibration5->Verbosity(Enable::FEMC_VERBOSITY); + TowerCalibration5->Verbosity(verbosity); TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); TowerCalibration5->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration5->set_pedstal_ADC(0); @@ -202,7 +203,7 @@ void FEMC_Towers() RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); TowerCalibration6->Detector("FEMC"); TowerCalibration6->TowerType(6); - TowerCalibration6->Verbosity(Enable::FEMC_VERBOSITY); + TowerCalibration6->Verbosity(verbosity); TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); TowerCalibration6->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 TowerCalibration6->set_pedstal_ADC(0); @@ -211,13 +212,15 @@ void FEMC_Towers() void FEMC_Clusters() { + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(Enable::FEMC_VERBOSITY); + ClusterBuilder->Verbosity(verbosity); ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below std::string femc_prof = getenv("CALIBRATIONROOT"); femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; @@ -229,7 +232,7 @@ void FEMC_Clusters() RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(Enable::FEMC_VERBOSITY); + ClusterBuilder->Verbosity(verbosity); ClusterBuilder->set_threshold_energy(0.010); se->registerSubsystem(ClusterBuilder); } @@ -244,10 +247,11 @@ void FEMC_Clusters() void FEMC_Eval(std::string outputfile) { + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(Enable::FEMC_VERBOSITY); + eval->Verbosity(verbosity); se->registerSubsystem(eval); return; From d93310ad4605203bc723e2e449ef003249cc30d9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 22:51:02 -0400 Subject: [PATCH 0553/1222] cleanup, remove c_str() calls --- macros/g4simulations/G4_GEM_EIC.C | 106 +++++++++++------------------- 1 file changed, 40 insertions(+), 66 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index b780ae479..0da14081f 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -89,20 +89,16 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // etamin = min_eta; zpos = 134.0; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(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(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + 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); + gem->OverlapCheck(Enable::OVERLAPCHECK); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); @@ -123,23 +119,19 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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(etamax)) / 2); + gem->get_geometry().set_normal_polar_angle((PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)) / 2); gem->get_geometry().set_normal_start( zpos * PHG4Sector::Sector_Geometry::Unit_cm(), PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - 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(min_eta)); + 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(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()); + gem->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); + gem->OverlapCheck(Enable::OVERLAPCHECK); g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -152,21 +144,17 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // etamax = 3.5; etamin = min_eta; zpos = 271.0; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(name); 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_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); + gem->OverlapCheck(Enable::OVERLAPCHECK); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); @@ -176,23 +164,19 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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_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_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()); + gem->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); + gem->OverlapCheck(Enable::OVERLAPCHECK); g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -214,7 +198,7 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmi if (zpos < 0) { zpos = -zpos; - polar_angle = TMath::Pi(); + polar_angle = M_PI; } double min_polar_angle = TMath::ATan2(Rmin, zpos); @@ -228,25 +212,22 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmi } PHG4SectorSubsystem *fst; - fst = new PHG4SectorSubsystem(name.c_str()); + fst = new PHG4SectorSubsystem(name); fst->SuperDetector(name); fst->get_geometry().set_normal_polar_angle(polar_angle); - fst->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + fst->get_geometry().set_normal_start(zpos * PHG4Sector::Sector_Geometry::Unit_cm()); fst->get_geometry().set_min_polar_angle(min_polar_angle); fst->get_geometry().set_max_polar_angle(max_polar_angle); - fst->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); fst->get_geometry().set_N_Sector(1); fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(overlapcheck); + fst->OverlapCheck(Enable::OVERLAPCHECK); const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; + const double mm = 0.1 * cm; const double um = 1e-3 * mm; // build up layers fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 18 * um, true, 100); @@ -268,25 +249,23 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) assert(gem); const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; + const double mm = 0.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("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; + ostringstream s; s << "DriftLayer_"; s << d; - gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, - true); + gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, true); } } @@ -312,24 +291,19 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, } PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(name); 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_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); + gem->OverlapCheck(Enable::OVERLAPCHECK); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); From 38c1b5f5d54dcaf6e2ec6c5c520fa2b3599f5c5a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 22:51:40 -0400 Subject: [PATCH 0554/1222] clang-format --- macros/g4simulations/G4_GEM_EIC.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 0da14081f..b8fe650d2 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -22,13 +22,13 @@ namespace Enable { static bool EGEM = false; static bool FGEM = false; -} +} // namespace Enable void EGEM_Init() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); -// extends only to -z - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z,-160. ); + // extends only to -z + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -160.); } void FGEM_Init() From e6794a885d0ad9ac670e517b794016e050e1a8c8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 23:00:19 -0400 Subject: [PATCH 0555/1222] move dstoutput together with dst compress and dstreader setting --- macros/g4simulations/Fun4All_G4_EICDetector.C | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 455ac8dfe..66c99a27a 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -83,8 +83,13 @@ int Fun4All_G4_EICDetector( 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; + // Write the DST const bool do_write_output = false; + // Compress DST files + const bool do_dst_compress = false; + //Option to convert DST to human command readable TTree for quick poke around the outputs + const bool do_DSTReader = false; //====================== // What to run @@ -174,12 +179,6 @@ int Fun4All_G4_EICDetector( // 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 = false; - // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; From 54e47278cca7010454be38df86a78d1f1b876c6a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 23:35:43 -0400 Subject: [PATCH 0556/1222] cleanup, use Enable namespace --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 126 +++++++++--------------- 1 file changed, 47 insertions(+), 79 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 65232e37e..8574770fe 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -1,37 +1,35 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include + +#include "GlobalVariables.C" + #include + #include + #include + #include #include -#include "GlobalVariables.C" + +#include + R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4trackfastsim.so) + int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); -#endif -// $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; +namespace Enable +{ + static bool FGEM = false; +} void FGEM_Init() { - if (BlackHoleGeometry::max_radius < 130) - { - BlackHoleGeometry::max_radius = 130; // eye balled - } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,130.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -56,17 +54,13 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // etamin = min_eta; zpos = 1.2e2; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(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(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); + 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); @@ -80,18 +74,14 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // etamax = 4; etamin = min_eta; zpos = 1.6e2; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(name); 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_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); @@ -104,19 +94,15 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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_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_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()); + gem->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); @@ -129,18 +115,14 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // etamax = 4; etamin = min_eta; zpos = 2.75e2; - gem = new PHG4SectorSubsystem(name.c_str()); + gem = new PHG4SectorSubsystem(name); 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_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); @@ -153,19 +135,15 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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_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_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()); + gem->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); @@ -188,8 +166,7 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) 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("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++) @@ -198,8 +175,7 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) s << "DriftLayer_"; s << d; - gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, - true); + gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, true); } } @@ -230,16 +206,11 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, 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_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); @@ -358,13 +329,10 @@ void FGEM_FastSim_Reco(int verbosity = 0) void FGEM_FastSim_Eval(std::string outputfile, int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4trackfastsim.so"); - Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_filename(outputfile.c_str()); + fast_sim_eval->set_filename(outputfile); se->registerSubsystem(fast_sim_eval); return; From f27f2ebd801fa601147b2833cba335de81cc3133 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 23:36:18 -0400 Subject: [PATCH 0557/1222] clang-format --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 8574770fe..fdfae64a1 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -28,7 +28,7 @@ namespace Enable void FGEM_Init() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,130.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); } @@ -272,7 +272,7 @@ void FGEM_FastSim_Reco(int verbosity = 0) "G4HIT_FGEM_1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, + 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, 0 // const float noise From 6a89c65aa2c1a91cffaf94e211de6eb2181c4979 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 23:37:06 -0400 Subject: [PATCH 0558/1222] move FGEM to new scheme --- macros/g4simulations/G4Setup_fsPHENIX.C | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 5bcc414a7..349f33309 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -12,7 +12,7 @@ #include "G4_FEMC.C" #include "G4_FHCAL.C" #include "G4_User.C" -#include "G4_WorldSize.C" +#include "G4_World.C" #include #include #include @@ -29,7 +29,6 @@ void RunLoadTest() {} void G4Init(bool do_svtx = true, bool do_cemc = true, bool do_pipe = true, - bool do_FGEM = true, int n_TPC_layers = 40) { // load detector/material macros and execute Init() function @@ -65,9 +64,8 @@ void G4Init(bool do_svtx = true, HCalOuterInit(); } - if (do_FGEM) + if (Enable::FGEM) { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); FGEM_Init(); } @@ -108,7 +106,6 @@ int G4Setup(const int absorberactive = 0, const bool do_svtx = true, const bool do_cemc = true, const bool do_pipe = true, - const bool do_FGEM = true, const float magfield_rescale = 1.0) { //--------------- @@ -194,8 +191,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // Forward tracking - if ( do_FGEM ) + if ( Enable::FGEM ) + { FGEMSetup(g4Reco); + } //---------------------------------------- // FEMC From 46e9a52dac97a861f24282508e9d0fe867844fad Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 27 May 2020 23:38:38 -0400 Subject: [PATCH 0559/1222] move FGEM to new scheme --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 4c34ae794..b47c7e570 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -62,6 +62,14 @@ int Fun4All_G4_fsPHENIX( // 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; + + // Write the DST + const bool do_write_output = true; + const bool do_dst_compress = false; + + //Option to convert DST to human command readable TTree for quick poke around the outputs + const bool do_DSTReader = false; + //====================== // What to run //====================== @@ -110,13 +118,13 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry - bool do_FGEM = false; - bool do_FGEM_track = do_FGEM && false; + Enable::FGEM = true; + bool do_FGEM_track = Enable::FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; - Enable::FEMC = true; - Enable::FEMC_ABSORBER = true; - bool do_FEMC_cell = Enable::FEMC && false; + Enable::FEMC = false; + Enable::FEMC_ABSORBER = false; + bool do_FEMC_cell = Enable::FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; @@ -129,15 +137,9 @@ int Fun4All_G4_fsPHENIX( Enable::PLUGDOOR_ABSORBER = true; // new settings using Enable namespace in GlobalVariables.C -// Enable::BLACKHOLE = true; + Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - // Write the DST - const bool do_write_output = true; - const bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = false; //--------------- // Load libraries @@ -151,7 +153,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,do_cemc,do_pipe,do_FGEM,n_TPC_layers); + G4Init(do_tracking,do_cemc,do_pipe,n_TPC_layers); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -255,7 +257,6 @@ int Fun4All_G4_fsPHENIX( G4Setup(absorberactive, magfield, EDecayType::kAll, do_tracking, do_cemc, do_pipe, - do_FGEM, magfield_rescale); } @@ -428,7 +429,7 @@ int Fun4All_G4_fsPHENIX( /*bool*/ do_cemc_twr , /*bool*/ do_hcalin_twr , /*bool*/ do_hcalout_twr, - /*bool*/ do_FGEM, + /*bool*/ Enable::FGEM, /*bool*/ Enable::FHCAL, /*bool*/ do_FHCAL_twr, /*bool*/ Enable::FEMC, From 37f1e2ec8f38a70c3093f5526c18be8fc20b61e8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 10:03:42 -0400 Subject: [PATCH 0560/1222] remove root5 lib loading, use enable for absorberactive --- macros/g4simulations/G4_HcalOut_ref.C | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index fef1dbce5..163d916c6 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -26,6 +26,8 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { static bool HCALOUT = false; + static bool HCALOUT_ABSORBER = false; + static bool HCALOUT_OVERLAPCHECK = false; } namespace G4HCALOUT @@ -58,8 +60,8 @@ double HCalOuter(PHG4Reco *g4Reco, const int absorberactive = 0, int verbosity = 0) { - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); + bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER || absorberactive; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); // hcal->set_double_param("inner_radius", 183.3); @@ -101,11 +103,11 @@ double HCalOuter(PHG4Reco *g4Reco, hcal->SetActive(); hcal->SuperDetector("HCALOUT"); - if (absorberactive) + if (AbsorberActive) { hcal->SetAbsorberActive(); } - hcal->OverlapCheck(overlapcheck); + hcal->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(hcal); radius = hcal->get_double_param("outer_radius"); @@ -117,8 +119,6 @@ double HCalOuter(PHG4Reco *g4Reco, void HCALOuter_Cells(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); @@ -139,8 +139,6 @@ void HCALOuter_Cells(int verbosity = 0) void HCALOuter_Towers(int verbosity = 0) { - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); @@ -153,8 +151,7 @@ void HCALOuter_Towers(int verbosity = 0) 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_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.); @@ -179,8 +176,6 @@ void HCALOuter_Towers(int verbosity = 0) void HCALOuter_Clusters(int verbosity = 0) { - gSystem->Load("libcalo_reco.so"); - Fun4AllServer *se = Fun4AllServer::instance(); if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) @@ -207,13 +202,11 @@ void HCALOuter_Clusters(int verbosity = 0) return; } -void HCALOuter_Eval(std::string outputfile, int verbosity = 0) +void HCALOuter_Eval(const 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()); + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile); eval->Verbosity(verbosity); se->registerSubsystem(eval); From b300a3c2fdeac601baabb360774dfa889914757b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 10:04:15 -0400 Subject: [PATCH 0561/1222] clang-format --- macros/g4simulations/G4_HcalOut_ref.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 163d916c6..270348c2d 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -28,7 +28,7 @@ namespace Enable static bool HCALOUT = false; static bool HCALOUT_ABSORBER = false; static bool HCALOUT_OVERLAPCHECK = false; -} +} // namespace Enable namespace G4HCALOUT { From 604e21261a30113fcfd5fa35a16b35db8e128d64 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 10:14:02 -0400 Subject: [PATCH 0562/1222] remove root5 lib loading, use enable for absorberactive --- macros/g4simulations/G4_Magnet.C | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 531f97fa7..90466dfef 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -11,7 +11,9 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { static bool MAGNET = false; -} + static bool MAGNET_ABSORBER = false; + static bool MAGNET_OVERLAPCHECK = false; +} // namespace Enable namespace G4MAGNET { @@ -33,6 +35,9 @@ double Magnet(PHG4Reco* g4Reco, const int absorberactive = 0, int verbosity = 0) { + bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER || absorberactive; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MAGNET_OVERLAPCHECK; + double magnet_inner_cryostat_wall_radius = 142; double magnet_inner_cryostat_wall_thickness = 1; double magnet_coil_radius = 150.8; @@ -54,7 +59,8 @@ double Magnet(PHG4Reco* g4Reco, 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(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("MAGNET", 1); @@ -64,7 +70,8 @@ double Magnet(PHG4Reco* g4Reco, 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(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("MAGNET", 2); @@ -74,7 +81,8 @@ double Magnet(PHG4Reco* g4Reco, 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(); + 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 From 91c814c39fc7ac8aacb1fbcfde52f32252320dfa Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 10:38:04 -0400 Subject: [PATCH 0563/1222] Add absorberactive, verbosity and overlapcheck to enable namespace --- macros/g4simulations/G4_HcalIn_ref.C | 37 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 6b49d2b43..6db80d19f 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -31,7 +31,10 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, namespace Enable { static bool HCALIN = false; -} + static bool HCALIN_ABSORBER = false; + static bool HCALIN_OVERLAPCHECK = false; + static int HCALIN_VERBOSITY = 0; +} // namespace Enable namespace G4HCALIN { @@ -74,11 +77,13 @@ void HCalInnerInit(const int iflag = 0) double HCalInner(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0) { - // all sizes are in cm! + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER || absorberactive; + 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"); @@ -134,11 +139,11 @@ double HCalInner(PHG4Reco *g4Reco, hcal->SetActive(); hcal->SuperDetector("HCALIN"); - if (absorberactive) + if (AbsorberActive) { hcal->SetAbsorberActive(); } - hcal->OverlapCheck(overlapcheck); + hcal->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(hcal); @@ -154,6 +159,8 @@ double HCalInner(PHG4Reco *g4Reco, void HCalInner_SupportRing(PHG4Reco *g4Reco, const int absorberactive = 0) { + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER || absorberactive; + const double z_ring1 = (2025 + 2050) / 2. / 10.; const double innerradius_sphenix = 116.; const double innerradius_ephenix_hadronside = 138.; @@ -177,7 +184,7 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, 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) + if (AbsorberActive) { cyl->SetActive(); } @@ -187,8 +194,10 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, return; } -void HCALInner_Cells(int verbosity = 0) +void HCALInner_Cells() { + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); @@ -207,8 +216,9 @@ void HCALInner_Cells(int verbosity = 0) return; } -void HCALInner_Towers(int verbosity = 0) +void HCALInner_Towers() { + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); @@ -247,8 +257,10 @@ void HCALInner_Towers(int verbosity = 0) return; } -void HCALInner_Clusters(int verbosity = 0) +void HCALInner_Clusters() { + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) @@ -274,11 +286,12 @@ void HCALInner_Clusters(int verbosity = 0) return; } -void HCALInner_Eval(std::string outputfile, int verbosity = 0) +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.c_str()); + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile); eval->Verbosity(verbosity); se->registerSubsystem(eval); From 885dd18543d919d8650c2fc4f89fdd27aca3634d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 14:14:51 -0400 Subject: [PATCH 0564/1222] add Enable and G4CEMC namespace --- macros/g4simulations/G4_CEmc_Spacal.C | 77 ++++++++++++++++----------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 95a643879..858fd5ff3 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -1,20 +1,27 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" -#include -#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, const int absorberactive = 0); double @@ -24,7 +31,17 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) -#endif + +namespace Enable +{ + static bool CEMC = false; + static bool CEMC_ABSORBER = false; + static bool CEMC_OVERLAPCHECK = false; + static int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ int Min_cemc_layer = 1; int Max_cemc_layer = 1; @@ -46,13 +63,11 @@ enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; //! graph clusterizer, RawClusterBuilderGraph //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; -#include +} // just a dummy parameter used by the tilted plate geom -void CEmcInit(const int nslats = 1) +void CEmcInit() { - Min_cemc_layer = 1; - Max_cemc_layer = 1; } //! EMCal main setup macro @@ -60,12 +75,12 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + if (G4CEMC::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) + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) { return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings, /*const int*/ absorberactive); @@ -74,7 +89,7 @@ CEmc(PHG4Reco *g4Reco, double radius, const int crossings, { std::cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; exit(-1); return 0; } @@ -123,7 +138,7 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co radius += 1.5; radius += no_overlapp; - int ilayer = Min_cemc_layer; + int ilayer = G4CEMC::Min_cemc_layer; PHG4SpacalSubsystem *cemc; cemc = new PHG4SpacalSubsystem("CEMC", ilayer); cemc->set_double_param("radius",emc_inner_radius); @@ -136,10 +151,10 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co g4Reco->registerSubsystem(cemc); - if (ilayer > Max_cemc_layer) + if (ilayer > G4CEMC::Max_cemc_layer) { cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; } radius += cemcthickness; @@ -267,10 +282,10 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, g4Reco->registerSubsystem(cemc); - if (ilayer > Max_cemc_layer) + if (ilayer > G4CEMC::Max_cemc_layer) { cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; } radius += cemcthickness; @@ -285,12 +300,12 @@ void CEMC_Cells(int verbosity = 0) gSystem->Load("libg4detectors.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + 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 = Min_cemc_layer; i <= Max_cemc_layer; i++) + 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; @@ -299,7 +314,7 @@ void CEMC_Cells(int verbosity = 0) } se->registerSubsystem(cemc_cells); } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) { PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); cemc_cells->Detector("CEMC"); @@ -313,7 +328,7 @@ void CEMC_Cells(int verbosity = 0) { std::cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; exit(-1); return; } @@ -334,11 +349,11 @@ void CEMC_Towers(int verbosity = 0) se->registerSubsystem(TowerBuilder); double sampling_fraction = 1; - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + 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 (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + 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 @@ -349,7 +364,7 @@ void CEMC_Towers(int verbosity = 0) { std::cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; exit(-1); return; } @@ -367,7 +382,7 @@ void CEMC_Towers(int verbosity = 0) TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting se->registerSubsystem(TowerDigitizer); - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) { RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); TowerCalibration->Detector("CEMC"); @@ -377,7 +392,7 @@ void CEMC_Towers(int verbosity = 0) TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) { RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); TowerCalibration->Detector("CEMC"); @@ -393,7 +408,7 @@ void CEMC_Towers(int verbosity = 0) { std::cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; exit(-1); return; } @@ -406,7 +421,7 @@ void CEMC_Clusters(int verbosity = 0) gSystem->Load("libcalo_reco.so"); Fun4AllServer *se = Fun4AllServer::instance(); - if (Cemc_clusterizer == kCemcTemplateClusterizer) + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); ClusterBuilder->Detector("CEMC"); @@ -417,7 +432,7 @@ void CEMC_Clusters(int verbosity = 0) ClusterBuilder->LoadProfile(femc_prof.c_str()); se->registerSubsystem(ClusterBuilder); } - else if (Cemc_clusterizer == kCemcGraphClusterizer) + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) { RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); ClusterBuilder->Detector("CEMC"); From 13c2e404b33e736fd9d7d554c45c8b4e2bd2fba3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 14:15:19 -0400 Subject: [PATCH 0565/1222] Add Enable::HCALOUT_VERBOSITY --- macros/g4simulations/G4_HcalOut_ref.C | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 270348c2d..797c4679f 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -28,6 +28,7 @@ namespace Enable static bool HCALOUT = false; static bool HCALOUT_ABSORBER = false; static bool HCALOUT_OVERLAPCHECK = false; + static int HCALOUT_VERBOSITY = 0; } // namespace Enable namespace G4HCALOUT @@ -57,11 +58,11 @@ void HCalOuterInit() double HCalOuter(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0) { bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER || absorberactive; 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); @@ -117,8 +118,10 @@ double HCalOuter(PHG4Reco *g4Reco, return radius; } -void HCALOuter_Cells(int verbosity = 0) +void HCALOuter_Cells() { + int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); @@ -137,8 +140,10 @@ void HCALOuter_Cells(int verbosity = 0) return; } -void HCALOuter_Towers(int verbosity = 0) +void HCALOuter_Towers() { + int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); @@ -174,8 +179,10 @@ void HCALOuter_Towers(int verbosity = 0) return; } -void HCALOuter_Clusters(int verbosity = 0) +void HCALOuter_Clusters() { + int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) @@ -202,8 +209,10 @@ void HCALOuter_Clusters(int verbosity = 0) return; } -void HCALOuter_Eval(const std::string &outputfile, int verbosity = 0) +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); From f61eeb3717d6add3ee134e8ac955cc9f3bf71970 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 14:16:25 -0400 Subject: [PATCH 0566/1222] change CEMC to new scheme --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 28 +++++++++++----------- macros/g4simulations/G4Setup_fsPHENIX.C | 16 +++++-------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index b47c7e570..6aef954bb 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -87,22 +87,22 @@ int Fun4All_G4_fsPHENIX( bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - bool do_cemc = false; - bool do_cemc_cell = do_cemc && false; + Enable::CEMC = true; + bool do_cemc_cell = Enable::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_cemc_eval = do_cemc_cluster && true; Enable::HCALIN = false; - bool do_hcalin_cell = Enable::HCALIN && false; + bool do_hcalin_cell = Enable::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_hcalin_eval = do_hcalin_cluster && true; Enable::MAGNET = false; Enable::HCALOUT = false; - bool do_hcalout_cell = Enable::HCALOUT && false; + bool do_hcalout_cell = Enable::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; @@ -118,7 +118,7 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry - Enable::FGEM = true; + Enable::FGEM = false; bool do_FGEM_track = Enable::FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; @@ -137,7 +137,7 @@ int Fun4All_G4_fsPHENIX( Enable::PLUGDOOR_ABSORBER = true; // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; +// Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; @@ -153,7 +153,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,do_cemc,do_pipe,n_TPC_layers); + G4Init(do_tracking,do_pipe,n_TPC_layers); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -239,11 +239,11 @@ int Fun4All_G4_fsPHENIX( } 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); //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(-1.0*M_PI, 1.0*M_PI); //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); - gen->set_p_range(30.0, 30.0); + gen->set_p_range(10.0, 10.0); gen->Embed(1); gen->Verbosity(0); se->registerSubsystem(gen); @@ -256,7 +256,7 @@ int Fun4All_G4_fsPHENIX( //--------------------- G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_cemc, do_pipe, + do_tracking, do_pipe, magfield_rescale); } @@ -422,7 +422,7 @@ int Fun4All_G4_fsPHENIX( G4DSTreader_fsPHENIX( outputFile, // /*int*/ absorberactive , /*bool*/ do_tracking , - /*bool*/ do_cemc , + /*bool*/ Enable::CEMC , /*bool*/ Enable::HCALIN, /*bool*/ Enable::MAGNET, /*bool*/ Enable::HCALOUT, diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 349f33309..72d37a7c4 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -27,7 +27,6 @@ int make_piston(string name, PHG4Reco* g4Reco); void RunLoadTest() {} void G4Init(bool do_svtx = true, - bool do_cemc = true, bool do_pipe = true, int n_TPC_layers = 40) { @@ -44,10 +43,9 @@ void G4Init(bool do_svtx = true, TrackingInit(n_TPC_layers); } - if (do_cemc) + if (Enable::CEMC) { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations + CEmcInit(); } if (Enable::HCALIN) @@ -98,13 +96,8 @@ void G4Init(bool do_svtx = true, int G4Setup(const int absorberactive = 0, const string &field ="1.5", -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) const EDecayType decayType = EDecayType::kAll, -#else - const EDecayType decayType = TPythia6Decayer::kAll, -#endif const bool do_svtx = true, - const bool do_cemc = true, const bool do_pipe = true, const float magfield_rescale = 1.0) { @@ -161,7 +154,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // CEMC // - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); + if (Enable::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 //---------------------------------------- From 56f4f31260b2a618ccd8b30ef9d3d6af4740d029 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 17:10:08 -0400 Subject: [PATCH 0567/1222] add black hole perimeters --- macros/g4simulations/G4_CEmc_Spacal.C | 97 ++++++++++++++------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 858fd5ff3..b3140e93b 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -27,6 +28,7 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co double CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0); + R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) @@ -68,6 +70,8 @@ enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; // just a dummy parameter used by the tilted plate geom void CEmcInit() { +// BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 150.); +// BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -150.); } //! EMCal main setup macro @@ -75,6 +79,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) { return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ @@ -99,6 +104,9 @@ CEmc(PHG4Reco *g4Reco, double radius, const int crossings, double CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER || absorberactive; + 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 @@ -111,13 +119,6 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co gSystem->Exit(-1); } - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - // boundary check if (radius > emc_inner_radius - 1.5 - no_overlapp) { @@ -132,22 +133,21 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co cyl->set_double_param("radius", radius); cyl->set_string_param("material", "G4_TEFLON"); cyl->set_double_param("thickness", 1.5); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); radius += 1.5; radius += no_overlapp; int ilayer = G4CEMC::Min_cemc_layer; - PHG4SpacalSubsystem *cemc; - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + 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); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cemc); @@ -166,11 +166,14 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co 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(); + 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; @@ -181,6 +184,9 @@ double CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER || absorberactive; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + double emc_inner_radius = 92; // emc inner radius from engineering drawing double cemcthickness = 24.00000 - no_overlapp; @@ -195,12 +201,6 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, gSystem->Exit(-1); } - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - // the radii are only to determined the thickness of the cemc radius = emc_inner_radius; @@ -214,8 +214,8 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, 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(); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); radius += 1.5; @@ -227,16 +227,18 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, 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(); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); - cemcthickness -= 0.5 + no_overlapp; +// 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); - //--------------- - // Load libraries - //--------------- + cemcthickness -= 0.5 + no_overlapp; int ilayer = 0; PHG4SpacalSubsystem *cemc; @@ -254,9 +256,8 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, cemc->SetActive(); cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); } else @@ -275,9 +276,8 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, cemc->SetActive(); cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); } g4Reco->registerSubsystem(cemc); @@ -294,10 +294,10 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, return radius; } -void CEMC_Cells(int verbosity = 0) +void CEMC_Cells() { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) @@ -336,10 +336,10 @@ void CEMC_Cells(int verbosity = 0) return; } -void CEMC_Towers(int verbosity = 0) +void CEMC_Towers() { - gSystem->Load("libg4calo.so"); - gSystem->Load("libcalo_reco.so"); + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); @@ -416,9 +416,10 @@ void CEMC_Towers(int verbosity = 0) return; } -void CEMC_Clusters(int verbosity = 0) +void CEMC_Clusters() { - gSystem->Load("libcalo_reco.so"); + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) @@ -461,13 +462,13 @@ void CEMC_Clusters(int verbosity = 0) return; } -void CEMC_Eval(std::string outputfile, int verbosity = 0) +void CEMC_Eval(const std::string &outputfile) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); - CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile.c_str()); + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); eval->Verbosity(verbosity); se->registerSubsystem(eval); From 75f959eeaff2544a39c10af32ca84c1d89173a89 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 17:16:36 -0400 Subject: [PATCH 0568/1222] clang-format --- macros/g4simulations/G4_CEmc_Spacal.C | 121 ++++++++++++-------------- 1 file changed, 56 insertions(+), 65 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index b3140e93b..bb4496804 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -16,10 +16,10 @@ #include #include -#include -#include #include +#include #include +#include #include @@ -44,34 +44,34 @@ namespace Enable namespace G4CEMC { -int Min_cemc_layer = 1; -int Max_cemc_layer = 1; + 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; + // 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, + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, - kCemcTemplateClusterizer -}; + kCemcTemplateClusterizer + }; -//! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky -enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; -//! graph clusterizer, RawClusterBuilderGraph -//enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + //! 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 // just a dummy parameter used by the tilted plate geom void CEmcInit() { -// BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 150.); -// BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -150.); + // BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 150.); + // BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -150.); } //! EMCal main setup macro @@ -79,7 +79,6 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) { - if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) { return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ @@ -141,8 +140,8 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co 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->set_double_param("radius", emc_inner_radius); + cemc->set_double_param("thickness", cemcthickness); cemc->SetActive(); cemc->SuperDetector("CEMC"); @@ -169,11 +168,11 @@ CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, co 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 + // 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); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); radius += no_overlapp; return radius; @@ -204,10 +203,6 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, // 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); @@ -231,12 +226,12 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, 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); + // 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); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); cemcthickness -= 0.5 + no_overlapp; @@ -310,7 +305,6 @@ void CEMC_Cells() // 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); - } se->registerSubsystem(cemc_cells); } @@ -326,10 +320,9 @@ void CEMC_Cells() } else { - std::cout - << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); return; } @@ -356,9 +349,9 @@ void CEMC_Towers() 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 + // 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 { @@ -398,18 +391,17 @@ void CEMC_Towers() 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->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 #" - << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); + cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); return; } @@ -427,10 +419,10 @@ void CEMC_Clusters() 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 femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); + 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) @@ -442,21 +434,20 @@ void CEMC_Clusters() } else { - cout <<"CEMC_Clusters - unknown clusterizer setting!"<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->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); From 10b24692f971ca48c5614727f29b473fd29f6196 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 20:28:36 -0400 Subject: [PATCH 0569/1222] remove commented out blakc hole geo in init function --- macros/g4simulations/G4_CEmc_Spacal.C | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index bb4496804..58c02314e 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -67,12 +67,9 @@ namespace G4CEMC } // namespace G4CEMC -// just a dummy parameter used by the tilted plate geom +// black hole parameters are set in CEmc function void CEmcInit() -{ - // BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 150.); - // BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -150.); -} +{} //! EMCal main setup macro double From f8d268b5297c27ed8514f7088218e7a4cc5e0982 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 20:31:59 -0400 Subject: [PATCH 0570/1222] Add comment about black hole setting --- macros/g4simulations/G4_CEmc_EIC.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index 0c5f916b8..e848adc7a 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -66,6 +66,7 @@ namespace G4CEMC // enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; } // namespace G4CEMC +// Black hole and size parameters set in CEmc function void CEmcInit(const int nslats = 1) { } From fd7ecfb4dda150fe7d8f28f1294b3fb080c13d25 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:39:13 -0400 Subject: [PATCH 0571/1222] add Enable namespace --- macros/g4simulations/G4_Pipe.C | 85 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index bd4502910..d6d2f8000 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -1,10 +1,31 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) + #include "GlobalVariables.C" + #include + #include + R__LOAD_LIBRARY(libg4detectors.so) -#endif + +namespace Enable +{ + static bool PIPE = false; + static bool PIPE_ABSORBER = false; + static bool PIPE_OVERLAPCHECK = false; + static int PIPE_VERBOSITY = 0; +} + +namespace G4PIPE +{ + static double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet + static double be_pipe_thickness = 0.0760; // 760 um based on spec sheet + static double be_pipe_length = 80.0; // +/- 40 cm + + static double al_pipe_radius = 2.0005; // same as Be pipe + static double al_pipe_thickness = 0.1600; // 1.6 mm based on spec + static double al_pipe_length = 88.3; // extension beyond +/- 40 cm +} // namespace G4PIPE void PipeInit() {} @@ -13,17 +34,9 @@ double Pipe(PHG4Reco* g4Reco, 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) { + if (radius > G4PIPE::be_pipe_radius) { cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << be_pipe_radius << endl; + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; gSystem->Exit(-1); } @@ -34,78 +47,78 @@ double Pipe(PHG4Reco* g4Reco, 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_double_param("length",G4PIPE::be_pipe_length); cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",be_pipe_radius); + cyl->set_double_param("thickness",G4PIPE::be_pipe_radius); cyl->SuperDetector("PIPE"); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius",be_pipe_radius); + cyl->set_double_param("radius",G4PIPE::be_pipe_radius); cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",be_pipe_length); + cyl->set_double_param("length",G4PIPE::be_pipe_length); cyl->set_string_param("material","G4_Be"); - cyl->set_double_param("thickness",be_pipe_thickness); + cyl->set_double_param("thickness",G4PIPE::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("place_z",0.5*G4PIPE::be_pipe_length+0.5*G4PIPE::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_double_param("length",G4PIPE::al_pipe_length); cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); + cyl->set_double_param("thickness",G4PIPE::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_double_param("place_z",0.5*G4PIPE::be_pipe_length+0.5*G4PIPE::al_pipe_length+no_overlapp); + cyl->set_double_param("radius",G4PIPE::al_pipe_radius); cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); + cyl->set_double_param("length",G4PIPE::al_pipe_length); cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); + cyl->set_double_param("thickness",G4PIPE::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("place_z",-0.5*G4PIPE::be_pipe_length-0.5*G4PIPE::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_double_param("length",G4PIPE::al_pipe_length); cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); + cyl->set_double_param("thickness",G4PIPE::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_double_param("place_z",-0.5*G4PIPE::be_pipe_length-0.5*G4PIPE::al_pipe_length-no_overlapp); + cyl->set_double_param("radius",G4PIPE::al_pipe_radius); cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); + cyl->set_double_param("length",G4PIPE::al_pipe_length); cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); + cyl->set_double_param("thickness",G4PIPE::al_pipe_thickness); cyl->SuperDetector("PIPE"); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem( cyl ); - radius = be_pipe_radius + be_pipe_thickness; + radius = G4PIPE::al_pipe_radius + G4PIPE::al_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 << " 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; } From 767781c522203acb1d79a51021065ff5b9c031bb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:49:38 -0400 Subject: [PATCH 0572/1222] add black hole params --- macros/g4simulations/G4_Pipe.C | 37 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index d6d2f8000..03cd0f15d 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -27,22 +27,29 @@ namespace G4PIPE static double al_pipe_length = 88.3; // extension beyond +/- 40 cm } // namespace G4PIPE -void PipeInit() {} +void PipeInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length/2.+G4PIPE::al_pipe_length); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length/2.+G4PIPE::al_pipe_length)); +} double Pipe(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { + const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER || absorberactive; +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); } - - 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); @@ -51,7 +58,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Galactic"); cyl->set_double_param("thickness",G4PIPE::be_pipe_radius); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); @@ -61,7 +69,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Be"); cyl->set_double_param("thickness",G4PIPE::be_pipe_thickness); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); // north aluminum pipe @@ -73,7 +82,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Galactic"); cyl->set_double_param("thickness",G4PIPE::al_pipe_radius); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3); @@ -84,7 +94,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Al"); cyl->set_double_param("thickness",G4PIPE::al_pipe_thickness); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); // south aluminum pipe @@ -96,7 +107,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Galactic"); cyl->set_double_param("thickness",G4PIPE::al_pipe_radius); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5); @@ -107,7 +119,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material","G4_Al"); cyl->set_double_param("thickness",G4PIPE::al_pipe_thickness); cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem( cyl ); radius = G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness; From 6287dce90b339930cee81e825ab8bb4461725481 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:49:56 -0400 Subject: [PATCH 0573/1222] use G4PIPE for namespace name --- macros/g4simulations/G4_Pipe_EIC.C | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 6afe1896a..63d0be497 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -17,23 +17,23 @@ namespace Enable static bool PIPE = false; } -namespace PIPE +namespace G4PIPE { // Central pipe dimension // Extracted via mechanical model: Detector chamber 3-20-20 // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - static const double be_pipe_radius = 3.1000; - static const double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - static const double be_pipe_length_plus = 66.8; // +z beam pipe extend. - static const double be_pipe_length_neg = -79.8; // -z beam pipe extend. -} // namespace PIPE + static double be_pipe_radius = 3.1000; + static double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX + static double be_pipe_length_plus = 66.8; // +z beam pipe extend. + static double be_pipe_length_neg = -79.8; // -z beam pipe extend. +} // namespace G4PIPE void PipeInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PIPE::be_pipe_radius + PIPE::be_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, PIPE::be_pipe_length_plus); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, PIPE::be_pipe_length_neg); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); } //! construct beam pipe @@ -48,13 +48,13 @@ double Pipe(PHG4Reco* g4Reco, const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; - static const double be_pipe_length = PIPE::be_pipe_length_plus - PIPE::be_pipe_length_neg; // pipe length - static const double be_pipe_center = 0.5 * (PIPE::be_pipe_length_plus + PIPE::be_pipe_length_neg); + static const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length + static const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); - if (radius > PIPE::be_pipe_radius) + if (radius > G4PIPE::be_pipe_radius) { cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << PIPE::be_pipe_radius << endl; + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; gSystem->Exit(-1); } @@ -65,25 +65,25 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", PIPE::be_pipe_radius); + cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", PIPE::be_pipe_radius); + cyl->set_double_param("radius", G4PIPE::be_pipe_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", be_pipe_length); cyl->set_double_param("place_z", be_pipe_center); cyl->set_string_param("material", "G4_Be"); - cyl->set_double_param("thickness", PIPE::be_pipe_thickness); + cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); cyl->SuperDetector("PIPE"); cyl->OverlapCheck(overlapcheck); if (absorberactive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); - radius = PIPE::be_pipe_radius + PIPE::be_pipe_thickness; + radius = G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness; radius += no_overlapp; From b6560d0f06242acdf0101939823c0675d689ca83 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:50:39 -0400 Subject: [PATCH 0574/1222] Add pipe via Enable namespace --- macros/g4simulations/G4Setup_fsPHENIX.C | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 72d37a7c4..cc9388b45 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -13,6 +13,7 @@ #include "G4_FHCAL.C" #include "G4_User.C" #include "G4_World.C" + #include #include #include @@ -27,14 +28,12 @@ int make_piston(string name, PHG4Reco* g4Reco); void RunLoadTest() {} void G4Init(bool do_svtx = true, - bool do_pipe = true, int n_TPC_layers = 40) { // load detector/material macros and execute Init() function - if (do_pipe) + if (Enable::PIPE) { - gROOT->LoadMacro("G4_Pipe.C"); PipeInit(); } if (do_svtx) @@ -98,7 +97,6 @@ int G4Setup(const int absorberactive = 0, const string &field ="1.5", const EDecayType decayType = EDecayType::kAll, const bool do_svtx = true, - const bool do_pipe = true, const float magfield_rescale = 1.0) { //--------------- @@ -145,8 +143,10 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - + if (Enable::PIPE) + { + radius = Pipe(g4Reco, radius, absorberactive); + } //---------------------------------------- // SVTX if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); @@ -158,7 +158,6 @@ int G4Setup(const int absorberactive = 0, { 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 From 6a5f8a3b13c3f0add92e0108f17c3468219746f0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:51:21 -0400 Subject: [PATCH 0575/1222] Add pipe via Enable namespace --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 6aef954bb..3d1194509 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -77,8 +77,8 @@ int Fun4All_G4_fsPHENIX( bool do_bbc = false; - bool do_pipe = false; - + Enable::PIPE = true; +// Enable::PIPE_OVERLAPCHECK = true; // central tracking bool do_tracking = false; bool do_tracking_cell = do_tracking && true; @@ -87,7 +87,7 @@ int Fun4All_G4_fsPHENIX( bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = true; + Enable::CEMC = false; bool do_cemc_cell = Enable::CEMC && true; bool do_cemc_twr = do_cemc_cell && true; bool do_cemc_cluster = do_cemc_twr && true; @@ -137,7 +137,7 @@ int Fun4All_G4_fsPHENIX( Enable::PLUGDOOR_ABSORBER = true; // new settings using Enable namespace in GlobalVariables.C -// Enable::BLACKHOLE = true; + // Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; @@ -153,7 +153,7 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,do_pipe,n_TPC_layers); + G4Init(do_tracking,n_TPC_layers); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -256,7 +256,7 @@ int Fun4All_G4_fsPHENIX( //--------------------- G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pipe, + do_tracking, magfield_rescale); } From bcef4ef2df523eb4461761294acda01bc7a9e2b4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:58:24 -0400 Subject: [PATCH 0576/1222] Add world init --- macros/g4simulations/G4Setup_fsPHENIX.C | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index cc9388b45..93637a2f6 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -1,4 +1,5 @@ #pragma once + #include "GlobalVariables.C" #include "G4_BlackHole.C" #include "G4_Pipe.C" @@ -21,8 +22,10 @@ #include #include class SubsysReco; + R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) + int make_piston(string name, PHG4Reco* g4Reco); void RunLoadTest() {} @@ -111,15 +114,9 @@ int G4Setup(const int absorberactive = 0, PHG4Reco* g4Reco = new PHG4Reco(); g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST + WorldInit(g4Reco); 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 ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) if (decayType != EDecayType::kAll) -#else - if (decayType != TPythia6Decayer::kAll) -#endif { g4Reco->set_force_decay(decayType); } @@ -242,9 +239,6 @@ int G4Setup(const int absorberactive = 0, void ShowerCompress(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); @@ -421,4 +415,3 @@ make_piston(string name, PHG4Reco* g4Reco) return 0; } - From 61f9a33d4e098a0f651a751aee02a69e1a0d6d40 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 21:59:11 -0400 Subject: [PATCH 0577/1222] clang-format --- macros/g4simulations/G4_Pipe.C | 144 ++++++++++++++++----------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index 03cd0f15d..524a86ed8 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -14,118 +14,118 @@ namespace Enable static bool PIPE_ABSORBER = false; static bool PIPE_OVERLAPCHECK = false; static int PIPE_VERBOSITY = 0; -} +} // namespace Enable namespace G4PIPE { - static double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet - static double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - static double be_pipe_length = 80.0; // +/- 40 cm + static double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet + static double be_pipe_thickness = 0.0760; // 760 um based on spec sheet + static double be_pipe_length = 80.0; // +/- 40 cm - static double al_pipe_radius = 2.0005; // same as Be pipe - static double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - static double al_pipe_length = 88.3; // extension beyond +/- 40 cm + static double al_pipe_radius = 2.0005; // same as Be pipe + static double al_pipe_thickness = 0.1600; // 1.6 mm based on spec + static double al_pipe_length = 88.3; // extension beyond +/- 40 cm } // namespace G4PIPE -void PipeInit() +void PipeInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length/2.+G4PIPE::al_pipe_length); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length/2.+G4PIPE::al_pipe_length)); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length)); } double Pipe(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0) + double radius, + const int absorberactive = 0) { - bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER || absorberactive; -bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; + 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; + + if (radius > G4PIPE::be_pipe_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; gSystem->Exit(-1); } - // 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",G4PIPE::be_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",G4PIPE::be_pipe_radius); + 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", 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(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); - + g4Reco->registerSubsystem(cyl); + cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius",G4PIPE::be_pipe_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->set_double_param("radius", G4PIPE::be_pipe_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(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); + g4Reco->registerSubsystem(cyl); // north aluminum pipe cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); - cyl->set_double_param("place_z",0.5*G4PIPE::be_pipe_length+0.5*G4PIPE::al_pipe_length+no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",G4PIPE::al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",G4PIPE::al_pipe_radius); + cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); cyl->SuperDetector("PIPE"); - if (AbsorberActive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); + g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3); - cyl->set_double_param("place_z",0.5*G4PIPE::be_pipe_length+0.5*G4PIPE::al_pipe_length+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_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",G4PIPE::al_pipe_thickness); + cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + 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_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); cyl->SuperDetector("PIPE"); - if (AbsorberActive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); + g4Reco->registerSubsystem(cyl); // south aluminum pipe cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); - cyl->set_double_param("place_z",-0.5*G4PIPE::be_pipe_length-0.5*G4PIPE::al_pipe_length-no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",G4PIPE::al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",G4PIPE::al_pipe_radius); + cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); cyl->SuperDetector("PIPE"); - if (AbsorberActive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); + g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5); - cyl->set_double_param("place_z",-0.5*G4PIPE::be_pipe_length-0.5*G4PIPE::al_pipe_length-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_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",G4PIPE::al_pipe_thickness); + cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - 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_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); cyl->SuperDetector("PIPE"); - if (AbsorberActive) cyl->SetActive(); + if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem( cyl ); - + g4Reco->registerSubsystem(cyl); + radius = G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness; - - if (verbosity > 0) { + + if (verbosity > 0) + { cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl; cout << " PIPE Material Description:" << endl; cout << " inner radius = " << G4PIPE::be_pipe_radius << " cm" << endl; @@ -136,6 +136,6 @@ bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; } radius += no_overlapp; - - return radius; + + return radius; } From d3f75d62d34a617de32546dcb3642de87cda54e1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 28 May 2020 22:27:56 -0400 Subject: [PATCH 0578/1222] initial version --- macros/g4simulations/G4_Piston.C | 124 +++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 macros/g4simulations/G4_Piston.C diff --git a/macros/g4simulations/G4_Piston.C b/macros/g4simulations/G4_Piston.C new file mode 100644 index 000000000..d0318373a --- /dev/null +++ b/macros/g4simulations/G4_Piston.C @@ -0,0 +1,124 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Pipe.C" + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + static bool PISTON = false; + static bool PISTON_ABSORBER = false; + static bool PISTON_OVERLAPCHECK = false; + static int PISTON_VERBOSITY = 0; +} // namespace Enable + +namespace G4PISTON +{ +} // namespace G4PIPE + +void PistonInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 50.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,305. - 20. ); +} + +void Piston(PHG4Reco* g4Reco, + const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::PISTON_ABSORBER || absorberactive; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PISTON_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PISTON_VERBOSITY); + + string name = "magpiston"; + const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::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 = G4PIPE::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, 1); +// magpiston->SetZlength((zpos1 - zpos0) / 2); +// magpiston->SetPlaceZ(pos); +// magpiston->Set_eta_range(eta_outter, eta_inner); +// magpiston->SetMaterial("G4_Fe"); +// magpiston->SuperDetector(name); +// 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); + if (AbsorberActive) magpiston->SetActive(); + 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_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); + if (AbsorberActive) magpiston2->SetActive(); + magpiston2->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(magpiston2); + + return; +} From d5d1d91622242852376d351f70a25ce500509492 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 10:59:48 -0400 Subject: [PATCH 0579/1222] apply black hole geometry --- macros/g4simulations/G4_Piston.C | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4_Piston.C b/macros/g4simulations/G4_Piston.C index d0318373a..2d8cd5fbc 100644 --- a/macros/g4simulations/G4_Piston.C +++ b/macros/g4simulations/G4_Piston.C @@ -21,12 +21,15 @@ namespace Enable namespace G4PISTON { -} // namespace G4PIPE + static double zpos1 = 305. - 20.; // front of forward ECal/MPC + static double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap + static double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that +} // namespace G4PISTON void PistonInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 50.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,305. - 20. ); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter/2.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,((G4PISTON::zpos2 + G4PISTON::zpos1) / 2.+(G4PISTON::zpos2 - G4PISTON::zpos1)/2.) ); } void Piston(PHG4Reco* g4Reco, @@ -38,9 +41,6 @@ void Piston(PHG4Reco* g4Reco, string name = "magpiston"; const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::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 = G4PIPE::be_pipe_radius; @@ -50,23 +50,23 @@ void Piston(PHG4Reco* g4Reco, 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; + double pos = zpos0 + (G4PISTON::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->SetZlength((G4PISTON::zpos1 - zpos0) / 2); + magpiston->SetPlaceZ((G4PISTON::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); + tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * G4PISTON::zpos1); magpiston->SetMaterial("G4_Fe"); magpiston->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(magpiston); // PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); -// magpiston->SetZlength((zpos1 - zpos0) / 2); +// magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); // magpiston->SetPlaceZ(pos); // magpiston->Set_eta_range(eta_outter, eta_inner); // magpiston->SetMaterial("G4_Fe"); @@ -105,15 +105,15 @@ void Piston(PHG4Reco* g4Reco, if (AbsorberActive) magpiston->SetActive(); magpiston->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(magpiston); - pos += ((zpos1 - zpos0 - 10) / number_of_wteeth); + pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); } // last piece connect to the field return PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_double_param("length",zpos2 - zpos1); - magpiston2->set_double_param("place_z", (zpos2 + zpos1) / 2.); + magpiston2->set_double_param("length",G4PISTON::zpos2 - G4PISTON::zpos1); + magpiston2->set_double_param("place_z", (G4PISTON::zpos2 + G4PISTON::zpos1) / 2.); magpiston2->set_double_param("radius",beampipe_radius); - magpiston2->set_double_param("thickness",calorimeter_hole_diamater / 2. - beampipe_radius); + magpiston2->set_double_param("thickness",G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); magpiston2->set_string_param("material","G4_Fe"); magpiston2->SuperDetector(name); if (AbsorberActive) magpiston2->SetActive(); From c9542db0ca63d31dd44886ec08437c4bfd2a8672 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 11:06:48 -0400 Subject: [PATCH 0580/1222] Add Enable driven OVERLAP check --- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C index 1c41ec7c2..fa99bdfb9 100644 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -3,6 +3,7 @@ #include "GlobalVariables.C" #include + #include R__LOAD_LIBRARY(libg4detectors.so) @@ -11,6 +12,7 @@ namespace Enable { static bool PLUGDOOR = false; static bool PLUGDOOR_ABSORBER = false; + static bool PLUGDOOR_OVERLAPCHECK = false; } // namespace Enable namespace G4PLUGDOOR @@ -30,10 +32,14 @@ void PlugDoorInit() void PlugDoor(PHG4Reco *g4Reco) { + + //---------------------------------------- // fsPHENIX forward flux return(s) + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + const string material("Steel_1006"); - const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); flux_return_plus->set_double_param("length", G4PLUGDOOR::length); @@ -43,7 +49,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(flux_return_plus); PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); @@ -54,7 +60,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(flux_return_minus); return; From 3c6f0f93140c42aef96e88f374ada06c6bc7b6f6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 11:07:19 -0400 Subject: [PATCH 0581/1222] move piston to G4_Piston.C --- macros/g4simulations/G4Setup_fsPHENIX.C | 118 ++---------------------- 1 file changed, 10 insertions(+), 108 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 93637a2f6..2e2105abd 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -12,6 +12,7 @@ #include "G4_FGEM_fsPHENIX.C" #include "G4_FEMC.C" #include "G4_FHCAL.C" +#include "G4_Piston.C" #include "G4_User.C" #include "G4_World.C" @@ -21,13 +22,11 @@ #include #include #include -class SubsysReco; + R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) -int make_piston(string name, PHG4Reco* g4Reco); - void RunLoadTest() {} void G4Init(bool do_svtx = true, @@ -78,6 +77,10 @@ void G4Init(bool do_svtx = true, { FHCALInit(); } + if (Enable::PISTON) + { + PistonInit(); + } if (Enable::PLUGDOOR) { @@ -202,24 +205,20 @@ int G4Setup(const int absorberactive = 0, { FHCALSetup(g4Reco); } + if (Enable::PISTON) + { + Piston(g4Reco); + } if (Enable::PLUGDOOR) { PlugDoor(g4Reco); } - //---------------------------------------- - // piston magnet -// make_piston("magpiston", g4Reco); - - //---------------------------------------- if (Enable::USER) { UserDetector(g4Reco); } - // BLACKHOLE - // minimal space for forward instrumentation - // if (radius<270) radius = 270; if (Enable::BLACKHOLE) { @@ -318,100 +317,3 @@ void DstCompress(Fun4AllDstOutputManager* out) { } } -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; -} From d9c20b47ce9aff1521471f5e88a50b23ad255a84 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 11:30:36 -0400 Subject: [PATCH 0582/1222] remove unused n_tpc_layers --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 30 ++++++++-------------- macros/g4simulations/G4Setup_fsPHENIX.C | 6 ++--- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 3d1194509..06cf41c3e 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -38,9 +38,6 @@ int Fun4All_G4_fsPHENIX( const char * outputFile = "G4fsPHENIX.root", const char * embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - //=============== // Input options //=============== @@ -77,8 +74,8 @@ int Fun4All_G4_fsPHENIX( bool do_bbc = false; - Enable::PIPE = true; -// Enable::PIPE_OVERLAPCHECK = true; + Enable::PIPE = false; + Enable::PIPE_OVERLAPCHECK = true; // central tracking bool do_tracking = false; bool do_tracking_cell = do_tracking && true; @@ -133,27 +130,20 @@ int Fun4All_G4_fsPHENIX( bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; - Enable::PLUGDOOR = false; - Enable::PLUGDOOR_ABSORBER = true; + Enable::PISTON = false; + Enable::PISTON_OVERLAPCHECK = false; + + Enable::PLUGDOOR = true; + Enable::PLUGDOOR_OVERLAPCHECK = false; + Enable::PLUGDOOR_ABSORBER = false; // new settings using Enable namespace in GlobalVariables.C - // Enable::BLACKHOLE = true; + Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_tracking,n_TPC_layers); + G4Init(do_tracking); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 2e2105abd..960aec68d 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -29,8 +29,8 @@ R__LOAD_LIBRARY(libg4detectors.so) void RunLoadTest() {} -void G4Init(bool do_svtx = true, - int n_TPC_layers = 40) { +void G4Init(bool do_svtx = true) +{ // load detector/material macros and execute Init() function @@ -41,7 +41,7 @@ void G4Init(bool do_svtx = true, if (do_svtx) { gROOT->LoadMacro("G4_Tracking.C"); - TrackingInit(n_TPC_layers); + TrackingInit(); } if (Enable::CEMC) From e789cc97f14f049d57a3d1e0c1a2de26fc019a9c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 13:21:32 -0400 Subject: [PATCH 0583/1222] Add AbsorberActive --- macros/g4simulations/G4_FEMC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index d8e7ad239..ebc72d6de 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -55,7 +55,7 @@ void FEMCInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +void FEMCSetup(PHG4Reco *g4Reco) { bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; Fun4AllServer *se = Fun4AllServer::instance(); From 57732f6236fa7cb80522732b1a1a07306a1adc0f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 13:23:20 -0400 Subject: [PATCH 0584/1222] Add OverlapCheck --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index fdfae64a1..8042582e2 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -4,8 +4,6 @@ #include -#include - #include #include @@ -24,6 +22,7 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); namespace Enable { static bool FGEM = false; + static bool FGEM_OVERLAPCHECK = false; } void FGEM_Init() @@ -38,6 +37,8 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // { const double tilt = .1; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; + string name; double etamax; double etamin; @@ -63,7 +64,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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); + gem->OverlapCheck(OverlapCheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); @@ -84,7 +85,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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); + gem->OverlapCheck(OverlapCheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); @@ -106,7 +107,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); + gem->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -125,7 +126,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // 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); + gem->OverlapCheck(OverlapCheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); g4Reco->registerSubsystem(gem); @@ -147,7 +148,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); + gem->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -213,7 +214,7 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, 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); + gem->OverlapCheck(OverlapCheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); From 8f8eb0089d29f20569b2de9fbdeefbb3caa8f8ea Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 13:26:40 -0400 Subject: [PATCH 0585/1222] close to new version --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 89 ++++++++++++---------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 06cf41c3e..6fc20bb3a 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -1,32 +1,41 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include +#include "GlobalVariables.C" +#include "DisplayOn.C" +#include "G4Setup_fsPHENIX.C" +#include "G4_Bbc.C" +#include "G4_Global.C" +#include "G4_CaloTrigger.C" +#include "G4_Jets.C" +#include "G4_FwdJets.C" +#include "G4_DSTReader_fsPHENIX.C" + +#include + #include #include #include #include #include #include -#include + #include -#include + #include + #include -#include "DisplayOn.C" -#include "G4Setup_fsPHENIX.C" -#include "G4_Bbc.C" -#include "G4_Global.C" -#include "G4_CaloTrigger.C" -#include "G4_Jets.C" -#include "G4_FwdJets.C" -#include "G4_DSTReader_fsPHENIX.C" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libPHPythia6.so) @@ -72,70 +81,72 @@ int Fun4All_G4_fsPHENIX( //====================== // Enable::ABSORBER = true; - bool do_bbc = false; + bool do_bbc = true; - Enable::PIPE = false; - Enable::PIPE_OVERLAPCHECK = true; + Enable::PIPE = true; + Enable::PIPE_OVERLAPCHECK = false; // central tracking - bool do_tracking = false; + bool do_tracking = true; bool do_tracking_cell = do_tracking && true; - bool do_tracking_cluster = do_tracking_cell && false; + bool do_tracking_cluster = do_tracking_cell && true; bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = false; + Enable::CEMC = true; bool do_cemc_cell = Enable::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; - Enable::HCALIN = false; + Enable::HCALIN = true; bool do_hcalin_cell = Enable::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; - Enable::MAGNET = false; + Enable::MAGNET = true; - Enable::HCALOUT = false; + Enable::HCALOUT = true; bool do_hcalout_cell = Enable::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_hcalout_eval = do_hcalout_cluster && true; - bool do_global = false; + bool do_global = true; bool do_global_fastsim = false; - bool do_jet_reco = false; + bool do_jet_reco = true; bool do_jet_eval = do_jet_reco && true; - bool do_fwd_jet_reco = false; + bool do_fwd_jet_reco = true; bool do_fwd_jet_eval = do_fwd_jet_reco && true; // fsPHENIX geometry - Enable::FGEM = false; - bool do_FGEM_track = Enable::FGEM && false; + Enable::FGEM = true; + bool do_FGEM_track = Enable::FGEM && true; bool do_FGEM_eval = do_FGEM_track && true; - Enable::FEMC = false; - Enable::FEMC_ABSORBER = false; + Enable::FEMC = true; + Enable::FEMC_ABSORBER = true; bool do_FEMC_cell = Enable::FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; - Enable::FHCAL = false; - bool do_FHCAL_cell = Enable::FHCAL && false; + Enable::FHCAL = true; + Enable::FHCAL_ABSORBER = true; + bool do_FHCAL_cell = Enable::FHCAL && true; bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; - Enable::PISTON = false; + Enable::PISTON = true; + Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; - Enable::PLUGDOOR_ABSORBER = false; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; From 9e39356190495d9cbd9edfd433005d2ee524d76f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 13:46:31 -0400 Subject: [PATCH 0586/1222] move EIC Mvtx to G4_Mvtx_EIC.C --- macros/g4simulations/G4_Mvtx_EIC.C | 116 +++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 macros/g4simulations/G4_Mvtx_EIC.C diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C new file mode 100644 index 000000000..ad0471a16 --- /dev/null +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -0,0 +1,116 @@ +#pragma once + +#include "GlobalVariables.C" + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4mvtx.so) + +namespace Enable +{ + static bool MVTX = false; +} + +namespace MVTX +{ + 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_staves[MVTX::n_maps_layer] = {18, 24, 30}; + const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; +} // namespace MVTX + +void MvtxInit(int verbosity = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10. + 0.7); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +} + +double Mvtx(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + // H?kan Wennl?f : + // Without time-stamping layer: + // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves + // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 + // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 + // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 + // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 + + // int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; + // double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + for (int ilyr = 0; ilyr < MVTX::n_maps_layer; ilyr++) + { + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); + mvtx->set_double_param(ilyr, "phi0", 0); + } + + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + return MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10.; // return cm +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +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 + //----------- + + return; +} + +// Central detector reco is disabled as EIC setup use the fast tracking sim for now +void Svtx_Reco(int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libfun4all.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + return; +} From ed1281a18343a34320670b66a76589a02d8ceb47 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 13:47:45 -0400 Subject: [PATCH 0587/1222] move EIC Mvtx to G4_Mvtx_EIC.C --- macros/g4simulations/G4Setup_EICDetector.C | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index a7acb7a85..3b880e96b 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -2,16 +2,6 @@ #include "GlobalVariables.C" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "G4_Aerogel.C" #include "G4_BlackHole.C" #include "G4_CEmc_EIC.C" @@ -23,7 +13,7 @@ #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" #include "G4_Magnet.C" -#include "G4_Mvtx.C" +#include "G4_Mvtx_EIC.C" #include "G4_PSTOF.C" #include "G4_Pipe_EIC.C" #include "G4_PlugDoor_EIC.C" @@ -33,6 +23,22 @@ #include "G4_User.C" #include "G4_World.C" +#include + +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include + R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) From ca7ad94966004c35967b560dfedd416a529f05bf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 14:33:15 -0400 Subject: [PATCH 0588/1222] use G4MVTX for namespace instead of MVTX --- macros/g4simulations/G4_Mvtx_EIC.C | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index ad0471a16..65bd20dc7 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -17,27 +17,30 @@ R__LOAD_LIBRARY(libg4mvtx.so) namespace Enable { static bool MVTX = false; + static bool MVTX_OVERLAPCHECK = false; + static int MVTX_VERBOSITY = 0; + } -namespace MVTX +namespace G4MVTX { 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_staves[MVTX::n_maps_layer] = {18, 24, 30}; - const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + const int N_staves[n_maps_layer] = {18, 24, 30}; + const double nom_radius[n_maps_layer] = {36.4, 48.1, 59.8}; } // namespace MVTX void MvtxInit(int verbosity = 0) { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10. + 0.7); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10. + 0.7); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } double Mvtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0) { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps + bool maps_overlapcheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker @@ -52,14 +55,14 @@ double Mvtx(PHG4Reco* g4Reco, double radius, // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - // int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; - // double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; - for (int ilyr = 0; ilyr < MVTX::n_maps_layer; ilyr++) + // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30}; + // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) { mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm + mvtx->set_int_param(ilyr, "N_staves", G4MVTX::N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", G4MVTX::nom_radius[ilyr]); // mm mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); mvtx->set_double_param(ilyr, "phi0", 0); } @@ -68,7 +71,7 @@ double Mvtx(PHG4Reco* g4Reco, double radius, mvtx->SetActive(1); mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); - return MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10.; // return cm + return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm } // Central detector cell reco is disabled as EIC setup use the fast tracking sim for now From 9bc6be1005ad5f383044e887acc708c504b30842 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 16:38:05 -0400 Subject: [PATCH 0589/1222] add OverlapCheck --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 8042582e2..c5296360e 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -187,6 +187,8 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " // << name << endl; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; + double polar_angle = 0; if (zpos < 0) From f0bb4e1d36b397d43741e115ac5a77f703df0b59 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 16:38:34 -0400 Subject: [PATCH 0590/1222] working initial version --- macros/g4simulations/G4_Mvtx.C | 108 ++++++++++++++------------------- 1 file changed, 44 insertions(+), 64 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index ad0471a16..895fdb79b 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -3,10 +3,13 @@ #include "GlobalVariables.C" #include +#include #include #include +#include + #include #include @@ -17,100 +20,77 @@ R__LOAD_LIBRARY(libg4mvtx.so) namespace Enable { static bool MVTX = false; + static bool MVTX_OVERLAPCHECK = false; + static int MVTX_VERBOSITY = 0; + } -namespace MVTX +namespace G4MVTX { 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_staves[MVTX::n_maps_layer] = {18, 24, 30}; - const double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; } // namespace MVTX -void MvtxInit(int verbosity = 0) +void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10. + 0.7); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer-1][PHG4MvtxDefs::kRmd]); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } double Mvtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) + const int absorberactive = 0) { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker + 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); - // H?kan Wennl?f : - // Without time-stamping layer: - // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves - // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 - // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 - // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 - // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - - // int N_staves[MVTX::n_maps_layer] = {18, 24, 30}; - // double nom_radius[MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; - for (int ilyr = 0; ilyr < MVTX::n_maps_layer; ilyr++) + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) { - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", MVTX::N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", MVTX::nom_radius[ilyr]); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); - mvtx->set_double_param(ilyr, "phi0", 0); + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; + if (verbosity) + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + radius = radius_lyr; } - - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); + 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); - return MVTX::nom_radius[MVTX::n_maps_layer - 1] / 10.; // return cm + return radius; } + // Central detector cell reco is disabled as EIC setup use the fast tracking sim for now -void Svtx_Cells(int verbosity = 0) +void Mvtx_Cells() { - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - - //----------- - // SVTX cells - //----------- - + // new storage containers + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); return; } -// Central detector reco is disabled as EIC setup use the fast tracking sim for now -void Svtx_Reco(int verbosity = 0) +void Mvtx_Clustering() { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - - //--------------- - // Fun4All server - //--------------- - + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); + 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); + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); - return; } From ccdf2ed87e17aea7b23fe96489cd73464111bdca Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:30:38 -0400 Subject: [PATCH 0591/1222] splitting off the mvtx --- macros/g4simulations/G4_Tracking_fsPHENIX.C | 607 ++++++++++++++++++++ 1 file changed, 607 insertions(+) create mode 100644 macros/g4simulations/G4_Tracking_fsPHENIX.C diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C new file mode 100644 index 000000000..1434ba678 --- /dev/null +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -0,0 +1,607 @@ +#pragma once + +#include "GlobalVariables.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 + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtrack_reco.so) + +// Tracking simulation setup parameters and flag - leave them alone! +//============================================== + +////////////// MVTX +const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + +/////////////// INTT +int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely +int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; +int nladder[4] = {15, 15, 18, 18}; +double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +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 + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational +}; +enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + +///////////////// TPC +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; + +// Tracking reconstruction setup parameters and flags +//===================================== +const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events +const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead +const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit +const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples + +// This is the setup we have been using before PHInitZVertexing was implemented - 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: +const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex + +// This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event +//const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex +//std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. + + +void TrackingInit(int verbosity = 0) +{ +} + +double Tracking(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + // create the three tracker subsystems + gSystem->Load("libg4mvtx.so"); + +/* + if (n_maps_layer > 0) + { + bool maps_overlapcheck = false; // set to true if you want to check for overlaps + + // MAPS inner barrel layers + //====================================================== + // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + { + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; + if (verbosity) + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + radius = radius_lyr; + } + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + } +*/ + if (n_intt_layer > 0) + { + //------------------- + // INTT ladders + //------------------- + + bool intt_overlapcheck = false; // set to true if you want to check for overlaps + + // 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 + 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; i < 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(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); + g4Reco->registerSubsystem(sitrack); + + // Set the laddertype and ladder spacing configuration + + cout << "Intt has " << n_intt_layer << " layers with layer setup:" << endl; + for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); + sitrack->set_int_param(i, "nladder", nladder[i]); + sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm + sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees + } + + // outer radius marker (translation back to cm) + radius = intt_radius_max * 0.1; + } + + + // The Tpc - always present! + //================================ + gSystem->Load("libg4tpc.so"); + + PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("TPC"); + tpc->set_double_param("steplimits", 1); + // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 + + if (absorberactive) + { + tpc->SetAbsorberActive(); + } + tpc->OverlapCheck(overlapcheck); + + g4Reco->registerSubsystem(tpc); + + radius = 77. + 1.17; + + radius += no_overlapp; + + return radius; +} + +void Tracking_Cells(int verbosity = 0) +{ + // runs the cellularization of the energy deposits (g4hits) + // into detector hits (TrkrHits) + + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libtrack_io.so"); + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4detectors.so"); + gSystem->Load("libg4tpc.so"); + gSystem->Load("libg4intt.so"); + gSystem->Load("libg4mvtx.so"); + gSystem->Load("libtpc.so"); + gSystem->Load("libintt.so"); + gSystem->Load("libmvtx.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + // Mvtx hit reco + //=========== +/* + if (n_maps_layer > 0) + { + // new storage containers + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); + } +*/ + // Intt hit reco + //=========== + if (n_intt_layer > 0) + { + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + // The timing windows are hard-coded in the INTT ladder model, they can be overridden here + //reco->set_double_param("tmax",80.0); + //reco->set_double_param("tmin",-20.0); + reco->Verbosity(verbosity); + se->registerSubsystem(reco); + } + + //========================= + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout + //========================= + + PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); + padplane->Verbosity(0); + + PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); + edrift->Detector("TPC"); + edrift->Verbosity(0); + // 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->set_double_param("added_smear_trans",0.085); + //edrift->set_double_param("added_smear_long",0.105); + 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", n_maps_layer + n_intt_layer); // sPHENIX layer number of first Tpc readout layer + padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); + padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); + + return; +} + +void Tracking_Clus(int verbosity = 0) +{ + // processes the TrkrHits to make clusters, then reconstruct tracks and vertices + + //--------------- + // Load libraries + //--------------- + gSystem->Load("libfun4all.so"); + gSystem->Load("libtrack_reco.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //------------------------------------------- + // Digitize the hit energy into ADC + //------------------------------------------ + + // Mvtx + //====== +/* + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); + digimvtx->Verbosity(0); + // 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); +*/ + if (n_intt_layer > 0) + { + +#ifdef SVTXDEADMAP + if (InttDeadMapOption != kInttNoDeadMap) + { + // Load pre-defined deadmaps + PHG4SvtxDeadMapLoader* deadMapIntt = new PHG4SvtxDeadMapLoader("INTT"); + for (int i = 0; i < n_intt_layer; i++) + { + const int database_strip_type = (laddertype[i] == PHG4InttDefs::SEGMENTATION_Z) ? 0 : 1; + string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); + + + if (InttDeadMapOption == kIntt4PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + DeadMapPath += DeadMapConfigName; + deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else if (InttDeadMapOption == kIntt8PercentDeadMap) + { + + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + DeadMapPath += DeadMapConfigName; + deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); + + } + else + { + cout <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "< Verbosity(1); + se->registerSubsystem(deadMapIntt); + } +#endif // SVTXDEADMAP + + // Intt + //===== + // 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); + for (int i = 0; i < n_intt_layer; i++) + { + digiintt->set_adc_scale(n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + } + + // Tpc + //==== + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); + digitpc->SetTpcMinLayer(n_maps_layer + 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(0); + cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+Intt layers set to " << n_maps_layer + n_intt_layer << endl; + + se->registerSubsystem(digitpc); + + //------------- + // Cluster Hits + //------------- + +/* + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); +*/ + // For the Intt layers + //=============== + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + { + if (laddertype[i - n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) + inttclusterizer->set_z_clustering(i, false); + } + se->registerSubsystem(inttclusterizer); + + // For the Tpc + //========== + TpcClusterizer* tpcclusterizer = new TpcClusterizer(); + tpcclusterizer->Verbosity(0); + se->registerSubsystem(tpcclusterizer); + +} + +void Tracking_Reco(int verbosity = 0) +{ + // processes the TrkrHits to make clusters, then reconstruct tracks and vertices + + //--------------- + // Load libraries + //--------------- + gSystem->Load("libfun4all.so"); + gSystem->Load("libtrack_reco.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //------------- + // Tracking + //------------ + + if (use_track_prop) + { + //-------------------------------------------------- + // Normal track seeding and propagation + //-------------------------------------------------- + + if(use_truth_vertex) + { + // We cheat to get the initial vertex for the full track reconstruction case + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + } + else + { + // get the initial vertex for track fitting from the MVTX hits + PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); + int seed_layer[7] = {0,1,2,3,4,5,6}; + init_zvtx->set_seeding_layer(seed_layer,7); + // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. + // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). + init_zvtx->set_min_zvtx_tracks(init_vertexing_min_zvtx_tracks); + init_zvtx->Verbosity(0); + se->registerSubsystem(init_zvtx); + } + + // find seed tracks using a subset of TPC layers + int min_layers = 4; + int nlayers_seeds = 12; + PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + track_seed->Verbosity(0); + se->registerSubsystem(track_seed); + + // Find all clusters associated with each seed track + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + track_prop->Verbosity(0); + se->registerSubsystem(track_prop); + for(int i = 0;iset_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); + } + } + else + { + //------------------------------------------------------- + // Track finding using truth information only + //------------------------------------------------------ + + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + + // For each truth particle, create a track and associate clusters with it using truth information + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); + pat_rec->Verbosity(0); + se->registerSubsystem(pat_rec); + } + + //------------------------------------------------ + // Fitting of tracks using Kalman Filter + //------------------------------------------------ + + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(0); + + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + + return; +} + + + void Tracking_Eval(std::string outputfile, int verbosity = 0) +{ + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libg4eval.so"); + gSystem->Load("libfun4all.so"); + gSystem->Load("libg4detectors.so"); + gSystem->Load("libtrack_reco.so"); + + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_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(false); + eval->do_eval_light(true); + eval->set_use_initial_vertex(g4eval_use_initial_vertex); + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(0); + 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", n_maps_layer, n_intt_layer, n_gas_layer); 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); + } + + return; +} From b830a5e992bfcc7330699ffe4f7d32b7092fd0a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:31:02 -0400 Subject: [PATCH 0592/1222] splitting the mvtx off the tracking --- macros/g4simulations/G4_WorldSize.C | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 macros/g4simulations/G4_WorldSize.C diff --git a/macros/g4simulations/G4_WorldSize.C b/macros/g4simulations/G4_WorldSize.C deleted file mode 100644 index 9d1058b92..000000000 --- a/macros/g4simulations/G4_WorldSize.C +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" -#include - -R__LOAD_LIBRARY(libg4testbench.so) - - -void WorldSize(PHG4Reco *g4Reco, double radius) -{ - double world_radius = radius; - if (world_radius < BlackHoleGeometry::max_radius) - { - world_radius = BlackHoleGeometry::max_radius; - } - if (g4Reco->GetWorldSizeX() < (world_radius+100)) // add 1m - { - g4Reco->SetWorldSizeX(world_radius+100); - } -// 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,-((g4Reco->GetWorldSizeZ()-100)/2.)); - double max_zval = std::max(BlackHoleGeometry::max_z,(g4Reco->GetWorldSizeZ()-100)/2.); - double final_zval = std::max(fabs(min_zval),fabs(max_zval))+100; // add 1m - if (g4Reco->GetWorldSizeZ() < 2*(final_zval)) - { - g4Reco->SetWorldSizeZ( 2*(final_zval)); - } - return; -} From 02e639029b911f9c41f2480b2bf21f20c09d9c52 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:31:31 -0400 Subject: [PATCH 0593/1222] splitting the mvtx off the tracking --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 6fc20bb3a..84e9df409 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -17,7 +17,6 @@ #include #include #include -#include #include @@ -86,70 +85,74 @@ int Fun4All_G4_fsPHENIX( Enable::PIPE = true; Enable::PIPE_OVERLAPCHECK = false; // central tracking + Enable::MVTX = true; + bool do_mvtx_cell = Enable::MVTX && true; + bool do_mvtx_cluster = do_mvtx_cell && true; + bool do_tracking = true; bool do_tracking_cell = do_tracking && true; bool do_tracking_cluster = do_tracking_cell && true; bool do_tracking_track = do_tracking_cluster && true; - bool do_tracking_eval = do_tracking_track && true; + bool do_tracking_eval = do_tracking_track && false; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = true; + Enable::CEMC = false; bool do_cemc_cell = Enable::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; - Enable::HCALIN = true; + Enable::HCALIN = false; bool do_hcalin_cell = Enable::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; - Enable::MAGNET = true; + Enable::MAGNET = false; - Enable::HCALOUT = true; + Enable::HCALOUT = false; bool do_hcalout_cell = Enable::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 = false; bool do_global_fastsim = false; - bool do_jet_reco = true; + bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; - bool do_fwd_jet_reco = true; + bool do_fwd_jet_reco = false; bool do_fwd_jet_eval = do_fwd_jet_reco && true; // fsPHENIX geometry - Enable::FGEM = true; + Enable::FGEM = false; bool do_FGEM_track = Enable::FGEM && true; bool do_FGEM_eval = do_FGEM_track && true; - Enable::FEMC = true; + Enable::FEMC = false; Enable::FEMC_ABSORBER = true; bool do_FEMC_cell = Enable::FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; - Enable::FHCAL = true; + Enable::FHCAL = false; Enable::FHCAL_ABSORBER = true; bool do_FHCAL_cell = Enable::FHCAL && true; bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; - Enable::PISTON = true; + Enable::PISTON = false; Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; - Enable::PLUGDOOR = true; + Enable::PLUGDOOR = false; Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; +// Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; @@ -276,6 +279,8 @@ int Fun4All_G4_fsPHENIX( // Detector Division //------------------ + if (do_mvtx_cell) Mvtx_Cells(); + if (do_tracking_cell) Tracking_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -315,6 +320,7 @@ int Fun4All_G4_fsPHENIX( //-------------- // SVTX tracking //-------------- + if (do_mvtx_cluster) Mvtx_Clustering(); if (do_tracking_cluster) Tracking_Clus(); if (do_tracking_track) Tracking_Reco(); From f33819bc09acf1b3ccc91e93312f17256e05c09f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:31:49 -0400 Subject: [PATCH 0594/1222] splitting the mvtx off the tracking --- macros/g4simulations/G4Setup_fsPHENIX.C | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 960aec68d..f83769362 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -4,10 +4,11 @@ #include "G4_BlackHole.C" #include "G4_Pipe.C" #include "G4_PlugDoor_fsPHENIX.C" -#include "G4_Tracking.C" +#include "G4_Tracking_fsPHENIX.C" #include "G4_CEmc_Spacal.C" #include "G4_HcalIn_ref.C" #include "G4_Magnet.C" +#include "G4_Mvtx.C" #include "G4_HcalOut_ref.C" #include "G4_FGEM_fsPHENIX.C" #include "G4_FEMC.C" @@ -17,16 +18,25 @@ #include "G4_World.C" #include + #include + #include + #include #include +#include + #include +#include R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) +void ShowerCompress(int verbosity = 0); +void DstCompress(Fun4AllDstOutputManager* out); + void RunLoadTest() {} void G4Init(bool do_svtx = true) @@ -38,9 +48,12 @@ void G4Init(bool do_svtx = true) { PipeInit(); } + if (Enable::MVTX) + { + MvtxInit(); + } if (do_svtx) { - gROOT->LoadMacro("G4_Tracking.C"); TrackingInit(); } @@ -147,6 +160,10 @@ int G4Setup(const int absorberactive = 0, { radius = Pipe(g4Reco, radius, absorberactive); } + if (Enable::MVTX) + { + radius = Mvtx(g4Reco, radius, absorberactive); + } //---------------------------------------- // SVTX if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); From 2b4ca21d7ff89ddbe3f2723ea2b761d806c2cf99 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:52:37 -0400 Subject: [PATCH 0595/1222] move n_maps_layer to G4MVTX namespace --- macros/g4simulations/G4_Tracking_fsPHENIX.C | 35 ++++++++++----------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index 1434ba678..bb126400d 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -2,6 +2,8 @@ #include "GlobalVariables.C" +#include "G4_Mvtx.C" + #include #include @@ -17,7 +19,6 @@ #include #include #include -#include #include #include @@ -52,9 +53,6 @@ R__LOAD_LIBRARY(libtrack_reco.so) // Tracking simulation setup parameters and flag - leave them alone! //============================================== -////////////// MVTX -const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers - /////////////// INTT int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, @@ -104,7 +102,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, int verbosity = 0) { // create the three tracker subsystems - gSystem->Load("libg4mvtx.so"); /* if (n_maps_layer > 0) @@ -152,7 +149,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, for (int i = 0; i < 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(n_maps_layer + i, i)); // sphxlayer=n_maps_layer+i corresponding to inttlayer=i + 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; } @@ -281,7 +278,7 @@ void Tracking_Cells(int verbosity = 0) // 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", n_maps_layer + n_intt_layer); // sPHENIX layer number of first Tpc readout layer + padplane->set_int_param("tpc_minlayer_inner", G4MVTX::n_maps_layer + n_intt_layer); // sPHENIX layer number of first Tpc readout layer padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); @@ -336,7 +333,7 @@ void Tracking_Clus(int verbosity = 0) string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); + deadMapIntt->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); } else if (InttDeadMapOption == kIntt8PercentDeadMap) @@ -344,7 +341,7 @@ void Tracking_Clus(int verbosity = 0) string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); + deadMapIntt->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); } else @@ -396,7 +393,7 @@ void Tracking_Clus(int verbosity = 0) digiintt->Verbosity(verbosity); for (int i = 0; i < n_intt_layer; i++) { - digiintt->set_adc_scale(n_maps_layer + i, userrange); + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); } se->registerSubsystem(digiintt); } @@ -404,14 +401,14 @@ void Tracking_Clus(int verbosity = 0) // Tpc //==== PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); - digitpc->SetTpcMinLayer(n_maps_layer + n_intt_layer); + digitpc->SetTpcMinLayer(G4MVTX::n_maps_layer + 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(0); cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold - << " maps+Intt layers set to " << n_maps_layer + n_intt_layer << endl; + << " maps+Intt layers set to " << G4MVTX::n_maps_layer + n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -428,13 +425,13 @@ void Tracking_Clus(int verbosity = 0) */ // For the Intt layers //=============== - InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + n_intt_layer - 1); + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) + for (int i = G4MVTX::n_maps_layer; i < G4MVTX::n_maps_layer + n_intt_layer; i++) { - if (laddertype[i - n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) + if (laddertype[i - G4MVTX::n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) inttclusterizer->set_z_clustering(i, false); } se->registerSubsystem(inttclusterizer); @@ -496,12 +493,12 @@ void Tracking_Reco(int verbosity = 0) // find seed tracks using a subset of TPC layers int min_layers = 4; int nlayers_seeds = 12; - PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); track_seed->Verbosity(0); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); for(int i = 0;ido_cluster_eval(true); eval->do_g4hit_eval(true); eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... @@ -594,7 +591,7 @@ void Tracking_Reco(int verbosity = 0) // 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", n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From 8c7389390bac7c61addc8cbebf7fa4037e55c04a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 17:52:43 -0400 Subject: [PATCH 0596/1222] move n_maps_layer to G4MVTX namespace --- macros/g4simulations/G4_Mvtx.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index 895fdb79b..c8a7371c1 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -69,7 +70,7 @@ void Mvtx_Cells() // new storage containers PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); maps_hits->Verbosity(verbosity); - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) { // override the default timing window for this layer - default is +/- 5000 ns maps_hits->set_timing_window(ilayer, -5000, 5000); From ac2b4ee96b032d4c33c63292060d96268eea189e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 18:02:41 -0400 Subject: [PATCH 0597/1222] cleanup --- macros/g4simulations/G4_Mvtx.C | 1 + macros/g4simulations/G4_Tracking_fsPHENIX.C | 104 +------------------- 2 files changed, 3 insertions(+), 102 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index c8a7371c1..d6aaca0e8 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -17,6 +17,7 @@ #include R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libmvtx.so) namespace Enable { diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index bb126400d..3d286ee75 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -16,10 +16,6 @@ #include -#include -#include -#include - #include #include #include @@ -27,7 +23,6 @@ #include #include -#include #include #include @@ -43,10 +38,8 @@ R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) -R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) -R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) @@ -103,31 +96,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, { // create the three tracker subsystems -/* - if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // MAPS inner barrel layers - //====================================================== - // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... - - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; - radius = radius_lyr; - } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - } -*/ if (n_intt_layer > 0) { //------------------- @@ -207,42 +175,12 @@ void Tracking_Cells(int verbosity = 0) // runs the cellularization of the energy deposits (g4hits) // into detector hits (TrkrHits) - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libtrack_io.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4tpc.so"); - gSystem->Load("libg4intt.so"); - gSystem->Load("libg4mvtx.so"); - gSystem->Load("libtpc.so"); - gSystem->Load("libintt.so"); - gSystem->Load("libmvtx.so"); - //--------------- // Fun4All server //--------------- Fun4AllServer* se = Fun4AllServer::instance(); - // Mvtx hit reco - //=========== -/* - if (n_maps_layer > 0) - { - // new storage containers - PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); - maps_hits->Verbosity(verbosity); - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); - } - se->registerSubsystem(maps_hits); - } -*/ // Intt hit reco //=========== if (n_intt_layer > 0) @@ -289,12 +227,6 @@ void Tracking_Clus(int verbosity = 0) { // processes the TrkrHits to make clusters, then reconstruct tracks and vertices - //--------------- - // Load libraries - //--------------- - gSystem->Load("libfun4all.so"); - gSystem->Load("libtrack_reco.so"); - //--------------- // Fun4All server //--------------- @@ -305,15 +237,6 @@ void Tracking_Clus(int verbosity = 0) // Digitize the hit energy into ADC //------------------------------------------ - // Mvtx - //====== -/* - PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); - digimvtx->Verbosity(0); - // 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); -*/ if (n_intt_layer > 0) { @@ -416,13 +339,6 @@ void Tracking_Clus(int verbosity = 0) // Cluster Hits //------------- -/* - // For the Mvtx layers - //================ - MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); - mvtxclusterizer->Verbosity(verbosity); - se->registerSubsystem(mvtxclusterizer); -*/ // For the Intt layers //=============== InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + n_intt_layer - 1); @@ -448,12 +364,6 @@ void Tracking_Reco(int verbosity = 0) { // processes the TrkrHits to make clusters, then reconstruct tracks and vertices - //--------------- - // Load libraries - //--------------- - gSystem->Load("libfun4all.so"); - gSystem->Load("libtrack_reco.so"); - //--------------- // Fun4All server //--------------- @@ -553,18 +463,8 @@ void Tracking_Reco(int verbosity = 0) } - void Tracking_Eval(std::string outputfile, int verbosity = 0) + void Tracking_Eval(const std::string &outputfile, int verbosity = 0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4eval.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libtrack_reco.so"); - - //--------------- // Fun4All server //--------------- @@ -575,7 +475,7 @@ void Tracking_Reco(int verbosity = 0) // Tracking evaluation //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", G4MVTX::n_maps_layer, n_intt_layer, n_gas_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... From 4c85709428e28b9befc6570d4dd450ca08528da6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 19:23:00 -0400 Subject: [PATCH 0598/1222] clang-format --- macros/g4simulations/G4_Mvtx.C | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index d6aaca0e8..c0f577376 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -25,16 +25,16 @@ namespace Enable static bool MVTX_OVERLAPCHECK = false; static int MVTX_VERBOSITY = 0; -} +} // namespace Enable namespace G4MVTX { const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers -} // namespace MVTX +} // namespace G4MVTX void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer-1][PHG4MvtxDefs::kRmd]); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -55,28 +55,27 @@ double Mvtx(PHG4Reco* g4Reco, double radius, cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; radius = radius_lyr; } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + 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); 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); - for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); - } - se->registerSubsystem(maps_hits); + // new storage containers + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); return; } @@ -94,5 +93,4 @@ void Mvtx_Clustering() MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); mvtxclusterizer->Verbosity(verbosity); se->registerSubsystem(mvtxclusterizer); - } From c250a8d5a993814cd87b18ff07d799f932c93f0f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 19:52:12 -0400 Subject: [PATCH 0599/1222] working first intt version --- macros/g4simulations/G4_Intt.C | 181 ++++++++++++++++++++ macros/g4simulations/G4_Tracking_fsPHENIX.C | 75 +++----- 2 files changed, 202 insertions(+), 54 deletions(-) create mode 100644 macros/g4simulations/G4_Intt.C diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C new file mode 100644 index 000000000..d4892c473 --- /dev/null +++ b/macros/g4simulations/G4_Intt.C @@ -0,0 +1,181 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Mvtx.C" + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libintt.so) + +namespace Enable +{ + static bool INTT = false; + static bool INTT_OVERLAPCHECK = false; + static int INTT_VERBOSITY = 0; + +} // namespace Enable + +namespace G4INTT +{ +const int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely +const double intt_radius_max = 140.; // including stagger radius (mm) +const int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; +const int nladder[4] = {15, 15, 18, 18}; +const double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +const 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 + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational +}; +const enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + +} // namespace G4MVTX + +void InttInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4INTT::intt_radius_max/10.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +} + +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); + 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;iset_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(); + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + // The timing windows are hard-coded in the INTT ladder model, they can be overridden here + //reco->set_double_param("tmax",80.0); + //reco->set_double_param("tmin",-20.0); + reco->Verbosity(verbosity); + se->registerSubsystem(reco); + return; +} + +void Intt_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + // Intt + //===== + // 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); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + 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); + +} diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index 3d286ee75..b5f333c12 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -3,6 +3,7 @@ #include "GlobalVariables.C" #include "G4_Mvtx.C" +#include "G4_Intt.C" #include @@ -47,6 +48,7 @@ R__LOAD_LIBRARY(libtrack_reco.so) //============================================== /////////////// INTT +/* int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, @@ -62,7 +64,7 @@ enum enu_InttDeadMapType // Dead map options for INTT kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational }; enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here - +*/ ///////////////// TPC int n_tpc_layer_inner = 16; int tpc_layer_rphi_count_inner = 1152; @@ -95,7 +97,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, int verbosity = 0) { // create the three tracker subsystems - +/* if (n_intt_layer > 0) { //------------------- @@ -143,7 +145,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, // outer radius marker (translation back to cm) radius = intt_radius_max * 0.1; } - +*/ // The Tpc - always present! //================================ @@ -183,6 +185,7 @@ void Tracking_Cells(int verbosity = 0) // Intt hit reco //=========== +/* if (n_intt_layer > 0) { // new storage containers @@ -193,7 +196,7 @@ void Tracking_Cells(int verbosity = 0) reco->Verbosity(verbosity); se->registerSubsystem(reco); } - +*/ //========================= // setup Tpc readout for filling cells // g4tpc/PHG4TpcElectronDrift uses @@ -216,7 +219,7 @@ void Tracking_Cells(int verbosity = 0) // 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 + n_intt_layer); // sPHENIX layer number of first Tpc readout layer + 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", n_tpc_layer_inner); padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); @@ -236,47 +239,9 @@ void Tracking_Clus(int verbosity = 0) //------------------------------------------- // Digitize the hit energy into ADC //------------------------------------------ - - if (n_intt_layer > 0) + if (G4INTT::n_intt_layer > 0) { -#ifdef SVTXDEADMAP - if (InttDeadMapOption != kInttNoDeadMap) - { - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapIntt = new PHG4SvtxDeadMapLoader("INTT"); - for (int i = 0; i < n_intt_layer; i++) - { - const int database_strip_type = (laddertype[i] == PHG4InttDefs::SEGMENTATION_Z) ? 0 : 1; - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - - - if (InttDeadMapOption == kIntt4PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); - - } - else if (InttDeadMapOption == kIntt8PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); - - } - else - { - cout <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "< Verbosity(1); - se->registerSubsystem(deadMapIntt); - } -#endif // SVTXDEADMAP // Intt //===== @@ -301,6 +266,7 @@ void Tracking_Clus(int verbosity = 0) | 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); @@ -314,24 +280,24 @@ void Tracking_Clus(int verbosity = 0) // new containers PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); digiintt->Verbosity(verbosity); - for (int i = 0; i < n_intt_layer; i++) + for (int i = 0; i < G4INTT::n_intt_layer; i++) { digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); } se->registerSubsystem(digiintt); +*/ } - // Tpc //==== PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); - digitpc->SetTpcMinLayer(G4MVTX::n_maps_layer + n_intt_layer); + 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(0); cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold - << " maps+Intt layers set to " << G4MVTX::n_maps_layer + n_intt_layer << endl; + << " maps+Intt layers set to " << G4MVTX::n_maps_layer + G4INTT::n_intt_layer << endl; se->registerSubsystem(digitpc); @@ -341,6 +307,7 @@ void Tracking_Clus(int verbosity = 0) // For the Intt layers //=============== +/* InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + n_intt_layer - 1); inttclusterizer->Verbosity(verbosity); // no Z clustering for Intt type 1 layers (we DO want Z clustering for type 0 layers) @@ -351,7 +318,7 @@ void Tracking_Clus(int verbosity = 0) inttclusterizer->set_z_clustering(i, false); } se->registerSubsystem(inttclusterizer); - +*/ // For the Tpc //========== TpcClusterizer* tpcclusterizer = new TpcClusterizer(); @@ -403,15 +370,15 @@ void Tracking_Reco(int verbosity = 0) // find seed tracks using a subset of TPC layers int min_layers = 4; int nlayers_seeds = 12; - PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); track_seed->Verbosity(0); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); - for(int i = 0;iset_max_search_win_theta_intt(i, 0.200); @@ -475,7 +442,7 @@ void Tracking_Reco(int verbosity = 0) // Tracking evaluation //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_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... @@ -491,7 +458,7 @@ void Tracking_Reco(int verbosity = 0) // 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", G4MVTX::n_maps_layer, n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From 8d40d0c636466a39d6ab2f34a378f9aeee28af28 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 19:52:42 -0400 Subject: [PATCH 0600/1222] working first intt version --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 7 ++++++- macros/g4simulations/G4Setup_fsPHENIX.C | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 84e9df409..5983b71dd 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -88,12 +88,15 @@ int Fun4All_G4_fsPHENIX( Enable::MVTX = true; bool do_mvtx_cell = Enable::MVTX && true; bool do_mvtx_cluster = do_mvtx_cell && true; + Enable::INTT = true; + bool do_intt_cell = Enable::INTT && true; + bool do_intt_cluster = do_intt_cell && true; bool do_tracking = true; bool do_tracking_cell = do_tracking && true; bool do_tracking_cluster = do_tracking_cell && true; bool do_tracking_track = do_tracking_cluster && true; - bool do_tracking_eval = do_tracking_track && false; + bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run Enable::CEMC = false; @@ -280,6 +283,7 @@ int Fun4All_G4_fsPHENIX( //------------------ if (do_mvtx_cell) Mvtx_Cells(); + if (do_intt_cell) Intt_Cells(); if (do_tracking_cell) Tracking_Cells(); @@ -321,6 +325,7 @@ int Fun4All_G4_fsPHENIX( // SVTX tracking //-------------- if (do_mvtx_cluster) Mvtx_Clustering(); + if (do_intt_cluster) Intt_Clustering(); if (do_tracking_cluster) Tracking_Clus(); if (do_tracking_track) Tracking_Reco(); diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index f83769362..65ddc81c9 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -52,6 +52,10 @@ void G4Init(bool do_svtx = true) { MvtxInit(); } + if (Enable::INTT) + { + InttInit(); + } if (do_svtx) { TrackingInit(); @@ -164,6 +168,10 @@ int G4Setup(const int absorberactive = 0, { radius = Mvtx(g4Reco, radius, absorberactive); } + if (Enable::INTT) + { + radius = Intt(g4Reco, radius, absorberactive); + } //---------------------------------------- // SVTX if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); From d2bfc436221706a466e35201b895b7242fbe5380 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 19:53:34 -0400 Subject: [PATCH 0601/1222] clang-format --- macros/g4simulations/G4_Intt.C | 168 ++++++++++++++++----------------- 1 file changed, 83 insertions(+), 85 deletions(-) diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C index d4892c473..afbe78993 100644 --- a/macros/g4simulations/G4_Intt.C +++ b/macros/g4simulations/G4_Intt.C @@ -6,9 +6,8 @@ #include #include -#include #include -#include +#include #include @@ -32,28 +31,28 @@ namespace Enable namespace G4INTT { -const int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely -const double intt_radius_max = 140.; // including stagger radius (mm) -const int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; -const int nladder[4] = {15, 15, 18, 18}; -const double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -const 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 - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational -}; -const enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + const int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely + const double intt_radius_max = 140.; // including stagger radius (mm) + const int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; + const int nladder[4] = {15, 15, 18, 18}; + const double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default + const 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 + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + }; + const enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here -} // namespace G4MVTX +} // namespace G4INTT void InttInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius,G4INTT::intt_radius_max/10.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4INTT::intt_radius_max / 10.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -63,45 +62,45 @@ double Intt(PHG4Reco* g4Reco, double radius, { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); - bool intt_overlapcheck = Enable::OVERLAPCHECK || Enable::INTT_OVERLAPCHECK; + 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 + // 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 + // 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; - } + // 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); - 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;iset_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; + PHG4InttSubsystem* sitrack = new PHG4InttSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + 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; } @@ -110,13 +109,13 @@ void Intt_Cells() { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - // new storage containers - PHG4InttHitReco* reco = new PHG4InttHitReco(); - // The timing windows are hard-coded in the INTT ladder model, they can be overridden here - //reco->set_double_param("tmax",80.0); - //reco->set_double_param("tmin",-20.0); - reco->Verbosity(verbosity); - se->registerSubsystem(reco); + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + // The timing windows are hard-coded in the INTT ladder model, they can be overridden here + //reco->set_double_param("tmax",80.0); + //reco->set_double_param("tmin",-20.0); + reco->Verbosity(verbosity); + se->registerSubsystem(reco); return; } @@ -124,10 +123,10 @@ void Intt_Clustering() { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - // Intt - //===== - // these should be used for the Intt - /* + // Intt + //===== + // 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 @@ -147,24 +146,24 @@ void Intt_Clustering() | 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); - for (int i = 0; i < G4INTT::n_intt_layer; i++) - { - digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); + 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); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); 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) @@ -177,5 +176,4 @@ void Intt_Clustering() } } se->registerSubsystem(inttclusterizer); - } From 30d0b1f613dd12e552c47c2bb804023e1f29f2ef Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 19:59:03 -0400 Subject: [PATCH 0602/1222] cleanup intt --- macros/g4simulations/G4_Tracking_fsPHENIX.C | 157 -------------------- 1 file changed, 157 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index b5f333c12..fb248a42e 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -9,12 +9,6 @@ #include -#include -#include -#include -#include -#include - #include #include @@ -23,7 +17,6 @@ #include #include -#include #include #include @@ -38,33 +31,13 @@ #include R__LOAD_LIBRARY(libg4tpc.so) -R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) // Tracking simulation setup parameters and flag - leave them alone! //============================================== -/////////////// INTT -/* -int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely -int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -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 - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational -}; -enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here -*/ ///////////////// TPC int n_tpc_layer_inner = 16; int tpc_layer_rphi_count_inner = 1152; @@ -96,57 +69,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, int verbosity = 0) { - // create the three tracker subsystems -/* - if (n_intt_layer > 0) - { - //------------------- - // INTT ladders - //------------------- - - bool intt_overlapcheck = false; // set to true if you want to check for overlaps - - // 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 - 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; i < 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); - g4Reco->registerSubsystem(sitrack); - - // Set the laddertype and ladder spacing configuration - - cout << "Intt has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } -*/ - // The Tpc - always present! //================================ gSystem->Load("libg4tpc.so"); @@ -183,20 +105,6 @@ void Tracking_Cells(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - // Intt hit reco - //=========== -/* - if (n_intt_layer > 0) - { - // new storage containers - PHG4InttHitReco* reco = new PHG4InttHitReco(); - // The timing windows are hard-coded in the INTT ladder model, they can be overridden here - //reco->set_double_param("tmax",80.0); - //reco->set_double_param("tmin",-20.0); - reco->Verbosity(verbosity); - se->registerSubsystem(reco); - } -*/ //========================= // setup Tpc readout for filling cells // g4tpc/PHG4TpcElectronDrift uses @@ -236,57 +144,6 @@ void Tracking_Clus(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - //------------------------------------------- - // Digitize the hit energy into ADC - //------------------------------------------ - if (G4INTT::n_intt_layer > 0) - { - - - // Intt - //===== - // 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); - for (int i = 0; i < G4INTT::n_intt_layer; i++) - { - digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); -*/ - } // Tpc //==== PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); @@ -305,20 +162,6 @@ void Tracking_Clus(int verbosity = 0) // Cluster Hits //------------- - // For the Intt layers - //=============== -/* - InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + 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 + n_intt_layer; i++) - { - if (laddertype[i - G4MVTX::n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) - inttclusterizer->set_z_clustering(i, false); - } - se->registerSubsystem(inttclusterizer); -*/ // For the Tpc //========== TpcClusterizer* tpcclusterizer = new TpcClusterizer(); From 6894fb98a1c3067543cd5fce205dfded0b076861 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 21:06:54 -0400 Subject: [PATCH 0603/1222] first commit of working G4_TPC.C --- macros/g4simulations/G4_TPC.C | 169 +++++++++++++------- macros/g4simulations/G4_Tracking_fsPHENIX.C | 32 ++-- 2 files changed, 123 insertions(+), 78 deletions(-) diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index 0999f3a58..12e8e241e 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -1,81 +1,132 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Mvtx.C" +#include "G4_Intt.C" + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libtpc.so) + +namespace Enable +{ + static bool TPC = false; + static bool TPC_ABSORBER = false; + static bool TPC_OVERLAPCHECK = false; + static int TPC_VERBOSITY = 0; +} // namespace Enable + +namespace G4TPC +{ +static int n_tpc_layer_inner = 16; +static int tpc_layer_rphi_count_inner = 1152; +static int n_tpc_layer_mid = 16; +static int n_tpc_layer_outer = 16; +static int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + static double tpc_outer_radius = 77. + 1.17; +} + void TPCInit() {} double TPC(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - overlappcheck = 1; - if (radius > 21-1.17) { - cout << "inconsistency: radius: " << radius - << " larger than tpc inner radius: " << 21-1.17 << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4tpc.so"); - gSystem->Load("libg4testbench.so"); + const int absorberactive = 0) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; - PHG4TPCSubsystem *tpc = new PHG4TPCSubsystem("TPC"); + PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); tpc->SetActive(); tpc->SuperDetector("TPC"); - // tpc_set_double_param("gas_inner_radius",21.); - // tpc_set_double_param("gas_outer_radius",77.); - // tpc_set_double_param("place_x", 0.); - // tpc_set_double_param("place_y", 0.); - // tpc_set_double_param("place_z", 0.); - // tpc_set_double_param("rot_x", 0.); - // tpc_set_double_param("rot_y", 0.); - // tpc_set_double_param("rot_z", 0.); - // tpc_set_double_param("tpc_length",211.); + tpc->set_double_param("steplimits", 1); // 1cm steps - // tpc_set_double_param("steplimits", NAN); - - // tpc_set_string_param("tpc_gas", "sPHENIX_TPC_Gas"); + if (AbsorberActive) + { + tpc->SetAbsorberActive(); + } + tpc->OverlapCheck(OverlapCheck); -// material budget: -// Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2. -// Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286 -// 250 um FR4 (Substrate for Cu layers) -// HoneyComb (nomex) 1/2 inch=0.5*2.54 cm - // tpc_set_string_param("cage_layer_1_material","G4_Cu"); - // tpc_set_double_param("cage_layer_1_thickness",0.00347/2.); + g4Reco->registerSubsystem(tpc); - // tpc_set_string_param("cage_layer_2_material","FR4"); - // tpc_set_double_param("cage_layer_2_thickness",0.025); + radius = G4TPC::tpc_outer_radius; - // tpc_set_string_param("cage_layer_3_material","NOMEX"); - // tpc_set_double_param("cage_layer_3_thickness",0.5*2.54); + radius += no_overlapp; - // tpc_set_string_param("cage_layer_4_material","G4_Cu"); - // tpc_set_double_param("cage_layer_4_thickness",0.00347/2.); + return radius; +} - // tpc_set_string_param("cage_layer_5_material","FR4"); - // tpc_set_double_param("cage_layer_5_thickness",0.025); +void TPC_Cells() +{ + + Fun4AllServer* se = Fun4AllServer::instance(); + + //========================= + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout + //========================= + + PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); + padplane->Verbosity(0); + + PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); + edrift->Detector("TPC"); + edrift->Verbosity(0); + // 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->set_double_param("added_smear_trans",0.085); + //edrift->set_double_param("added_smear_long",0.105); + 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_set_string_param("cage_layer_6_material","G4_KAPTON"); - // tpc_set_double_param("cage_layer_6_thickness",0.2286); +void TPC_Clustering() +{ + Fun4AllServer* se = Fun4AllServer::instance(); - // tpc_set_string_param("cage_layer_7_material","G4_Cu"); - // tpc_set_double_param("cage_layer_7_thickness",0.00347/2.); + // Tpc + //==== + 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(0); + 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; - // tpc_set_string_param("cage_layer_8_material","G4_KAPTON"); - // tpc_set_double_param("cage_layer_8_thickness",0.05); // 50 um + se->registerSubsystem(digitpc); - // tpc_set_string_param("cage_layer_9_material","G4_Cu"); - // tpc_set_double_param("cage_layer_9_thickness",0.00347/2.); - if (absorberactive) - { - tpc->SetAbsorberActive(); - } - tpc->OverlapCheck(overlapcheck); + //------------- + // Cluster Hits + //------------- - g4Reco->registerSubsystem( tpc ); + // For the Tpc + //========== + TpcClusterizer* tpcclusterizer = new TpcClusterizer(); + tpcclusterizer->Verbosity(0); + se->registerSubsystem(tpcclusterizer); - radius = 77.+1.17; - - radius += no_overlapp; - - return radius; } diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index fb248a42e..48f2832f0 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -4,6 +4,7 @@ #include "G4_Mvtx.C" #include "G4_Intt.C" +#include "G4_TPC.C" #include @@ -11,13 +12,6 @@ #include -#include -#include -#include -#include -#include - -#include #include #include @@ -37,14 +31,14 @@ R__LOAD_LIBRARY(libtrack_reco.so) // Tracking simulation setup parameters and flag - leave them alone! //============================================== - +/* ///////////////// TPC 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; - +*/ // Tracking reconstruction setup parameters and flags //===================================== const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events @@ -71,7 +65,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, { // The Tpc - always present! //================================ - gSystem->Load("libg4tpc.so"); +/* PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); tpc->SetActive(); @@ -90,7 +84,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, radius = 77. + 1.17; radius += no_overlapp; - +*/ return radius; } @@ -110,7 +104,7 @@ void Tracking_Cells(int verbosity = 0) // g4tpc/PHG4TpcElectronDrift uses // g4tpc/PHG4TpcPadPlaneReadout //========================= - +/* PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); padplane->Verbosity(0); @@ -130,7 +124,7 @@ void Tracking_Cells(int verbosity = 0) 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", n_tpc_layer_inner); padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); - +*/ return; } @@ -141,7 +135,7 @@ void Tracking_Clus(int verbosity = 0) //--------------- // Fun4All server //--------------- - +/* Fun4AllServer* se = Fun4AllServer::instance(); // Tpc @@ -167,7 +161,7 @@ void Tracking_Clus(int verbosity = 0) TpcClusterizer* tpcclusterizer = new TpcClusterizer(); tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); - +*/ } void Tracking_Reco(int verbosity = 0) @@ -213,12 +207,12 @@ void Tracking_Reco(int verbosity = 0) // find seed tracks using a subset of TPC layers int min_layers = 4; int nlayers_seeds = 12; - PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer, nlayers_seeds, min_layers); track_seed->Verbosity(0); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer); + PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); track_prop->Verbosity(0); se->registerSubsystem(track_prop); for(int i = 0;ido_cluster_eval(true); eval->do_g4hit_eval(true); eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... @@ -301,7 +295,7 @@ void Tracking_Reco(int verbosity = 0) // 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", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, n_gas_layer); evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From f3242bdefe6bd758b575c8af72382028595be75b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 21:07:45 -0400 Subject: [PATCH 0604/1222] vars need to be static --- macros/g4simulations/G4_Intt.C | 20 +++++++++++--------- macros/g4simulations/G4_Mvtx.C | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C index afbe78993..dbbaeffe5 100644 --- a/macros/g4simulations/G4_Intt.C +++ b/macros/g4simulations/G4_Intt.C @@ -26,27 +26,26 @@ namespace Enable static bool INTT = false; static bool INTT_OVERLAPCHECK = false; static int INTT_VERBOSITY = 0; - } // namespace Enable namespace G4INTT { - const int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely - const double intt_radius_max = 140.; // including stagger radius (mm) - const int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + static int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely + static double intt_radius_max = 140.; // including stagger radius (mm) + static int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI}; - const int nladder[4] = {15, 15, 18, 18}; - const double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default - const double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; + static int nladder[4] = {15, 15, 18, 18}; + static double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default + static 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 kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational }; - const enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + static enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here } // namespace G4INTT @@ -55,13 +54,16 @@ void InttInit() BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4INTT::intt_radius_max / 10.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +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 diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index c0f577376..d9fa1a0d7 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -29,7 +29,7 @@ namespace Enable namespace G4MVTX { - const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + static int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers } // namespace G4MVTX void MvtxInit() From 07ec939c4236684e3e335496dfabf5763a27466a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 21:08:03 -0400 Subject: [PATCH 0605/1222] first commit of working G4_TPC.C --- macros/g4simulations/G4Setup_fsPHENIX.C | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 65ddc81c9..297b3de9e 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -14,6 +14,7 @@ #include "G4_FEMC.C" #include "G4_FHCAL.C" #include "G4_Piston.C" +#include "G4_TPC.C" #include "G4_User.C" #include "G4_World.C" @@ -39,7 +40,7 @@ void DstCompress(Fun4AllDstOutputManager* out); void RunLoadTest() {} -void G4Init(bool do_svtx = true) +void G4Init() { // load detector/material macros and execute Init() function @@ -56,11 +57,10 @@ void G4Init(bool do_svtx = true) { InttInit(); } - if (do_svtx) - { - TrackingInit(); - } - + if (Enable::TPC) + { + TPCInit(); + } if (Enable::CEMC) { CEmcInit(); @@ -172,10 +172,10 @@ int G4Setup(const int absorberactive = 0, { radius = Intt(g4Reco, radius, absorberactive); } - //---------------------------------------- - // SVTX - if (do_svtx) radius = Tracking(g4Reco, radius, absorberactive); - + if (Enable::TPC) + { + radius = TPC(g4Reco, radius); + } //---------------------------------------- // CEMC // From 6943fb1d48fda07ec242d1c14dc7da922d3fc0d9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 21:08:29 -0400 Subject: [PATCH 0606/1222] first commit of working G4_TPC.C --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 5983b71dd..98b7e92d7 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -78,7 +78,7 @@ int Fun4All_G4_fsPHENIX( //====================== // What to run //====================== -// Enable::ABSORBER = true; +// Enable::ABSORBER = true; bool do_bbc = true; @@ -91,6 +91,10 @@ int Fun4All_G4_fsPHENIX( Enable::INTT = true; bool do_intt_cell = Enable::INTT && true; bool do_intt_cluster = do_intt_cell && true; + Enable::TPC = true; + Enable::TPC_ABSORBER = true; + bool do_tpc_cell = Enable::TPC && true; + bool do_tpc_cluster = do_tpc_cell && true; bool do_tracking = true; bool do_tracking_cell = do_tracking && true; @@ -160,7 +164,7 @@ int Fun4All_G4_fsPHENIX( // establish the geometry and reconstruction setup - G4Init(do_tracking); + G4Init(); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -284,8 +288,9 @@ int Fun4All_G4_fsPHENIX( if (do_mvtx_cell) Mvtx_Cells(); if (do_intt_cell) Intt_Cells(); + if (do_tpc_cell) TPC_Cells(); - if (do_tracking_cell) Tracking_Cells(); +// if (do_tracking_cell) Tracking_Cells(); if (do_cemc_cell) CEMC_Cells(); @@ -326,7 +331,8 @@ int Fun4All_G4_fsPHENIX( //-------------- if (do_mvtx_cluster) Mvtx_Clustering(); if (do_intt_cluster) Intt_Clustering(); - if (do_tracking_cluster) Tracking_Clus(); + if (do_tpc_cluster) TPC_Clustering(); +// if (do_tracking_cluster) Tracking_Clus(); if (do_tracking_track) Tracking_Reco(); From 2c517d46ba8b31d120baabbbaa5409bcf5bf3561 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 22:17:44 -0400 Subject: [PATCH 0607/1222] remove do_tracking --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 8 +------- macros/g4simulations/G4Setup_fsPHENIX.C | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 98b7e92d7..62b3d2c87 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -73,7 +73,7 @@ int Fun4All_G4_fsPHENIX( const bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = false; + const bool do_DSTReader = true; //====================== // What to run @@ -267,7 +267,6 @@ int Fun4All_G4_fsPHENIX( //--------------------- G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, magfield_rescale); } @@ -277,7 +276,6 @@ int Fun4All_G4_fsPHENIX( if (do_bbc) { - gROOT->LoadMacro("G4_Bbc.C"); BbcInit(); Bbc_Reco(); } @@ -290,8 +288,6 @@ int Fun4All_G4_fsPHENIX( if (do_intt_cell) Intt_Cells(); if (do_tpc_cell) TPC_Cells(); -// if (do_tracking_cell) Tracking_Cells(); - if (do_cemc_cell) CEMC_Cells(); if (do_hcalin_cell) HCALInner_Cells(); @@ -332,7 +328,6 @@ int Fun4All_G4_fsPHENIX( if (do_mvtx_cluster) Mvtx_Clustering(); if (do_intt_cluster) Intt_Clustering(); if (do_tpc_cluster) TPC_Clustering(); -// if (do_tracking_cluster) Tracking_Clus(); if (do_tracking_track) Tracking_Reco(); @@ -439,7 +434,6 @@ int Fun4All_G4_fsPHENIX( G4DSTreader_fsPHENIX( outputFile, // /*int*/ absorberactive , - /*bool*/ do_tracking , /*bool*/ Enable::CEMC , /*bool*/ Enable::HCALIN, /*bool*/ Enable::MAGNET, diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 297b3de9e..9473ecbf7 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -119,7 +119,6 @@ void G4Init() int G4Setup(const int absorberactive = 0, const string &field ="1.5", const EDecayType decayType = EDecayType::kAll, - const bool do_svtx = true, const float magfield_rescale = 1.0) { //--------------- From f913931e45b5b43620ebd561e03d14f56d0efeb1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 22:21:58 -0400 Subject: [PATCH 0608/1222] move TPC to G4_TPC.C --- macros/g4simulations/G4_Tracking_fsPHENIX.C | 118 +------------------- 1 file changed, 2 insertions(+), 116 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index 48f2832f0..5fd6db3fc 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -24,21 +24,11 @@ #include -R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libtrack_reco.so) // Tracking simulation setup parameters and flag - leave them alone! //============================================== -/* -///////////////// TPC -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; -*/ // Tracking reconstruction setup parameters and flags //===================================== const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events @@ -59,111 +49,6 @@ void TrackingInit(int verbosity = 0) { } -double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - // The Tpc - always present! - //================================ -/* - - PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); - tpc->SetActive(); - tpc->SuperDetector("TPC"); - tpc->set_double_param("steplimits", 1); - // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - - if (absorberactive) - { - tpc->SetAbsorberActive(); - } - tpc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(tpc); - - radius = 77. + 1.17; - - radius += no_overlapp; -*/ - return radius; -} - -void Tracking_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (TrkrHits) - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - //========================= - // setup Tpc readout for filling cells - // g4tpc/PHG4TpcElectronDrift uses - // g4tpc/PHG4TpcPadPlaneReadout - //========================= -/* - PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); - padplane->Verbosity(0); - - PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); - edrift->Detector("TPC"); - edrift->Verbosity(0); - // 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->set_double_param("added_smear_trans",0.085); - //edrift->set_double_param("added_smear_long",0.105); - 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", n_tpc_layer_inner); - padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); -*/ - return; -} - -void Tracking_Clus(int verbosity = 0) -{ - // processes the TrkrHits to make clusters, then reconstruct tracks and vertices - - //--------------- - // Fun4All server - //--------------- -/* - Fun4AllServer* se = Fun4AllServer::instance(); - - // Tpc - //==== - 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(0); - 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); - - //------------- - // Cluster Hits - //------------- - - // For the Tpc - //========== - TpcClusterizer* tpcclusterizer = new TpcClusterizer(); - tpcclusterizer->Verbosity(0); - se->registerSubsystem(tpcclusterizer); -*/ -} - void Tracking_Reco(int verbosity = 0) { // processes the TrkrHits to make clusters, then reconstruct tracks and vertices @@ -295,7 +180,8 @@ void Tracking_Reco(int verbosity = 0) // 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", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); evalp->do_cluster_eval(true); + evalp = new SvtxEvaluator("SVTXEVALUATOR", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); + evalp->do_cluster_eval(true); evalp->do_g4hit_eval(true); evalp->do_hit_eval(false); evalp->do_gpoint_eval(false); From e25ae3f0ed342f6195de84ff407392bf556bf454 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 22:22:39 -0400 Subject: [PATCH 0609/1222] remove obsolete do_tracking flags --- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 25 +++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C index 1ba2f613e..8ca92614b 100644 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ b/macros/g4simulations/G4_DSTReader_fsPHENIX.C @@ -1,9 +1,15 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + +#include "G4_INTT.C" +#include "G4_MVTX.C" +#include "G4_TPC.C" + #include + +#include + R__LOAD_LIBRARY(libg4eval.so) -#endif + ////////////////////////////////////////////////////////////////// /*! @@ -22,7 +28,6 @@ void G4DSTreader_fsPHENIXInit() {} 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, // @@ -59,9 +64,17 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// if (save_g4_raw) { - if (do_svtx) + if (Enable::MVTX) + { + ana->AddNode("MVTX"); + } + if (Enable::INTT) + { + ana->AddNode("INTT"); + } + if (Enable::TPC) { - ana->AddNode("SVTX"); + ana->AddNode("TPC"); } if (do_cemc) From 8dce0b176a1fada8fc354d541e0e74775d8847c2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 22:22:57 -0400 Subject: [PATCH 0610/1222] remove obsolete do_tracking flags --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 62b3d2c87..a1cdce3fa 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -88,18 +88,17 @@ int Fun4All_G4_fsPHENIX( Enable::MVTX = true; bool do_mvtx_cell = Enable::MVTX && true; bool do_mvtx_cluster = do_mvtx_cell && true; + Enable::INTT = true; bool do_intt_cell = Enable::INTT && true; bool do_intt_cluster = do_intt_cell && true; + Enable::TPC = true; Enable::TPC_ABSORBER = true; bool do_tpc_cell = Enable::TPC && true; bool do_tpc_cluster = do_tpc_cell && true; - bool do_tracking = true; - bool do_tracking_cell = do_tracking && true; - bool do_tracking_cluster = do_tracking_cell && true; - bool do_tracking_track = do_tracking_cluster && true; + bool do_tracking_track = do_tpc_cell && do_intt_cell && do_mvtx_cell && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run From e03ee72731b421f7f726c929716ab88aa7352713 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 22:24:24 -0400 Subject: [PATCH 0611/1222] clang-format --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 353 ++++++++++----------- macros/g4simulations/G4Setup_fsPHENIX.C | 157 ++++----- macros/g4simulations/G4_TPC.C | 28 +- 3 files changed, 268 insertions(+), 270 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index a1cdce3fa..5067341ff 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -1,22 +1,22 @@ #pragma once -#include "GlobalVariables.C" #include "DisplayOn.C" #include "G4Setup_fsPHENIX.C" #include "G4_Bbc.C" -#include "G4_Global.C" #include "G4_CaloTrigger.C" -#include "G4_Jets.C" -#include "G4_FwdJets.C" #include "G4_DSTReader_fsPHENIX.C" +#include "G4_FwdJets.C" +#include "G4_Global.C" +#include "G4_Jets.C" +#include "GlobalVariables.C" #include -#include #include -#include +#include #include #include +#include #include @@ -24,14 +24,14 @@ #include -#include -#include -#include -#include -#include #include -#include #include +#include +#include +#include +#include +#include +#include #include @@ -42,9 +42,9 @@ R__LOAD_LIBRARY(libPHPythia8.so) 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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") + 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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { //=============== // Input options @@ -57,7 +57,7 @@ int Fun4All_G4_fsPHENIX( 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 + const bool readhepmc = false; // read HepMC files // Or: // Use particle generator const bool runpythia8 = false; @@ -78,10 +78,10 @@ int Fun4All_G4_fsPHENIX( //====================== // What to run //====================== -// Enable::ABSORBER = true; + // Enable::ABSORBER = true; bool do_bbc = true; - + Enable::PIPE = true; Enable::PIPE_OVERLAPCHECK = false; // central tracking @@ -98,7 +98,7 @@ int Fun4All_G4_fsPHENIX( bool do_tpc_cell = Enable::TPC && true; bool do_tpc_cluster = do_tpc_cell && true; - bool do_tracking_track = do_tpc_cell && do_intt_cell && do_mvtx_cell && true; + bool do_tracking_track = do_tpc_cell && do_intt_cell && do_mvtx_cell && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run @@ -109,7 +109,7 @@ int Fun4All_G4_fsPHENIX( bool do_cemc_eval = do_cemc_cluster && true; Enable::HCALIN = false; - bool do_hcalin_cell = Enable::HCALIN && true; + bool do_hcalin_cell = Enable::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; @@ -134,8 +134,8 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry Enable::FGEM = false; - bool do_FGEM_track = Enable::FGEM && true; - bool do_FGEM_eval = do_FGEM_track && true; + bool do_FGEM_track = Enable::FGEM && true; + bool do_FGEM_eval = do_FGEM_track && true; Enable::FEMC = false; Enable::FEMC_ABSORBER = true; @@ -158,31 +158,30 @@ int Fun4All_G4_fsPHENIX( Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C -// Enable::BLACKHOLE = true; + // Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - // establish the geometry and reconstruction setup G4Init(); - int absorberactive = 1; // set to 1 to make all absorbers active volumes + int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4/1.5; // make consistent with Fun4All_G4_sPHENIX() + const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + const float magfield_rescale = -1.4 / 1.5; // make consistent with Fun4All_G4_sPHENIX() //--------------- // Fun4All server //--------------- bool display_on = false; - if(display_on) - { - gROOT->LoadMacro("DisplayOn.C"); - } + if (display_on) + { + gROOT->LoadMacro("DisplayOn.C"); + } 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 + // 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 @@ -193,92 +192,95 @@ int Fun4All_G4_fsPHENIX( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation //----------------- if (readhits) + { + // Get the hits from a file + // The input manager is declared later + if (do_embedding) { - // 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."<Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - } + { + gSystem->Load("libPHPythia8.so"); + + PHPythia8 *pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + pythia8->set_config_file("phpythia8.cfg"); + se->registerSubsystem(pythia8); + } else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); + { + gSystem->Load("libPHPythia6.so"); - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - } + PHPythia6 *pythia6 = new PHPythia6(); + pythia6->set_config_file("phpythia6.cfg"); + se->registerSubsystem(pythia6); + } 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 { - // 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(-3.0, 3.0); - //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD - gen->set_phi_range(-1.0*M_PI, 1.0*M_PI); - //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); - gen->set_p_range(10.0, 10.0); - gen->Embed(1); - gen->Verbosity(0); - se->registerSubsystem(gen); + 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(-3.0, 3.0); + //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD + gen->set_phi_range(-1.0 * M_PI, 1.0 * M_PI); + //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); + gen->set_p_range(10.0, 10.0); + gen->Embed(1); + gen->Verbosity(0); + se->registerSubsystem(gen); + } if (!readhits) - { - //--------------------- - // Detector description - //--------------------- + { + //--------------------- + // Detector description + //--------------------- - G4Setup(absorberactive, magfield, EDecayType::kAll, - magfield_rescale); - } + G4Setup(absorberactive, magfield, EDecayType::kAll, + magfield_rescale); + } //--------- // BBC Reco //--------- - - if (do_bbc) - { - BbcInit(); - Bbc_Reco(); - } - + + if (do_bbc) + { + BbcInit(); + Bbc_Reco(); + } + //------------------ // Detector Division //------------------ @@ -306,7 +308,7 @@ int Fun4All_G4_fsPHENIX( //----------------------------- // HCAL towering and clustering //----------------------------- - + if (do_hcalin_twr) HCALInner_Towers(); if (do_hcalin_cluster) HCALInner_Clusters(); @@ -320,7 +322,7 @@ int Fun4All_G4_fsPHENIX( if (do_FHCAL_cluster) FHCAL_Clusters(); if (do_dst_compress) ShowerCompress(); - + //-------------- // SVTX tracking //-------------- @@ -334,39 +336,39 @@ int Fun4All_G4_fsPHENIX( // FGEM tracking //-------------- - if(do_FGEM_track) FGEM_FastSim_Reco(); + if (do_FGEM_track) FGEM_FastSim_Reco(); //----------------- // Global Vertexing //----------------- - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } + if (do_global) + { + gROOT->LoadMacro("G4_Global.C"); + Global_Reco(); + } + + else if (do_global_fastsim) + { + gROOT->LoadMacro("G4_Global.C"); + Global_FastSim(); + } - 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_jet_reco) + { + gROOT->LoadMacro("G4_Jets.C"); + Jet_Reco(); + } + if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } + { + gROOT->LoadMacro("G4_FwdJets.C"); + Jet_FwdReco(); + } //---------------------- // Simulation evaluation //---------------------- @@ -385,17 +387,17 @@ int Fun4All_G4_fsPHENIX( if (do_FGEM_eval) FGEM_FastSim_Eval("g4tracking_fgem_eval.root"); - //-------------- + //-------------- // IO management //-------------- if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } + { + // Hits file + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); + hitsin->fileopen(inputFile); + se->registerInputManager(hitsin); + } if (do_embedding) { if (embed_input_file == NULL) @@ -407,51 +409,51 @@ int Fun4All_G4_fsPHENIX( gSystem->Load("libg4dst.so"); Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - in1->AddFile(embed_input_file); // if one use a single input file -// in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning + in1->AddFile(embed_input_file); // if one use a single input file + // in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning se->registerInputManager(in1); } if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } + { + 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 ); - } + { + // 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*/ Enable::CEMC , - /*bool*/ Enable::HCALIN, - /*bool*/ Enable::MAGNET, - /*bool*/ Enable::HCALOUT, - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_hcalout_twr, - /*bool*/ Enable::FGEM, - /*bool*/ Enable::FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ Enable::FEMC, - /*bool*/ do_FEMC_twr - ); - } + { + //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*/ Enable::CEMC, + /*bool*/ Enable::HCALIN, + /*bool*/ Enable::MAGNET, + /*bool*/ Enable::HCALOUT, + /*bool*/ do_cemc_twr, + /*bool*/ do_hcalin_twr, + /*bool*/ do_hcalout_twr, + /*bool*/ Enable::FGEM, + /*bool*/ Enable::FHCAL, + /*bool*/ do_FHCAL_twr, + /*bool*/ Enable::FEMC, + /*bool*/ do_FEMC_twr); + } - if(do_write_output) { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (do_dst_compress) DstCompress(out); - se->registerOutputManager(out); + if (do_write_output) + { + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); + if (do_dst_compress) DstCompress(out); + se->registerOutputManager(out); } //----------------- @@ -469,14 +471,14 @@ int Fun4All_G4_fsPHENIX( return 0; } - if(display_on) - { - DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; - } + if (display_on) + { + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; + } se->run(nEvents); @@ -484,7 +486,6 @@ int Fun4All_G4_fsPHENIX( // Exit //----- - se->End(); std::cout << "All done" << std::endl; delete se; @@ -492,9 +493,7 @@ int Fun4All_G4_fsPHENIX( return 0; } - -void -G4Cmd(const char * cmd) +void G4Cmd(const char *cmd) { Fun4AllServer *se = Fun4AllServer::instance(); PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 9473ecbf7..9804caafa 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -1,22 +1,22 @@ #pragma once -#include "GlobalVariables.C" #include "G4_BlackHole.C" -#include "G4_Pipe.C" -#include "G4_PlugDoor_fsPHENIX.C" -#include "G4_Tracking_fsPHENIX.C" #include "G4_CEmc_Spacal.C" +#include "G4_FEMC.C" +#include "G4_FGEM_fsPHENIX.C" +#include "G4_FHCAL.C" #include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" #include "G4_Magnet.C" #include "G4_Mvtx.C" -#include "G4_HcalOut_ref.C" -#include "G4_FGEM_fsPHENIX.C" -#include "G4_FEMC.C" -#include "G4_FHCAL.C" +#include "G4_Pipe.C" #include "G4_Piston.C" +#include "G4_PlugDoor_fsPHENIX.C" #include "G4_TPC.C" +#include "G4_Tracking_fsPHENIX.C" #include "G4_User.C" #include "G4_World.C" +#include "GlobalVariables.C" #include @@ -24,9 +24,9 @@ #include +#include #include #include -#include #include @@ -36,19 +36,18 @@ R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) void ShowerCompress(int verbosity = 0); -void DstCompress(Fun4AllDstOutputManager* out); +void DstCompress(Fun4AllDstOutputManager *out); void RunLoadTest() {} void G4Init() { - // load detector/material macros and execute Init() function if (Enable::PIPE) - { - PipeInit(); - } + { + PipeInit(); + } if (Enable::MVTX) { MvtxInit(); @@ -62,38 +61,38 @@ void G4Init() TPCInit(); } if (Enable::CEMC) - { - CEmcInit(); - } + { + CEmcInit(); + } - if (Enable::HCALIN) - { - HCalInnerInit(); - } + if (Enable::HCALIN) + { + HCalInnerInit(); + } if (Enable::MAGNET) - { - MagnetInit(); - } + { + MagnetInit(); + } if (Enable::HCALOUT) - { - HCalOuterInit(); - } + { + HCalOuterInit(); + } if (Enable::FGEM) - { - FGEM_Init(); - } + { + FGEM_Init(); + } if (Enable::FEMC) - { - FEMCInit(); - } + { + FEMCInit(); + } - if (Enable::FHCAL) - { - FHCALInit(); - } + if (Enable::FHCAL) + { + FHCALInit(); + } if (Enable::PISTON) { PistonInit(); @@ -112,15 +111,13 @@ void G4Init() { BlackHoleInit(); } - } - int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = EDecayType::kAll, - const float magfield_rescale = 1.0) { - + const string &field = "1.5", + const EDecayType decayType = EDecayType::kAll, + const float magfield_rescale = 1.0) +{ //--------------- // Fun4All server //--------------- @@ -131,30 +128,36 @@ int G4Setup(const int absorberactive = 0, HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST + PHG4Reco *g4Reco = new PHG4Reco(); + g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST WorldInit(g4Reco); - g4Reco->set_rapidity_coverage(1.1); // according to drawings + g4Reco->set_rapidity_coverage(1.1); // according to drawings if (decayType != EDecayType::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 (stringline.fail()) + { // conversion to double fails -> we have a string - if (field.find("sPHENIX.root") != string::npos) { + if (field.find("sPHENIX.root") != string::npos) + { g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); - } else { + } + else + { g4Reco->set_field_map(field, PHFieldConfig::kField2D); } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field + } + else + { + g4Reco->set_field(fieldstrength); // use const soleniodal field } g4Reco->set_field_rescale(magfield_rescale); - + double radius = 0.; //---------------------------------------- @@ -177,40 +180,40 @@ int G4Setup(const int absorberactive = 0, } //---------------------------------------- // CEMC -// + // if (Enable::CEMC) { radius = CEmc(g4Reco, radius, 8, absorberactive); } - + //---------------------------------------- // HCALIN - + if (Enable::HCALIN) { - radius = HCalInner(g4Reco, radius, 4, absorberactive); + radius = HCalInner(g4Reco, radius, 4, absorberactive); } //---------------------------------------- // MAGNET - + if (Enable::MAGNET) { - radius = Magnet(g4Reco, radius, 0, absorberactive); + radius = Magnet(g4Reco, radius, 0, absorberactive); } //---------------------------------------- // HCALOUT - + if (Enable::HCALOUT) { - radius = HCalOuter(g4Reco, radius, 4, absorberactive); + radius = HCalOuter(g4Reco, radius, 4, absorberactive); } //---------------------------------------- // Forward tracking - if ( Enable::FGEM ) + if (Enable::FGEM) { FGEMSetup(g4Reco); } @@ -218,7 +221,7 @@ int G4Setup(const int absorberactive = 0, //---------------------------------------- // FEMC - if ( Enable::FEMC ) + if (Enable::FEMC) { FEMCSetup(g4Reco); } @@ -255,16 +258,15 @@ int G4Setup(const int absorberactive = 0, // finally adjust the world size in case the default is too small WorldSize(g4Reco, radius); - se->registerSubsystem( g4Reco ); + se->registerSubsystem(g4Reco); return 0; } - -void ShowerCompress(int verbosity = 0) { - +void ShowerCompress(int verbosity = 0) +{ Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); compress->AddHitContainer("G4HIT_PIPE"); compress->AddHitContainer("G4HIT_SVTXSUPPORT"); compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); @@ -296,7 +298,7 @@ void ShowerCompress(int verbosity = 0) { compress->AddHitContainer("G4HIT_FEMC"); compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); compress->AddHitContainer("G4HIT_FHCAL"); - compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); + compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); compress->AddCellContainer("G4CELL_FEMC"); compress->AddCellContainer("G4CELL_FHCAL"); compress->AddTowerContainer("TOWER_SIM_FEMC"); @@ -305,14 +307,16 @@ void ShowerCompress(int verbosity = 0) { compress->AddTowerContainer("TOWER_SIM_FHCAL"); compress->AddTowerContainer("TOWER_RAW_FHCAL"); compress->AddTowerContainer("TOWER_CALIB_FHCAL"); - + se->registerSubsystem(compress); - - return; + + return; } -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { +void DstCompress(Fun4AllDstOutputManager *out) +{ + if (out) + { out->StripNode("G4HIT_PIPE"); out->StripNode("G4HIT_SVTXSUPPORT"); out->StripNode("G4HIT_CEMC_ELECTRONICS"); @@ -335,9 +339,8 @@ void DstCompress(Fun4AllDstOutputManager* out) { out->StripNode("G4HIT_FEMC"); out->StripNode("G4HIT_ABSORBER_FEMC"); out->StripNode("G4HIT_FHCAL"); - out->StripNode("G4HIT_ABSORBER_FHCAL"); + out->StripNode("G4HIT_ABSORBER_FHCAL"); out->StripNode("G4CELL_FEMC"); out->StripNode("G4CELL_FHCAL"); } } - diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index 12e8e241e..8c02e035d 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -2,8 +2,8 @@ #include "GlobalVariables.C" -#include "G4_Mvtx.C" #include "G4_Intt.C" +#include "G4_Mvtx.C" #include #include @@ -30,20 +30,19 @@ namespace Enable namespace G4TPC { -static int n_tpc_layer_inner = 16; -static int tpc_layer_rphi_count_inner = 1152; -static int n_tpc_layer_mid = 16; -static int n_tpc_layer_outer = 16; -static int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + static int n_tpc_layer_inner = 16; + static int tpc_layer_rphi_count_inner = 1152; + static int n_tpc_layer_mid = 16; + static int n_tpc_layer_outer = 16; + static int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; static double tpc_outer_radius = 77. + 1.17; -} - +} // namespace G4TPC void TPCInit() {} double TPC(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0) + double radius, + const int absorberactive = 0) { bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; @@ -51,7 +50,7 @@ double TPC(PHG4Reco* g4Reco, PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); tpc->SetActive(); tpc->SuperDetector("TPC"); - tpc->set_double_param("steplimits", 1); // 1cm steps + tpc->set_double_param("steplimits", 1); // 1cm steps if (AbsorberActive) { @@ -70,7 +69,6 @@ double TPC(PHG4Reco* g4Reco, void TPC_Cells() { - Fun4AllServer* se = Fun4AllServer::instance(); //========================= @@ -79,10 +77,10 @@ void TPC_Cells() // g4tpc/PHG4TpcPadPlaneReadout //========================= - PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); + PHG4TpcPadPlane* padplane = new PHG4TpcPadPlaneReadout(); padplane->Verbosity(0); - PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); + PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); edrift->Verbosity(0); // fudge factors to get drphi 150 microns (in mid and outer Tpc) and dz 500 microns cluster resolution @@ -127,6 +125,4 @@ void TPC_Clustering() TpcClusterizer* tpcclusterizer = new TpcClusterizer(); tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); - - } From 39056f952606f04f2b371db46b8f94eac3749752 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 23:42:01 -0400 Subject: [PATCH 0612/1222] fix typo --- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C index 8ca92614b..e74da4b49 100644 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ b/macros/g4simulations/G4_DSTReader_fsPHENIX.C @@ -1,7 +1,7 @@ #pragma once -#include "G4_INTT.C" -#include "G4_MVTX.C" +#include "G4_Intt.C" +#include "G4_Mvtx.C" #include "G4_TPC.C" #include From 8d4c54f695d79c19fa693d242f845a1bf0a2cc29 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 29 May 2020 23:43:01 -0400 Subject: [PATCH 0613/1222] get rid of absG4Setup_fsPHENIX.Corberactive flag --- macros/g4simulations/G4Setup_fsPHENIX.C | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 9804caafa..0e9381132 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -113,8 +113,7 @@ void G4Init() } } -int G4Setup(const int absorberactive = 0, - const string &field = "1.5", +int G4Setup(const string &field = "1.5", const EDecayType decayType = EDecayType::kAll, const float magfield_rescale = 1.0) { @@ -164,15 +163,15 @@ int G4Setup(const int absorberactive = 0, // PIPE if (Enable::PIPE) { - radius = Pipe(g4Reco, radius, absorberactive); + radius = Pipe(g4Reco, radius); } if (Enable::MVTX) { - radius = Mvtx(g4Reco, radius, absorberactive); + radius = Mvtx(g4Reco, radius); } if (Enable::INTT) { - radius = Intt(g4Reco, radius, absorberactive); + radius = Intt(g4Reco, radius); } if (Enable::TPC) { @@ -183,7 +182,7 @@ int G4Setup(const int absorberactive = 0, // if (Enable::CEMC) { - radius = CEmc(g4Reco, radius, 8, absorberactive); + radius = CEmc(g4Reco, radius, 8); } //---------------------------------------- @@ -191,7 +190,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::HCALIN) { - radius = HCalInner(g4Reco, radius, 4, absorberactive); + radius = HCalInner(g4Reco, radius, 4); } //---------------------------------------- @@ -199,7 +198,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::MAGNET) { - radius = Magnet(g4Reco, radius, 0, absorberactive); + radius = Magnet(g4Reco, radius, 0); } //---------------------------------------- @@ -207,7 +206,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::HCALOUT) { - radius = HCalOuter(g4Reco, radius, 4, absorberactive); + radius = HCalOuter(g4Reco, radius, 4); } //---------------------------------------- From c6c0dd9115cd99d503a2676715ee9b9fe52ccf70 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 30 May 2020 12:52:54 -0400 Subject: [PATCH 0614/1222] remove static keyword from namespace --- macros/g4simulations/G4_Aerogel.C | 2 +- macros/g4simulations/G4_HcalIn_ref.C | 18 +++++++++--------- macros/g4simulations/G4_HcalOut_ref.C | 12 ++++++------ macros/g4simulations/G4_RICH.C | 2 +- macros/g4simulations/G4_User.C | 4 ++-- macros/g4simulations/GlobalVariables.C | 16 ++++++++-------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C index fe02bf441..767828ead 100644 --- a/macros/g4simulations/G4_Aerogel.C +++ b/macros/g4simulations/G4_Aerogel.C @@ -16,7 +16,7 @@ namespace Enable { - static bool AEROGEL = false; + bool AEROGEL = false; } void AerogelInit() diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index 6db80d19f..b9e5ee922 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -30,24 +30,24 @@ void HCalInner_SupportRing(PHG4Reco *g4Reco, namespace Enable { - static bool HCALIN = false; - static bool HCALIN_ABSORBER = false; - static bool HCALIN_OVERLAPCHECK = false; - static int HCALIN_VERBOSITY = 0; + bool HCALIN = false; + bool HCALIN_ABSORBER = false; + bool HCALIN_OVERLAPCHECK = false; + int HCALIN_VERBOSITY = 0; } // namespace Enable namespace G4HCALIN { - const double support_ring_outer_radius = 178.0 - 0.001; - const double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; - const double dz = 25. / 10.; + 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 - const bool inner_hcal_material_Al = true; + bool inner_hcal_material_Al = true; - static int inner_hcal_eic = 0; + int inner_hcal_eic = 0; enum enu_HCalIn_clusterizer { diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 797c4679f..f3606e31d 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -25,16 +25,16 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool HCALOUT = false; - static bool HCALOUT_ABSORBER = false; - static bool HCALOUT_OVERLAPCHECK = false; - static int HCALOUT_VERBOSITY = 0; + bool HCALOUT = false; + bool HCALOUT_ABSORBER = false; + bool HCALOUT_OVERLAPCHECK = false; + int HCALOUT_VERBOSITY = 0; } // namespace Enable namespace G4HCALOUT { - const double outer_radius = 264.71; - const double size_z = 304.91 * 2; + double outer_radius = 264.71; + double size_z = 304.91 * 2; enum enu_HCalOut_clusterizer { kHCalOutGraphClusterizer, diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C index 7ab61c8e6..acc637a56 100644 --- a/macros/g4simulations/G4_RICH.C +++ b/macros/g4simulations/G4_RICH.C @@ -17,7 +17,7 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool RICH = false; + bool RICH = false; } void RICHInit() diff --git a/macros/g4simulations/G4_User.C b/macros/g4simulations/G4_User.C index b23de91b3..f1838eee4 100644 --- a/macros/g4simulations/G4_User.C +++ b/macros/g4simulations/G4_User.C @@ -2,12 +2,12 @@ namespace Enable { - static bool USER = false; + bool USER = false; } namespace G4USER { - static int myparam = 0; + int myparam = 0; } void UserInit(int verbosity = 0) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 6c9ff3ffd..a2cc0d944 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -4,9 +4,9 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volu namespace Enable { - static bool OVERLAPCHECK = false; - static bool ABSORBER = false; - static int VERBOSITY = 0; + bool OVERLAPCHECK = false; + bool ABSORBER = false; + int VERBOSITY = 0; } // every G4 subsystem needs to implement this @@ -14,9 +14,9 @@ namespace Enable // let's put this into the GlobalVariables.C namespace BlackHoleGeometry { - static double max_radius = 0.; // this is needed for the overall dimension of the black hole - static double min_z = 0.; - static double max_z = 0.; - static double gap = no_overlapp; - static bool visible = false; + 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 From 48d3aacb2b7f108e4059169e55bb4e0a395f9fbf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 30 May 2020 12:56:04 -0400 Subject: [PATCH 0615/1222] remove static keyword from namespace --- macros/g4simulations/G4_BlackHole.C | 2 +- macros/g4simulations/G4_CEmc_EIC.C | 2 +- macros/g4simulations/G4_CEmc_Spacal.C | 8 ++++---- macros/g4simulations/G4_DIRC.C | 14 +++++++------- macros/g4simulations/G4_EEMC.C | 8 ++++---- macros/g4simulations/G4_FEMC.C | 12 ++++++------ macros/g4simulations/G4_FEMC_EIC.C | 2 +- macros/g4simulations/G4_FGEM_fsPHENIX.C | 4 ++-- macros/g4simulations/G4_FHCAL.C | 10 +++++----- macros/g4simulations/G4_GEM_EIC.C | 4 ++-- macros/g4simulations/G4_Intt.C | 20 ++++++++++---------- macros/g4simulations/G4_Magnet.C | 12 ++++++------ macros/g4simulations/G4_Mvtx.C | 8 ++++---- macros/g4simulations/G4_Mvtx_EIC.C | 12 ++++++------ macros/g4simulations/G4_PSTOF.C | 2 +- macros/g4simulations/G4_Pipe.C | 20 ++++++++++---------- macros/g4simulations/G4_Pipe_EIC.C | 18 +++++++++--------- macros/g4simulations/G4_Piston.C | 14 +++++++------- macros/g4simulations/G4_PlugDoor_EIC.C | 16 ++++++++-------- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 14 +++++++------- macros/g4simulations/G4_TPC.C | 20 ++++++++++---------- macros/g4simulations/G4_TPC_EIC.C | 2 +- macros/g4simulations/G4_Tracking_EIC.C | 2 +- 23 files changed, 113 insertions(+), 113 deletions(-) diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C index f4ca08ba5..cbf64b26e 100644 --- a/macros/g4simulations/G4_BlackHole.C +++ b/macros/g4simulations/G4_BlackHole.C @@ -9,7 +9,7 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool BLACKHOLE = false; + bool BLACKHOLE = false; } void BlackHoleInit() {} diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index e848adc7a..cf1581351 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -27,7 +27,7 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool CEMC = false; + bool CEMC = false; } namespace G4CEMC diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 58c02314e..fd50bd9a2 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -36,10 +36,10 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool CEMC = false; - static bool CEMC_ABSORBER = false; - static bool CEMC_OVERLAPCHECK = false; - static int CEMC_VERBOSITY = 0; + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + int CEMC_VERBOSITY = 0; } // namespace Enable namespace G4CEMC diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C index ee10e6cf3..3846bd993 100644 --- a/macros/g4simulations/G4_DIRC.C +++ b/macros/g4simulations/G4_DIRC.C @@ -21,17 +21,17 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool DIRC = false; + bool DIRC = false; } namespace G4DIRC { - const double radiator_R = 83.65; - const double length = 400; - const double z_shift = -75; //115 - const double z_start = z_shift + length / 2.; - const double z_end = z_shift - length / 2.; - const double outer_skin_radius = 89.25; + double radiator_R = 83.65; + double length = 400; + double z_shift = -75; //115 + double z_start = z_shift + length / 2.; + double z_end = z_shift - length / 2.; + double outer_skin_radius = 89.25; } // namespace G4DIRC void DIRCInit() diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index f0e857524..5b3624cbb 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -23,14 +23,14 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool EEMC = false; + bool EEMC = false; } namespace G4EEMC { - const int use_projective_geometry = 0; - const double Gdz = 18. + 0.0001; - const double Gz0 = -170.; + int use_projective_geometry = 0; + double Gdz = 18. + 0.0001; + double Gz0 = -170.; } // namespace G4EEMC void EEMCInit() diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index ebc72d6de..1e00f21fe 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -25,17 +25,17 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool FEMC = false; - static bool FEMC_ABSORBER = false; - static int FEMC_VERBOSITY = 0; + bool FEMC = false; + bool FEMC_ABSORBER = false; + int FEMC_VERBOSITY = 0; } // namespace Enable namespace G4FEMC { // from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt - const double Gz0 = 305.; - const double Gdz = 40.; - const double outer_radius = 180.; + double Gz0 = 305.; + double Gdz = 40.; + double outer_radius = 180.; string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; enum enu_Femc_clusterizer { diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index b918a3f7d..48683625f 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -20,7 +20,7 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool FEMC = false; + bool FEMC = false; } namespace G4FEMC diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index c5296360e..ebdc53258 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -21,8 +21,8 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); namespace Enable { - static bool FGEM = false; - static bool FGEM_OVERLAPCHECK = false; + bool FGEM = false; + bool FGEM_OVERLAPCHECK = false; } void FGEM_Init() diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index fa6f4dbc2..2aaa70852 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -24,16 +24,16 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - static bool FHCAL = false; - static bool FHCAL_ABSORBER = false; + bool FHCAL = false; + bool FHCAL_ABSORBER = false; } namespace G4FHCAL { // from ForwardHcal/mapping/towerMap_FHCAL_v005.txt - const double Gz0 = 400.; - const double Gdz = 100.; - const double outer_radius = 262.; + double Gz0 = 400.; + double Gdz = 100.; + double outer_radius = 262.; } // namespace G4FHCAL void FHCALInit() diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index b8fe650d2..e5181ab60 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -20,8 +20,8 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmi namespace Enable { - static bool EGEM = false; - static bool FGEM = false; + bool EGEM = false; + bool FGEM = false; } // namespace Enable void EGEM_Init() diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C index dbbaeffe5..845d5718b 100644 --- a/macros/g4simulations/G4_Intt.C +++ b/macros/g4simulations/G4_Intt.C @@ -23,29 +23,29 @@ R__LOAD_LIBRARY(libintt.so) namespace Enable { - static bool INTT = false; - static bool INTT_OVERLAPCHECK = false; - static int INTT_VERBOSITY = 0; + bool INTT = false; + bool INTT_OVERLAPCHECK = false; + int INTT_VERBOSITY = 0; } // namespace Enable namespace G4INTT { - static int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely - static double intt_radius_max = 140.; // including stagger radius (mm) - static int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + 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}; - static int nladder[4] = {15, 15, 18, 18}; - static double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default - static double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; + int nladder[4] = {15, 15, 18, 18}; + double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default + 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 kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational }; - static enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here } // namespace G4INTT diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 90466dfef..e0ecea703 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -10,16 +10,16 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool MAGNET = false; - static bool MAGNET_ABSORBER = false; - static bool MAGNET_OVERLAPCHECK = false; + bool MAGNET = false; + bool MAGNET_ABSORBER = false; + bool MAGNET_OVERLAPCHECK = false; } // namespace Enable namespace G4MAGNET { - static double magnet_outer_cryostat_wall_radius = 174.5; - static double magnet_outer_cryostat_wall_thickness = 2.5; - static double magnet_length = 379.; + double magnet_outer_cryostat_wall_radius = 174.5; + double magnet_outer_cryostat_wall_thickness = 2.5; + double magnet_length = 379.; } // namespace G4MAGNET void MagnetInit() diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index d9fa1a0d7..2778ff27f 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -21,15 +21,15 @@ R__LOAD_LIBRARY(libmvtx.so) namespace Enable { - static bool MVTX = false; - static bool MVTX_OVERLAPCHECK = false; - static int MVTX_VERBOSITY = 0; + bool MVTX = false; + bool MVTX_OVERLAPCHECK = false; + int MVTX_VERBOSITY = 0; } // namespace Enable namespace G4MVTX { - static int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers } // namespace G4MVTX void MvtxInit() diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index 65bd20dc7..bb05d1dde 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -16,17 +16,17 @@ R__LOAD_LIBRARY(libg4mvtx.so) namespace Enable { - static bool MVTX = false; - static bool MVTX_OVERLAPCHECK = false; - static int MVTX_VERBOSITY = 0; + bool MVTX = false; + bool MVTX_OVERLAPCHECK = false; + int MVTX_VERBOSITY = 0; } namespace G4MVTX { - 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_staves[n_maps_layer] = {18, 24, 30}; - const double nom_radius[n_maps_layer] = {36.4, 48.1, 59.8}; + int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + int N_staves[n_maps_layer] = {18, 24, 30}; + double nom_radius[n_maps_layer] = {36.4, 48.1, 59.8}; } // namespace MVTX void MvtxInit(int verbosity = 0) diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C index ffc03c681..1a5416a56 100644 --- a/macros/g4simulations/G4_PSTOF.C +++ b/macros/g4simulations/G4_PSTOF.C @@ -15,7 +15,7 @@ R__LOAD_LIBRARY(libg4detectors.so) */ namespace Enable { - static bool PSTOF = false; + bool PSTOF = false; } void PSTOFInit() diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C index 524a86ed8..5ae0470a1 100644 --- a/macros/g4simulations/G4_Pipe.C +++ b/macros/g4simulations/G4_Pipe.C @@ -10,21 +10,21 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool PIPE = false; - static bool PIPE_ABSORBER = false; - static bool PIPE_OVERLAPCHECK = false; - static int PIPE_VERBOSITY = 0; + bool PIPE = false; + bool PIPE_ABSORBER = false; + bool PIPE_OVERLAPCHECK = false; + int PIPE_VERBOSITY = 0; } // namespace Enable namespace G4PIPE { - static double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet - static double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - static double be_pipe_length = 80.0; // +/- 40 cm + 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 - static double al_pipe_radius = 2.0005; // same as Be pipe - static double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - static double al_pipe_length = 88.3; // extension beyond +/- 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 } // namespace G4PIPE void PipeInit() diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 63d0be497..26851d31a 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -14,7 +14,7 @@ R__LOAD_LIBRARY(libg4detectors.so) // This creates the Enable Flag to be used in the main steering macro namespace Enable { - static bool PIPE = false; + bool PIPE = false; } namespace G4PIPE @@ -23,10 +23,10 @@ namespace G4PIPE // Extracted via mechanical model: Detector chamber 3-20-20 // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - static double be_pipe_radius = 3.1000; - static double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - static double be_pipe_length_plus = 66.8; // +z beam pipe extend. - static double be_pipe_length_neg = -79.8; // -z beam pipe extend. + double be_pipe_radius = 3.1000; + double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX + double be_pipe_length_plus = 66.8; // +z beam pipe extend. + double be_pipe_length_neg = -79.8; // -z beam pipe extend. } // namespace G4PIPE void PipeInit() @@ -45,11 +45,11 @@ double Pipe(PHG4Reco* g4Reco, { // process pipe extentions? bool use_forward_pipes = false; - const static bool do_pipe_hadron_forward_extension = use_forward_pipes && true; - const static bool do_pipe_electron_forward_extension = use_forward_pipes && true; + const bool do_pipe_hadron_forward_extension = use_forward_pipes && true; + const bool do_pipe_electron_forward_extension = use_forward_pipes && true; - static const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length - static const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); + const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length + const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); if (radius > G4PIPE::be_pipe_radius) { diff --git a/macros/g4simulations/G4_Piston.C b/macros/g4simulations/G4_Piston.C index 2d8cd5fbc..06e73a091 100644 --- a/macros/g4simulations/G4_Piston.C +++ b/macros/g4simulations/G4_Piston.C @@ -13,17 +13,17 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool PISTON = false; - static bool PISTON_ABSORBER = false; - static bool PISTON_OVERLAPCHECK = false; - static int PISTON_VERBOSITY = 0; + bool PISTON = false; + bool PISTON_ABSORBER = false; + bool PISTON_OVERLAPCHECK = false; + int PISTON_VERBOSITY = 0; } // namespace Enable namespace G4PISTON { - static double zpos1 = 305. - 20.; // front of forward ECal/MPC - static double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - static double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that + double zpos1 = 305. - 20.; // front of forward ECal/MPC + double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap + double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that } // namespace G4PISTON void PistonInit() diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 1ebd35533..34ca38a11 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -10,21 +10,21 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool PLUGDOOR = false; - static bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; } namespace G4PLUGDOOR { // sPHENIX forward flux return(s) // define via four corners in the engineering drawing - const double z_1 = 330.81; - const double z_2 = 360.81; - const double r_1 = 30; - const double r_2 = 263.5; + double z_1 = 330.81; + double z_2 = 360.81; + double r_1 = 30; + double r_2 = 263.5; - const double length = z_2 - z_1; - const double place_z = -(z_1 + z_2) / 2.; + double length = z_2 - z_1; + double place_z = -(z_1 + z_2) / 2.; } // namespace G4PLUGDOOR void PlugDoorInit() diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C index fa99bdfb9..90c7cbe28 100644 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C @@ -10,17 +10,17 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - static bool PLUGDOOR = false; - static bool PLUGDOOR_ABSORBER = false; - static bool PLUGDOOR_OVERLAPCHECK = false; + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; } // namespace Enable namespace G4PLUGDOOR { - const double place_z = 335.9; - const double length = 10.2; - const double inner_radius = 2.1; - const double thickness = 258.5; + double place_z = 335.9; + double length = 10.2; + double inner_radius = 2.1; + double thickness = 258.5; } // namespace G4PLUGDOOR void PlugDoorInit() diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index 8c02e035d..cb13a706b 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -22,20 +22,20 @@ R__LOAD_LIBRARY(libtpc.so) namespace Enable { - static bool TPC = false; - static bool TPC_ABSORBER = false; - static bool TPC_OVERLAPCHECK = false; - static int TPC_VERBOSITY = 0; + bool TPC = false; + bool TPC_ABSORBER = false; + bool TPC_OVERLAPCHECK = false; + int TPC_VERBOSITY = 0; } // namespace Enable namespace G4TPC { - static int n_tpc_layer_inner = 16; - static int tpc_layer_rphi_count_inner = 1152; - static int n_tpc_layer_mid = 16; - static int n_tpc_layer_outer = 16; - static int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; - static double tpc_outer_radius = 77. + 1.17; + 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. + 1.17; } // namespace G4TPC void TPCInit() {} diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index 8d28bdbed..56d3b2327 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -19,7 +19,7 @@ R__LOAD_LIBRARY(libg4mvtx.so) namespace Enable { - static bool TPC = false; + bool TPC = false; } namespace G4TPC diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 0f368ea23..2139f352e 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -26,7 +26,7 @@ R__LOAD_LIBRARY(libg4trackfastsim.so) namespace Enable { - static bool TRACKING = false; + bool TRACKING = false; } void TrackingInit() {} From d1a4b3e32cc150274288ada0b1f70510fe643637 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 30 May 2020 23:23:04 -0400 Subject: [PATCH 0616/1222] put inputs in separate macros --- macros/g4simulations/G4_Input.C | 60 ++++++++++++++++++++ macros/g4simulations/G4_Input_Simple.C | 77 ++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 macros/g4simulations/G4_Input.C create mode 100644 macros/g4simulations/G4_Input_Simple.C diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C new file mode 100644 index 000000000..b480f9718 --- /dev/null +++ b/macros/g4simulations/G4_Input.C @@ -0,0 +1,60 @@ +#pragma once + +#include "GlobalVariables.C" + +#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) + +namespace Input +{ + bool READHITS = false; + bool PYTHIA6 = false; + bool PYTHIA8 = false; + bool GUN = false; +} + +#include "G4_Input_Simple.C" + +void InputInit() +{ +// first consistency checks - not all input generators play nice +// with each other + + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + PHPythia6 *pythia6 = new PHPythia6(); + pythia6->set_config_file("phpythia6.cfg"); + se->registerSubsystem(pythia6); + } + if (Input::PYTHIA8) + { + PHPythia8 *pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + pythia8->set_config_file("phpythia8.cfg"); + se->registerSubsystem(pythia8); + } + if (Input::SIMPLE) + { + InputSimpleInit(); + } + +} + +void InputManagers() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + se->registerInputManager(in); +} diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C new file mode 100644 index 000000000..ea707eab7 --- /dev/null +++ b/macros/g4simulations/G4_Input_Simple.C @@ -0,0 +1,77 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Input.C" + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Input +{ + bool SIMPLE = false; + bool SIMPLE_VERBOSITY = 0; +} + +namespace INPUTSIMPLE +{ + double vxmean = 0.; + double vymean = 0.; + double vzmean = 0.; + double vxwidth = 0.; + double vywidth = 0.; + double vzwidth = 5.; + double etamin = -1.; + double etamax = 3.; + double phimin = -1.*M_PI; + double phimax = 1.*M_PI; + double pmin = 0.5; + double pmax = 50.; + map particles; +} + +void InputSimpleInit() +{ + if (INPUTSIMPLE::particles.empty()) + { + cout << "Input::SIMPLE: particle map is empty use for e.g. 5 pi-" << endl; + cout << "INPUTSIMPLE::particles[\"pi-\"] = 5;" << endl; + gSystem->Exit(-1); + } + Fun4AllServer *se = Fun4AllServer::instance(); + // toss low multiplicity dummy events + PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); + for (map::const_iterator iter = INPUTSIMPLE::particles.begin(); + iter != INPUTSIMPLE::particles.end(); ++iter) + { + gen->add_particles(iter->first, iter->second); + } + if (Input::HEPMC || Input::EMBED) + { + 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(INPUTSIMPLE::vxmean, INPUTSIMPLE::vymean, INPUTSIMPLE::vzmean); + gen->set_vertex_distribution_width(INPUTSIMPLE::vxwidth,INPUTSIMPLE::vywidth,INPUTSIMPLE::vzwidth); + } + gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); + gen->set_vertex_size_parameters(0.0, 0.0); + gen->set_eta_range(INPUTSIMPLE::etamin,INPUTSIMPLE::etamax); + //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD + gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); + gen->set_p_range(INPUTSIMPLE::pmin,INPUTSIMPLE::pmax); + gen->Embed(1); + gen->Verbosity(Input::SIMPLE_VERBOSITY); + se->registerSubsystem(gen); +} From 1a695a040e39f7a83a35a196cd02107eab2eafdd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 31 May 2020 00:45:18 -0400 Subject: [PATCH 0617/1222] initial commit --- macros/g4simulations/G4_Input_Gun.C | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 macros/g4simulations/G4_Input_Gun.C diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C new file mode 100644 index 000000000..d9d69e1f3 --- /dev/null +++ b/macros/g4simulations/G4_Input_Gun.C @@ -0,0 +1,47 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Input.C" + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Input +{ + bool GUN = false; + bool GUN_VERBOSITY = 0; +} + +namespace INPUTGUN +{ + double vx = 0.; + double vy = 0.; + double vz = 0.; + deque> particles; +} + +void InputGunInit() +{ + if (INPUTGUN::particles.empty()) + { + cout << "Input::GUN: particle map is empty use for e.g. 1 pi-" << endl; + cout << "INPUTGUN::particles.push_back(make_tuple(\"pi-\",0,1,0));" << endl; + gSystem->Exit(-1); + } + Fun4AllServer *se = Fun4AllServer::instance(); + // toss low multiplicity dummy events + PHG4ParticleGun *gun = new PHG4ParticleGun(); + for (auto iter = INPUTGUN::particles.begin(); iter != INPUTGUN::particles.end(); ++iter) + { + gun->AddParticle(get<0>(*iter),get<1>(*iter),get<2>(*iter),get<3>(*iter)); + } + gun->Verbosity(Input::GUN_VERBOSITY); + se->registerSubsystem(gun); +} From 35ae97fca07bd9f810117bf83c9444260fb6c6a5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 31 May 2020 11:24:42 -0400 Subject: [PATCH 0618/1222] use function to add particles to generator --- macros/g4simulations/G4_Input_Gun.C | 7 +++++++ macros/g4simulations/G4_Input_Simple.C | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C index d9d69e1f3..af59953bf 100644 --- a/macros/g4simulations/G4_Input_Gun.C +++ b/macros/g4simulations/G4_Input_Gun.C @@ -25,8 +25,15 @@ namespace INPUTGUN double vy = 0.; double vz = 0.; deque> particles; + void AddParticle(const string &name, const double px, const double py, const double pz); } +void INPUTGUN::AddParticle(const string &name, const double px, const double py, const double pz) +{ + particles.push_back(make_tuple(name,px,py,pz)); +} + + void InputGunInit() { if (INPUTGUN::particles.empty()) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index ea707eab7..e2d61183b 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -34,8 +34,29 @@ namespace INPUTSIMPLE double pmin = 0.5; double pmax = 50.; map particles; + void AddParticle(const string &name, const unsigned int num); } +void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) +{ + if (num == 0) + { + cout << "INPUTSIMPLE::AddParticle(\"" << name << "\"," << num + << "): number of " << name << " has to be > 0" << endl; + return; + } + auto iter = particles.find(name); + if (iter != particles.end()) + { + iter->second += num; + } + else + { + particles.insert(make_pair(name,num)); + } +} + + void InputSimpleInit() { if (INPUTSIMPLE::particles.empty()) From 09192ce03fe13491317300db6f95b0d6a92df63c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 13:35:43 -0400 Subject: [PATCH 0619/1222] register hepmcnode reader only if hepmc input is enabled --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 154 ++++++++------------- 1 file changed, 55 insertions(+), 99 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 5067341ff..9c4a59454 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -1,5 +1,7 @@ #pragma once +#include "GlobalVariables.C" + #include "DisplayOn.C" #include "G4Setup_fsPHENIX.C" #include "G4_Bbc.C" @@ -8,7 +10,7 @@ #include "G4_FwdJets.C" #include "G4_Global.C" #include "G4_Jets.C" -#include "GlobalVariables.C" +#include "G4_Input.C" #include @@ -20,10 +22,6 @@ #include -#include - -#include - #include #include #include @@ -37,8 +35,6 @@ R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libPHPythia6.so) -R__LOAD_LIBRARY(libPHPythia8.so) int Fun4All_G4_fsPHENIX( const int nEvents = 2, @@ -49,6 +45,22 @@ int Fun4All_G4_fsPHENIX( //=============== // Input options //=============== +// Input::SIMPLE = true; + Input::SIMPLE_VERBOSITY = true; + INPUTSIMPLE::AddParticle("pi-",1); + INPUTSIMPLE::AddParticle("e-",0); + INPUTSIMPLE::AddParticle("pi-",10); + +// Input::PYTHIA6 = true; +// Input::PYTHIA8 = true; + +// Input::GUN = true; + Input::GUN_VERBOSITY = 5; + INPUTGUN::AddParticle("pi-",0,1,0); + + Input::HEPMC = true; + Input::HEPMC_VERBOSITY = 1; + INPUTHEPMC::filename=inputFile; // Either: // read previously generated g4-hits files, in this case it opens a DST and skips @@ -56,45 +68,51 @@ int Fun4All_G4_fsPHENIX( // 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; +// Initialize the selected Input + InputInit(); // Write the DST const bool do_write_output = true; const bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = true; + const bool do_DSTReader = false; + +// turn the display on + bool display_on = false; //====================== // What to run //====================== - // Enable::ABSORBER = true; +// Global options (enabled for all enables subsystems - if implemented) +// Enable::ABSORBER = true; +// Enable::OVERLAPCHECK = true; +// Enable::VERBOSITY = 1; + int absorberactive = 0; // set to 1 to make all absorbers active volumes - bool do_bbc = true; + bool do_bbc = false; - Enable::PIPE = true; - Enable::PIPE_OVERLAPCHECK = false; + Enable::PIPE = false; + Enable::PIPE_ABSORBER = true; +// Enable::PIPE_OVERLAPCHECK = false; // central tracking - Enable::MVTX = true; + Enable::MVTX = false; bool do_mvtx_cell = Enable::MVTX && true; bool do_mvtx_cluster = do_mvtx_cell && true; - Enable::INTT = true; + Enable::INTT = false; bool do_intt_cell = Enable::INTT && true; bool do_intt_cluster = do_intt_cell && true; - Enable::TPC = true; - Enable::TPC_ABSORBER = true; + Enable::TPC = false; +// Enable::TPC_ABSORBER = true; bool do_tpc_cell = Enable::TPC && true; bool do_tpc_cluster = do_tpc_cell && true; @@ -103,20 +121,24 @@ int Fun4All_G4_fsPHENIX( // central calorimeters, which is a detailed simulation and slow to run Enable::CEMC = false; +// Enable::CEMC_ABSORBER = true; bool do_cemc_cell = Enable::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; Enable::HCALIN = false; +// Enable::HCALIN_ABSORBER = true; bool do_hcalin_cell = Enable::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; Enable::MAGNET = false; +// Enable::MAGNET_ABSORBER = true; Enable::HCALOUT = false; +// Enable::HCALOUT_ABSORBER = true; bool do_hcalout_cell = Enable::HCALOUT && true; bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; @@ -138,46 +160,41 @@ int Fun4All_G4_fsPHENIX( bool do_FGEM_eval = do_FGEM_track && true; Enable::FEMC = false; - Enable::FEMC_ABSORBER = true; +// Enable::FEMC_ABSORBER = true; bool do_FEMC_cell = Enable::FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; Enable::FHCAL = false; - Enable::FHCAL_ABSORBER = true; +// Enable::FHCAL_ABSORBER = true; bool do_FHCAL_cell = Enable::FHCAL && true; bool do_FHCAL_twr = do_FHCAL_cell && true; bool do_FHCAL_cluster = do_FHCAL_twr && true; Enable::PISTON = false; - Enable::PISTON_ABSORBER = true; +// Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; Enable::PLUGDOOR = false; - Enable::PLUGDOOR_ABSORBER = true; +// Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C // Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - // establish the geometry and reconstruction setup + // Initialize the selected subsystems G4Init(); - int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = -1.4 / 1.5; // make consistent with Fun4All_G4_sPHENIX() + //--------------- // Fun4All server //--------------- - bool display_on = false; - if (display_on) - { - gROOT->LoadMacro("DisplayOn.C"); - } Fun4AllServer *se = Fun4AllServer::instance(); // se->Verbosity(0); // uncomment for batch production running with minimal output messages @@ -197,6 +214,7 @@ int Fun4All_G4_fsPHENIX( //----------------- // Event generation //----------------- +// InputInit(); if (readhits) { @@ -208,57 +226,8 @@ int Fun4All_G4_fsPHENIX( exit(1); } } - else if (readhepmc) - { - // action is performed in later stage at the input manager level - } - 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); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - } 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(-3.0, 3.0); - //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD - gen->set_phi_range(-1.0 * M_PI, 1.0 * M_PI); - //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); - gen->set_p_range(10.0, 10.0); - gen->Embed(1); - gen->Verbosity(0); - se->registerSubsystem(gen); } if (!readhits) @@ -267,7 +236,7 @@ int Fun4All_G4_fsPHENIX( // Detector description //--------------------- - G4Setup(absorberactive, magfield, EDecayType::kAll, + G4Setup(magfield, EDecayType::kAll, magfield_rescale); } @@ -344,13 +313,11 @@ int Fun4All_G4_fsPHENIX( if (do_global) { - gROOT->LoadMacro("G4_Global.C"); Global_Reco(); } else if (do_global_fastsim) { - gROOT->LoadMacro("G4_Global.C"); Global_FastSim(); } @@ -360,13 +327,11 @@ int Fun4All_G4_fsPHENIX( if (do_jet_reco) { - gROOT->LoadMacro("G4_Jets.C"); Jet_Reco(); } if (do_fwd_jet_reco) { - gROOT->LoadMacro("G4_FwdJets.C"); Jet_FwdReco(); } //---------------------- @@ -414,25 +379,14 @@ int Fun4All_G4_fsPHENIX( in1->Repeat(); // if file(or filelist) is exhausted, start from beginning 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); - } +// 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*/ Enable::CEMC, @@ -449,6 +403,8 @@ int Fun4All_G4_fsPHENIX( /*bool*/ do_FEMC_twr); } + InputManagers(); + if (do_write_output) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); @@ -464,7 +420,7 @@ int Fun4All_G4_fsPHENIX( return 0; } // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) + if (nEvents == 0 && !readhits && !Input::HEPMC) { 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; From 9f611a5188c4f86ae8f04502c64e0091c5776544 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 13:36:19 -0400 Subject: [PATCH 0620/1222] register hepmcnode reader only if hepmc input is enabled --- macros/g4simulations/G4Setup_fsPHENIX.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 0e9381132..6b93107bd 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -1,5 +1,7 @@ #pragma once +#include "GlobalVariables.C" + #include "G4_BlackHole.C" #include "G4_CEmc_Spacal.C" #include "G4_FEMC.C" @@ -16,7 +18,6 @@ #include "G4_Tracking_fsPHENIX.C" #include "G4_User.C" #include "G4_World.C" -#include "GlobalVariables.C" #include @@ -123,10 +124,12 @@ int G4Setup(const string &field = "1.5", Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::HEPMC) + { // read-in HepMC events to Geant4 if there is any HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); - + } PHG4Reco *g4Reco = new PHG4Reco(); g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST WorldInit(g4Reco); From b84573e1fa46af025184be9f74110349d70bc466 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 13:37:11 -0400 Subject: [PATCH 0621/1222] add Input namespace with global settings --- macros/g4simulations/GlobalVariables.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index a2cc0d944..7575b515c 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -2,6 +2,13 @@ static bool overlapcheck = false; static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes +namespace Input +{ + bool HEPMC = false; + int HEPMC_VERBOSITY = 0; + bool EMBED = false; +} + namespace Enable { bool OVERLAPCHECK = false; From 1590ab8108a93eabd3518c079e9cb907832098e0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 13:37:41 -0400 Subject: [PATCH 0622/1222] Add HepMC and particle gun --- macros/g4simulations/G4_Input.C | 42 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index b480f9718..fcb339bca 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -2,11 +2,15 @@ #include "GlobalVariables.C" -#include +#include "G4_Input_Simple.C" +#include "G4_Input_Gun.C" + #include #include +#include + #include #include #include @@ -21,15 +25,33 @@ namespace Input bool READHITS = false; bool PYTHIA6 = false; bool PYTHIA8 = false; - bool GUN = false; } -#include "G4_Input_Simple.C" +namespace INPUTHEPMC +{ + string filename; +} + +namespace INPUTREADHITS +{ + string filename; +} + +namespace INPUTEMBED +{ + string filename; +} + void InputInit() { // 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); + } Fun4AllServer *se = Fun4AllServer::instance(); if (Input::PYTHIA6) @@ -49,12 +71,26 @@ void InputInit() { InputSimpleInit(); } + if (Input::GUN) + { + InputGunInit(); + } } void InputManagers() { Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::HEPMC) + { + Fun4AllInputManager *in = new Fun4AllHepMCInputManager("DSTIN"); + in->Verbosity(Input::HEPMC_VERBOSITY); + se->registerInputManager(in); + se->fileopen(in->Name(), INPUTHEPMC::filename); + } + else + { Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); se->registerInputManager(in); + } } From eb6f506c85f83b9d69e72e3ed1e462b4e889f7e4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 22:23:52 -0400 Subject: [PATCH 0623/1222] add Input::READHITS --- macros/g4simulations/G4_Input.C | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index fcb339bca..ce143abce 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -11,6 +11,7 @@ #include +#include #include #include #include @@ -83,14 +84,22 @@ void InputManagers() Fun4AllServer *se = Fun4AllServer::instance(); if (Input::HEPMC) { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager("DSTIN"); + Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); in->Verbosity(Input::HEPMC_VERBOSITY); se->registerInputManager(in); se->fileopen(in->Name(), INPUTHEPMC::filename); } - else + else if (Input::READHITS) + { + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); + hitsin->fileopen(INPUTREADHITS::filename); + hitsin->Verbosity(1); + se->registerInputManager(hitsin); + } + else { Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + in->Verbosity(1); se->registerInputManager(in); } } From 339b5b5ed594061ebd2cc40784eedfca344b1895 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 1 Jun 2020 22:25:31 -0400 Subject: [PATCH 0624/1222] add Input::READHITS --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 78 ++++++++-------------- 1 file changed, 29 insertions(+), 49 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 9c4a59454..8e7550d2a 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -45,11 +45,18 @@ int Fun4All_G4_fsPHENIX( //=============== // 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 + Input::READHITS = true; + INPUTREADHITS::filename=inputFile; + // Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = true; - INPUTSIMPLE::AddParticle("pi-",1); - INPUTSIMPLE::AddParticle("e-",0); - INPUTSIMPLE::AddParticle("pi-",10); + INPUTSIMPLE::AddParticle("pi-",5); +// INPUTSIMPLE::AddParticle("e-",0); +// INPUTSIMPLE::AddParticle("pi-",10); // Input::PYTHIA6 = true; // Input::PYTHIA8 = true; @@ -58,16 +65,11 @@ int Fun4All_G4_fsPHENIX( Input::GUN_VERBOSITY = 5; INPUTGUN::AddParticle("pi-",0,1,0); - Input::HEPMC = true; +// Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; INPUTHEPMC::filename=inputFile; - // 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: + // Or: // Use particle generator // And @@ -77,7 +79,7 @@ int Fun4All_G4_fsPHENIX( const bool do_embedding = false; // Initialize the selected Input - InputInit(); +// InputInit(); // Write the DST const bool do_write_output = true; const bool do_dst_compress = false; @@ -97,21 +99,21 @@ int Fun4All_G4_fsPHENIX( // Enable::VERBOSITY = 1; int absorberactive = 0; // set to 1 to make all absorbers active volumes - bool do_bbc = false; + bool do_bbc = true; - Enable::PIPE = false; + Enable::PIPE = true; Enable::PIPE_ABSORBER = true; // Enable::PIPE_OVERLAPCHECK = false; // central tracking - Enable::MVTX = false; + Enable::MVTX = true; bool do_mvtx_cell = Enable::MVTX && true; bool do_mvtx_cluster = do_mvtx_cell && true; - Enable::INTT = false; + Enable::INTT = true; bool do_intt_cell = Enable::INTT && true; bool do_intt_cluster = do_intt_cell && true; - Enable::TPC = false; + Enable::TPC = true; // Enable::TPC_ABSORBER = true; bool do_tpc_cell = Enable::TPC && true; bool do_tpc_cluster = do_tpc_cell && true; @@ -120,31 +122,31 @@ int Fun4All_G4_fsPHENIX( bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = false; + Enable::CEMC = true; // Enable::CEMC_ABSORBER = true; bool do_cemc_cell = Enable::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; - Enable::HCALIN = false; + Enable::HCALIN = true; // Enable::HCALIN_ABSORBER = true; bool do_hcalin_cell = Enable::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; - Enable::MAGNET = false; + Enable::MAGNET = true; // Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = false; + Enable::HCALOUT = true; // Enable::HCALOUT_ABSORBER = true; bool do_hcalout_cell = Enable::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 = false; + bool do_global = true; bool do_global_fastsim = false; bool do_jet_reco = false; @@ -155,11 +157,11 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry - Enable::FGEM = false; - bool do_FGEM_track = Enable::FGEM && true; + Enable::FGEM = true; + bool do_FGEM_track = Enable::FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; - Enable::FEMC = false; + Enable::FEMC = true; // Enable::FEMC_ABSORBER = true; bool do_FEMC_cell = Enable::FEMC && true; bool do_FEMC_twr = do_FEMC_cell && true; @@ -214,28 +216,13 @@ int Fun4All_G4_fsPHENIX( //----------------- // Event generation //----------------- -// InputInit(); - - 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." << endl; - exit(1); - } - } - else - { - } + InputInit(); - if (!readhits) + if (!Input::READHITS) { //--------------------- // Detector description //--------------------- - G4Setup(magfield, EDecayType::kAll, magfield_rescale); } @@ -356,13 +343,6 @@ int Fun4All_G4_fsPHENIX( // 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) @@ -420,7 +400,7 @@ int Fun4All_G4_fsPHENIX( return 0; } // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !Input::HEPMC) + 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; From 1ef01cd341ed2911a87c585afd446858fff66732 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Jun 2020 10:47:17 -0400 Subject: [PATCH 0625/1222] clang-format --- macros/g4simulations/G4_Input_Simple.C | 72 +++++++++++++------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index e2d61183b..6bbb01b45 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -17,7 +17,7 @@ namespace Input { bool SIMPLE = false; bool SIMPLE_VERBOSITY = 0; -} +} // namespace Input namespace INPUTSIMPLE { @@ -29,19 +29,19 @@ namespace INPUTSIMPLE double vzwidth = 5.; double etamin = -1.; double etamax = 3.; - double phimin = -1.*M_PI; - double phimax = 1.*M_PI; + double phimin = -1. * M_PI; + double phimax = 1. * M_PI; double pmin = 0.5; double pmax = 50.; - map particles; + map particles; void AddParticle(const string &name, const unsigned int num); -} +} // namespace INPUTSIMPLE void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) { if (num == 0) { - cout << "INPUTSIMPLE::AddParticle(\"" << name << "\"," << num + cout << "INPUTSIMPLE::AddParticle(\"" << name << "\"," << num << "): number of " << name << " has to be > 0" << endl; return; } @@ -52,47 +52,45 @@ void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) } else { - particles.insert(make_pair(name,num)); + particles.insert(make_pair(name, num)); } } - void InputSimpleInit() { if (INPUTSIMPLE::particles.empty()) { cout << "Input::SIMPLE: particle map is empty use for e.g. 5 pi-" << endl; - cout << "INPUTSIMPLE::particles[\"pi-\"] = 5;" << endl; + cout << "INPUTSIMPLE::particles[\"pi-\"] = 5;" << endl; gSystem->Exit(-1); } Fun4AllServer *se = Fun4AllServer::instance(); - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - for (map::const_iterator iter = INPUTSIMPLE::particles.begin(); - iter != INPUTSIMPLE::particles.end(); ++iter) - { + // toss low multiplicity dummy events + PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); + for (map::const_iterator iter = INPUTSIMPLE::particles.begin(); + iter != INPUTSIMPLE::particles.end(); ++iter) + { gen->add_particles(iter->first, iter->second); - } - if (Input::HEPMC || Input::EMBED) - { - 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(INPUTSIMPLE::vxmean, INPUTSIMPLE::vymean, INPUTSIMPLE::vzmean); - gen->set_vertex_distribution_width(INPUTSIMPLE::vxwidth,INPUTSIMPLE::vywidth,INPUTSIMPLE::vzwidth); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(INPUTSIMPLE::etamin,INPUTSIMPLE::etamax); - //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD - gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); - gen->set_p_range(INPUTSIMPLE::pmin,INPUTSIMPLE::pmax); - gen->Embed(1); - gen->Verbosity(Input::SIMPLE_VERBOSITY); - se->registerSubsystem(gen); + } + if (Input::HEPMC || Input::EMBED) + { + 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(INPUTSIMPLE::vxmean, INPUTSIMPLE::vymean, INPUTSIMPLE::vzmean); + gen->set_vertex_distribution_width(INPUTSIMPLE::vxwidth, INPUTSIMPLE::vywidth, INPUTSIMPLE::vzwidth); + } + gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); + gen->set_vertex_size_parameters(0.0, 0.0); + gen->set_eta_range(INPUTSIMPLE::etamin, INPUTSIMPLE::etamax); + gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); + gen->set_p_range(INPUTSIMPLE::pmin, INPUTSIMPLE::pmax); + gen->Embed(1); + gen->Verbosity(Input::SIMPLE_VERBOSITY); + se->registerSubsystem(gen); } From 50fdde4e74876378c6673a45ae58fe476857006d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Jun 2020 10:48:07 -0400 Subject: [PATCH 0626/1222] Add INput::EMBED --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 8e7550d2a..3010f9c87 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -36,6 +36,14 @@ R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) +// If using the default embedding file results in a error, try +// TFile *f1 = TFile::Open("http://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") +// if it returns a certificate error, something like +// Error in : can not open file with davix: Failure (Neon): Server certificate verification failed: bad certificate chain after 3 attempts (6) +// add the line +// Davix.GSI.CACheck: n +// to your .rootrc + 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", @@ -49,17 +57,20 @@ int Fun4All_G4_fsPHENIX( // 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; + Input::READHITS = false; INPUTREADHITS::filename=inputFile; -// Input::SIMPLE = true; +// Input::EMBED = true; + INPUTEMBED::filename=embed_input_file; + + Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = true; INPUTSIMPLE::AddParticle("pi-",5); // INPUTSIMPLE::AddParticle("e-",0); // INPUTSIMPLE::AddParticle("pi-",10); // Input::PYTHIA6 = true; -// Input::PYTHIA8 = true; + Input::PYTHIA8 = true; // Input::GUN = true; Input::GUN_VERBOSITY = 5; @@ -76,7 +87,7 @@ int Fun4All_G4_fsPHENIX( // 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; + const bool do_embedding = true; // Initialize the selected Input // InputInit(); @@ -105,31 +116,31 @@ int Fun4All_G4_fsPHENIX( Enable::PIPE_ABSORBER = true; // Enable::PIPE_OVERLAPCHECK = false; // central tracking - Enable::MVTX = true; + Enable::MVTX = false; bool do_mvtx_cell = Enable::MVTX && true; bool do_mvtx_cluster = do_mvtx_cell && true; - Enable::INTT = true; + Enable::INTT = false; bool do_intt_cell = Enable::INTT && true; bool do_intt_cluster = do_intt_cell && true; Enable::TPC = true; // Enable::TPC_ABSORBER = true; - bool do_tpc_cell = Enable::TPC && true; + bool do_tpc_cell = Enable::TPC && false; bool do_tpc_cluster = do_tpc_cell && true; bool do_tracking_track = do_tpc_cell && do_intt_cell && do_mvtx_cell && true; bool do_tracking_eval = do_tracking_track && true; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = true; + Enable::CEMC = false; // Enable::CEMC_ABSORBER = true; bool do_cemc_cell = Enable::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; - Enable::HCALIN = true; + Enable::HCALIN = false; // Enable::HCALIN_ABSORBER = true; bool do_hcalin_cell = Enable::HCALIN && true; bool do_hcalin_twr = do_hcalin_cell && true; @@ -139,14 +150,14 @@ int Fun4All_G4_fsPHENIX( Enable::MAGNET = true; // Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = true; + Enable::HCALOUT = false; // Enable::HCALOUT_ABSORBER = true; bool do_hcalout_cell = Enable::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 = false; bool do_global_fastsim = false; bool do_jet_reco = false; @@ -157,13 +168,13 @@ int Fun4All_G4_fsPHENIX( // fsPHENIX geometry - Enable::FGEM = true; + Enable::FGEM = false; bool do_FGEM_track = Enable::FGEM && false; bool do_FGEM_eval = do_FGEM_track && true; Enable::FEMC = true; // Enable::FEMC_ABSORBER = true; - bool do_FEMC_cell = Enable::FEMC && true; + bool do_FEMC_cell = Enable::FEMC && false; bool do_FEMC_twr = do_FEMC_cell && true; bool do_FEMC_cluster = do_FEMC_twr && true; @@ -359,10 +370,6 @@ int Fun4All_G4_fsPHENIX( in1->Repeat(); // if file(or filelist) is exhausted, start from beginning se->registerInputManager(in1); } - // 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) { From 1c007e8683ebf3fda2506b98a364d61ef212d532 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Jun 2020 10:48:35 -0400 Subject: [PATCH 0627/1222] Add INput::EMBED --- macros/g4simulations/G4_Input.C | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index ce143abce..a6e0ee1b6 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -2,8 +2,8 @@ #include "GlobalVariables.C" -#include "G4_Input_Simple.C" #include "G4_Input_Gun.C" +#include "G4_Input_Simple.C" #include @@ -14,6 +14,7 @@ #include #include #include +#include #include R__LOAD_LIBRARY(libfun4all.so) @@ -26,7 +27,7 @@ namespace Input bool READHITS = false; bool PYTHIA6 = false; bool PYTHIA8 = false; -} +} // namespace Input namespace INPUTHEPMC { @@ -43,11 +44,10 @@ namespace INPUTEMBED string filename; } - void InputInit() { -// first consistency checks - not all input generators play nice -// with each other + // 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; @@ -76,12 +76,19 @@ void InputInit() { InputGunInit(); } - } void InputManagers() { Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::EMBED) + { + gSystem->Load("libg4dst.so"); + Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); + in1->AddFile(INPUTEMBED::filename); // if one use a single input file + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning + se->registerInputManager(in1); + } if (Input::HEPMC) { Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); @@ -96,7 +103,7 @@ void InputManagers() hitsin->Verbosity(1); se->registerInputManager(hitsin); } - else + else { Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); in->Verbosity(1); From 3c0165697f929ff1022d681fdd771cdb7563fa1d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Jun 2020 12:36:07 -0400 Subject: [PATCH 0628/1222] put arguments back in place to run sPHENIX macro unchanged --- macros/g4simulations/G4_CEmc_Spacal.C | 3 ++- macros/g4simulations/G4_FEMC.C | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index fd50bd9a2..bca7bad33 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -68,7 +68,8 @@ namespace G4CEMC } // namespace G4CEMC // black hole parameters are set in CEmc function -void CEmcInit() +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i) {} //! EMCal main setup macro diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 1e00f21fe..166f67a5a 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -55,9 +55,9 @@ void FEMCInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMCSetup(PHG4Reco *g4Reco) +void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive) { - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive>0); Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FEMC module */ From 22ef5dbed362602f787a68985ce815daca1b6554 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Jun 2020 13:13:14 -0400 Subject: [PATCH 0629/1222] clang-format --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 +++--- macros/g4simulations/G4Setup_fsPHENIX.C | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 0010d1900..da4ca86b8 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -83,7 +83,7 @@ int Fun4All_G4_sPHENIX( // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. - const bool do_write_output = false; + const bool do_write_output = true; // To write cluster files set do_write_output = true and set // do_tracking = true, do_tracking_cell = true, do_tracking_cluster = true and // leave the tracking for later do_tracking_track = false, do_tracking_eval = false @@ -125,7 +125,7 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_eval = do_hcalout_cluster && true; // forward EMC - bool do_femc = false; + 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; @@ -199,7 +199,7 @@ int Fun4All_G4_sPHENIX( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 6b93107bd..6262369c7 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -126,9 +126,9 @@ int G4Setup(const string &field = "1.5", if (Input::HEPMC) { - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); } PHG4Reco *g4Reco = new PHG4Reco(); g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST From ee5a2d80f5390053d7521e172978cd97982f28be Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 12:41:24 -0400 Subject: [PATCH 0630/1222] move everything to Enable namespace for uniform look and feel, clean out Fun4All_G4_fsPHENIX.C --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 360 +++++++++---------- macros/g4simulations/G4Setup_fsPHENIX.C | 18 +- macros/g4simulations/G4_Bbc.C | 37 +- macros/g4simulations/G4_CEmc_Spacal.C | 17 +- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 98 ++--- macros/g4simulations/G4_FEMC.C | 5 +- macros/g4simulations/G4_FGEM_fsPHENIX.C | 28 +- macros/g4simulations/G4_FHCAL.C | 14 +- macros/g4simulations/G4_FwdJets.C | 15 +- macros/g4simulations/G4_Global.C | 41 ++- macros/g4simulations/G4_HcalIn_ref.C | 4 + macros/g4simulations/G4_HcalOut_ref.C | 4 + macros/g4simulations/G4_Intt.C | 2 + macros/g4simulations/G4_Jets.C | 30 +- macros/g4simulations/G4_Magnet.C | 3 + macros/g4simulations/G4_Mvtx.C | 4 + macros/g4simulations/G4_TPC.C | 17 +- macros/g4simulations/G4_Tracking_fsPHENIX.C | 53 ++- macros/g4simulations/GlobalVariables.C | 14 + 19 files changed, 426 insertions(+), 338 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 3010f9c87..b44321d1a 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -9,8 +9,8 @@ #include "G4_DSTReader_fsPHENIX.C" #include "G4_FwdJets.C" #include "G4_Global.C" -#include "G4_Jets.C" #include "G4_Input.C" +#include "G4_Jets.C" #include @@ -50,6 +50,25 @@ int Fun4All_G4_fsPHENIX( const char *outputFile = "G4fsPHENIX.root", const char *embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { + //--------------- + // 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); + //=============== // Input options //=============== @@ -58,191 +77,184 @@ int Fun4All_G4_fsPHENIX( // 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 = false; - INPUTREADHITS::filename=inputFile; + INPUTREADHITS::filename = 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=embed_input_file; + // Input::EMBED = true; + INPUTEMBED::filename = embed_input_file; Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = true; - INPUTSIMPLE::AddParticle("pi-",5); -// INPUTSIMPLE::AddParticle("e-",0); -// INPUTSIMPLE::AddParticle("pi-",10); + INPUTSIMPLE::AddParticle("pi-", 5); + // INPUTSIMPLE::AddParticle("e-",0); + // INPUTSIMPLE::AddParticle("pi-",10); -// Input::PYTHIA6 = true; + // Input::PYTHIA6 = true; Input::PYTHIA8 = true; -// Input::GUN = true; + // Input::GUN = true; Input::GUN_VERBOSITY = 5; - INPUTGUN::AddParticle("pi-",0,1,0); + INPUTGUN::AddParticle("pi-", 0, 1, 0); -// Input::HEPMC = true; + // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; - INPUTHEPMC::filename=inputFile; + INPUTHEPMC::filename = 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/ - const bool do_embedding = true; + //----------------- + // Initialize the selected Input/Event generation + //----------------- +InputInit(); -// Initialize the selected Input -// InputInit(); + //====================== // Write the DST - const bool do_write_output = true; - const bool do_dst_compress = false; + //====================== + + Enable::DSTOUT = true; + Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = false; + Enable::DSTREADER = true; -// turn the display on + // turn the display on bool display_on = false; //====================== // What to run //====================== -// Global options (enabled for all enables subsystems - if implemented) -// Enable::ABSORBER = true; -// Enable::OVERLAPCHECK = true; -// Enable::VERBOSITY = 1; - int absorberactive = 0; // set to 1 to make all absorbers active volumes + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; - bool do_bbc = true; + Enable::BBC = true; Enable::PIPE = true; Enable::PIPE_ABSORBER = true; -// Enable::PIPE_OVERLAPCHECK = false; + // Enable::PIPE_OVERLAPCHECK = false; + // central tracking - Enable::MVTX = false; - bool do_mvtx_cell = Enable::MVTX && true; - bool do_mvtx_cluster = do_mvtx_cell && true; + Enable::MVTX = true; + Enable::MVTX_CELL = Enable::MVTX && true; + Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; - Enable::INTT = false; - bool do_intt_cell = Enable::INTT && true; - bool do_intt_cluster = do_intt_cell && true; + Enable::INTT = true; + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; Enable::TPC = true; -// Enable::TPC_ABSORBER = true; - bool do_tpc_cell = Enable::TPC && false; - bool do_tpc_cluster = do_tpc_cell && true; + // Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; - bool do_tracking_track = do_tpc_cell && do_intt_cell && do_mvtx_cell && true; - bool do_tracking_eval = do_tracking_track && true; + Enable::TRACKING_TRACK = Enable::TPC_CELL && Enable::INTT_CELL && Enable::MVTX_CELL && true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = false; -// Enable::CEMC_ABSORBER = true; - bool do_cemc_cell = Enable::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; - - Enable::HCALIN = false; -// Enable::HCALIN_ABSORBER = true; - bool do_hcalin_cell = Enable::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; + Enable::CEMC = true; + // 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::HCALIN = true; + // 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::MAGNET = true; -// Enable::MAGNET_ABSORBER = true; + // Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = false; -// Enable::HCALOUT_ABSORBER = true; - bool do_hcalout_cell = Enable::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; + Enable::HCALOUT = true; + // 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; - bool do_global = false; - bool do_global_fastsim = false; + Enable::GLOBAL_RECO = true; + Enable::GLOBAL_FASTSIM = true; - bool do_jet_reco = false; - bool do_jet_eval = do_jet_reco && true; + Enable::JETS = true; + Enable::JETS_EVAL = Enable::JETS && true; - bool do_fwd_jet_reco = false; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; + Enable::FWDJETS = true; + Enable::FWDJETS_EVAL = Enable::FWDJETS && true; // fsPHENIX geometry - Enable::FGEM = false; - bool do_FGEM_track = Enable::FGEM && false; - bool do_FGEM_eval = do_FGEM_track && true; + Enable::FGEM = true; + Enable::FGEM_TRACK = Enable::FGEM && Enable::MVTX && true; + Enable::FGEM_EVAL = Enable::FGEM_TRACK && true; Enable::FEMC = true; -// Enable::FEMC_ABSORBER = true; - bool do_FEMC_cell = Enable::FEMC && false; - bool do_FEMC_twr = do_FEMC_cell && true; - bool do_FEMC_cluster = do_FEMC_twr && true; - - Enable::FHCAL = false; -// Enable::FHCAL_ABSORBER = true; - bool do_FHCAL_cell = Enable::FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; - bool do_FHCAL_cluster = do_FHCAL_twr && true; - - Enable::PISTON = false; -// Enable::PISTON_ABSORBER = true; + Enable::FEMC_ABSORBER = true; + Enable::FEMC_CELL = Enable::FEMC && true; + Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; + + Enable::FHCAL = true; + Enable::FHCAL_ABSORBER = true; + Enable::FHCAL_CELL = Enable::FHCAL && true; + Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; + + Enable::PISTON = true; + Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; - Enable::PLUGDOOR = false; -// Enable::PLUGDOOR_ABSORBER = true; + Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C - // Enable::BLACKHOLE = true; + Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - // Initialize the selected subsystems - G4Init(); - // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4 / 1.5; // make consistent with Fun4All_G4_sPHENIX() + //--------------- + // 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.4 / 1.5; // make consistent with expected Babar field strength of 1.4T //--------------- - // Fun4All server + // 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(); - 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 - //----------------- - InputInit(); if (!Input::READHITS) { //--------------------- // Detector description //--------------------- - G4Setup(magfield, EDecayType::kAll, - magfield_rescale); + G4Setup(); } //--------- // BBC Reco //--------- - if (do_bbc) + if (Enable::BBC) { BbcInit(); Bbc_Reco(); @@ -252,69 +264,69 @@ int Fun4All_G4_fsPHENIX( // Detector Division //------------------ - if (do_mvtx_cell) Mvtx_Cells(); - if (do_intt_cell) Intt_Cells(); - if (do_tpc_cell) TPC_Cells(); + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); - if (do_cemc_cell) CEMC_Cells(); + if (Enable::CEMC_CELL) CEMC_Cells(); - if (do_hcalin_cell) HCALInner_Cells(); + if (Enable::HCALIN_CELL) HCALInner_Cells(); - if (do_hcalout_cell) HCALOuter_Cells(); + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (do_FEMC_cell) FEMC_Cells(); - if (do_FHCAL_cell) FHCAL_Cells(); + if (Enable::FEMC_CELL) FEMC_Cells(); + if (Enable::FHCAL_CELL) FHCAL_Cells(); //----------------------------- // CEMC towering and clustering //----------------------------- - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); //----------------------------- // HCAL towering and clustering //----------------------------- - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); + if (Enable::FEMC_TOWER) FEMC_Towers(); + if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - if (do_FHCAL_twr) FHCAL_Towers(); - if (do_FHCAL_cluster) FHCAL_Clusters(); + if (Enable::FHCAL_TOWER) FHCAL_Towers(); + if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - if (do_dst_compress) ShowerCompress(); + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); //-------------- // SVTX tracking //-------------- - if (do_mvtx_cluster) Mvtx_Clustering(); - if (do_intt_cluster) Intt_Clustering(); - if (do_tpc_cluster) TPC_Clustering(); + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); - if (do_tracking_track) Tracking_Reco(); + if (Enable::TRACKING_TRACK) Tracking_Reco(); //-------------- // FGEM tracking //-------------- - if (do_FGEM_track) FGEM_FastSim_Reco(); + if (Enable::FGEM_TRACK) FGEM_FastSim_Reco(); //----------------- // Global Vertexing //----------------- - if (do_global) + if (Enable::GLOBAL_RECO) { Global_Reco(); } - else if (do_global_fastsim) + else if (Enable::GLOBAL_FASTSIM) { Global_FastSim(); } @@ -323,12 +335,12 @@ int Fun4All_G4_fsPHENIX( // Jet reco //--------- - if (do_jet_reco) + if (Enable::JETS) { Jet_Reco(); } - if (do_fwd_jet_reco) + if (Enable::FWDJETS) { Jet_FwdReco(); } @@ -336,66 +348,37 @@ int Fun4All_G4_fsPHENIX( // Simulation evaluation //---------------------- - if (do_tracking_eval) Tracking_Eval("g4tracking_eval.root"); + if (Enable::TRACKING_EVAL) Tracking_Eval("g4tracking_eval.root"); - if (do_cemc_eval) CEMC_Eval("g4cemc_eval.root"); + if (Enable::CEMC_EVAL) CEMC_Eval("g4cemc_eval.root"); - if (do_hcalin_eval) HCALInner_Eval("g4hcalin_eval.root"); + if (Enable::HCALIN_EVAL) HCALInner_Eval("g4hcalin_eval.root"); - if (do_hcalout_eval) HCALOuter_Eval("g4hcalout_eval.root"); + if (Enable::HCALOUT_EVAL) HCALOuter_Eval("g4hcalout_eval.root"); - if (do_jet_eval) Jet_Eval("g4jet_eval.root"); + if (Enable::JETS_EVAL) Jet_Eval("g4jet_eval.root"); - if (do_fwd_jet_eval) Jet_FwdEval("g4fwdjet_eval.root"); + if (Enable::FWDJETS_EVAL) Jet_FwdEval("g4fwdjet_eval.root"); - if (do_FGEM_eval) FGEM_FastSim_Eval("g4tracking_fgem_eval.root"); + if (Enable::FGEM_EVAL) FGEM_FastSim_Eval("g4tracking_fgem_eval.root"); + + if (Enable::DSTREADER) G4DSTreader_fsPHENIX(outputFile); //-------------- - // IO management + // Set up Input Managers //-------------- - if (do_embedding) - { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - in1->AddFile(embed_input_file); // if one use a single input file - // in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning - se->registerInputManager(in1); - } + InputManagers(); - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - G4DSTreader_fsPHENIX(outputFile, // - /*int*/ absorberactive, - /*bool*/ Enable::CEMC, - /*bool*/ Enable::HCALIN, - /*bool*/ Enable::MAGNET, - /*bool*/ Enable::HCALOUT, - /*bool*/ do_cemc_twr, - /*bool*/ do_hcalin_twr, - /*bool*/ do_hcalout_twr, - /*bool*/ Enable::FGEM, - /*bool*/ Enable::FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ Enable::FEMC, - /*bool*/ do_FEMC_twr); - } - InputManagers(); + //-------------- + // Set up Output Managers + //-------------- - if (do_write_output) + if (Enable::DSTOUT) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (do_dst_compress) DstCompress(out); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); se->registerOutputManager(out); } @@ -443,4 +426,3 @@ void G4Cmd(const char *cmd) g4->ApplyCommand(cmd); } -void RunFFALoadTest() {} diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 6262369c7..f60304c6e 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -114,9 +114,7 @@ void G4Init() } } -int G4Setup(const string &field = "1.5", - const EDecayType decayType = EDecayType::kAll, - const float magfield_rescale = 1.0) +int G4Setup() { //--------------- // Fun4All server @@ -134,31 +132,31 @@ int G4Setup(const string &field = "1.5", g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST WorldInit(g4Reco); g4Reco->set_rapidity_coverage(1.1); // according to drawings - if (decayType != EDecayType::kAll) + if (G4P6DECAYER::decayType != EDecayType::kAll) { - g4Reco->set_force_decay(decayType); + g4Reco->set_force_decay(G4P6DECAYER::decayType); } double fieldstrength; - istringstream stringline(field); + istringstream stringline(G4MAGNET::magfield); stringline >> fieldstrength; if (stringline.fail()) { // conversion to double fails -> we have a string - if (field.find("sPHENIX.root") != string::npos) + if (G4MAGNET::magfield.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); } else { - g4Reco->set_field_map(field, PHFieldConfig::kField2D); + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::kField2D); } } else { g4Reco->set_field(fieldstrength); // use const soleniodal field } - g4Reco->set_field_rescale(magfield_rescale); + g4Reco->set_field_rescale(G4MAGNET::magfield_rescale); double radius = 0.; diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C index afbf0b651..efaccdf1c 100644 --- a/macros/g4simulations/G4_Bbc.C +++ b/macros/g4simulations/G4_Bbc.C @@ -1,31 +1,26 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + #include -R__LOAD_LIBRARY(libg4bbc.so) -#endif -void BbcInit() {} +#include -double Bbc(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { +R__LOAD_LIBRARY(libg4bbc.so) - // the BBC is a fast sim only at the moment - // this is a place holder for the G4 material setup - - return radius; +namespace Enable +{ + bool BBC = false; } +namespace G4BBC +{ + double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC + double t_smearing = 0.002; // 20ps timing resolution +} + +void BbcInit() {} + void Bbc_Reco(int verbosity = 0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4bbc.so"); //--------------- // Fun4All server @@ -34,8 +29,8 @@ void Bbc_Reco(int verbosity = 0) { 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 + bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing + bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps se->registerSubsystem(bbcvertex); return; diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index bca7bad33..71f6c8c8e 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -36,10 +36,14 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { - bool CEMC = false; - bool CEMC_ABSORBER = false; - bool CEMC_OVERLAPCHECK = false; - int CEMC_VERBOSITY = 0; + 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; + int CEMC_VERBOSITY = 0; } // namespace Enable namespace G4CEMC @@ -69,8 +73,9 @@ 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) -{} +void CEmcInit(const int i = 0) +{ +} //! EMCal main setup macro double diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C index e74da4b49..9488fe34f 100644 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ b/macros/g4simulations/G4_DSTReader_fsPHENIX.C @@ -1,8 +1,18 @@ #pragma once +#include "GlobalVariables.C" + #include "G4_Intt.C" #include "G4_Mvtx.C" #include "G4_TPC.C" +#include "G4_CEmc_Spacal.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_FHCAL.C" +#include "G4_FEMC.C" +#include "G4_FGEM_fsPHENIX.C" + #include @@ -21,48 +31,43 @@ R__LOAD_LIBRARY(libg4eval.so) */ ////////////////////////////////////////////////////////////////// -#include +namespace Enable +{ + bool DSTREADER = false; + int DSTREADER_VERBOSITY = 0; +} + +namespace G4DSTREADER +{ + bool save_g4_raw = true; + double tower_zero_supp = 1.e-6; +} + + + void G4DSTreader_fsPHENIXInit() {} void -G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - 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_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 // - ) +G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root") { //! debug output on screen? - const bool debug = false; + int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); //! save raw g4 hits const bool save_g4_raw = true; // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); + 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); - } + ana->Verbosity(verbosity); - if (save_g4_raw) + if (G4DSTREADER::save_g4_raw) { if (Enable::MVTX) { @@ -77,10 +82,10 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("TPC"); } - if (do_cemc) + if (Enable::CEMC) { ana->AddNode("CEMC"); - if (absorberactive) + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) { ana->AddNode("ABSORBER_CEMC"); ana->AddNode("CEMC_ELECTRONICS"); @@ -88,41 +93,41 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// } } - if (do_hcalin) + if (Enable::HCALIN) { ana->AddNode("HCALIN"); - if (absorberactive) + if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) ana->AddNode("ABSORBER_HCALIN"); } - if (do_magnet) + if (Enable::MAGNET) { - if (absorberactive) + if (Enable::ABSORBER || Enable::MAGNET) ana->AddNode("MAGNET"); } - if (do_hcalout) + if (Enable::HCALOUT) { ana->AddNode("HCALOUT"); - if (absorberactive) + if (Enable::ABSORBER || Enable::HCALOUT) ana->AddNode("ABSORBER_HCALOUT"); } - if (do_FHCAL) + if (Enable::FHCAL) { ana->AddNode("FHCAL"); - if (absorberactive) + if (Enable::ABSORBER || Enable::FHCAL) ana->AddNode("ABSORBER_FHCAL"); } - if (do_FEMC) + if (Enable::FEMC) { ana->AddNode("FEMC"); - if (absorberactive) + if (Enable::ABSORBER || Enable::FEMC) ana->AddNode("ABSORBER_FEMC"); } - if (do_FGEM) + if (Enable::FGEM) { ana->AddNode("FGEM_0"); ana->AddNode("FGEM_1"); @@ -130,39 +135,40 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("FGEM_3"); ana->AddNode("FGEM_4"); } - + if (Enable::BLACKHOLE) + { 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->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 (do_hcalin_twr) + if (Enable::HCALIN_TOWER) { ana->AddTower("SIM_HCALIN"); ana->AddTower("RAW_HCALIN"); ana->AddTower("CALIB_HCALIN"); } - if (do_hcalout_twr) + if (Enable::HCALOUT_TOWER) { ana->AddTower("SIM_HCALOUT"); ana->AddTower("RAW_HCALOUT"); ana->AddTower("CALIB_HCALOUT"); } - if (do_FHCAL_twr) + if (Enable::FHCAL_TOWER) { ana->AddTower("SIM_FHCAL"); ana->AddTower("RAW_FHCAL"); ana->AddTower("CALIB_FHCAL"); } - if (do_FEMC_twr) + if (Enable::FHCAL_TOWER) { ana->AddTower("SIM_FEMC"); ana->AddTower("RAW_FEMC"); @@ -170,7 +176,7 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// } // Jets disabled for now -// if (do_jet_reco) +// if (Enable::JETS) // { // // ana->AddJet("AntiKt06JetsInPerfect"); diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C index 166f67a5a..cbf9ed4fe 100644 --- a/macros/g4simulations/G4_FEMC.C +++ b/macros/g4simulations/G4_FEMC.C @@ -27,6 +27,9 @@ namespace Enable { bool FEMC = false; bool FEMC_ABSORBER = false; + bool FEMC_CELL = false; + bool FEMC_TOWER = false; + bool FEMC_CLUSTER = false; int FEMC_VERBOSITY = 0; } // namespace Enable @@ -55,7 +58,7 @@ void FEMCInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive) +void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive>0); Fun4AllServer *se = Fun4AllServer::instance(); diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index ebdc53258..18e3a9c29 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -2,6 +2,9 @@ #include "GlobalVariables.C" +#include "G4_FEMC.C" +#include "G4_FHCAL.C" + #include #include @@ -23,6 +26,9 @@ namespace Enable { bool FGEM = false; bool FGEM_OVERLAPCHECK = false; + bool FGEM_TRACK = false; + bool FGEM_EVAL = false; + int FGEM_VERBOSITY = 0; } void FGEM_Init() @@ -224,14 +230,9 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, return 0; } -void FGEM_FastSim_Reco(int verbosity = 0) +void FGEM_FastSim_Reco() { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4trackfastsim.so"); +int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); //--------------- // Fun4All server @@ -324,14 +325,21 @@ void FGEM_FastSim_Reco(int verbosity = 0) ); // Saved track states (projections) - kalman->add_state_name("FEMC"); - kalman->add_state_name("FHCAL"); + if (Enable::FEMC) + { + kalman->add_state_name("FEMC"); + } + if (Enable::FHCAL) + { + kalman->add_state_name("FHCAL"); + } se->registerSubsystem(kalman); } -void FGEM_FastSim_Eval(std::string outputfile, int verbosity = 0) +void FGEM_FastSim_Eval(const std::string &outputfile) { +int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index 2aaa70852..d4ebf0224 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -26,6 +26,10 @@ namespace Enable { bool FHCAL = false; bool FHCAL_ABSORBER = false; + bool FHCAL_CELL = false; + bool FHCAL_TOWER = false; + bool FHCAL_CLUSTER = false; + int FHCAL_VERBOSITY = 0; } namespace G4FHCAL @@ -77,8 +81,10 @@ void FHCALSetup(PHG4Reco *g4Reco) g4Reco->registerSubsystem(hhcal); } -void FHCAL_Towers(int verbosity = 0) +void FHCAL_Towers() { +int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; @@ -133,8 +139,9 @@ void FHCAL_Towers(int verbosity = 0) se->registerSubsystem(TowerCalibration); } -void FHCAL_Clusters(int verbosity = 0) +void FHCAL_Clusters() { +int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); @@ -146,8 +153,9 @@ void FHCAL_Clusters(int verbosity = 0) return; } -void FHCAL_Eval(std::string outputfile, int verbosity = 0) +void FHCAL_Eval(const std::string &outputfile) { +int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str()); diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C index d3fe3c169..b454b935a 100644 --- a/macros/g4simulations/G4_FwdJets.C +++ b/macros/g4simulations/G4_FwdJets.C @@ -12,10 +12,19 @@ R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libg4eval.so) +namespace Enable +{ + bool FWDJETS = false; + bool FWDJETS_EVAL = false; + int FWDJETS_VERBOSITY = 0; +} + void Jet_FwdRecoInit() {} -void Jet_FwdReco(int verbosity = 0) +void Jet_FwdReco() { +int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets @@ -55,9 +64,9 @@ void Jet_FwdReco(int verbosity = 0) return; } -void Jet_FwdEval(std::string outfilename = "g4fwdjets_eval.root", - int verbosity = 0) +void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") { +int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", diff --git a/macros/g4simulations/G4_Global.C b/macros/g4simulations/G4_Global.C index 9e9b4b88f..ceb05fee1 100644 --- a/macros/g4simulations/G4_Global.C +++ b/macros/g4simulations/G4_Global.C @@ -1,21 +1,30 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + #include #include + +#include + R__LOAD_LIBRARY(libg4vertex.so) -#endif + +namespace Enable +{ + bool GLOBAL_RECO = false; + bool GLOBAL_FASTSIM = false; +} + +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 +} void GlobalInit() {} void Global_Reco(int verbosity = 0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); //--------------- // Fun4All server @@ -31,12 +40,6 @@ void Global_Reco(int verbosity = 0) { void Global_FastSim(int verbosity = 0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); //--------------- // Fun4All server @@ -45,10 +48,10 @@ void Global_FastSim(int verbosity = 0) { 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 + 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; diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index b9e5ee922..c404134a6 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -33,6 +33,10 @@ 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; int HCALIN_VERBOSITY = 0; } // namespace Enable diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index f3606e31d..47e389b77 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -28,6 +28,10 @@ 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; int HCALOUT_VERBOSITY = 0; } // namespace Enable diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C index 845d5718b..e2101e646 100644 --- a/macros/g4simulations/G4_Intt.C +++ b/macros/g4simulations/G4_Intt.C @@ -25,6 +25,8 @@ namespace Enable { bool INTT = false; bool INTT_OVERLAPCHECK = false; + bool INTT_CELL = false; + bool INTT_CLUSTER = false; int INTT_VERBOSITY = 0; } // namespace Enable diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C index cc92b2e62..fa42c2560 100644 --- a/macros/g4simulations/G4_Jets.C +++ b/macros/g4simulations/G4_Jets.C @@ -1,23 +1,34 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + +#include "GlobalVariables.C" + #include #include #include #include #include #include + #include + +#include + R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libg4eval.so) -#endif + +namespace Enable +{ + bool JETS = false; + bool JETS_EVAL = false; + int JETS_VERBOSITY = 0; +} void JetInit() {} -void Jet_Reco(int verbosity = 0) { +void Jet_Reco() { + +int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); - gSystem->Load("libg4jets.so"); - Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets @@ -87,11 +98,10 @@ void Jet_Reco(int verbosity = 0) { return; } -void Jet_Eval(std::string outfilename = "g4jets_eval.root", - int verbosity = 0) { +void Jet_Eval(const std::string &outfilename = "g4jets_eval.root") +{ +int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index e0ecea703..2da4346c1 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -20,6 +20,9 @@ namespace G4MAGNET double magnet_outer_cryostat_wall_radius = 174.5; double magnet_outer_cryostat_wall_thickness = 2.5; double magnet_length = 379.; + double magfield_rescale = -1.4/1.5; + string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + } // namespace G4MAGNET void MagnetInit() diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index 2778ff27f..b9f9eadf9 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -23,6 +23,8 @@ namespace Enable { bool MVTX = false; bool MVTX_OVERLAPCHECK = false; + bool MVTX_CELL = false; + bool MVTX_CLUSTER = false; int MVTX_VERBOSITY = 0; } // namespace Enable @@ -52,7 +54,9 @@ double Mvtx(PHG4Reco* g4Reco, double radius, { double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; if (verbosity) + { cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + } radius = radius_lyr; } mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index cb13a706b..a0292e8a4 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -25,6 +25,8 @@ namespace Enable bool TPC = false; bool TPC_ABSORBER = false; bool TPC_OVERLAPCHECK = false; + bool TPC_CELL = false; + bool TPC_CLUSTER = false; int TPC_VERBOSITY = 0; } // namespace Enable @@ -38,7 +40,20 @@ namespace G4TPC double tpc_outer_radius = 77. + 1.17; } // namespace G4TPC -void TPCInit() {} +void TPCInit() +{ +// 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; + } +} double TPC(PHG4Reco* g4Reco, double radius, diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C index 5fd6db3fc..6b356f1b8 100644 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ b/macros/g4simulations/G4_Tracking_fsPHENIX.C @@ -27,6 +27,16 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libtrack_reco.so) +namespace Enable +{ + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; +} + +namespace G4TRACKING +{ + // Tracking simulation setup parameters and flag - leave them alone! //============================================== // Tracking reconstruction setup parameters and flags @@ -43,14 +53,17 @@ const bool use_truth_vertex = true; // set to false to get initial vertex from // This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event //const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. +} void TrackingInit(int verbosity = 0) { } -void Tracking_Reco(int verbosity = 0) +void Tracking_Reco() { + + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); // processes the TrkrHits to make clusters, then reconstruct tracks and vertices //--------------- @@ -62,18 +75,17 @@ void Tracking_Reco(int verbosity = 0) //------------- // Tracking //------------ - - if (use_track_prop) + if (G4TRACKING::use_track_prop) { //-------------------------------------------------- // Normal track seeding and propagation //-------------------------------------------------- - if(use_truth_vertex) + if(G4TRACKING::use_truth_vertex) { // We cheat to get the initial vertex for the full track reconstruction case PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); + init_vtx->Verbosity(verbosity); se->registerSubsystem(init_vtx); } else @@ -84,8 +96,8 @@ void Tracking_Reco(int verbosity = 0) init_zvtx->set_seeding_layer(seed_layer,7); // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). - init_zvtx->set_min_zvtx_tracks(init_vertexing_min_zvtx_tracks); - init_zvtx->Verbosity(0); + init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); + init_zvtx->Verbosity(verbosity); se->registerSubsystem(init_zvtx); } @@ -98,7 +110,7 @@ void Tracking_Reco(int verbosity = 0) // Find all clusters associated with each seed track PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - track_prop->Verbosity(0); + track_prop->Verbosity(verbosity); se->registerSubsystem(track_prop); for(int i = 0;iVerbosity(0); + init_vtx->Verbosity(verbosity); se->registerSubsystem(init_vtx); // For each truth particle, create a track and associate clusters with it using truth information PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(0); + pat_rec->Verbosity(verbosity); se->registerSubsystem(pat_rec); } @@ -131,12 +143,13 @@ void Tracking_Reco(int verbosity = 0) PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); + kalman->Verbosity(verbosity); - if (use_primary_vertex) + if (G4TRACKING::use_primary_vertex) + { kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); + } + kalman->set_vertexing_method(G4TRACKING::vmethod); kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); @@ -152,8 +165,10 @@ void Tracking_Reco(int verbosity = 0) } - void Tracking_Eval(const std::string &outputfile, int verbosity = 0) + void Tracking_Eval(const std::string &outputfile) { + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + //--------------- // Fun4All server //--------------- @@ -170,12 +185,12 @@ void Tracking_Reco(int verbosity = 0) eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... eval->do_gpoint_eval(false); eval->do_eval_light(true); - eval->set_use_initial_vertex(g4eval_use_initial_vertex); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(0); + eval->Verbosity(verbosity); se->registerSubsystem(eval); - if (use_primary_vertex) + if (G4TRACKING::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 @@ -186,7 +201,7 @@ void Tracking_Reco(int verbosity = 0) 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); + evalp->Verbosity(verbosity); se->registerSubsystem(evalp); } diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 7575b515c..2b732af81 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -1,7 +1,13 @@ #pragma once + +#include + static bool overlapcheck = false; static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes + +// These Input settings are needed in multiple Input selections +// Putting those here avoids include file ordering problems namespace Input { bool HEPMC = false; @@ -9,10 +15,13 @@ namespace Input bool EMBED = false; } +// Global settings affecting multiple subsystems namespace Enable { bool OVERLAPCHECK = false; bool ABSORBER = false; + bool DSTOUT = false; + bool DSTOUT_COMPRESS = false; int VERBOSITY = 0; } @@ -27,3 +36,8 @@ namespace BlackHoleGeometry double gap = no_overlapp; bool visible = false; }; // namespace BlackHoleGeometry + +namespace G4P6DECAYER +{ + EDecayType decayType = EDecayType::kAll; +} From 9b2ad4b01a25ef7fe20ceef9f1ef63ae570da6af Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 13:57:57 -0400 Subject: [PATCH 0631/1222] use Enable namespace for Display --- macros/g4simulations/DisplayOn.C | 7 ++++++- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C index 3b4781365..72b69734e 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/macros/g4simulations/DisplayOn.C @@ -1,11 +1,16 @@ #pragma once -#include #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 diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index b44321d1a..3de08d401 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -122,8 +122,8 @@ InputInit(); //Option to convert DST to human command readable TTree for quick poke around the outputs Enable::DSTREADER = true; - // turn the display on - bool display_on = false; + // turn the display on (default off) + Enable::DISPLAY = false; //====================== // What to run @@ -397,7 +397,7 @@ InputInit(); return 0; } - if (display_on) + if (Enable::DISPLAY) { DisplayOn(); // prevent macro from finishing so can see display From 32b77f341a4fd23b41aa338f77540c605c7af769 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 15:13:34 -0400 Subject: [PATCH 0632/1222] fit black hole, fix returned radius --- macros/g4simulations/G4_Mvtx.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index b9f9eadf9..9a36d28a4 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -32,11 +32,12 @@ 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 void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd])/10.+G4MVTX::radius_offset); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -57,12 +58,13 @@ double Mvtx(PHG4Reco* g4Reco, double radius, { cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; } - radius = radius_lyr; + radius = radius_lyr/10.; } 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; } From e114642919c489cfe53a944e419cfb79f7394198 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 15:16:18 -0400 Subject: [PATCH 0633/1222] clabg-format --- macros/g4simulations/G4_Mvtx.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C index 9a36d28a4..ce2a18bee 100644 --- a/macros/g4simulations/G4_Mvtx.C +++ b/macros/g4simulations/G4_Mvtx.C @@ -31,13 +31,13 @@ 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 + 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 void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd])/10.+G4MVTX::radius_offset); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -58,7 +58,7 @@ double Mvtx(PHG4Reco* g4Reco, double radius, { cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; } - radius = radius_lyr/10.; + radius = radius_lyr / 10.; } mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); mvtx->SetActive(); From 646ced5240b24c1dafce825d710b77ee2675efeb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 17:44:31 -0400 Subject: [PATCH 0634/1222] fix blak hole dimensions to cover rails --- macros/g4simulations/G4_Intt.C | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C index e2101e646..292291994 100644 --- a/macros/g4simulations/G4_Intt.C +++ b/macros/g4simulations/G4_Intt.C @@ -35,9 +35,9 @@ 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}; + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; int nladder[4] = {15, 15, 18, 18}; double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1], 0.0, 0.5 * 360.0 / nladder[3]}; @@ -53,13 +53,15 @@ namespace G4INTT void InttInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4INTT::intt_radius_max / 10.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); -if (!Enable::MVTX) - { - G4MVTX::n_maps_layer = 0; -} + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 16.85 + 0.6); // rail radius + rail outer radius + 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, From 927501952fdc0a7e64992e4604ef5518f629efbc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 17:57:00 -0400 Subject: [PATCH 0635/1222] adjust black hole dimensions --- macros/g4simulations/G4_TPC.C | 38 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C index a0292e8a4..8bcf97f8a 100644 --- a/macros/g4simulations/G4_TPC.C +++ b/macros/g4simulations/G4_TPC.C @@ -37,27 +37,30 @@ namespace G4TPC 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. + 1.17; + double tpc_outer_radius = 77. + 2; } // namespace G4TPC -void TPCInit() +void TPCInit() { -// 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) + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); + 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; } } double TPC(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0) + double radius) { bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; @@ -84,6 +87,7 @@ double TPC(PHG4Reco* g4Reco, void TPC_Cells() { + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); //========================= @@ -93,11 +97,11 @@ void TPC_Cells() //========================= PHG4TpcPadPlane* padplane = new PHG4TpcPadPlaneReadout(); - padplane->Verbosity(0); + padplane->Verbosity(verbosity); PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); - edrift->Verbosity(0); + edrift->Verbosity(verbosity); // 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 @@ -115,6 +119,8 @@ void TPC_Cells() void TPC_Clustering() { + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); // Tpc @@ -125,7 +131,7 @@ void TPC_Clustering() digitpc->SetENC(ENC); double ADC_threshold = 4.0 * ENC; digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK - digitpc->Verbosity(0); + 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; @@ -138,6 +144,6 @@ void TPC_Clustering() // For the Tpc //========== TpcClusterizer* tpcclusterizer = new TpcClusterizer(); - tpcclusterizer->Verbosity(0); + tpcclusterizer->Verbosity(verbosity); se->registerSubsystem(tpcclusterizer); } From e0940addc0be1bfeb9fabc6622267e8e0a031f5c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 17:58:31 -0400 Subject: [PATCH 0636/1222] fix verbosity data type --- macros/g4simulations/G4_Input_Simple.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index 6bbb01b45..7bb443906 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -16,7 +16,7 @@ R__LOAD_LIBRARY(libg4testbench.so) namespace Input { bool SIMPLE = false; - bool SIMPLE_VERBOSITY = 0; + int SIMPLE_VERBOSITY = 0; } // namespace Input namespace INPUTSIMPLE From a647528254138f7d4d7d76fc8a962cd44fbc9838 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 19:09:32 -0400 Subject: [PATCH 0637/1222] pythia6 and pythia8 do not play together right now (PHHepMCGenEventMap::insert_event - Fatal Error -embedding ID 1 is already used in the PHHepMCGenEventMap) --- macros/g4simulations/G4_Input.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index a6e0ee1b6..a286d1fa5 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -53,6 +53,11 @@ void InputInit() cout << "Reading Hits and Embedding into background at the same time 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); + } Fun4AllServer *se = Fun4AllServer::instance(); if (Input::PYTHIA6) From 81bdb3a370b08d627ed7b2a8f57ae1582f73953a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 19:28:40 -0400 Subject: [PATCH 0638/1222] all settings ready to run --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 3de08d401..2ac1a16df 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -67,7 +67,7 @@ int Fun4All_G4_fsPHENIX( // 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); + // rc->set_IntFlag("RANDOMSEED", 12345); //=============== // Input options @@ -90,20 +90,21 @@ int Fun4All_G4_fsPHENIX( INPUTEMBED::filename = embed_input_file; Input::SIMPLE = true; - Input::SIMPLE_VERBOSITY = true; + //Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); // INPUTSIMPLE::AddParticle("e-",0); // INPUTSIMPLE::AddParticle("pi-",10); - // Input::PYTHIA6 = true; - Input::PYTHIA8 = true; +// Input::PYTHIA6 = true; + +// Input::PYTHIA8 = true; // Input::GUN = true; - Input::GUN_VERBOSITY = 5; + //Input::GUN_VERBOSITY = 0; INPUTGUN::AddParticle("pi-", 0, 1, 0); // Input::HEPMC = true; - Input::HEPMC_VERBOSITY = 1; + Input::HEPMC_VERBOSITY = 0; INPUTHEPMC::filename = inputFile; @@ -120,7 +121,7 @@ InputInit(); Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - Enable::DSTREADER = true; +// Enable::DSTREADER = true; // turn the display on (default off) Enable::DISPLAY = false; @@ -208,17 +209,17 @@ InputInit(); Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; - Enable::PISTON = true; +// Enable::PISTON = true; Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; Enable::PLUGDOOR = true; - Enable::PLUGDOOR_ABSORBER = true; +// Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; +// BlackHoleGeometry::visible = true; //--------------- @@ -245,13 +246,13 @@ InputInit(); if (!Input::READHITS) { //--------------------- - // Detector description + // Set up G4 only if we do not read hits //--------------------- G4Setup(); } //--------- - // BBC Reco + // BBC Reco, just smeared vertex //--------- if (Enable::BBC) @@ -321,11 +322,10 @@ InputInit(); // Global Vertexing //----------------- - if (Enable::GLOBAL_RECO) + if (Enable::GLOBAL_RECO) { Global_Reco(); } - else if (Enable::GLOBAL_FASTSIM) { Global_FastSim(); @@ -335,15 +335,10 @@ InputInit(); // Jet reco //--------- - if (Enable::JETS) - { - Jet_Reco(); - } + if (Enable::JETS) Jet_Reco(); + + if (Enable::FWDJETS) Jet_FwdReco(); - if (Enable::FWDJETS) - { - Jet_FwdReco(); - } //---------------------- // Simulation evaluation //---------------------- @@ -425,4 +420,3 @@ void G4Cmd(const char *cmd) PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->ApplyCommand(cmd); } - From fd8bb6667e5d96089a6536fc82eca182e2b72fa8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 19:29:01 -0400 Subject: [PATCH 0639/1222] clang-format --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 33 +++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 2ac1a16df..c90f2328c 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -95,9 +95,9 @@ int Fun4All_G4_fsPHENIX( // INPUTSIMPLE::AddParticle("e-",0); // INPUTSIMPLE::AddParticle("pi-",10); -// Input::PYTHIA6 = true; + // Input::PYTHIA6 = true; -// Input::PYTHIA8 = true; + // Input::PYTHIA8 = true; // Input::GUN = true; //Input::GUN_VERBOSITY = 0; @@ -107,11 +107,10 @@ int Fun4All_G4_fsPHENIX( Input::HEPMC_VERBOSITY = 0; INPUTHEPMC::filename = inputFile; - //----------------- // Initialize the selected Input/Event generation //----------------- -InputInit(); + InputInit(); //====================== // Write the DST @@ -121,7 +120,7 @@ InputInit(); Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs -// Enable::DSTREADER = true; + // Enable::DSTREADER = true; // turn the display on (default off) Enable::DISPLAY = false; @@ -209,40 +208,37 @@ InputInit(); Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; -// Enable::PISTON = true; + // Enable::PISTON = true; Enable::PISTON_ABSORBER = true; Enable::PISTON_OVERLAPCHECK = false; Enable::PLUGDOOR = true; -// Enable::PLUGDOOR_ABSORBER = true; + // Enable::PLUGDOOR_ABSORBER = true; Enable::PLUGDOOR_OVERLAPCHECK = false; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; -// BlackHoleGeometry::visible = true; - + // BlackHoleGeometry::visible = true; //--------------- // 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.4 / 1.5; // make consistent with expected Babar field strength of 1.4T + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database + // G4MAGNET::magfield_rescale = -1.4 / 1.5; // 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; + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; // Initialize the selected subsystems G4Init(); - - if (!Input::READHITS) { //--------------------- @@ -322,7 +318,7 @@ InputInit(); // Global Vertexing //----------------- - if (Enable::GLOBAL_RECO) + if (Enable::GLOBAL_RECO) { Global_Reco(); } @@ -365,7 +361,6 @@ InputInit(); InputManagers(); - //-------------- // Set up Output Managers //-------------- From e363ffe1b365f27fe3515cc180520272df7aba7d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 20:03:21 -0400 Subject: [PATCH 0640/1222] put original version back --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index da4ca86b8..0010d1900 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -83,7 +83,7 @@ int Fun4All_G4_sPHENIX( // Event pile up simulation with collision rate in Hz MB collisions. // Note please follow up the macro to verify the settings for beam parameters const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. - const bool do_write_output = true; + const bool do_write_output = false; // To write cluster files set do_write_output = true and set // do_tracking = true, do_tracking_cell = true, do_tracking_cluster = true and // leave the tracking for later do_tracking_track = false, do_tracking_eval = false @@ -125,7 +125,7 @@ int Fun4All_G4_sPHENIX( bool do_hcalout_eval = do_hcalout_cluster && true; // forward EMC - bool do_femc = true; + bool do_femc = false; bool do_femc_cell = do_femc && true; bool do_femc_twr = do_femc_cell && true; bool do_femc_cluster = do_femc_twr && true; @@ -199,7 +199,7 @@ int Fun4All_G4_sPHENIX( // 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); + // rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation From dd412fdc80db6c1a9cd690779f6408ede78021da Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 20:31:48 -0400 Subject: [PATCH 0641/1222] fix fallout from fsPHENIX macro change (rename G4_Mvtx.C to G4_Mvtx_EIC.C) --- macros/g4simulations/G4_Mvtx_EIC.C | 16 ++++++++++++++-- macros/g4simulations/G4_TPC_EIC.C | 6 +++--- macros/g4simulations/G4_Tracking_EIC.C | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index bb05d1dde..d2b79da81 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -25,8 +25,8 @@ 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 - int N_staves[n_maps_layer] = {18, 24, 30}; - double nom_radius[n_maps_layer] = {36.4, 48.1, 59.8}; + vector N_staves = {18, 24, 30}; + vector nom_radius = {36.4, 48.1, 59.8}; } // namespace MVTX void MvtxInit(int verbosity = 0) @@ -57,6 +57,18 @@ double Mvtx(PHG4Reco* g4Reco, double radius, // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30}; // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + if (G4MVTX::N_staves.size() < G4MVTX::n_maps_layer) + { + cout << "vector N_staves too small: " << G4MVTX::N_staves.size() + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + gSystem->Exit(1); + } + if (G4MVTX::nom_radius.size() < G4MVTX::n_maps_layer) + { + cout << "vector nom_radius too small: " << G4MVTX::nom_radius.size() + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + gSystem->Exit(1); + } for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) { mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index 56d3b2327..0f19accca 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -1,6 +1,6 @@ #pragma once -#include "G4_Mvtx.C" +#include "G4_Mvtx_EIC.C" #include "GlobalVariables.C" #include @@ -64,7 +64,7 @@ double TPC(PHG4Reco* g4Reco, double radius, radius = G4TPC::inner_cage_radius; // inner field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", MVTX::n_maps_layer); + cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", G4MVTX::n_maps_layer); cyl->set_double_param("radius", radius); cyl->set_double_param("length", G4TPC::cage_length); cyl->set_string_param("material", "G4_KAPTON"); @@ -85,7 +85,7 @@ double TPC(PHG4Reco* g4Reco, double radius, double tpc_region_thickness[3] = {20., 20., 18.}; // Active layers of the TPC (inner layers) - int nlayer = MVTX::n_maps_layer; + int nlayer = G4MVTX::n_maps_layer; for (int irange = 0; irange < 3; irange++) { double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 2139f352e..ac1a69db7 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -6,7 +6,7 @@ #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" #include "G4_GEM_EIC.C" -#include "G4_Mvtx.C" +#include "G4_Mvtx_EIC.C" #include "G4_TPC_EIC.C" #include From 440ca10198683740d57aa08ae7b52591aad69723 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 20:33:09 -0400 Subject: [PATCH 0642/1222] comment out fixed seed --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 66c99a27a..f2893d95e 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -213,7 +213,7 @@ int Fun4All_G4_EICDetector( // 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); +// rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation From c48a99098599eb8634089230c77c2b01bfb65ac5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 20:44:45 -0400 Subject: [PATCH 0643/1222] remove unused includes --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 15 --------------- macros/g4simulations/G4Setup_fsPHENIX.C | 4 ---- 2 files changed, 19 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index c90f2328c..a86034363 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -12,24 +12,9 @@ #include "G4_Input.C" #include "G4_Jets.C" -#include - -#include -#include -#include -#include -#include - -#include - -#include #include -#include -#include -#include #include #include -#include #include diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index f60304c6e..1b756c48d 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -19,10 +19,6 @@ #include "G4_User.C" #include "G4_World.C" -#include - -#include - #include #include From 0f1d0b54d6948f0745e1ce33ac69c65c085a7d34 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Jun 2020 20:45:46 -0400 Subject: [PATCH 0644/1222] use Enable namespace for dst output --- macros/g4simulations/Fun4All_G4_EICDetector.C | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index f2893d95e..c0073b3dd 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -1,5 +1,7 @@ #pragma once +#include "GlobalVariables.C" + #include "DisplayOn.C" #include "G4Setup_EICDetector.C" #include "G4_Bbc.C" @@ -85,9 +87,9 @@ int Fun4All_G4_EICDetector( const bool upsilons = false && !readhits; // Write the DST - const bool do_write_output = false; + Enable::DSTOUT = false; // Compress DST files - const bool do_dst_compress = false; + Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs const bool do_DSTReader = false; @@ -450,7 +452,7 @@ int Fun4All_G4_EICDetector( if (do_EEMC_twr) EEMC_Towers(); if (do_EEMC_cluster) EEMC_Clusters(); - if (do_dst_compress) ShowerCompress(); + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); //-------------- // SVTX tracking @@ -567,10 +569,10 @@ int Fun4All_G4_EICDetector( /*bool*/ do_EEMC_twr); } - if(do_write_output) + if(Enable::DSTOUT) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (do_dst_compress) DstCompress(out); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); se->registerOutputManager(out); } From c6fd07223aa7397dc21207b4e4876646d1d0126c Mon Sep 17 00:00:00 2001 From: pingwong Date: Fri, 12 Jun 2020 17:17:39 -0400 Subject: [PATCH 0645/1222] add FST_5 in the tree --- macros/g4simulations/G4_DSTReader_EICDetector.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index e6b73d842..5d1ca62dc 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -78,6 +78,7 @@ G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("FST_2"); ana->AddNode("FST_3"); ana->AddNode("FST_4"); + ana->AddNode("FST_5"); } if (do_cemc) From 4f0df185955ef3a0bb56eaea30cc1d0c2f5ec467 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 12 Jun 2020 18:14:54 -0400 Subject: [PATCH 0646/1222] Import Ping Wong's edit, and keep default behavior with GEM and FST enabled --- macros/g4simulations/G4_Tracking_EIC.C | 130 ++++++------------------- 1 file changed, 32 insertions(+), 98 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 0f368ea23..da95b268a 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -20,7 +20,6 @@ #include class SubsysReco; - R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) @@ -134,103 +133,38 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) if (Enable::FGEM) { - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM4, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - kalman->add_phg4hits( - "G4HIT_FST_5", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + bool do_FST = true; + bool do_FGEM = true; + + if (do_FST) + { + // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. + for (int i = 0; i < 6; i++) + { + kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } + + if (do_FGEM) + { + // GEM2, 70um azimuthal resolution, 1cm radial strips + for (int i = 2; i < 5; i++) + { + kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } } // Saved track states (projections) From ff3cbb834db0b5f62d4a6f90aa30dfeecec93aee Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sun, 14 Jun 2020 15:53:16 -0600 Subject: [PATCH 0647/1222] added micromegas subsystem and reco modules. They are disabled by default --- macros/g4simulations/G4_Tracking.C | 57 ++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 4e183eded..b70ddb62f 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -14,6 +14,10 @@ #include +#include +#include +#include + #include #include #include @@ -26,6 +30,7 @@ #include #include +#include #include #include @@ -42,10 +47,12 @@ R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libg4micromegas.so) R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libmicromegas.so) R__LOAD_LIBRARY(libtrack_reco.so) #endif @@ -82,6 +89,10 @@ 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; +///////////////// Micromegas +bool enable_micromegas = false; +const int n_micromegas_layer = 2; + // Tracking reconstruction setup parameters and flags //===================================== const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events @@ -201,9 +212,19 @@ double Tracking(PHG4Reco* g4Reco, double radius, g4Reco->registerSubsystem(tpc); radius = 77. + 1.17; - radius += no_overlapp; + // micromegas + if( enable_micromegas ) + { + const int mm_layer = n_maps_layer + n_intt_layer + n_gas_layer; + auto mm = new PHG4MicromegasSubsystem( "MICROMEGAS", mm_layer ); + mm->SetActive(); + mm->set_double_param("mm_length", 220); + mm->set_double_param("mm_radius", 82); + g4Reco->registerSubsystem(mm); + } + return radius; } @@ -287,6 +308,28 @@ void Tracking_Cells(int verbosity = 0) padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); + // micromegas + if( enable_micromegas ) + { + + // micromegas + auto reco = new PHG4MicromegasHitReco; + reco->Verbosity(0); + + static constexpr double radius = 82; + static constexpr double tile_length = 50; + static constexpr double tile_width = 25; + + // 12 tiles at mid rapidity, one in front of each TPC sector + static constexpr int ntiles = 12; + MicromegasTile::List tiles; + for( int i = 0; i < ntiles; ++i ) + { tiles.push_back( {{ 2.*M_PI*(0.5+i)/ntiles, 0, tile_width/radius, tile_length }} ); } + reco->set_tiles( tiles ); + + se->registerSubsystem( reco ); + + } return; } @@ -416,6 +459,10 @@ void Tracking_Clus(int verbosity = 0) se->registerSubsystem(digitpc); + // micromegas + if(enable_micromegas) + { se->registerSubsystem( new PHG4MicromegasDigitizer ); } + //------------- // Cluster Hits //------------- @@ -445,6 +492,10 @@ void Tracking_Clus(int verbosity = 0) tpcclusterizer->Verbosity(0); se->registerSubsystem(tpcclusterizer); + // Micromegas + if(enable_micromegas) + { se->registerSubsystem( new MicromegasClusterizer ); } + } void Tracking_Reco(int verbosity = 0) @@ -496,12 +547,12 @@ void Tracking_Reco(int verbosity = 0) // find seed tracks using a subset of TPC layers int min_layers = 4; int nlayers_seeds = 12; - PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + auto track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); track_seed->Verbosity(0); se->registerSubsystem(track_seed); // Find all clusters associated with each seed track - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer); + auto track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer, enable_micromegas ? n_micromegas_layer:0); track_prop->Verbosity(0); se->registerSubsystem(track_prop); for(int i = 0;i Date: Mon, 15 Jun 2020 01:09:28 -0400 Subject: [PATCH 0648/1222] Add CaloTrigger --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index a86034363..ea8430cc5 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -169,6 +169,8 @@ int Fun4All_G4_fsPHENIX( Enable::GLOBAL_RECO = true; Enable::GLOBAL_FASTSIM = true; + Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && true; + Enable::JETS = true; Enable::JETS_EVAL = Enable::JETS && true; @@ -312,6 +314,15 @@ int Fun4All_G4_fsPHENIX( Global_FastSim(); } + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + //--------- // Jet reco //--------- From 76eb4854452c1f1602f3948eee98f35b5af02d04 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 01:09:38 -0400 Subject: [PATCH 0649/1222] Add CaloTrigger --- macros/g4simulations/G4_CaloTrigger.C | 34 ++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/G4_CaloTrigger.C b/macros/g4simulations/G4_CaloTrigger.C index deff5a020..8e183621f 100644 --- a/macros/g4simulations/G4_CaloTrigger.C +++ b/macros/g4simulations/G4_CaloTrigger.C @@ -1,30 +1,32 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + +#include "GlobalVariables.C" + #include -R__LOAD_LIBRARY(libcalotrigger.so) -#endif -void CaloTriggerInit() {} +#include + +R__LOAD_LIBRARY(libcalotrigger.so) -void CaloTrigger_Sim(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- +namespace Enable +{ + bool CALOTRIGGER = false; + int CALOTRIGGER_VERBOSITY = 0; +} // namespace Enable - gSystem->Load("libcalotrigger.so"); +void CaloTrigger_Sim() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CALOTRIGGER_VERBOSITY); //--------------- // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); + Fun4AllServer* se = Fun4AllServer::instance(); CaloTriggerSim* calotriggersim = new CaloTriggerSim(); - calotriggersim->Verbosity( verbosity ); - se->registerSubsystem( calotriggersim ); + calotriggersim->Verbosity(verbosity); + se->registerSubsystem(calotriggersim); return; - -} +} From c7110a48a7966875b89968b0a64da83eeab7ce56 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 18:40:15 -0400 Subject: [PATCH 0650/1222] move hcalin to Enable namespace --- macros/g4simulations/Fun4All_G4_EICDetector.C | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index c0073b3dd..e65b027c3 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -87,7 +87,7 @@ int Fun4All_G4_EICDetector( const bool upsilons = false && !readhits; // Write the DST - Enable::DSTOUT = false; + Enable::DSTOUT = true; // Compress DST files Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs @@ -121,10 +121,11 @@ int Fun4All_G4_EICDetector( bool do_cemc_eval = do_cemc_cluster && true; Enable::HCALIN = true; - bool do_hcalin_cell = Enable::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; + // 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::MAGNET = true; @@ -166,20 +167,20 @@ int Fun4All_G4_EICDetector( bool do_global = true; bool do_global_fastsim = true; - bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; + bool do_calotrigger = true && do_cemc_twr && Enable::HCALIN_TOWER && do_hcalout_twr; // Select only one jet reconstruction- they currently use the same // output collections on the node tree! - bool do_jet_reco = false; + bool do_jet_reco = true; bool do_jet_eval = do_jet_reco && true; - bool do_fwd_jet_reco = false; + 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; + bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && Enable::HCALIN_TOWER && do_hcalout_twr; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -215,7 +216,7 @@ int Fun4All_G4_EICDetector( // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -412,7 +413,7 @@ int Fun4All_G4_EICDetector( if (do_cemc_cell) CEMC_Cells(); - if (do_hcalin_cell) HCALInner_Cells(); + if (Enable::HCALIN_CELL) HCALInner_Cells(); if (do_hcalout_cell) HCALOuter_Cells(); @@ -433,8 +434,8 @@ int Fun4All_G4_EICDetector( // HCAL towering and clustering //----------------------------- - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); if (do_hcalout_twr) HCALOuter_Towers(); if (do_hcalout_cluster) HCALOuter_Clusters(); @@ -509,7 +510,7 @@ int Fun4All_G4_EICDetector( if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); - if (do_hcalin_eval) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); + if (Enable::HCALIN_EVAL) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); @@ -559,8 +560,8 @@ int Fun4All_G4_EICDetector( /*bool*/ Enable::MAGNET, /*bool*/ Enable::HCALOUT, /*bool*/ do_cemc_twr, - /*bool*/ do_hcalin_twr, - /*bool*/ do_hcalout_twr, + /*bool*/ Enable::HCALIN_TOWER, + /*bool*/ Enable::HCALOUT_TOWER, /*bool*/ Enable::FHCAL, /*bool*/ do_FHCAL_twr, /*bool*/ Enable::FEMC, From e21519b478b77d40215fdfd22185bc5689ce93c9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 18:40:43 -0400 Subject: [PATCH 0651/1222] move GlobalVariables.C include to top --- macros/g4simulations/G4_TPC_EIC.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index 0f19accca..511c64cbc 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -1,8 +1,9 @@ #pragma once -#include "G4_Mvtx_EIC.C" #include "GlobalVariables.C" +#include "G4_Mvtx_EIC.C" + #include #include From 67bd3cc11e380fbaba2e3b36bdfe4f2f1ef535e6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 21:17:31 -0400 Subject: [PATCH 0652/1222] add outer hcal Enable --- macros/g4simulations/Fun4All_G4_EICDetector.C | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index e65b027c3..2d7e4073f 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -130,10 +130,11 @@ int Fun4All_G4_EICDetector( Enable::MAGNET = true; Enable::HCALOUT = true; - bool do_hcalout_cell = Enable::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; + // 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; // EICDetector geometry - barrel Enable::DIRC = true; @@ -167,7 +168,7 @@ int Fun4All_G4_EICDetector( bool do_global = true; bool do_global_fastsim = true; - bool do_calotrigger = true && do_cemc_twr && Enable::HCALIN_TOWER && do_hcalout_twr; + bool do_calotrigger = true && do_cemc_twr && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // Select only one jet reconstruction- they currently use the same // output collections on the node tree! @@ -180,7 +181,7 @@ int Fun4All_G4_EICDetector( // 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 && Enable::HCALIN_TOWER && do_hcalout_twr; + bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -415,7 +416,7 @@ int Fun4All_G4_EICDetector( if (Enable::HCALIN_CELL) HCALInner_Cells(); - if (do_hcalout_cell) HCALOuter_Cells(); + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); if (do_FEMC_cell) FEMC_Cells(); @@ -437,8 +438,8 @@ int Fun4All_G4_EICDetector( if (Enable::HCALIN_TOWER) HCALInner_Towers(); if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); //----------------------------- // e, h direction Calorimeter towering and clustering @@ -512,7 +513,7 @@ int Fun4All_G4_EICDetector( if (Enable::HCALIN_EVAL) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); - if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); + if (Enable::HCALOUT_EVAL) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); if (do_FEMC_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); From c00c89542c140d6de27b56636203f688f3bfccb9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 21:17:56 -0400 Subject: [PATCH 0653/1222] add FHCAL_EVAL to enable namespace --- macros/g4simulations/G4_FHCAL.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C index d4ebf0224..00564379a 100644 --- a/macros/g4simulations/G4_FHCAL.C +++ b/macros/g4simulations/G4_FHCAL.C @@ -29,6 +29,7 @@ namespace Enable bool FHCAL_CELL = false; bool FHCAL_TOWER = false; bool FHCAL_CLUSTER = false; + bool FHCAL_EVAL = false; int FHCAL_VERBOSITY = 0; } From 3212e5cbc2d24339a335b6e9581e03bcf05463b1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 21:48:00 -0400 Subject: [PATCH 0654/1222] add FHCAL evaluator --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index ea8430cc5..3253a1f2b 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -194,6 +194,7 @@ int Fun4All_G4_fsPHENIX( Enable::FHCAL_CELL = Enable::FHCAL && true; Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; + Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; // Enable::PISTON = true; Enable::PISTON_ABSORBER = true; @@ -343,6 +344,8 @@ int Fun4All_G4_fsPHENIX( if (Enable::HCALOUT_EVAL) HCALOuter_Eval("g4hcalout_eval.root"); + if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); + if (Enable::JETS_EVAL) Jet_Eval("g4jet_eval.root"); if (Enable::FWDJETS_EVAL) Jet_FwdEval("g4fwdjet_eval.root"); From 34c40e71e3633ec8aecc69d3b71c9023cfe2d48c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 21:48:23 -0400 Subject: [PATCH 0655/1222] Add Enable for FHCAL --- macros/g4simulations/Fun4All_G4_EICDetector.C | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 2d7e4073f..e7cb6f250 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -150,10 +150,15 @@ int Fun4All_G4_EICDetector( bool do_FEMC_eval = do_FEMC_cluster && true; Enable::FHCAL = true; - bool do_FHCAL_cell = Enable::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; +// Enable::FHCAL_ABSORBER = true; + Enable::FHCAL_CELL = Enable::FHCAL && true; + Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; + Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; + // bool do_FHCAL_cell = Enable::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 Enable::EEMC = true; @@ -420,7 +425,7 @@ int Fun4All_G4_EICDetector( if (do_FEMC_cell) FEMC_Cells(); - if (do_FHCAL_cell) FHCAL_Cells(); + if (Enable::FHCAL_CELL) FHCAL_Cells(); if (do_EEMC_cell) EEMC_Cells(); @@ -448,8 +453,8 @@ int Fun4All_G4_EICDetector( 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 (Enable::FHCAL_TOWER) FHCAL_Towers(); + if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); if (do_EEMC_twr) EEMC_Towers(); if (do_EEMC_cluster) EEMC_Clusters(); @@ -517,7 +522,7 @@ int Fun4All_G4_EICDetector( if (do_FEMC_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); - if (do_FHCAL_eval) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); + if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); if (do_EEMC_eval) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); @@ -564,7 +569,7 @@ int Fun4All_G4_EICDetector( /*bool*/ Enable::HCALIN_TOWER, /*bool*/ Enable::HCALOUT_TOWER, /*bool*/ Enable::FHCAL, - /*bool*/ do_FHCAL_twr, + /*bool*/ Enable::FHCAL_TOWER, /*bool*/ Enable::FEMC, /*bool*/ do_FEMC_twr, /*bool*/ Enable::EEMC, From 797d5934be7deedaac7a3d6c98163bbef7bdf891 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 22:06:10 -0400 Subject: [PATCH 0656/1222] use Enable for overlap check and absorber, put use_forward_pipes into G4PIPE namespace --- macros/g4simulations/G4_Pipe_EIC.C | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 26851d31a..09f1e2b87 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -15,6 +15,9 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { bool PIPE = false; + bool PIPE_ABSORBER = false; + bool PIPE_OVERLAPCHECK = false; + int PIPE_VERBOSITY = 0; } namespace G4PIPE @@ -27,6 +30,7 @@ namespace G4PIPE double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX double be_pipe_length_plus = 66.8; // +z beam pipe extend. double be_pipe_length_neg = -79.8; // -z beam pipe extend. + bool use_forward_pipes = false; } // namespace G4PIPE void PipeInit() @@ -37,16 +41,15 @@ void PipeInit() } //! construct beam pipe -//! \param[in] use_forward_pipes whether to include the forward pipe extension beyond the Be section double Pipe(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) + double radius) { + bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); // process pipe extentions? - bool use_forward_pipes = false; - const bool do_pipe_hadron_forward_extension = use_forward_pipes && true; - const bool do_pipe_electron_forward_extension = use_forward_pipes && true; + const bool do_pipe_hadron_forward_extension = G4PIPE::use_forward_pipes && true; + const bool do_pipe_electron_forward_extension = G4PIPE::use_forward_pipes && true; const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); @@ -67,8 +70,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material", "G4_Galactic"); cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); @@ -79,8 +82,8 @@ double Pipe(PHG4Reco* g4Reco, cyl->set_string_param("material", "G4_Be"); cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); g4Reco->registerSubsystem(cyl); radius = G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness; @@ -93,7 +96,7 @@ double Pipe(PHG4Reco* g4Reco, gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(overlapcheck); + gdml->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(gdml); } @@ -103,7 +106,7 @@ double Pipe(PHG4Reco* g4Reco, gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(overlapcheck); + gdml->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(gdml); } From bb6c45d26694dd1054a4f4ab268a72401b5ed0a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 22:35:55 -0400 Subject: [PATCH 0657/1222] use Enable for all of CEMC --- macros/g4simulations/Fun4All_G4_EICDetector.C | 35 ++++++++++------- macros/g4simulations/G4Setup_EICDetector.C | 13 +------ macros/g4simulations/G4_CEmc_EIC.C | 39 ++++++++++++------- 3 files changed, 48 insertions(+), 39 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index e7cb6f250..574953a91 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -98,11 +98,12 @@ int Fun4All_G4_EICDetector( //====================== // sPHENIX barrel - bool do_bbc = true; + Enable::BBC = true; // whether to simulate the Be section of the beam pipe Enable::PIPE = true; - // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C + // EIC beam pipe extension beyond the Be-section: + //G4PIPE::use_forward_pipes = true; Enable::EGEM = true; Enable::FGEM = true; @@ -115,10 +116,16 @@ int Fun4All_G4_EICDetector( bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes Enable::CEMC = true; - bool do_cemc_cell = Enable::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; + // 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; + + // bool do_cemc_cell = Enable::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; Enable::HCALIN = true; // Enable::HCALIN_ABSORBER = true; @@ -173,7 +180,7 @@ int Fun4All_G4_EICDetector( bool do_global = true; bool do_global_fastsim = true; - bool do_calotrigger = true && do_cemc_twr && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + bool do_calotrigger = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // Select only one jet reconstruction- they currently use the same // output collections on the node tree! @@ -186,7 +193,7 @@ int Fun4All_G4_EICDetector( // 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 && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + bool do_HIjetreco = false && do_jet_reco && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -405,7 +412,7 @@ int Fun4All_G4_EICDetector( // BBC Reco //--------- - if (do_bbc) + if (Enable::BBC) { BbcInit(); Bbc_Reco(); @@ -417,7 +424,7 @@ int Fun4All_G4_EICDetector( if (do_tracking_cell) Svtx_Cells(); - if (do_cemc_cell) CEMC_Cells(); + if (Enable::CEMC_CELL) CEMC_Cells(); if (Enable::HCALIN_CELL) HCALInner_Cells(); @@ -433,8 +440,8 @@ int Fun4All_G4_EICDetector( // CEMC towering and clustering //----------------------------- - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); //----------------------------- // HCAL towering and clustering @@ -514,7 +521,7 @@ int Fun4All_G4_EICDetector( //---------------------- if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); - if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); + if (Enable::CEMC_EVAL) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); if (Enable::HCALIN_EVAL) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); @@ -565,7 +572,7 @@ int Fun4All_G4_EICDetector( /*bool*/ Enable::HCALIN, /*bool*/ Enable::MAGNET, /*bool*/ Enable::HCALOUT, - /*bool*/ do_cemc_twr, + /*bool*/ Enable::CEMC_TOWER, /*bool*/ Enable::HCALIN_TOWER, /*bool*/ Enable::HCALOUT_TOWER, /*bool*/ Enable::FHCAL, diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 3b880e96b..63f95bb65 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -143,12 +143,6 @@ int G4Setup(const int absorberactive = 0, const EDecayType decayType = EDecayType::kAll, const float magfield_rescale = 1.0) { - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); //--------------- // Fun4All server @@ -201,7 +195,7 @@ int G4Setup(const int absorberactive = 0, // PIPE if (Enable::PIPE) { - radius = Pipe(g4Reco, radius, absorberactive); + radius = Pipe(g4Reco, radius); } //---------------------------------------- @@ -232,7 +226,7 @@ int G4Setup(const int absorberactive = 0, // if (Enable::CEMC) { - radius = CEmc(g4Reco, radius, 8, absorberactive); + radius = CEmc(g4Reco, radius, 8); } // if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render @@ -325,9 +319,6 @@ int G4Setup(const int absorberactive = 0, void ShowerCompress(int verbosity = 0) { - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index cf1581351..afa1a4a3d 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -28,6 +28,13 @@ R__LOAD_LIBRARY(libg4eval.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; + int CEMC_VERBOSITY = 0; } namespace G4CEMC @@ -71,9 +78,11 @@ void CEmcInit(const int nslats = 1) { } -double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0) +double CEmc(PHG4Reco *g4Reco, double radius, const int crossings) { + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + if (radius > 95) { cout << "inconsistency, radius: " << radius @@ -83,9 +92,6 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, radius = 95; - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - PHG4CylinderSubsystem *cemc; // determine the length of the calorimeter @@ -138,8 +144,8 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->set_double_param("place_z", layer_shift); cemc->SuperDetector("ABSORBER_CEMC"); - if (absorberactive) cemc->SetActive(); - cemc->OverlapCheck(overlapcheck); + if (AbsorberActive) cemc->SetActive(); + cemc->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cemc); @@ -169,7 +175,7 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, cemc->SuperDetector("CEMC"); cemc->SetActive(); - cemc->OverlapCheck(overlapcheck); + cemc->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cemc); radius += G4CEMC::scint_width; @@ -195,8 +201,8 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings, layer_shift = -1. * ((l2 - l1) / 2.); cemc_cyl->set_double_param("place_z", layer_shift); - if (absorberactive) cemc_cyl->SetActive(); - cemc_cyl->OverlapCheck(overlapcheck); + if (AbsorberActive) cemc_cyl->SetActive(); + cemc_cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cemc_cyl); // update black hole settings since we have the values here BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + G4CEMC::electronics_width); @@ -227,8 +233,10 @@ void CEMC_Cells(int verbosity = 0) return; } -void CEMC_Towers(int verbosity = 0) +void CEMC_Towers() { + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); @@ -263,8 +271,10 @@ void CEMC_Towers(int verbosity = 0) return; } -void CEMC_Clusters(int verbosity = 0) +void CEMC_Clusters() { + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) @@ -276,7 +286,7 @@ void CEMC_Clusters(int verbosity = 0) cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below std::string femc_prof = getenv("CALIBRATIONROOT"); femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - cemc_clusterbuilder->LoadProfile(femc_prof.c_str()); + cemc_clusterbuilder->LoadProfile(femc_prof); se->registerSubsystem(cemc_clusterbuilder); } else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) @@ -293,8 +303,9 @@ void CEMC_Clusters(int verbosity = 0) } return; } -void CEMC_Eval(std::string outputfile, int verbosity = 0) +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.c_str()); eval->Verbosity(verbosity); From 2e060da1097c2715bc33cdfb16efcc3b70710984 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 22:45:53 -0400 Subject: [PATCH 0658/1222] remove unused crossing parameter --- macros/g4simulations/G4_CEmc_EIC.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C index afa1a4a3d..78db65cb4 100644 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ b/macros/g4simulations/G4_CEmc_EIC.C @@ -78,7 +78,7 @@ void CEmcInit(const int nslats = 1) { } -double CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +double CEmc(PHG4Reco *g4Reco, double radius) { bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; @@ -212,8 +212,10 @@ double CEmc(PHG4Reco *g4Reco, double radius, const int crossings) return radius; } -void CEMC_Cells(int verbosity = 0) +void CEMC_Cells() { + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); From ed9e751e15121b29b4d4e1d9505f79857d791b96 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 22:46:18 -0400 Subject: [PATCH 0659/1222] more Enable namespace use --- macros/g4simulations/Fun4All_G4_EICDetector.C | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 574953a91..9bd950506 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -177,23 +177,23 @@ int Fun4All_G4_EICDetector( Enable::PLUGDOOR = true; // Other options - bool do_global = true; - bool do_global_fastsim = true; + Enable::GLOBAL_RECO = true; + Enable::GLOBAL_FASTSIM = true; - bool do_calotrigger = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // Select only one jet reconstruction- they currently use the same // output collections on the node tree! - bool do_jet_reco = true; - bool do_jet_eval = do_jet_reco && true; + Enable::JETS = true; + Enable::JETS_EVAL = Enable::JETS && true; - bool do_fwd_jet_reco = true; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; + Enable::FWDJETS = true; + Enable::FWDJETS_EVAL = Enable::FWDJETS && 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 && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + bool do_HIjetreco = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -478,12 +478,11 @@ int Fun4All_G4_EICDetector( // Global Vertexing //----------------- - if (do_global) + if (Enable::GLOBAL_RECO) { Global_Reco(); } - - else if (do_global_fastsim) + else if (Enable::GLOBAL_FASTSIM) { Global_FastSim(); } @@ -492,7 +491,7 @@ int Fun4All_G4_EICDetector( // Calo Trigger Simulation //----------------- - if (do_calotrigger) + if (Enable::CALOTRIGGER) { CaloTrigger_Sim(); } @@ -501,7 +500,7 @@ int Fun4All_G4_EICDetector( // Jet reco //--------- - if (do_jet_reco) + if (Enable::JETS) { Jet_Reco(); } @@ -511,7 +510,7 @@ int Fun4All_G4_EICDetector( HIJetReco(); } - if (do_fwd_jet_reco) + if (Enable::FWDJETS) { Jet_FwdReco(); } @@ -533,9 +532,9 @@ int Fun4All_G4_EICDetector( if (do_EEMC_eval) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); - if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); + if (Enable::JETS_EVAL) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - if (do_fwd_jet_eval) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); + if (Enable::FWDJETS_EVAL) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); //-------------- // IO management From 64461720147fdfcc93efc5b17cfc4a3ca2d51a75 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 22:46:42 -0400 Subject: [PATCH 0660/1222] remove unused crossing parameter from cemc --- macros/g4simulations/G4Setup_EICDetector.C | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 63f95bb65..16e053bf3 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -217,18 +217,14 @@ int G4Setup(const int absorberactive = 0, { radius = TPC(g4Reco, radius, absorberactive); } - if (Enable::TRACKING) - { - // radius = Tracking(g4Reco, radius, absorberactive); - } + //---------------------------------------- // CEMC // if (Enable::CEMC) { - radius = CEmc(g4Reco, radius, 8); + radius = CEmc(g4Reco, radius); } - // if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render //---------------------------------------- // HCALIN From 81a0e13241703ca4de4f8fc07f683f387a4f24af Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 23:13:17 -0400 Subject: [PATCH 0661/1222] adjust black hole size if forward/backward beam pipe is enabled --- macros/g4simulations/G4_Pipe_EIC.C | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C index 09f1e2b87..c50d8797c 100644 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ b/macros/g4simulations/G4_Pipe_EIC.C @@ -35,9 +35,18 @@ namespace G4PIPE void PipeInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); + if (G4PIPE::use_forward_pipes) + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 23.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 450.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -463.); + } + else + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); + } } //! construct beam pipe From 2973f9f2658c0370feefbcdef6545b579c18d7e4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 23:29:27 -0400 Subject: [PATCH 0662/1222] add Enable FEMC --- macros/g4simulations/Fun4All_G4_EICDetector.C | 28 ++++------- macros/g4simulations/G4_FEMC_EIC.C | 50 +++++++++++++------ 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 9bd950506..1aaf27881 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -122,11 +122,6 @@ int Fun4All_G4_EICDetector( Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; - // bool do_cemc_cell = Enable::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; - Enable::HCALIN = true; // Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; @@ -151,10 +146,11 @@ int Fun4All_G4_EICDetector( Enable::AEROGEL = true; Enable::FEMC = true; - bool do_FEMC_cell = Enable::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; +// Enable::FEMC_ABSORBER = true; + Enable::FEMC_CELL = Enable::FEMC && true; + Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; + Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; Enable::FHCAL = true; // Enable::FHCAL_ABSORBER = true; @@ -162,10 +158,6 @@ int Fun4All_G4_EICDetector( Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; - // bool do_FHCAL_cell = Enable::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 Enable::EEMC = true; @@ -430,7 +422,7 @@ int Fun4All_G4_EICDetector( if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (do_FEMC_cell) FEMC_Cells(); + if (Enable::FEMC_CELL) FEMC_Cells(); if (Enable::FHCAL_CELL) FHCAL_Cells(); @@ -457,8 +449,8 @@ int Fun4All_G4_EICDetector( // e, h direction Calorimeter towering and clustering //----------------------------- - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); + if (Enable::FEMC_TOWER) FEMC_Towers(); + if (Enable::FEMC_CLUSTER) FEMC_Clusters(); if (Enable::FHCAL_TOWER) FHCAL_Towers(); if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); @@ -526,7 +518,7 @@ int Fun4All_G4_EICDetector( if (Enable::HCALOUT_EVAL) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); - if (do_FEMC_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); + if (Enable::FEMC_EVAL) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); @@ -577,7 +569,7 @@ int Fun4All_G4_EICDetector( /*bool*/ Enable::FHCAL, /*bool*/ Enable::FHCAL_TOWER, /*bool*/ Enable::FEMC, - /*bool*/ do_FEMC_twr, + /*bool*/ Enable::FEMC_TOWER, /*bool*/ Enable::EEMC, /*bool*/ do_EEMC_twr); } diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C index 48683625f..e471c2618 100644 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ b/macros/g4simulations/G4_FEMC_EIC.C @@ -21,6 +21,13 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { bool FEMC = false; + bool FEMC_ABSORBER = false; + bool FEMC_CELL = false; + bool FEMC_TOWER = false; + bool FEMC_CLUSTER = false; + bool FEMC_EVAL = false; + bool FEMC_OVERLAPCHECK = false; + int FEMC_VERBOSITY = 0; } namespace G4FEMC @@ -46,19 +53,11 @@ void FEMCInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMC_Cells(int verbosity = 0) +void FEMCSetup(PHG4Reco *g4Reco) { - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; -void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) -{ Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FEMC module */ @@ -75,16 +74,31 @@ void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) cout << mapping_femc.str() << endl; femc->SetTowerMappingFile(mapping_femc.str()); - femc->OverlapCheck(overlapcheck); + femc->OverlapCheck(OverlapCheck); femc->SetActive(); femc->SuperDetector("FEMC"); - if (absorberactive) femc->SetAbsorberActive(); + if (AbsorberActive) femc->SetAbsorberActive(); g4Reco->registerSubsystem(femc); } -void FEMC_Towers(int verbosity = 0) +void FEMC_Cells() { + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); + hc->Detector("FEMC"); + se->registerSubsystem(hc); + + return; +} + +void FEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; @@ -205,8 +219,10 @@ void FEMC_Towers(int verbosity = 0) // se->registerSubsystem( TowerCalibration6 ); } -void FEMC_Clusters(int verbosity = 0) +void FEMC_Clusters() { + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) @@ -238,8 +254,10 @@ void FEMC_Clusters(int verbosity = 0) return; } -void FEMC_Eval(std::string outputfile, int verbosity = 0) +void FEMC_Eval(const std::string &outputfile) { + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); From 1176a7437d5528d1cc0aa4011c114f83358487ce Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 23:30:04 -0400 Subject: [PATCH 0663/1222] remove unused absorberactive parameters --- macros/g4simulations/G4Setup_EICDetector.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 16e053bf3..f64bba73b 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -231,28 +231,28 @@ int G4Setup(const int absorberactive = 0, if (Enable::HCALIN) { - radius = HCalInner(g4Reco, radius, 4, absorberactive); + radius = HCalInner(g4Reco, radius, 4); } //---------------------------------------- // MAGNET if (Enable::MAGNET) { - radius = Magnet(g4Reco, radius, 0, absorberactive); + radius = Magnet(g4Reco, radius, 0); } //---------------------------------------- // HCALOUT if (Enable::HCALOUT) { - radius = HCalOuter(g4Reco, radius, 4, absorberactive); + radius = HCalOuter(g4Reco, radius, 4); } //---------------------------------------- // FEMC if (Enable::FEMC) { - FEMCSetup(g4Reco, absorberactive); + FEMCSetup(g4Reco); } //---------------------------------------- From 94b2dfbbe89ce7d4538360458488da86b64974fa Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 23:44:01 -0400 Subject: [PATCH 0664/1222] Add Enalbe EEMC --- macros/g4simulations/Fun4All_G4_EICDetector.C | 22 ++++++++------ macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_EEMC.C | 30 ++++++++++++++----- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 1aaf27881..1588a305e 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -161,10 +161,14 @@ int Fun4All_G4_EICDetector( // EICDetector geometry - 'electron' direction Enable::EEMC = true; - bool do_EEMC_cell = Enable::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; + Enable::EEMC_CELL = Enable::EEMC && true; + Enable::EEMC_TOWER = Enable::EEMC_CELL && true; + Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; + Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; + // bool do_EEMC_cell = Enable::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; Enable::PLUGDOOR = true; @@ -426,7 +430,7 @@ int Fun4All_G4_EICDetector( if (Enable::FHCAL_CELL) FHCAL_Cells(); - if (do_EEMC_cell) EEMC_Cells(); + if (Enable::EEMC_CELL) EEMC_Cells(); //----------------------------- // CEMC towering and clustering @@ -455,8 +459,8 @@ int Fun4All_G4_EICDetector( if (Enable::FHCAL_TOWER) FHCAL_Towers(); if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - if (do_EEMC_twr) EEMC_Towers(); - if (do_EEMC_cluster) EEMC_Clusters(); + if (Enable::EEMC_TOWER) EEMC_Towers(); + if (Enable::EEMC_CLUSTER) EEMC_Clusters(); if (Enable::DSTOUT_COMPRESS) ShowerCompress(); @@ -522,7 +526,7 @@ int Fun4All_G4_EICDetector( if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); - if (do_EEMC_eval) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); + if (Enable::EEMC_EVAL) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); if (Enable::JETS_EVAL) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); @@ -571,7 +575,7 @@ int Fun4All_G4_EICDetector( /*bool*/ Enable::FEMC, /*bool*/ Enable::FEMC_TOWER, /*bool*/ Enable::EEMC, - /*bool*/ do_EEMC_twr); + /*bool*/ Enable::EEMC_TOWER); } if(Enable::DSTOUT) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index f64bba73b..b321843a2 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -267,7 +267,7 @@ int G4Setup(const int absorberactive = 0, if (Enable::EEMC) { - EEMCSetup(g4Reco, absorberactive); + EEMCSetup(g4Reco); } //---------------------------------------- diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C index 5b3624cbb..d37cf7da5 100644 --- a/macros/g4simulations/G4_EEMC.C +++ b/macros/g4simulations/G4_EEMC.C @@ -24,6 +24,12 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { bool EEMC = false; + bool EEMC_CELL = false; + bool EEMC_TOWER = false; + bool EEMC_CLUSTER = false; + bool EEMC_EVAL = false; + bool EEMC_OVERLAPCHECK = false; + int EEMC_VERBOSITY = 0; } namespace G4EEMC @@ -39,8 +45,10 @@ void EEMCInit() BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); } -void EEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +void EEMCSetup(PHG4Reco *g4Reco) { + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::EEMC_OVERLAPCHECK; + /** Use dedicated EEMC module */ PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); @@ -64,17 +72,19 @@ void EEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) eemc->SetProjectiveGeometry(mapping_eemc.str(), mapping_eemc_4x4construct.str()); } - eemc->OverlapCheck(overlapcheck); + eemc->OverlapCheck(OverlapCheck); // SetAbsorberActive method not implemented - // if (absorberactive) eemc->SetAbsorberActive(); + // if (AbsorberActive) eemc->SetAbsorberActive(); /* register Ecal module */ g4Reco->registerSubsystem(eemc); } -void EEMC_Cells(int verbosity = 0) +void EEMC_Cells() { + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); @@ -84,8 +94,10 @@ void EEMC_Cells(int verbosity = 0) return; } -void EEMC_Towers(int verbosity = 0) +void EEMC_Towers() { + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_eemc; @@ -128,8 +140,10 @@ void EEMC_Towers(int verbosity = 0) se->registerSubsystem(TowerCalibration_EEMC); } -void EEMC_Clusters(int verbosity = 0) +void EEMC_Clusters() { + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); @@ -140,8 +154,10 @@ void EEMC_Clusters(int verbosity = 0) return; } -void EEMC_Eval(std::string outputfile, int verbosity = 0) +void EEMC_Eval(const std::string &outputfile) { + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str()); From d3693770c20e0bc560a115f2379b92171d99427d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 15 Jun 2020 23:44:33 -0400 Subject: [PATCH 0665/1222] Add overlap check, set name to FLUXRET_ETA_MINUS --- macros/g4simulations/G4_PlugDoor_EIC.C | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C index 34ca38a11..1ad14168a 100644 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ b/macros/g4simulations/G4_PlugDoor_EIC.C @@ -12,6 +12,7 @@ namespace Enable { bool PLUGDOOR = false; bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; } namespace G4PLUGDOOR @@ -36,9 +37,11 @@ void PlugDoorInit() void PlugDoor(PHG4Reco *g4Reco) { //---------------------------------------- - const string material("Steel_1006"); + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + const string material("Steel_1006"); + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); flux_return_minus->set_int_param("lengthviarapidity", 0); flux_return_minus->set_double_param("length", G4PLUGDOOR::length); @@ -47,8 +50,8 @@ void PlugDoor(PHG4Reco *g4Reco) 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); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(flux_return_minus); return; From 5afca5520bb35df48bb701d23539433396c887d4 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Tue, 16 Jun 2020 13:28:26 -0400 Subject: [PATCH 0666/1222] Configure topoCluster and particle flow jet reconstruction --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 8 +++++ macros/g4simulations/G4_ParticleFlow.C | 42 +++++++++++++++++++++++ macros/g4simulations/G4_TopoClusterReco.C | 34 ++++++++++++++++-- 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 macros/g4simulations/G4_ParticleFlow.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 0010d1900..e8e2f7bcb 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -27,6 +27,7 @@ #include "G4_Jets.C" #include "G4_HIJetReco.C" #include "G4_TopoClusterReco.C" +#include "G4_ParticleFlow.C" #include "G4_DSTReader.C" #include "DisplayOn.C" R__LOAD_LIBRARY(libfun4all.so) @@ -149,6 +150,8 @@ int Fun4All_G4_sPHENIX( // 3-D topoCluster reconstruction, potentially in all calorimeter layers bool do_topoCluster = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; + // particle flow jet reconstruction - needs topoClusters! + bool do_particle_flow = false && do_topoCluster; bool do_dst_compress = false; @@ -469,6 +472,11 @@ int Fun4All_G4_sPHENIX( HIJetReco(); } + if (do_particle_flow) { + gROOT->LoadMacro("G4_ParticleFlow.C"); + ParticleFlow(); + } + //---------------------- // Simulation evaluation //---------------------- diff --git a/macros/g4simulations/G4_ParticleFlow.C b/macros/g4simulations/G4_ParticleFlow.C new file mode 100644 index 000000000..f46a1fad5 --- /dev/null +++ b/macros/g4simulations/G4_ParticleFlow.C @@ -0,0 +1,42 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libparticleflow.so) +#endif + +void ParticleFlow(int verbosity = 0) { + + //--------------- + // Load libraries + //--------------- + + gSystem->Load("libg4jets.so"); + gSystem->Load("libparticleflow.so"); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + // note: assumes topoCluster input already configured + ParticleFlowReco *pfr = new ParticleFlowReco(); + pfr->Verbosity( verbosity ); + se->registerSubsystem( pfr ); + + JetReco *particleflowjetreco = new JetReco("PARTICLEFLOWJETRECO"); + particleflowjetreco->add_input( new ParticleFlowJetInput() ); + particleflowjetreco->add_algo( new FastJetAlgo(Jet::ANTIKT,0.4), "AntiKt_ParticleFlow_r04" ); + particleflowjetreco->set_algo_node("ANTIKT"); + particleflowjetreco->set_input_node("PARTICLEFLOW"); + particleflowjetreco->Verbosity( verbosity ); + se->registerSubsystem( particleflowjetreco ); + + return; + +} diff --git a/macros/g4simulations/G4_TopoClusterReco.C b/macros/g4simulations/G4_TopoClusterReco.C index 6de1f4b3e..42d15508c 100644 --- a/macros/g4simulations/G4_TopoClusterReco.C +++ b/macros/g4simulations/G4_TopoClusterReco.C @@ -22,17 +22,47 @@ void TopoClusterReco(int verbosity = 0) { 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( false ); - ClusterBuilder->set_minE_local_max( 1.0, 1.0, 1.0 ); + 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; From 01a4a2f2cd7c183b2ae29621abbff21afc75eff6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:10:33 -0400 Subject: [PATCH 0667/1222] add Enable namespace, enable projections --- macros/g4simulations/G4_Tracking_EIC.C | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 2d535b081..41ecbaf51 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -19,19 +19,27 @@ #include -class SubsysReco; R__LOAD_LIBRARY(libtrack_reco.so) R__LOAD_LIBRARY(libg4trackfastsim.so) namespace Enable { bool TRACKING = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; +} + +namespace G4TRACKING +{ + bool displaced_vertex = false; } void TrackingInit() {} -void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) +void Tracking_Reco() { + +int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- @@ -41,7 +49,7 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); // kalman->Verbosity(); // kalman->Smearing(false); - if (displaced_vertex) + if (G4TRACKING::displaced_vertex) { //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex kalman->set_use_vertex_in_fitting(true); @@ -57,6 +65,8 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) kalman->set_vertex_z_resolution(50e-4); } + // kalman->set_sub_top_node_name("TRACKS"); + // kalman->set_trackmap_out_name("TrackMap"); kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); @@ -170,24 +180,25 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) // Saved track states (projections) if (Enable::FEMC) { - // kalman->add_state_name("FEMC"); + kalman->add_state_name("FEMC"); } if (Enable::FHCAL) { - // kalman->add_state_name("FHCAL"); + kalman->add_state_name("FHCAL"); } if (Enable::CEMC) { - // kalman->add_state_name("CEMC"); + kalman->add_state_name("CEMC"); } se->registerSubsystem(kalman); return; } -void Tracking_Eval(std::string outputfile, int verbosity = 0) +void Tracking_Eval(const std::string &outputfile) { +int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- @@ -199,6 +210,6 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) //---------------- PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_filename(outputfile.c_str()); + fast_sim_eval->set_filename(outputfile); se->registerSubsystem(fast_sim_eval); } From 6bf7b6c09bb86b57111552102d5eb68f9f37adfb Mon Sep 17 00:00:00 2001 From: pingwong Date: Tue, 16 Jun 2020 18:19:24 -0400 Subject: [PATCH 0668/1222] (1) Separate FST from FGEM. (2) Added barrel tracker and modified FST based on Xuan Li's design --- macros/g4simulations/Fun4All_G4_EICDetector.C | 17 +- macros/g4simulations/G4Setup_EICDetector.C | 20 +- macros/g4simulations/G4_Barrel_EIC.C | 88 +++++++ macros/g4simulations/G4_FST_EIC.C | 112 +++++++++ macros/g4simulations/G4_GEM_EIC.C | 110 +-------- macros/g4simulations/G4_Tracking_EIC.C | 216 +++++++++--------- 6 files changed, 342 insertions(+), 221 deletions(-) create mode 100644 macros/g4simulations/G4_Barrel_EIC.C create mode 100644 macros/g4simulations/G4_FST_EIC.C diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index e5de52600..5beaa68cf 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -96,8 +96,10 @@ int Fun4All_G4_EICDetector( // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C Enable::EGEM = false; - Enable::FGEM = true; - Enable::MVTX = true; + Enable::FGEM = false; + Enable::FST = true; + Enable::BARREL = true; //barrel tracker + Enable::MVTX = false; Enable::TPC = false; Enable::TRACKING = true; bool do_tracking_cell = Enable::TRACKING && true; @@ -176,7 +178,7 @@ int Fun4All_G4_EICDetector( bool do_dst_compress = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = false; + bool do_DSTReader = true; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -306,10 +308,13 @@ int Fun4All_G4_EICDetector( } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-3, 3); - gen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); + //gen->set_eta_range(-3, 3); + gen->set_eta_range(2,2); + gen->set_phi_range(TMath::Pi()/2.0,TMath::Pi()/2.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->set_pt_range(0.1, 20.0); + gen->set_pt_range(3,3); gen->Embed(1); gen->Verbosity(0); diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 7c05abf94..5e464ecef 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -13,12 +13,14 @@ #include #include #include "G4_Aerogel.C" +#include "G4_Barrel_EIC.C" #include "G4_BlackHole.C" #include "G4_CEmc_EIC.C" #include "G4_DIRC.C" #include "G4_EEMC.C" #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" +#include "G4_FST_EIC.C" #include "G4_GEM_EIC.C" #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" @@ -56,11 +58,18 @@ void G4Init() { EGEM_Init(); } - if (Enable::FGEM) { FGEM_Init(); } + if (Enable::FST) + { + FST_Init(); + } + if (Enable::BARREL) + { + BarrelInit(); + } if (Enable::MVTX) { MvtxInit(); @@ -205,8 +214,15 @@ int G4Setup(const int absorberactive = 0, if (Enable::FGEM) { FGEMSetup(g4Reco); + } + if (Enable::FST) + { + FSTSetup(g4Reco); + } + if (Enable::BARREL) + { + Barrel(g4Reco, radius, absorberactive); } - if (Enable::MVTX) { radius = Mvtx(g4Reco, radius, absorberactive); diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C new file mode 100644 index 000000000..9c0bc893c --- /dev/null +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------* + * 06-15-2020 * + * Ping: Base on G4_TPC_EIC.C * + *--------------------------------------------------------------------*/ +#pragma once + +#include "G4_Mvtx.C" +#include "GlobalVariables.C" +#include +#include +#include +#include +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) +//---------------------------------------------------------------------// +namespace Enable +{ + static bool BARREL = false; +} +//---------------------------------------------------------------------// +namespace G4Barrel +{ +} // namespace G4Barrel +//---------------------------------------------------------------------// +void BarrelInit(int verbosity = 0) +{ +} +//---------------------------------------------------------------------// +double Barrel(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + int i,j; + + //--------------------------------- + //build barrel detector + //--------------------------------- + const int nLayer=5; + const int nSubLayer=7; + const float um=0.0001; //convert um to cm + + double r[nLayer]={3.64, 4.81, 5.98, 16.0, 22.0}; //cm + double halfLength[nLayer]={20, 20, 25, 25, 25}; //cm + + string layerName[nSubLayer]={"SiliconSensor","Metalconnection","HDI","Cooling", + "Support1","Support_Gap","Support2"}; + string material[nSubLayer]={"G4_Si","G4_Al","G4_KAPTON","G4_WATER", + "G4_GRAPHITE","G4_AIR","G4_GRAPHITE"}; + double thickness[nSubLayer]={285 * um, 15 * um, 20 * um, 100 * um, + 50 * um, 1, 50 * um}; + + int k=0; //layer id. Must be unique. + PHG4CylinderSubsystem* cyl; + for (i=0;i2) continue; + for (j=0;jset_double_param("radius", r[i]); + else cyl->set_double_param("radius", r[i]+thickness[j-1]); + + cyl->set_double_param("length", 2.0*halfLength[i]); + cyl->set_string_param("material", material[j].c_str()); + cyl->set_double_param("thickness", thickness[j]); + cyl->SuperDetector("Barrel"); + if (j==0) cyl->SetActive(); //only the Silicon Sensor is active + + g4Reco->registerSubsystem(cyl); + k++; + } + } + + //fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + //fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + //fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); + //fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + //fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + //fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + //fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + + // update now that we know the outer radius + //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); + //return radius; + return r[nLayer-1]; +} +//---------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C new file mode 100644 index 000000000..b0d40077b --- /dev/null +++ b/macros/g4simulations/G4_FST_EIC.C @@ -0,0 +1,112 @@ +#pragma once + +#include "GlobalVariables.C" +#include +#include +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax); +//-----------------------------------------------------------------------------------// +namespace Enable +{ + static bool FST = false; +} +//-----------------------------------------------------------------------------------// +void FST_Init() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); +} +//-----------------------------------------------------------------------------------// +void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) +{ + //const double tilt = .1; + /* + string name; + double etamax; + double etamin; + double zpos; + */ + + //Design from Xuan Li @LANL + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); + //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); + +} +//-----------------------------------------------------------------------------------// +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, + double zpos, double Rmin, double Rmax) +{ + // cout + // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " + // << name << endl; + + // always facing the interaction point + double polar_angle = 0; + if (zpos < 0) { + zpos = -zpos; + polar_angle = TMath::Pi(); + } + + double min_polar_angle = TMath::ATan2(Rmin, zpos); + double max_polar_angle = TMath::ATan2(Rmax, zpos); + + if (max_polar_angle < min_polar_angle) { + double t = max_polar_angle; + max_polar_angle = min_polar_angle; + min_polar_angle = t; + } + + PHG4SectorSubsystem *fst; + fst = new PHG4SectorSubsystem(name.c_str()); + + fst->SuperDetector(name); + + fst->get_geometry().set_normal_polar_angle(polar_angle); + fst->get_geometry().set_normal_start( + zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + fst->get_geometry().set_min_polar_angle(min_polar_angle); + fst->get_geometry().set_max_polar_angle(max_polar_angle); + fst->get_geometry().set_max_polar_edge( + PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_min_polar_edge( + PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_N_Sector(1); + fst->get_geometry().set_material("G4_AIR"); + fst->OverlapCheck(overlapcheck); + + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + // build up layers + + /* + fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 18 * um, true, 100); + fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + fst->get_geometry().AddLayer("SliconSupport", "G4_Al", 285 * um, false, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); + fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + */ + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); + fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + + g4Reco->registerSubsystem(fst); + return 0; +} +//-----------------------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 1c1c4e763..cea545057 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,22 +1,15 @@ #pragma once #include "GlobalVariables.C" - #include - #include - #include - #include R__LOAD_LIBRARY(libg4detectors.so) -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8); +int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax); namespace Enable { @@ -64,24 +57,6 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // double zpos; PHG4SectorSubsystem *gem; - /// LANL FST From Xuan Li - // plane 1, z location: 1200mm, inner radius: 45mm, outer radius: 350mm - // plane 2, z location: 1400mm, inner radius: 50mm, outer radius: 390mm - // plane 3, z location: 1700mm, inner radius: 60mm, outer radius: 410mm - // plane 4, z location: 1900mm, inner radius: 70mm, outer radius: 430mm - // We also need two outer barrel layers which might need some adjustments by the space limitation - // and needs integration with the central vertex detector. - // - // Note1: last station need to be removed to avoid confliction with the gas RICH. GEM chamber at z=2.7m is used instead - // Note2: increase inner radius for beam pipe flange clearance - - make_LANL_FST_station("FST_0", g4Reco, 17, 3.2, 18); - make_LANL_FST_station("FST_1", g4Reco, 62, 3.2, 18); - - /////////////////////////////////////////////////////////////////////////// - - make_LANL_FST_station("FST_2", g4Reco, 120, 10, 35); - /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; @@ -105,11 +80,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // gem->OverlapCheck(overlapcheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - //g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - make_LANL_FST_station("FST_3", g4Reco, 140, 12, 41); + g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// @@ -140,14 +111,10 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); gem->OverlapCheck(overlapcheck); - //g4Reco->registerSubsystem(gem); + g4Reco->registerSubsystem(gem); /////////////////////////////////////////////////////////////////////////// - make_LANL_FST_station("FST_4", g4Reco, 160, 12, 41); - - /////////////////////////////////////////////////////////////////////////// - name = "FGEM_4"; etamax = 3.5; etamin = min_eta; @@ -169,7 +136,9 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // gem->OverlapCheck(overlapcheck); AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); - //g4Reco->registerSubsystem(gem); + g4Reco->registerSubsystem(gem); + + /////////////////////////////////////////////////////////////////////////// zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) * sin(tilt); @@ -193,73 +162,8 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // AddLayers_MiniTPCDrift(gem); gem->get_geometry().AddLayers_HBD_GEM(); gem->OverlapCheck(overlapcheck); - //g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); - - /////////////////////////////////////////////////////////////////////////// -} - -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax) -{ - // cout - // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " - // << name << endl; - - // always facing the interaction point - double polar_angle = 0; - if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - } - - double min_polar_angle = TMath::ATan2(Rmin, zpos); - double max_polar_angle = TMath::ATan2(Rmax, zpos); - - if (max_polar_angle < min_polar_angle) - { - double t = max_polar_angle; - max_polar_angle = min_polar_angle; - min_polar_angle = t; - } - - PHG4SectorSubsystem *fst; - fst = new PHG4SectorSubsystem(name.c_str()); - - fst->SuperDetector(name); - - fst->get_geometry().set_normal_polar_angle(polar_angle); - fst->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - fst->get_geometry().set_min_polar_angle(min_polar_angle); - fst->get_geometry().set_max_polar_angle(max_polar_angle); - fst->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_N_Sector(1); - fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(overlapcheck); + g4Reco->registerSubsystem(gem); - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - // build up layers - fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 18 * um, true, 100); - fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - fst->get_geometry().AddLayer("SliconSupport", "G4_Al", 285 * um, false, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); - - g4Reco->registerSubsystem(fst); - return 0; } //! Add drift layers to mini TPC diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 802bca896..d38a8be5c 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -27,9 +27,9 @@ namespace Enable { static bool TRACKING = false; } - +//-----------------------------------------------------------------------------// void TrackingInit() {} - +//-----------------------------------------------------------------------------// void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) { int i; @@ -43,114 +43,90 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) // kalman->Verbosity(); // kalman->Smearing(false); if (displaced_vertex) - { - //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(1); - kalman->set_vertex_z_resolution(1); - kalman->enable_vertexing(true); - } + { + //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(1); + kalman->set_vertex_z_resolution(1); + kalman->enable_vertexing(true); + } else - { - // constraint to a primary vertex and use it as part of the fitting level arm - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50e-4); - kalman->set_vertex_z_resolution(50e-4); - } + { + // constraint to a primary vertex and use it as part of the fitting level arm + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50e-4); + kalman->set_vertex_z_resolution(50e-4); + } kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name("SvtxTrackMap"); - if (Enable::MVTX) - { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); + //------------------------- + // Barrel + //------------------------- + if (Enable::BARREL) { + kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise } - // + //------------------------- + // MVTX + //------------------------- + if (Enable::MVTX) + { + // MAPS + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + //------------------------- // TPC + //------------------------- if (Enable::TPC) - { - kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } + { + kalman->add_phg4hits( + "G4HIT_SVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + //------------------------- + // EGEM + //------------------------- if (Enable::EGEM) - { - // GEM0, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM1, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_EGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - - if (Enable::FGEM) - { - bool do_FST=true; - bool do_FGEM=false; //Ping: don't need GEM at the moment - - if (do_FST) { - // LANL FST: We could put the hit resolution at 5 micron with the 30 micron pixel pitch. - for (i=0;i<6;i++) { - kalman->add_phg4hits(Form("G4HIT_FST_%d",i), // const std::string& phg4hitsNames, + { + // GEM, 70um azimuthal resolution, 1cm radial strips + for (i=0;i<4;i++) { + kalman->add_phg4hits( + Form("G4HIT_EGEM_%d",i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, 1, // const float eff, - 0); // const float noise + 0 // const float noise + ); } } - - if (do_FGEM) { + //------------------------- + // FGEM + //------------------------- + if (Enable::FGEM) + { // GEM2, 70um azimuthal resolution, 1cm radial strips for (i=2;i<5;i++) { kalman->add_phg4hits(Form("G4HIT_FGEM_%d",i), // const std::string& phg4hitsNames, @@ -162,27 +138,47 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) 0); // const float noise } } - } - + //------------------------- + // FST + //------------------------- + if (Enable::FST) { + for (i=0;i<5;i++) { + kalman->add_phg4hits(Form("G4HIT_FST_%d",i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } + //------------------------- + // FEMC + //------------------------- // Saved track states (projections) if (Enable::FEMC) - { - // kalman->add_state_name("FEMC"); - } + { + // kalman->add_state_name("FEMC"); + } + //------------------------- + // FHCAL + //------------------------- if (Enable::FHCAL) - { - // kalman->add_state_name("FHCAL"); - } - + { + // kalman->add_state_name("FHCAL"); + } + //------------------------- + // CEMC + //------------------------- if (Enable::CEMC) - { - // kalman->add_state_name("CEMC"); - } + { + // kalman->add_state_name("CEMC"); + } se->registerSubsystem(kalman); return; } - +//-----------------------------------------------------------------------------// void Tracking_Eval(std::string outputfile, int verbosity = 0) { //--------------- From a27e57581c785545fcd63dd7581fd0dbb5b7f3f1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:41:37 -0400 Subject: [PATCH 0669/1222] add flags for calorimeter projections --- macros/g4simulations/G4_Tracking_EIC.C | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 41ecbaf51..85f06a293 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -31,7 +31,10 @@ namespace Enable namespace G4TRACKING { - bool displaced_vertex = false; + bool DISPLACED_VERTEX = false; + bool PROJECTION_CEMC = false; + bool PROJECTION_FEMC = false; + bool PROJECTION_FHCAL = false; } void TrackingInit() {} @@ -49,7 +52,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); // kalman->Verbosity(); // kalman->Smearing(false); - if (G4TRACKING::displaced_vertex) + if (G4TRACKING::DISPLACED_VERTEX) { //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex kalman->set_use_vertex_in_fitting(true); @@ -178,16 +181,16 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); } // Saved track states (projections) - if (Enable::FEMC) + if (Enable::FEMC && G4TRACKING::PROJECTION_FEMC) { kalman->add_state_name("FEMC"); } - if (Enable::FHCAL) + if (Enable::FHCAL && G4TRACKING::PROJECTION_FHCAL) { kalman->add_state_name("FHCAL"); } - if (Enable::CEMC) + if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) { kalman->add_state_name("CEMC"); } From 74c2e48da2ca24ea75cdf5eb533fa21e78b228c8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:41:58 -0400 Subject: [PATCH 0670/1222] clang-format --- macros/g4simulations/G4_Tracking_EIC.C | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 85f06a293..5b9a3e2c5 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -27,7 +27,7 @@ namespace Enable bool TRACKING = false; bool TRACKING_EVAL = false; int TRACKING_VERBOSITY = 0; -} +} // namespace Enable namespace G4TRACKING { @@ -35,14 +35,13 @@ namespace G4TRACKING bool PROJECTION_CEMC = false; bool PROJECTION_FEMC = false; bool PROJECTION_FHCAL = false; -} +} // namespace G4TRACKING void TrackingInit() {} void Tracking_Reco() { - -int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- @@ -187,7 +186,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); } if (Enable::FHCAL && G4TRACKING::PROJECTION_FHCAL) { - kalman->add_state_name("FHCAL"); + kalman->add_state_name("FHCAL"); } if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) @@ -201,7 +200,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); void Tracking_Eval(const std::string &outputfile) { -int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- From 0b0188c826fed1763bcfbf1eaee78a888d988680 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:42:42 -0400 Subject: [PATCH 0671/1222] remove obsolete SVTX functions --- macros/g4simulations/G4_Mvtx_EIC.C | 44 ------------------------------ 1 file changed, 44 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index d2b79da81..20667c09d 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -85,47 +85,3 @@ double Mvtx(PHG4Reco* g4Reco, double radius, g4Reco->registerSubsystem(mvtx); return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm } - -// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now -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 - //----------- - - return; -} - -// Central detector reco is disabled as EIC setup use the fast tracking sim for now -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - return; -} From b148d59b48e6f214dd63812d24c02a56777e6bea Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:42:57 -0400 Subject: [PATCH 0672/1222] clang-format --- macros/g4simulations/G4_Mvtx_EIC.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index 20667c09d..f32b53bac 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -20,14 +20,14 @@ namespace Enable bool MVTX_OVERLAPCHECK = 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 vector N_staves = {18, 24, 30}; vector nom_radius = {36.4, 48.1, 59.8}; -} // namespace MVTX +} // namespace G4MVTX void MvtxInit(int verbosity = 0) { @@ -60,13 +60,13 @@ double Mvtx(PHG4Reco* g4Reco, double radius, if (G4MVTX::N_staves.size() < G4MVTX::n_maps_layer) { cout << "vector N_staves too small: " << G4MVTX::N_staves.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; gSystem->Exit(1); } if (G4MVTX::nom_radius.size() < G4MVTX::n_maps_layer) { cout << "vector nom_radius too small: " << G4MVTX::nom_radius.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; gSystem->Exit(1); } for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) From 205ea26ff6b286f612ca3ab8795e8e1914a97a69 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 18:43:22 -0400 Subject: [PATCH 0673/1222] use Enable namespace for tracking --- macros/g4simulations/Fun4All_G4_EICDetector.C | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 1588a305e..14724ab82 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -110,10 +110,12 @@ int Fun4All_G4_EICDetector( Enable::MVTX = true; Enable::TPC = true; Enable::TRACKING = true; - bool do_tracking_cell = Enable::TRACKING && true; - bool do_tracking_track = do_tracking_cell && true; - bool do_tracking_eval = do_tracking_track && true; - bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes + Enable::TRACKING_EVAL = Enable::TRACKING && true; + G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes +// projections to calorimeters + G4TRACKING::PROJECTION_CEMC = false; + G4TRACKING::PROJECTION_FEMC = false; + G4TRACKING::PROJECTION_FHCAL = false; Enable::CEMC = true; // Enable::CEMC_ABSORBER = true; @@ -165,10 +167,6 @@ int Fun4All_G4_EICDetector( Enable::EEMC_TOWER = Enable::EEMC_CELL && true; Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; - // bool do_EEMC_cell = Enable::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; Enable::PLUGDOOR = true; @@ -418,8 +416,6 @@ int Fun4All_G4_EICDetector( // Detector Division //------------------ - if (do_tracking_cell) Svtx_Cells(); - if (Enable::CEMC_CELL) CEMC_Cells(); if (Enable::HCALIN_CELL) HCALInner_Cells(); @@ -468,7 +464,7 @@ int Fun4All_G4_EICDetector( // SVTX tracking //-------------- - if (do_tracking_track) Tracking_Reco(0, do_vertex_finding); + if (Enable::TRACKING) Tracking_Reco(); //----------------- // Global Vertexing @@ -514,7 +510,7 @@ int Fun4All_G4_EICDetector( //---------------------- // Simulation evaluation //---------------------- - if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); + if (Enable::TRACKING_EVAL) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); if (Enable::CEMC_EVAL) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); From 5adf30b9a74908ab765f66db902bb3b97e39d526 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 21:13:43 -0400 Subject: [PATCH 0674/1222] rename SVTX to TPC (nodes) --- macros/g4simulations/G4_TPC_EIC.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C index 511c64cbc..7afb6b3b6 100644 --- a/macros/g4simulations/G4_TPC_EIC.C +++ b/macros/g4simulations/G4_TPC_EIC.C @@ -65,12 +65,12 @@ double TPC(PHG4Reco* g4Reco, double radius, radius = G4TPC::inner_cage_radius; // inner field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", G4MVTX::n_maps_layer); + cyl = new PHG4CylinderSubsystem("FIELDCAGE", G4MVTX::n_maps_layer); cyl->set_double_param("radius", radius); cyl->set_double_param("length", G4TPC::cage_length); cyl->set_string_param("material", "G4_KAPTON"); cyl->set_double_param("thickness", G4TPC::cage_thickness); - cyl->SuperDetector("SVTXSUPPORT"); + cyl->SuperDetector("FIELDCAGE"); cyl->Verbosity(0); g4Reco->registerSubsystem(cyl); @@ -92,13 +92,13 @@ double TPC(PHG4Reco* g4Reco, double radius, double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) { - cyl = new PHG4CylinderSubsystem("SVTX", nlayer); + cyl = new PHG4CylinderSubsystem("TPC", nlayer); cyl->set_double_param("radius", radius); cyl->set_double_param("length", G4TPC::cage_length); cyl->set_string_param("material", G4TPC::tpcgas); cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); cyl->SetActive(); - cyl->SuperDetector("SVTX"); + cyl->SuperDetector("TPC"); g4Reco->registerSubsystem(cyl); radius += tpc_layer_thickness; @@ -107,13 +107,13 @@ double TPC(PHG4Reco* g4Reco, double radius, } // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", nlayer); + cyl = new PHG4CylinderSubsystem("FIELDCAGE", nlayer); cyl->set_double_param("radius", radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4TPC::cage_length); cyl->set_string_param("material", "G4_KAPTON"); cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("SVTXSUPPORT"); + cyl->SuperDetector("FIELDCAGE"); g4Reco->registerSubsystem(cyl); radius += G4TPC::cage_thickness; From c0382d3a0c2838ac080d54ad6ac9f8ff96e2022d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 21:14:27 -0400 Subject: [PATCH 0675/1222] use TrackMap as track node name, put under TRACKS composite node --- macros/g4simulations/G4_Tracking_EIC.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 5b9a3e2c5..c6ce4ae50 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -37,7 +37,10 @@ namespace G4TRACKING bool PROJECTION_FHCAL = false; } // namespace G4TRACKING -void TrackingInit() {} +void TrackingInit() +{ + TRACKING::TrackNodeName = "TrackMap"; +} void Tracking_Reco() { @@ -67,10 +70,8 @@ void Tracking_Reco() kalman->set_vertex_z_resolution(50e-4); } - // kalman->set_sub_top_node_name("TRACKS"); - // kalman->set_trackmap_out_name("TrackMap"); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); + kalman->set_sub_top_node_name("TRACKS"); + kalman->set_trackmap_out_name(TRACKING::TrackNodeName); if (Enable::MVTX) { @@ -90,7 +91,7 @@ void Tracking_Reco() if (Enable::TPC) { kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, + "G4HIT_TPC", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, 1, // const float radres, 200e-4, // const float phires, From cad1773f84e45706b9166729f84586b3bb66a7b9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 21:15:06 -0400 Subject: [PATCH 0676/1222] Add TrackNodeName used by G4_Tracking and G4_Jets macros --- macros/g4simulations/GlobalVariables.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 2b732af81..8d4f1f8e6 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -41,3 +41,9 @@ namespace G4P6DECAYER { EDecayType decayType = EDecayType::kAll; } + +// our various tracking macro +namespace TRACKING +{ + string TrackNodeName = "SvtxTrackMap"; +} From 6c55f34e8d193682065c2a7d2f8ea30557e24203 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 21:15:38 -0400 Subject: [PATCH 0677/1222] add tracknodename as parameter to trackjet input --- macros/g4simulations/G4_Jets.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C index fa42c2560..c167dd9e6 100644 --- a/macros/g4simulations/G4_Jets.C +++ b/macros/g4simulations/G4_Jets.C @@ -82,7 +82,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); // track jets JetReco *trackjetreco = new JetReco("TRACKJETRECO"); - trackjetreco->add_input(new TrackJetInput(Jet::TRACK)); + 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"); From ab343fa556ae76630cf4a9bbad009dc0e822f730 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 22:51:37 -0400 Subject: [PATCH 0678/1222] Add Enable namespace --- macros/g4simulations/G4_HIJetReco.C | 126 +++++++++++++++------------- 1 file changed, 67 insertions(+), 59 deletions(-) diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C index c039d104b..c5511dcd4 100644 --- a/macros/g4simulations/G4_HIJetReco.C +++ b/macros/g4simulations/G4_HIJetReco.C @@ -1,29 +1,39 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + #include #include #include #include -#include + #include #include #include +#include #include #include + +#include + R__LOAD_LIBRARY(libg4jets.so) R__LOAD_LIBRARY(libjetbackground.so) -#endif -void HIJetRecoInit() {} +namespace Enable +{ + bool HIJETS = false; + int HIJETS_VERBOSITY = 0; +} // namespace Enable -void HIJetReco(int verbosity = 0, bool do_flow = false, bool do_CS = false ) { - - //--------------- - // Load libraries - //--------------- +namespace G4HIJETS +{ + bool do_flow = false; + bool do_CS = false; +} // namespace G4HIJETS + +void HIJetRecoInit() {} - gSystem->Load("libjetbackground.so"); +void HIJetReco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HIJETS_VERBOSITY); //--------------- // Fun4All server @@ -33,95 +43,93 @@ void HIJetReco(int verbosity = 0, bool do_flow = false, bool do_CS = false ) { JetReco *truthjetreco = new JetReco(); TruthJetInput *tji = new TruthJetInput(Jet::PARTICLE); - tji->add_embedding_flag( 0 ); // changes depending on signal vs. embedded + 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->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(0); + truthjetreco->Verbosity(verbosity); se->registerSubsystem(truthjetreco); RetowerCEMC *rcemc = new RetowerCEMC(); - rcemc->Verbosity( verbosity ); - se->registerSubsystem( rcemc ); + 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->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 ); + towerjetreco->Verbosity(verbosity); se->registerSubsystem(towerjetreco); DetermineTowerBackground *dtb = new DetermineTowerBackground(); dtb->SetBackgroundOutputName("TowerBackground_Sub1"); - dtb->SetFlow( do_flow ); - dtb->SetSeedType( 0 ); - dtb->SetSeedJetD( 3 ); - dtb->Verbosity( verbosity ); - se->registerSubsystem( dtb ); + dtb->SetFlow(G4HIJETS::do_flow); + dtb->SetSeedType(0); + dtb->SetSeedJetD(3); + dtb->Verbosity(verbosity); + se->registerSubsystem(dtb); CopyAndSubtractJets *casj = new CopyAndSubtractJets(); - casj->SetFlowModulation( do_flow ); - casj->Verbosity( verbosity ); - se->registerSubsystem( casj ); + casj->SetFlowModulation(G4HIJETS::do_flow); + casj->Verbosity(verbosity); + se->registerSubsystem(casj); DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); dtb2->SetBackgroundOutputName("TowerBackground_Sub2"); - dtb2->SetFlow( do_flow ); - dtb2->SetSeedType( 1 ); - dtb2->SetSeedJetPt( 7 ); - dtb2->Verbosity( verbosity ); - se->registerSubsystem( dtb2 ); - + dtb2->SetFlow(G4HIJETS::do_flow); + dtb2->SetSeedType(1); + dtb2->SetSeedJetPt(7); + dtb2->Verbosity(verbosity); + se->registerSubsystem(dtb2); + SubtractTowers *st = new SubtractTowers(); - st->SetFlowModulation( do_flow ); - st->Verbosity( verbosity ); - se->registerSubsystem( st ); + 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->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 ); + towerjetreco->Verbosity(verbosity); se->registerSubsystem(towerjetreco); - if ( do_CS ) { - + if (G4HIJETS::do_CS) + { SubtractTowersCS *stCS = new SubtractTowersCS(); - stCS->SetFlowModulation( do_flow ); - stCS->SetAlpha( 1 ); - stCS->SetDeltaRmax( 0.3 ); - stCS->Verbosity( verbosity ); - se->registerSubsystem( stCS ); + 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->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 ); - + towerjetrecoCS->Verbosity(verbosity); + se->registerSubsystem(towerjetrecoCS); } return; - -} +} From c413ce4d2da351e6b9e74c6b2d0b4427c55a9916 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 23:03:17 -0400 Subject: [PATCH 0679/1222] propagate track node name to evaluator --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 6 ++++-- macros/g4simulations/G4_Tracking_EIC.C | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index 18e3a9c29..d72153a34 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -35,6 +35,7 @@ void FGEM_Init() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); + TRACKING::TrackNodeName = "TrackMap"; // node name for tracks } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -247,8 +248,8 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); kalman->set_vertex_xy_resolution(50E-4); kalman->set_vertex_z_resolution(50E-4); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); + kalman->set_sub_top_node_name("TRACKS"); + kalman->set_trackmap_out_name(TRACKING::TrackNodeName); // MAPS in MVTX detector kalman->add_phg4hits( @@ -343,6 +344,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); fast_sim_eval->set_filename(outputfile); se->registerSubsystem(fast_sim_eval); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index c6ce4ae50..3ca63dbcc 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -213,6 +213,7 @@ void Tracking_Eval(const std::string &outputfile) //---------------- PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); fast_sim_eval->set_filename(outputfile); se->registerSubsystem(fast_sim_eval); } From 966bfda507019f369b0eccc438498f769284b157 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Jun 2020 23:03:51 -0400 Subject: [PATCH 0680/1222] Add Enable namespace for HIJETS --- macros/g4simulations/Fun4All_G4_EICDetector.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 14724ab82..b19ad0416 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -187,7 +187,7 @@ int Fun4All_G4_EICDetector( // 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 && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -497,7 +497,7 @@ int Fun4All_G4_EICDetector( Jet_Reco(); } - if (do_HIjetreco) + if (Enable::HIJETS) { HIJetReco(); } From 1b7fd259276dabef65811a9d5be0866e8d8d36c7 Mon Sep 17 00:00:00 2001 From: pingwong Date: Wed, 17 Jun 2020 01:17:44 -0400 Subject: [PATCH 0681/1222] fix buds --- macros/g4simulations/G4_Barrel_EIC.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 9c0bc893c..75a49744b 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -4,7 +4,6 @@ *--------------------------------------------------------------------*/ #pragma once -#include "G4_Mvtx.C" #include "GlobalVariables.C" #include #include @@ -64,7 +63,7 @@ double Barrel(PHG4Reco* g4Reco, double radius, cyl->set_double_param("length", 2.0*halfLength[i]); cyl->set_string_param("material", material[j].c_str()); cyl->set_double_param("thickness", thickness[j]); - cyl->SuperDetector("Barrel"); + cyl->SuperDetector("BARREL"); if (j==0) cyl->SetActive(); //only the Silicon Sensor is active g4Reco->registerSubsystem(cyl); From 65ef07cf66a4d8b9acccda53de7ceda3206e10e7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 01:20:59 -0400 Subject: [PATCH 0682/1222] put pythia6/8 config files into namespace --- macros/g4simulations/G4_Input.C | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index a286d1fa5..5ff2ff3e4 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -44,6 +44,16 @@ namespace INPUTEMBED string filename; } +namespace PYTHIA6 +{ + string config_file = "phpythia6.cfg"; +} + +namespace PYTHIA8 +{ + string config_file = "phpythia8.cfg"; +} + void InputInit() { // first consistency checks - not all input generators play nice @@ -63,14 +73,14 @@ void InputInit() if (Input::PYTHIA6) { PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); + pythia6->set_config_file(PYTHIA6::config_file); se->registerSubsystem(pythia6); } if (Input::PYTHIA8) { PHPythia8 *pythia8 = new PHPythia8(); // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); + pythia8->set_config_file(PYTHIA8::config_file); se->registerSubsystem(pythia8); } if (Input::SIMPLE) From 31cba85d5b8a36ae5eac798ce84d0932c05c8c54 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 02:29:04 -0400 Subject: [PATCH 0683/1222] add convenience setting functions --- macros/g4simulations/G4_Input_Simple.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index 7bb443906..26f33ea96 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -35,6 +35,11 @@ namespace INPUTSIMPLE double pmax = 50.; map particles; void AddParticle(const string &name, const unsigned int num); + void set_eta_range(double d1, double d2) {etamin = d1; etamax=d2;} + void set_phi_range(double d1, double d2) {phimin = d1; phimax=d2;} + void set_p_range(double d1, double d2) {pmin = d1; pmax=d2;} + void set_vtx_mean(double dx, double dy, double dz) {vxmean = vx; vymean = vy; vzmean = vz;} + void set_vtx_width(double dx, double dy, double dz) {vxwidth = vx; vywidth = vy; vzwidth = vz;} } // namespace INPUTSIMPLE void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) From 6748897d5d9847439bbfc2e08111e0ee345cb5c1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 02:29:40 -0400 Subject: [PATCH 0684/1222] replace pythi6/8 and simple particle with new G4_Inputs --- macros/g4simulations/Fun4All_G4_EICDetector.C | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index b19ad0416..39f64e667 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -10,6 +10,7 @@ #include "G4_FwdJets.C" #include "G4_Global.C" #include "G4_HIJetReco.C" +#include "G4_Input.C" #include "G4_Jets.C" #include @@ -31,15 +32,11 @@ #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) int Fun4All_G4_EICDetector( @@ -67,10 +64,18 @@ int Fun4All_G4_EICDetector( const bool readeictree = false; // Or: // Use Pythia 8 - const bool runpythia8 = false; + // Input::PYTHIA8 = true; // Or: // Use Pythia 6 - const bool runpythia6 = false; +// Input::PYTHIA6 = true; + PYTHIA6::config_file = "phpythia6_ep.cfg"; + Input::SIMPLE = true; +INPUTSIMPLE::AddParticle("pi-", 5); +INPUTSIMPLE::set_eta_range(-3,3); +INPUTSIMPLE::set_phi_range(-M_PI,M_PI); +INPUTSIMPLE::set_p_range(0.1,20.); +INPUTSIMPLE::set_vtx_mean(0.,0.,0.); +INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Or: // Use HEPGen const bool runhepgen = false; @@ -246,20 +251,6 @@ int Fun4All_G4_EICDetector( se->registerSubsystem(eicr); } - else if (runpythia8) - { - PHPythia8 *pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - } - else if (runpythia6) - { - PHPythia6 *pythia6 = new PHPythia6(); - // see coresoftware/generators/PHPythia6 for example config - pythia6->set_config_file("phpythia6_ep.cfg"); - se->registerSubsystem(pythia6); - } /* else if (runhepgen) { @@ -294,12 +285,16 @@ int Fun4All_G4_EICDetector( se->registerSubsystem(mysartre); } + //----------------- + // Initialize the selected Input/Event generation + //----------------- + InputInit(); // If "readhepMC" is also set, the particles will be embedded in Hijing events - if (particles) + if (particles && false) { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi-", 5); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc) @@ -313,7 +308,7 @@ int Fun4All_G4_EICDetector( 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_distribution_width(0.0, 0.0, 5.0); } gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); gen->set_vertex_size_parameters(0.0, 0.0); @@ -392,6 +387,7 @@ int Fun4All_G4_EICDetector( cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; } + if (!readhits) { //--------------------- From d547591faf208d88a315544870230c15afe37ac1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 22:19:11 -0400 Subject: [PATCH 0685/1222] Add set_p_range and set_pt_range --- macros/g4simulations/G4_Input_Simple.C | 29 +++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index 26f33ea96..c6f0904bf 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -31,15 +31,18 @@ namespace INPUTSIMPLE double etamax = 3.; double phimin = -1. * M_PI; double phimax = 1. * M_PI; - double pmin = 0.5; - double pmax = 50.; + double ptmin = 0.5; + double ptmax = 50.; + double pmin = NAN; + double pmax = NAN; map particles; void AddParticle(const string &name, const unsigned int num); void set_eta_range(double d1, double d2) {etamin = d1; etamax=d2;} void set_phi_range(double d1, double d2) {phimin = d1; phimax=d2;} - void set_p_range(double d1, double d2) {pmin = d1; pmax=d2;} - void set_vtx_mean(double dx, double dy, double dz) {vxmean = vx; vymean = vy; vzmean = vz;} - void set_vtx_width(double dx, double dy, double dz) {vxwidth = vx; vywidth = vy; vzwidth = vz;} + void set_p_range(double d1, double d2); + void set_pt_range(double d1, double d2); + void set_vtx_mean(double vx, double vy, double vz) {vxmean = vx; vymean = vy; vzmean = vz;} + void set_vtx_width(double vx, double vy, double vz) {vxwidth = vx; vywidth = vy; vzwidth = vz;} } // namespace INPUTSIMPLE void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) @@ -61,6 +64,22 @@ void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) } } +void INPUTSIMPLE::set_p_range(double d1, double d2) +{ +pmin = d1; +pmax=d2; +ptmin = NAN; +ptmax=NAN; +} + +void INPUTSIMPLE::set_pt_range(double d1, double d2) +{ +pmin = NAN; +pmax=NAN; +ptmin = d1; +ptmax=d2; +} + void InputSimpleInit() { if (INPUTSIMPLE::particles.empty()) From 06eefdabae7da76fc6589503fb00d164d68cefd0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 22:19:44 -0400 Subject: [PATCH 0686/1222] clang-format --- macros/g4simulations/G4_Input_Simple.C | 42 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index c6f0904bf..dc105e02d 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -37,12 +37,30 @@ namespace INPUTSIMPLE double pmax = NAN; map particles; void AddParticle(const string &name, const unsigned int num); - void set_eta_range(double d1, double d2) {etamin = d1; etamax=d2;} - void set_phi_range(double d1, double d2) {phimin = d1; phimax=d2;} + void set_eta_range(double d1, double d2) + { + etamin = d1; + etamax = d2; + } + void set_phi_range(double d1, double d2) + { + phimin = d1; + phimax = d2; + } void set_p_range(double d1, double d2); void set_pt_range(double d1, double d2); - void set_vtx_mean(double vx, double vy, double vz) {vxmean = vx; vymean = vy; vzmean = vz;} - void set_vtx_width(double vx, double vy, double vz) {vxwidth = vx; vywidth = vy; vzwidth = vz;} + void set_vtx_mean(double vx, double vy, double vz) + { + vxmean = vx; + vymean = vy; + vzmean = vz; + } + void set_vtx_width(double vx, double vy, double vz) + { + vxwidth = vx; + vywidth = vy; + vzwidth = vz; + } } // namespace INPUTSIMPLE void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) @@ -66,18 +84,18 @@ void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) void INPUTSIMPLE::set_p_range(double d1, double d2) { -pmin = d1; -pmax=d2; -ptmin = NAN; -ptmax=NAN; + pmin = d1; + pmax = d2; + ptmin = NAN; + ptmax = NAN; } void INPUTSIMPLE::set_pt_range(double d1, double d2) { -pmin = NAN; -pmax=NAN; -ptmin = d1; -ptmax=d2; + pmin = NAN; + pmax = NAN; + ptmin = d1; + ptmax = d2; } void InputSimpleInit() From 44cf07325074c3a2f0ce188531e9f61fc30967f6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 22:20:33 -0400 Subject: [PATCH 0687/1222] move HepMC input and particle with embedding to G4_Input.C --- macros/g4simulations/Fun4All_G4_EICDetector.C | 83 +++++++------------ 1 file changed, 31 insertions(+), 52 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 39f64e667..963bf53dd 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -44,6 +44,22 @@ int Fun4All_G4_EICDetector( 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") { + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); // 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); + //=============== // Input options //=============== @@ -58,7 +74,7 @@ int Fun4All_G4_EICDetector( 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 + const bool readhepmc = true; // read HepMC files // Or: // read files in EICTree format generated by eicsmear package const bool readeictree = false; @@ -69,7 +85,9 @@ int Fun4All_G4_EICDetector( // Use Pythia 6 // Input::PYTHIA6 = true; PYTHIA6::config_file = "phpythia6_ep.cfg"; + Input::SIMPLE = true; + Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); INPUTSIMPLE::set_eta_range(-3,3); INPUTSIMPLE::set_phi_range(-M_PI,M_PI); @@ -91,6 +109,11 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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; + Input::HEPMC = true; + Input::HEPMC_VERBOSITY = 1; + INPUTHEPMC::filename = inputFile; + + InputInit(); // Write the DST Enable::DSTOUT = true; // Compress DST files @@ -214,22 +237,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(01); // 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 //----------------- @@ -288,39 +295,8 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //----------------- // Initialize the selected Input/Event generation //----------------- - InputInit(); +// InputInit(); // If "readhepMC" is also set, the particles will be embedded in Hijing events - if (particles && false) - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 5); // 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, 5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-3, 3); - 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(); @@ -537,9 +513,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); } if (readhepmc) { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager("DSTIN"); - se->registerInputManager(in); - se->fileopen(in->Name().c_str(), inputFile); } else { @@ -549,6 +522,12 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); se->registerInputManager(in); } + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + if (do_DSTReader) { //Convert DST to human command readable TTree for quick poke around the outputs From 60e6f99981896402fa768f8ca83fe844c3b3259d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 22:21:58 -0400 Subject: [PATCH 0688/1222] move registration of hepmcnodereader from G4Setup to G4_Input --- macros/g4simulations/G4Setup_EICDetector.C | 6 +----- macros/g4simulations/G4Setup_fsPHENIX.C | 7 ------- macros/g4simulations/G4_Input.C | 10 ++++++++++ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index b321843a2..1b8cc9880 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -12,6 +12,7 @@ #include "G4_GEM_EIC.C" #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" +#include "G4_Input.C" #include "G4_Magnet.C" #include "G4_Mvtx_EIC.C" #include "G4_PSTOF.C" @@ -27,7 +28,6 @@ #include -#include #include #include @@ -150,10 +150,6 @@ int G4Setup(const int absorberactive = 0, Fun4AllServer *se = Fun4AllServer::instance(); - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - PHG4Reco *g4Reco = new PHG4Reco(); WorldInit(g4Reco); diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C index 1b756c48d..5d04f5a17 100644 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ b/macros/g4simulations/G4Setup_fsPHENIX.C @@ -21,7 +21,6 @@ #include -#include #include #include @@ -118,12 +117,6 @@ int G4Setup() Fun4AllServer *se = Fun4AllServer::instance(); - if (Input::HEPMC) - { - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } PHG4Reco *g4Reco = new PHG4Reco(); g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST WorldInit(g4Reco); diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index 5ff2ff3e4..a3e017127 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -9,6 +9,8 @@ #include +#include + #include #include @@ -91,6 +93,14 @@ void InputInit() { InputGunInit(); } +// here are the various utility modules which read particles and +// put them onto the G4 particle stack + if (Input::HEPMC) + { + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + } } void InputManagers() From 1f85d6d0c7a4d5d4f5d25a9777240b315d1c9e04 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 22:22:18 -0400 Subject: [PATCH 0689/1222] add simple particle generator options --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 3253a1f2b..c9023693c 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -79,6 +79,11 @@ int Fun4All_G4_fsPHENIX( INPUTSIMPLE::AddParticle("pi-", 5); // INPUTSIMPLE::AddParticle("e-",0); // INPUTSIMPLE::AddParticle("pi-",10); +INPUTSIMPLE::set_eta_range(-1,3); +INPUTSIMPLE::set_phi_range(-M_PI,M_PI); +INPUTSIMPLE::set_pt_range(0.5,50.); +INPUTSIMPLE::set_vtx_mean(0.,0.,0.); +INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Input::PYTHIA6 = true; From c157d0fefccee2e8a600c10931402d89f169d58e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 23:13:16 -0400 Subject: [PATCH 0690/1222] Add hepmcnode reader also for pythia running --- macros/g4simulations/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index a3e017127..b582b38fe 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -95,7 +95,7 @@ void InputInit() } // here are the various utility modules which read particles and // put them onto the G4 particle stack - if (Input::HEPMC) + if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) { // read-in HepMC events to Geant4 if there is any HepMCNodeReader *hr = new HepMCNodeReader(); From f6bf22d170b485c66efcfe83c28f0adc5112351f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 17 Jun 2020 23:13:56 -0400 Subject: [PATCH 0691/1222] remove readhepmc --- macros/g4simulations/Fun4All_G4_EICDetector.C | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 963bf53dd..6e965a91b 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -73,20 +73,18 @@ int Fun4All_G4_EICDetector( // 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 = true; // read HepMC files // Or: // read files in EICTree format generated by eicsmear package const bool readeictree = false; // Or: // Use Pythia 8 - // Input::PYTHIA8 = true; + Input::PYTHIA8 = true; // Or: // Use Pythia 6 // Input::PYTHIA6 = true; PYTHIA6::config_file = "phpythia6_ep.cfg"; - Input::SIMPLE = true; +// Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); INPUTSIMPLE::set_eta_range(-3,3); @@ -103,13 +101,12 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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; - Input::HEPMC = true; +// Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; INPUTHEPMC::filename = inputFile; @@ -246,10 +243,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Get the hits from a file // The input manager is declared later } - else if (readhepmc) - { - // action is performed in later stage at the input manager level - } else if (readeictree) { // this module is needed to read the EICTree style records into our G4 sims @@ -326,7 +319,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); vgen->add_decay_particles("e+", "e-", 0); // i = decay id // event vertex - if (readhepmc || particles) + if (Input::HEPMC || Input::SIMPLE) { vgen->set_reuse_existing_vertex(true); } @@ -511,9 +504,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); hitsin->fileopen(inputFile); se->registerInputManager(hitsin); } - if (readhepmc) - { - } else { // for single particle generators we just need something which drives @@ -564,7 +554,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); return 0; } // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) + if (nEvents == 0 && !readhits && !Input::HEPMC) { 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; From 8b02660588100ec0157b9e3de50d10976e3901f4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 13:44:04 -0400 Subject: [PATCH 0692/1222] replace local particle gun with the one in G4_Input_Gun.C --- macros/g4simulations/Fun4All_G4_EICDetector.C | 63 ++++++------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 6e965a91b..116105343 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -20,17 +20,13 @@ #include #include #include -#include -#include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -39,6 +35,8 @@ R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libPHSartre.so) +//#define OLD + 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", @@ -78,7 +76,7 @@ int Fun4All_G4_EICDetector( const bool readeictree = false; // Or: // Use Pythia 8 - Input::PYTHIA8 = true; + // Input::PYTHIA8 = true; // Or: // Use Pythia 6 // Input::PYTHIA6 = true; @@ -89,12 +87,16 @@ int Fun4All_G4_EICDetector( INPUTSIMPLE::AddParticle("pi-", 5); INPUTSIMPLE::set_eta_range(-3,3); INPUTSIMPLE::set_phi_range(-M_PI,M_PI); -INPUTSIMPLE::set_p_range(0.1,20.); +INPUTSIMPLE::set_pt_range(0.1,20.); INPUTSIMPLE::set_vtx_mean(0.,0.,0.); INPUTSIMPLE::set_vtx_width(0.,0.,5.); - // Or: - // Use HEPGen - const bool runhepgen = false; + + Input::GUN = true; + Input::GUN_VERBOSITY = 0; + INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); + INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); + //INPUTGUN::set_vtx(0,0,0); + // Or: // Use Sartre const bool runsartre = false; @@ -102,7 +104,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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 // 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; @@ -121,6 +122,10 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //====================== // What to run //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; // sPHENIX barrel Enable::BBC = true; @@ -251,20 +256,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); se->registerSubsystem(eicr); } - /* - 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); - } -*/ else if (runsartre) { // see coresoftware/generators/PHSartre/README for setup instructions @@ -290,27 +281,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //----------------- // InputInit(); // If "readhepMC" is also set, the particles will be embedded in Hijing events - 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("mu-"); - pgen->set_z_range(0, 0); - pgen->set_eta_range(-4.0, 0.0); - pgen->set_mom_range(30, 30); - 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) { @@ -509,6 +479,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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"); + in->Verbosity(1); se->registerInputManager(in); } @@ -516,7 +487,9 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Set up Input Managers //-------------- +#ifndef OLD InputManagers(); +#endif if (do_DSTReader) { From ce883d08bdc600fb9758682801beb0be2c6a6a11 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 13:44:26 -0400 Subject: [PATCH 0693/1222] Add setting of vertex --- macros/g4simulations/G4_Input_Gun.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C index af59953bf..7836d30c4 100644 --- a/macros/g4simulations/G4_Input_Gun.C +++ b/macros/g4simulations/G4_Input_Gun.C @@ -26,6 +26,7 @@ namespace INPUTGUN double vz = 0.; deque> particles; void AddParticle(const string &name, const double px, const double py, const double pz); + void set_vtx(double x, double y, double z) {vx=x; vy = y; vz = z;} } void INPUTGUN::AddParticle(const string &name, const double px, const double py, const double pz) From ef9349ae588c44fd12c4d3487eef5097734aa35e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 17:38:40 -0400 Subject: [PATCH 0694/1222] move readeic and sartre to G4_Input --- macros/g4simulations/G4_Input.C | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index b582b38fe..2b65685d1 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -10,9 +10,13 @@ #include #include +#include #include +#include +#include + #include #include #include @@ -23,12 +27,15 @@ 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) namespace Input { bool READHITS = false; + bool READEIC = false; bool PYTHIA6 = false; bool PYTHIA8 = false; + bool SARTRE = false; } // namespace Input namespace INPUTHEPMC @@ -36,6 +43,11 @@ namespace INPUTHEPMC string filename; } +namespace INPUTREADEIC +{ + string filename; +} + namespace INPUTREADHITS { string filename; @@ -56,6 +68,11 @@ namespace PYTHIA8 string config_file = "phpythia8.cfg"; } +namespace SARTRE +{ + string config_file = "sartre.cfg"; +} + void InputInit() { // first consistency checks - not all input generators play nice @@ -85,6 +102,20 @@ void InputInit() pythia8->set_config_file(PYTHIA8::config_file); se->registerSubsystem(pythia8); } + if (Input::SARTRE) + { + PHSartre *mysartre = new PHSartre(); + mysartre->set_config_file(SARTRE::config_file); + // 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); + } + if (Input::SIMPLE) { InputSimpleInit(); @@ -101,6 +132,12 @@ void InputInit() HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); } + if (Input::READEIC) + { + ReadEICFiles *eicr = new ReadEICFiles(); + eicr->OpenInputFile(INPUTREADEIC::filename); + se->registerSubsystem(eicr); + } } void InputManagers() From 4d628f4159f1e4592f314298a470173651e9af82 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 17:39:02 -0400 Subject: [PATCH 0695/1222] move readeic and sartre to G4_Input --- macros/g4simulations/Fun4All_G4_EICDetector.C | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 116105343..4137a85ff 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -26,14 +26,10 @@ #include #include #include -#include #include -#include -#include R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libPHSartre.so) //#define OLD @@ -72,8 +68,6 @@ int Fun4All_G4_EICDetector( const bool readhits = false; // Or: // Or: - // read files in EICTree format generated by eicsmear package - const bool readeictree = false; // Or: // Use Pythia 8 // Input::PYTHIA8 = true; @@ -82,6 +76,8 @@ int Fun4All_G4_EICDetector( // Input::PYTHIA6 = true; PYTHIA6::config_file = "phpythia6_ep.cfg"; + Input::SARTRE = true; + // Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); @@ -97,9 +93,9 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); //INPUTGUN::set_vtx(0,0,0); +// Input::READEIC = true; + INPUTREADEIC::filename = inputFile; // 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 @@ -248,34 +244,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Get the hits from a file // The input manager is declared later } - 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); - } - 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 - - 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); - } - //----------------- // Initialize the selected Input/Event generation //----------------- From abe800604757430fed9dbaee23c3ed73ba46ab75 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 18:45:38 -0400 Subject: [PATCH 0696/1222] move readhits to g4_input --- macros/g4simulations/Fun4All_G4_EICDetector.C | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 4137a85ff..13913392f 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -63,9 +63,10 @@ int Fun4All_G4_EICDetector( // 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 = inputFile; // 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: // Or: // Or: @@ -76,7 +77,7 @@ int Fun4All_G4_EICDetector( // Input::PYTHIA6 = true; PYTHIA6::config_file = "phpythia6_ep.cfg"; - Input::SARTRE = true; +// Input::SARTRE = true; // Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; @@ -87,7 +88,7 @@ INPUTSIMPLE::set_pt_range(0.1,20.); INPUTSIMPLE::set_vtx_mean(0.,0.,0.); INPUTSIMPLE::set_vtx_width(0.,0.,5.); - Input::GUN = true; +// Input::GUN = true; Input::GUN_VERBOSITY = 0; INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); @@ -101,7 +102,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics // or gun/ very simple single particle gun generator // 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; + const bool upsilons = false && !Input::READHITS; // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; @@ -239,7 +240,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Event generation //----------------- - if (readhits) + if (!Input::READHITS) { // Get the hits from a file // The input manager is declared later @@ -295,7 +296,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); } - if (!readhits) + if (!Input::READHITS) { //--------------------- // Detector description @@ -435,12 +436,12 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // IO management //-------------- - if (readhits) + if (Input::READHITS) { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); + // // Hits file + // Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); + // hitsin->fileopen(inputFile); + // se->registerInputManager(hitsin); } else { @@ -495,7 +496,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); return 0; } // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !Input::HEPMC) + if (nEvents == 0 && !Input::READHITS && !Input::HEPMC) { 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; From 1e4ab6d5fff83f15260465655149bb1fa75e3915 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 23:12:55 -0400 Subject: [PATCH 0697/1222] move upsilon generator to G4_Input_Upsilon.C --- macros/g4simulations/G4_Input_Upsilon.C | 89 +++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 macros/g4simulations/G4_Input_Upsilon.C diff --git a/macros/g4simulations/G4_Input_Upsilon.C b/macros/g4simulations/G4_Input_Upsilon.C new file mode 100644 index 000000000..bf18db77e --- /dev/null +++ b/macros/g4simulations/G4_Input_Upsilon.C @@ -0,0 +1,89 @@ +#pragma once + +#include "GlobalVariables.C" + +#include "G4_Input.C" + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Input +{ + bool UPSILON = false; + bool UPSILON_VERBOSITY = 0; +} + +namespace INPUTUPSILON +{ + int istate = 1; + double etamin = -1.; + double etamax = 1.; + double ptmin = 0.; + double ptmax = 10.; + deque> particles; + void AddDecayParticles(const string &name1, const string &name2, const int decay_id); + void set_rapidity_range(double min, double max) {etamin = min; etamax = max;} + void set_pt_range(double min, double max) {ptmin = min; ptmax = max;} +} + +void INPUTUPSILON::AddDecayParticles(const string &name1, const string &name2, const int decay_id) +{ + particles.push_back(make_tuple(name1,name2,decay_id)); +} + + +void InputUpsilonInit() +{ + if (INPUTUPSILON::particles.empty()) + { + cout << "Input::UPSILON: particle map is empty use for e.g. e+/e-" << endl; + cout << "INPUTUPSILON::AddDecayParticle(\"e+\", \"e-\", 0);" << endl; + gSystem->Exit(-1); + } + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); + for (auto iter = INPUTUPSILON::particles.begin(); iter != INPUTUPSILON::particles.end(); ++iter) + { + vgen->add_decay_particles(get<0>(*iter),get<1>(*iter),get<2>(*iter)); + } + // event vertex + if (Input::HEPMC || Input::SIMPLE) + { + vgen->set_reuse_existing_vertex(true); + } + + vgen->set_rapidity_range(INPUTUPSILON::etamin, INPUTUPSILON::etamax); + vgen->set_pt_range(INPUTUPSILON::ptmin, INPUTUPSILON::ptmax); + + + if (INPUTUPSILON::istate == 1) + { + // Upsilon(1S) + vgen->set_mass(9.46); + vgen->set_width(54.02e-6); + } + else if (INPUTUPSILON::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(Input::UPSILON_VERBOSITY); + vgen->Embed(2); + se->registerSubsystem(vgen); + +} + From 1b77b812a17c79b28ee756d270ce8751c0e58a33 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 23:13:18 -0400 Subject: [PATCH 0698/1222] move upsilon generator to G4_Input_Upsilon.C --- macros/g4simulations/Fun4All_G4_EICDetector.C | 81 +------------------ macros/g4simulations/G4_Input.C | 6 ++ 2 files changed, 10 insertions(+), 77 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 13913392f..067af2570 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -31,8 +31,6 @@ R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) -//#define OLD - 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", @@ -63,7 +61,7 @@ int Fun4All_G4_EICDetector( // 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; + //Input::READHITS = true; INPUTREADHITS::filename = inputFile; // 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/ @@ -93,7 +91,9 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); //INPUTGUN::set_vtx(0,0,0); - + Input::UPSILON = true; + Input::UPSILON_VERBOSITY = 2; + INPUTUPSILON::AddDecayParticles("e+", "e-", 0); // Input::READEIC = true; INPUTREADEIC::filename = inputFile; // Or: @@ -102,7 +102,6 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics // or gun/ very simple single particle gun generator // 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 && !Input::READHITS; // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; @@ -240,62 +239,12 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Event generation //----------------- - if (!Input::READHITS) - { - // Get the hits from a file - // The input manager is declared later - } //----------------- // Initialize the selected Input/Event generation //----------------- // InputInit(); // If "readhepMC" is also set, the particles will be embedded in Hijing events // 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 (Input::HEPMC || Input::SIMPLE) - { - vgen->set_reuse_existing_vertex(true); - } - - // 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 (!Input::READHITS) { //--------------------- @@ -432,33 +381,11 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); if (Enable::FWDJETS_EVAL) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); - //-------------- - // IO management - //-------------- - - if (Input::READHITS) - { - // // Hits file - // Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - // hitsin->fileopen(inputFile); - // se->registerInputManager(hitsin); - } - 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"); - in->Verbosity(1); - se->registerInputManager(in); - } - //-------------- // Set up Input Managers //-------------- -#ifndef OLD InputManagers(); -#endif if (do_DSTReader) { diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index 2b65685d1..cb1f0c56a 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -4,6 +4,7 @@ #include "G4_Input_Gun.C" #include "G4_Input_Simple.C" +#include "G4_Input_Upsilon.C" #include @@ -124,6 +125,11 @@ void InputInit() { InputGunInit(); } + if (Input::UPSILON) + { + InputUpsilonInit(); + } + // here are the various utility modules which read particles and // put them onto the G4 particle stack if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) From 1af2bf0f5ab5f5e17e46dc532fb273ff8bcb9457 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 23:13:36 -0400 Subject: [PATCH 0699/1222] fix printout --- macros/g4simulations/G4_Input_Gun.C | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C index 7836d30c4..49333be50 100644 --- a/macros/g4simulations/G4_Input_Gun.C +++ b/macros/g4simulations/G4_Input_Gun.C @@ -39,12 +39,11 @@ void InputGunInit() { if (INPUTGUN::particles.empty()) { - cout << "Input::GUN: particle map is empty use for e.g. 1 pi-" << endl; - cout << "INPUTGUN::particles.push_back(make_tuple(\"pi-\",0,1,0));" << endl; + cout << "Input::GUN: particle map is empty use for e.g. 1 pi- with px=0, py=1GeV/c, pz=0" << endl; + cout << "INPUTGUN::AddParticle(\"pi-\",0,1,0);" << endl; gSystem->Exit(-1); } Fun4AllServer *se = Fun4AllServer::instance(); - // toss low multiplicity dummy events PHG4ParticleGun *gun = new PHG4ParticleGun(); for (auto iter = INPUTGUN::particles.begin(); iter != INPUTGUN::particles.end(); ++iter) { From d59d2602ef260401abfa44f46beab06796070d21 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 18 Jun 2020 23:16:44 -0400 Subject: [PATCH 0700/1222] clang-format --- macros/g4simulations/G4_Input.C | 4 +- macros/g4simulations/G4_Input_Gun.C | 32 +++++---- macros/g4simulations/G4_Input_Upsilon.C | 92 +++++++++++++------------ 3 files changed, 68 insertions(+), 60 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index cb1f0c56a..194a36cc8 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -130,8 +130,8 @@ void InputInit() InputUpsilonInit(); } -// here are the various utility modules which read particles and -// put them onto the G4 particle stack + // here are the various utility modules which read particles and + // put them onto the G4 particle stack if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) { // read-in HepMC events to Geant4 if there is any diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C index 49333be50..43b289685 100644 --- a/macros/g4simulations/G4_Input_Gun.C +++ b/macros/g4simulations/G4_Input_Gun.C @@ -17,38 +17,42 @@ namespace Input { bool GUN = false; bool GUN_VERBOSITY = 0; -} +} // namespace Input namespace INPUTGUN { double vx = 0.; double vy = 0.; double vz = 0.; - deque> particles; + deque> particles; void AddParticle(const string &name, const double px, const double py, const double pz); - void set_vtx(double x, double y, double z) {vx=x; vy = y; vz = z;} -} + void set_vtx(double x, double y, double z) + { + vx = x; + vy = y; + vz = z; + } +} // namespace INPUTGUN void INPUTGUN::AddParticle(const string &name, const double px, const double py, const double pz) { - particles.push_back(make_tuple(name,px,py,pz)); + particles.push_back(make_tuple(name, px, py, pz)); } - void InputGunInit() { if (INPUTGUN::particles.empty()) { cout << "Input::GUN: particle map is empty use for e.g. 1 pi- with px=0, py=1GeV/c, pz=0" << endl; - cout << "INPUTGUN::AddParticle(\"pi-\",0,1,0);" << endl; + cout << "INPUTGUN::AddParticle(\"pi-\",0,1,0);" << endl; gSystem->Exit(-1); } Fun4AllServer *se = Fun4AllServer::instance(); - PHG4ParticleGun *gun = new PHG4ParticleGun(); - for (auto iter = INPUTGUN::particles.begin(); iter != INPUTGUN::particles.end(); ++iter) - { - gun->AddParticle(get<0>(*iter),get<1>(*iter),get<2>(*iter),get<3>(*iter)); - } - gun->Verbosity(Input::GUN_VERBOSITY); - se->registerSubsystem(gun); + PHG4ParticleGun *gun = new PHG4ParticleGun(); + for (auto iter = INPUTGUN::particles.begin(); iter != INPUTGUN::particles.end(); ++iter) + { + gun->AddParticle(get<0>(*iter), get<1>(*iter), get<2>(*iter), get<3>(*iter)); + } + gun->Verbosity(Input::GUN_VERBOSITY); + se->registerSubsystem(gun); } diff --git a/macros/g4simulations/G4_Input_Upsilon.C b/macros/g4simulations/G4_Input_Upsilon.C index bf18db77e..2bf887b12 100644 --- a/macros/g4simulations/G4_Input_Upsilon.C +++ b/macros/g4simulations/G4_Input_Upsilon.C @@ -17,7 +17,7 @@ namespace Input { bool UPSILON = false; bool UPSILON_VERBOSITY = 0; -} +} // namespace Input namespace INPUTUPSILON { @@ -26,64 +26,68 @@ namespace INPUTUPSILON double etamax = 1.; double ptmin = 0.; double ptmax = 10.; - deque> particles; + deque> particles; void AddDecayParticles(const string &name1, const string &name2, const int decay_id); - void set_rapidity_range(double min, double max) {etamin = min; etamax = max;} - void set_pt_range(double min, double max) {ptmin = min; ptmax = max;} -} + void set_rapidity_range(double min, double max) + { + etamin = min; + etamax = max; + } + void set_pt_range(double min, double max) + { + ptmin = min; + ptmax = max; + } +} // namespace INPUTUPSILON void INPUTUPSILON::AddDecayParticles(const string &name1, const string &name2, const int decay_id) { - particles.push_back(make_tuple(name1,name2,decay_id)); + particles.push_back(make_tuple(name1, name2, decay_id)); } - void InputUpsilonInit() { if (INPUTUPSILON::particles.empty()) { cout << "Input::UPSILON: particle map is empty use for e.g. e+/e-" << endl; - cout << "INPUTUPSILON::AddDecayParticle(\"e+\", \"e-\", 0);" << endl; + cout << "INPUTUPSILON::AddDecayParticle(\"e+\", \"e-\", 0);" << endl; gSystem->Exit(-1); } Fun4AllServer *se = Fun4AllServer::instance(); - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - for (auto iter = INPUTUPSILON::particles.begin(); iter != INPUTUPSILON::particles.end(); ++iter) - { - vgen->add_decay_particles(get<0>(*iter),get<1>(*iter),get<2>(*iter)); - } - // event vertex - if (Input::HEPMC || Input::SIMPLE) - { - vgen->set_reuse_existing_vertex(true); - } - - vgen->set_rapidity_range(INPUTUPSILON::etamin, INPUTUPSILON::etamax); - vgen->set_pt_range(INPUTUPSILON::ptmin, INPUTUPSILON::ptmax); - + PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); + for (auto iter = INPUTUPSILON::particles.begin(); iter != INPUTUPSILON::particles.end(); ++iter) + { + vgen->add_decay_particles(get<0>(*iter), get<1>(*iter), get<2>(*iter)); + } + // event vertex + if (Input::HEPMC || Input::SIMPLE) + { + vgen->set_reuse_existing_vertex(true); + } - if (INPUTUPSILON::istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (INPUTUPSILON::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->set_rapidity_range(INPUTUPSILON::etamin, INPUTUPSILON::etamax); + vgen->set_pt_range(INPUTUPSILON::ptmin, INPUTUPSILON::ptmax); - vgen->Verbosity(Input::UPSILON_VERBOSITY); - vgen->Embed(2); - se->registerSubsystem(vgen); + if (INPUTUPSILON::istate == 1) + { + // Upsilon(1S) + vgen->set_mass(9.46); + vgen->set_width(54.02e-6); + } + else if (INPUTUPSILON::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(Input::UPSILON_VERBOSITY); + vgen->Embed(2); + se->registerSubsystem(vgen); } - From 3b6a77206063bfab19b8e3e5decc941080824f05 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:10:21 -0400 Subject: [PATCH 0701/1222] use Enable namespace --- .../g4simulations/G4_DSTReader_EICDetector.C | 309 +++++++++--------- 1 file changed, 159 insertions(+), 150 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index e6b73d842..1cdb0733c 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -1,9 +1,24 @@ #pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include + +#include "GlobalVariables.C" + +#include "G4_GEM_EIC.C" +#include "G4_Mvtx_EIC.C" +#include "G4_TPC_EIC.C" +#include "G4_CEmc_EIC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_EEMC.C" +#include "G4_FEMC_EIC.C" +#include "G4_FHCAL.C" + #include + +#include + R__LOAD_LIBRARY(libg4eval.so) -#endif + ////////////////////////////////////////////////////////////////// /*! @@ -14,179 +29,173 @@ R__LOAD_LIBRARY(libg4eval.so) \date $Date: $ */ ////////////////////////////////////////////////////////////////// +namespace Enable +{ + bool DSTREADER = false; + int DSTREADER_VERBOSITY = 0; +} -#include +namespace G4DSTREADER +{ + bool save_g4_raw = true; + double tower_zero_supp = 1.e-6; +} void G4DSTreader_EICDetectorInit() {} 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_hcalout_twr = 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 // - ) +G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") { //! debug output on screen? - const bool debug = false; + int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); - //! save raw g4 hits - const bool save_g4_raw = true; // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); + PHG4DSTReader* ana = new PHG4DSTReader(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"); - ana->AddNode("MVTX"); - - ana->AddNode("EGEM_0"); - ana->AddNode("EGEM_1"); - ana->AddNode("EGEM_2"); - ana->AddNode("EGEM_3"); - - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - - ana->AddNode("FST_0"); - ana->AddNode("FST_1"); - ana->AddNode("FST_2"); - ana->AddNode("FST_3"); - ana->AddNode("FST_4"); - } - - 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"); - } - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } + ana->Verbosity(verbosity); - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) + if (G4DSTREADER::save_g4_raw) + { + if (Enable::MVTX) { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); + ana->AddNode("MVTX"); } - if (do_hcalin_twr) + if (Enable::TPC) { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); + ana->AddNode("TPC"); } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - if (do_FHCAL_twr) + + if (Enable::EGEM) { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); + ana->AddNode("EGEM_0"); + ana->AddNode("EGEM_1"); + ana->AddNode("EGEM_2"); + ana->AddNode("EGEM_3"); } - if (do_FEMC_twr) + if (Enable::FGEM) { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); + ana->AddNode("FGEM_2"); + ana->AddNode("FGEM_3"); + ana->AddNode("FGEM_4"); + ana->AddNode("FST_0"); + ana->AddNode("FST_1"); + ana->AddNode("FST_2"); + ana->AddNode("FST_3"); + ana->AddNode("FST_4"); } - if (do_EEMC_twr) + } + + if (Enable::CEMC) + { + ana->AddNode("CEMC"); + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) { - ana->AddTower("SIM_EEMC"); - ana->AddTower("RAW_EEMC"); - ana->AddTower("CALIB_EEMC"); + ana->AddNode("ABSORBER_CEMC"); + ana->AddNode("CEMC_ELECTRONICS"); + ana->AddNode("CEMC_SPT"); } - - // 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"); - // } + } + + 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::FHCAL) + { + ana->AddNode("FHCAL"); + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) + ana->AddNode("ABSORBER_FHCAL"); + } + + if (Enable::FEMC) + { + ana->AddNode("FEMC"); + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) + ana->AddNode("ABSORBER_FEMC"); + } + + if (Enable::EEMC) + { + ana->AddNode("EEMC"); + } + + 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"); + } + if (Enable::FHCAL_TOWER) + { + ana->AddTower("SIM_FHCAL"); + ana->AddTower("RAW_FHCAL"); + ana->AddTower("CALIB_FHCAL"); + } + if (Enable::FEMC_TOWER) + { + ana->AddTower("SIM_FEMC"); + ana->AddTower("RAW_FEMC"); + ana->AddTower("CALIB_FEMC"); + } + if (Enable::FEMC_TOWER) + { + 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); From 37de90fa54c49ccbc999e5c948ed52dc0283427d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:14:00 -0400 Subject: [PATCH 0702/1222] use Enable namespace for dst reader --- macros/g4simulations/Fun4All_G4_EICDetector.C | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 067af2570..adc0a65ff 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -113,7 +113,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Compress DST files Enable::DSTOUT_COMPRESS = false; //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = false; + Enable::DSTREADER = true; //====================== // What to run @@ -387,26 +387,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); InputManagers(); - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - G4DSTreader_EICDetector(outputFile, // - /*int*/ absorberactive, - /*bool*/ Enable::TRACKING, - /*bool*/ Enable::CEMC, - /*bool*/ Enable::HCALIN, - /*bool*/ Enable::MAGNET, - /*bool*/ Enable::HCALOUT, - /*bool*/ Enable::CEMC_TOWER, - /*bool*/ Enable::HCALIN_TOWER, - /*bool*/ Enable::HCALOUT_TOWER, - /*bool*/ Enable::FHCAL, - /*bool*/ Enable::FHCAL_TOWER, - /*bool*/ Enable::FEMC, - /*bool*/ Enable::FEMC_TOWER, - /*bool*/ Enable::EEMC, - /*bool*/ Enable::EEMC_TOWER); - } + if (Enable::DSTREADER) G4DSTreader_EICDetector(outputFile); if(Enable::DSTOUT) { From edd949afdb8d441c8c19887d499a3b1acf74339c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:14:44 -0400 Subject: [PATCH 0703/1222] fix incorrect Enable flags --- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C index 9488fe34f..829bd465e 100644 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ b/macros/g4simulations/G4_DSTReader_fsPHENIX.C @@ -49,15 +49,12 @@ namespace G4DSTREADER void G4DSTreader_fsPHENIXInit() {} void -G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root") +G4DSTreader_fsPHENIX( const string &outputFile = "G4sPHENIXCells.root") { //! debug output on screen? int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); - //! 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); @@ -102,28 +99,28 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root") if (Enable::MAGNET) { - if (Enable::ABSORBER || Enable::MAGNET) + if (Enable::ABSORBER || Enable::MAGNET_ABSORBER) ana->AddNode("MAGNET"); } if (Enable::HCALOUT) { ana->AddNode("HCALOUT"); - if (Enable::ABSORBER || Enable::HCALOUT) + if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER) ana->AddNode("ABSORBER_HCALOUT"); } if (Enable::FHCAL) { ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL) + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) ana->AddNode("ABSORBER_FHCAL"); } if (Enable::FEMC) { ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC) + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) ana->AddNode("ABSORBER_FEMC"); } @@ -168,7 +165,7 @@ G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root") ana->AddTower("RAW_FHCAL"); ana->AddTower("CALIB_FHCAL"); } - if (Enable::FHCAL_TOWER) + if (Enable::FEMC_TOWER) { ana->AddTower("SIM_FEMC"); ana->AddTower("RAW_FEMC"); From db0f82b8f72a259a0cbaa13a4781aa3abe9ddec8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:15:09 -0400 Subject: [PATCH 0704/1222] remove unused include G4_PSTOF.C --- macros/g4simulations/G4Setup_EICDetector.C | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 1b8cc9880..fdf47ff49 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -15,7 +15,6 @@ #include "G4_Input.C" #include "G4_Magnet.C" #include "G4_Mvtx_EIC.C" -#include "G4_PSTOF.C" #include "G4_Pipe_EIC.C" #include "G4_PlugDoor_EIC.C" #include "G4_RICH.C" From b0b8cf38a8445cfaf2d1921993810b21dc637385 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:29:11 -0400 Subject: [PATCH 0705/1222] remove old absorberactive flag --- macros/g4simulations/Fun4All_G4_EICDetector.C | 37 ++++++++++++------- macros/g4simulations/G4Setup_EICDetector.C | 7 ++-- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index adc0a65ff..95b5f41f8 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -107,18 +107,24 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Input::HEPMC_VERBOSITY = 1; INPUTHEPMC::filename = inputFile; + //----------------- + // Initialize the selected Input/Event generation + //----------------- InputInit(); + + //====================== // Write the DST + //====================== + Enable::DSTOUT = true; - // Compress DST files - Enable::DSTOUT_COMPRESS = false; + Enable::DSTOUT_COMPRESS = false;// Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs Enable::DSTREADER = true; //====================== // What to run //====================== - // Global options (enabled for all enables subsystems - if implemented) + // Global options (enabled for all subsystems - if implemented) // Enable::ABSORBER = true; // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; @@ -219,30 +225,33 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Enable::BLACKHOLE = true; BlackHoleGeometry::visible = true; - //--------------- - // Load libraries - //--------------- - // establish the geometry and reconstruction setup G4Init(); - int absorberactive = 0; // set to 1 to make all absorbers active volumes // 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) const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE //--------------- - // Fun4All server + // 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.4 / 1.5; // 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; + //----------------- // Event generation //----------------- - //----------------- - // Initialize the selected Input/Event generation - //----------------- -// InputInit(); // If "readhepMC" is also set, the particles will be embedded in Hijing events // 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 (!Input::READHITS) @@ -251,7 +260,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Detector description //--------------------- - G4Setup(absorberactive, magfield, EDecayType::kAll, + G4Setup(magfield, EDecayType::kAll, magfield_rescale); } diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index fdf47ff49..358d43f2a 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -137,8 +137,7 @@ void G4Init() } } -int G4Setup(const int absorberactive = 0, - const string &field = "1.5", +int G4Setup(const string &field = "1.5", const EDecayType decayType = EDecayType::kAll, const float magfield_rescale = 1.0) { @@ -206,11 +205,11 @@ int G4Setup(const int absorberactive = 0, if (Enable::MVTX) { - radius = Mvtx(g4Reco, radius, absorberactive); + radius = Mvtx(g4Reco, radius); } if (Enable::TPC) { - radius = TPC(g4Reco, radius, absorberactive); + radius = TPC(g4Reco, radius); } //---------------------------------------- From 03445b245c9c23b900eba957f7f0e4d8d653b2a6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:45:06 -0400 Subject: [PATCH 0706/1222] set default magfield scale to 1, -1.4/1.5 will just confuse everyone --- macros/g4simulations/G4_Magnet.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C index 2da4346c1..b05e49683 100644 --- a/macros/g4simulations/G4_Magnet.C +++ b/macros/g4simulations/G4_Magnet.C @@ -20,7 +20,7 @@ namespace G4MAGNET double magnet_outer_cryostat_wall_radius = 174.5; double magnet_outer_cryostat_wall_thickness = 2.5; double magnet_length = 379.; - double magfield_rescale = -1.4/1.5; + double magfield_rescale = 1; string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); } // namespace G4MAGNET From 66ed106d8a421230e8f58231bacb9c7b2a34d57f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:45:52 -0400 Subject: [PATCH 0707/1222] remove G4Setup() arguments --- macros/g4simulations/G4Setup_EICDetector.C | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 358d43f2a..ac454fa90 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -35,7 +35,6 @@ #include #include -#include #include R__LOAD_LIBRARY(libg4decayer.so) @@ -137,9 +136,7 @@ void G4Init() } } -int G4Setup(const string &field = "1.5", - const EDecayType decayType = EDecayType::kAll, - const float magfield_rescale = 1.0) +int G4Setup() { //--------------- @@ -157,31 +154,31 @@ int G4Setup(const string &field = "1.5", // (default is QGSP_BERT for speed) // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - if (decayType != EDecayType::kAll) + if (G4P6DECAYER::decayType != EDecayType::kAll) { - g4Reco->set_force_decay(decayType); + g4Reco->set_force_decay(G4P6DECAYER::decayType); } double fieldstrength; - istringstream stringline(field); + istringstream stringline(G4MAGNET::magfield); stringline >> fieldstrength; if (stringline.fail()) { // conversion to double fails -> we have a string - if (field.find("sPHENIX.root") != string::npos) + if (G4MAGNET::magfield.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, PHFieldConfig::Field3DCartesian); + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); } else { - g4Reco->set_field_map(field, PHFieldConfig::kField2D); + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::kField2D); } } else { g4Reco->set_field(fieldstrength); // use const soleniodal field } - g4Reco->set_field_rescale(magfield_rescale); + g4Reco->set_field_rescale(G4MAGNET::magfield_rescale); double radius = 0.; From c0af3a9b0fec0129c5ba244808a734a825daa63f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:46:09 -0400 Subject: [PATCH 0708/1222] remove G4Setup() arguments --- macros/g4simulations/Fun4All_G4_EICDetector.C | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 95b5f41f8..be05caec8 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -13,7 +13,6 @@ #include "G4_Input.C" #include "G4_Jets.C" -#include #include #include #include @@ -228,17 +227,13 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // establish the geometry and reconstruction setup G4Init(); - // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE - //--------------- // 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.4 / 1.5; // make consistent with expected Babar field strength of 1.4T + G4MAGNET::magfield_rescale = -1.4 / 1.5; // make consistent with expected Babar field strength of 1.4T //--------------- // Pythia Decayer @@ -260,8 +255,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Detector description //--------------------- - G4Setup(magfield, EDecayType::kAll, - magfield_rescale); + G4Setup(); } //--------- From 376cce7570e9e2e182ca1ea8c2951f48f4d17c8a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 10:46:30 -0400 Subject: [PATCH 0709/1222] set default magfield scale to 1, -1.4/1.5 will just confuse everyone --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index c9023693c..8b6187e66 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -92,6 +92,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Input::GUN = true; //Input::GUN_VERBOSITY = 0; INPUTGUN::AddParticle("pi-", 0, 1, 0); + //INPUTGUN::set_vtx(0,0,0); // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 0; @@ -219,7 +220,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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.4 / 1.5; // make consistent with expected Babar field strength of 1.4T + G4MAGNET::magfield_rescale = -1.4 / 1.5; // make consistent with expected Babar field strength of 1.4T //--------------- // Pythia Decayer From 85d948307b9370a441ee0ee88fe280974c645aaf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 11:21:20 -0400 Subject: [PATCH 0710/1222] cleanup --- macros/g4simulations/GlobalVariables.C | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 8d4f1f8e6..455771483 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -13,6 +13,7 @@ namespace Input bool HEPMC = false; int HEPMC_VERBOSITY = 0; bool EMBED = false; + bool READEIC = false; } // Global settings affecting multiple subsystems From 1be93e9ce37090ab8e1a5776645f9161fd6201ad Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 11:21:50 -0400 Subject: [PATCH 0711/1222] cleanup --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 8 ++------ macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_Input.C | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 8b6187e66..4a9e18d62 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -46,12 +46,8 @@ int Fun4All_G4_fsPHENIX( 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 + // if the RANDOMSEED flag is set its value is taken as initial seed + // which will produce identical results so you can debug your code // rc->set_IntFlag("RANDOMSEED", 12345); //=============== diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index ac454fa90..955b376de 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -304,7 +304,7 @@ int G4Setup() return 0; } -void ShowerCompress(int verbosity = 0) +void ShowerCompress() { Fun4AllServer *se = Fun4AllServer::instance(); diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index 194a36cc8..c058df60e 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -33,7 +33,6 @@ R__LOAD_LIBRARY(libPHSartre.so) namespace Input { bool READHITS = false; - bool READEIC = false; bool PYTHIA6 = false; bool PYTHIA8 = false; bool SARTRE = false; From cd19bf2c8c2bbbb00dacd3b224733ad3404c6bd9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 11:22:13 -0400 Subject: [PATCH 0712/1222] cleanup --- macros/g4simulations/Fun4All_G4_EICDetector.C | 87 ++++++++----------- 1 file changed, 36 insertions(+), 51 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index be05caec8..397fdfbdc 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -14,17 +14,9 @@ #include "G4_Jets.C" #include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include + #include R__LOAD_LIBRARY(libfun4all.so) @@ -33,22 +25,21 @@ R__LOAD_LIBRARY(libg4testbench.so) 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") + const string &outputFile = "G4EICDetector.root") { + //--------------- + // Fun4All server + //--------------- Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(1); // uncomment for batch production running with minimal output messages + // se->Verbosity(01); // 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 + // if the RANDOMSEED flag is set its value is taken as initial seed + // which will produce identical results so you can debug your code rc->set_IntFlag("RANDOMSEED", 12345); //=============== @@ -62,20 +53,21 @@ int Fun4All_G4_EICDetector( // //Input::READHITS = true; INPUTREADHITS::filename = inputFile; - // 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/ - // Or: - // Or: + // Or: + // Use one or more particle generators + // Use Pythia 8 // Input::PYTHIA8 = true; - // Or: + // Use Pythia 6 // Input::PYTHIA6 = true; - PYTHIA6::config_file = "phpythia6_ep.cfg"; +// PYTHIA6::config_file = "phpythia6_ep.cfg"; +// Use Sartre // Input::SARTRE = true; +// Simple multi particle generator in eta/phi/pt ranges // Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); @@ -85,23 +77,25 @@ INPUTSIMPLE::set_pt_range(0.1,20.); INPUTSIMPLE::set_vtx_mean(0.,0.,0.); INPUTSIMPLE::set_vtx_width(0.,0.,5.); +// Particle gun (same particles in always the same direction) // Input::GUN = true; Input::GUN_VERBOSITY = 0; INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); //INPUTGUN::set_vtx(0,0,0); + +// Upsilon generator Input::UPSILON = true; - Input::UPSILON_VERBOSITY = 2; + Input::UPSILON_VERBOSITY = 0; INPUTUPSILON::AddDecayParticles("e+", "e-", 0); + +// And/Or read generated particles from file + +// eic-smear output // Input::READEIC = true; INPUTREADEIC::filename = inputFile; - // Or: - - // 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 - // or gun/ very simple single particle gun generator - // Throw single Upsilons, may be embedded in Hijing by setting readhepmc flag also (note, careful to set Z vertex equal to Hijing events) +// HepMC2 files // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; INPUTHEPMC::filename = inputFile; @@ -118,7 +112,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Enable::DSTOUT = true; Enable::DSTOUT_COMPRESS = false;// Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs - Enable::DSTREADER = true; + //Enable::DSTREADER = true; //====================== // What to run @@ -339,29 +333,19 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // Calo Trigger Simulation //----------------- - if (Enable::CALOTRIGGER) - { - CaloTrigger_Sim(); - } + if (Enable::CALOTRIGGER) CaloTrigger_Sim(); //--------- // Jet reco //--------- - if (Enable::JETS) - { - Jet_Reco(); - } + if (Enable::JETS) Jet_Reco(); - if (Enable::HIJETS) - { - HIJetReco(); - } + if (Enable::HIJETS) HIJetReco(); - if (Enable::FWDJETS) - { - Jet_FwdReco(); - } + if (Enable::FWDJETS) Jet_FwdReco(); + + if (Enable::DSTREADER) G4DSTreader_EICDetector(outputFile); //---------------------- // Simulation evaluation @@ -390,8 +374,9 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); InputManagers(); - if (Enable::DSTREADER) G4DSTreader_EICDetector(outputFile); - + //-------------- + // Set up Output Manager + //-------------- if(Enable::DSTOUT) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); @@ -406,8 +391,8 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); { return 0; } - // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !Input::READHITS && !Input::HEPMC) + // if we run any of the particle generators and use 0 it'll run forever + if (nEvents == 0 && !Input::READHITS && !Input::HEPMC && !Input::READEIC) { 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; From d74e793410ee997d1639570b6700c856932bd4a1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 11:22:49 -0400 Subject: [PATCH 0713/1222] clang-format --- macros/g4simulations/Fun4All_G4_EICDetector.C | 58 +++++++++---------- macros/g4simulations/G4Setup_EICDetector.C | 1 - 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 397fdfbdc..5d17414d3 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -61,42 +61,42 @@ int Fun4All_G4_EICDetector( // Input::PYTHIA8 = true; // Use Pythia 6 -// Input::PYTHIA6 = true; -// PYTHIA6::config_file = "phpythia6_ep.cfg"; + // Input::PYTHIA6 = true; + // PYTHIA6::config_file = "phpythia6_ep.cfg"; -// Use Sartre -// Input::SARTRE = true; + // Use Sartre + // Input::SARTRE = true; -// Simple multi particle generator in eta/phi/pt ranges -// Input::SIMPLE = true; + // Simple multi particle generator in eta/phi/pt ranges + // Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; -INPUTSIMPLE::AddParticle("pi-", 5); -INPUTSIMPLE::set_eta_range(-3,3); -INPUTSIMPLE::set_phi_range(-M_PI,M_PI); -INPUTSIMPLE::set_pt_range(0.1,20.); -INPUTSIMPLE::set_vtx_mean(0.,0.,0.); -INPUTSIMPLE::set_vtx_width(0.,0.,5.); - -// Particle gun (same particles in always the same direction) -// Input::GUN = true; + INPUTSIMPLE::AddParticle("pi-", 5); + INPUTSIMPLE::set_eta_range(-3, 3); + INPUTSIMPLE::set_phi_range(-M_PI, M_PI); + INPUTSIMPLE::set_pt_range(0.1, 20.); + INPUTSIMPLE::set_vtx_mean(0., 0., 0.); + INPUTSIMPLE::set_vtx_width(0., 0., 5.); + + // Particle gun (same particles in always the same direction) + // Input::GUN = true; Input::GUN_VERBOSITY = 0; INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); - INPUTGUN::AddParticle("geantino",1.7776,-0.4335,0.); + INPUTGUN::AddParticle("geantino", 1.7776, -0.4335, 0.); //INPUTGUN::set_vtx(0,0,0); -// Upsilon generator + // Upsilon generator Input::UPSILON = true; Input::UPSILON_VERBOSITY = 0; INPUTUPSILON::AddDecayParticles("e+", "e-", 0); -// And/Or read generated particles from file + // And/Or read generated particles from file -// eic-smear output -// Input::READEIC = true; + // eic-smear output + // Input::READEIC = true; INPUTREADEIC::filename = inputFile; -// HepMC2 files -// Input::HEPMC = true; + // HepMC2 files + // Input::HEPMC = true; Input::HEPMC_VERBOSITY = 1; INPUTHEPMC::filename = inputFile; @@ -110,7 +110,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //====================== Enable::DSTOUT = true; - Enable::DSTOUT_COMPRESS = false;// Compress DST files + Enable::DSTOUT_COMPRESS = false; // Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs //Enable::DSTREADER = true; @@ -137,7 +137,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Enable::TRACKING = true; Enable::TRACKING_EVAL = Enable::TRACKING && true; G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes -// projections to calorimeters + // projections to calorimeters G4TRACKING::PROJECTION_CEMC = false; G4TRACKING::PROJECTION_FEMC = false; G4TRACKING::PROJECTION_FHCAL = false; @@ -173,14 +173,14 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Enable::AEROGEL = true; Enable::FEMC = true; -// Enable::FEMC_ABSORBER = true; + // Enable::FEMC_ABSORBER = true; Enable::FEMC_CELL = Enable::FEMC && true; Enable::FEMC_TOWER = Enable::FEMC_CELL && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; Enable::FHCAL = true; -// Enable::FHCAL_ABSORBER = true; + // Enable::FHCAL_ABSORBER = true; Enable::FHCAL_CELL = Enable::FHCAL && true; Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; @@ -199,7 +199,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); Enable::GLOBAL_RECO = true; Enable::GLOBAL_FASTSIM = true; - Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // Select only one jet reconstruction- they currently use the same // output collections on the node tree! @@ -212,7 +212,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); // 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) - Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -377,7 +377,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //-------------- // Set up Output Manager //-------------- - if(Enable::DSTOUT) + if (Enable::DSTOUT) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); if (Enable::DSTOUT_COMPRESS) DstCompress(out); diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 955b376de..0d60abf91 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -138,7 +138,6 @@ void G4Init() int G4Setup() { - //--------------- // Fun4All server //--------------- From 0d4f88a413e70424d4828f7c8cee2fe9c112811f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 13:25:08 -0400 Subject: [PATCH 0714/1222] set pt or momentum correctly --- macros/g4simulations/G4_Input_Simple.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index dc105e02d..3b8bf6216 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -131,7 +131,14 @@ void InputSimpleInit() gen->set_vertex_size_parameters(0.0, 0.0); gen->set_eta_range(INPUTSIMPLE::etamin, INPUTSIMPLE::etamax); gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); + if (isfinite(INPUTSIMPLE::ptmin) && isfinite(INPUTSIMPLE::ptmax)) + { + gen->set_pt_range(INPUTSIMPLE::ptmin, INPUTSIMPLE::ptmax); + } + else if (isfinite(INPUTSIMPLE::pmin) && isfinite(INPUTSIMPLE::pmax)) + { gen->set_p_range(INPUTSIMPLE::pmin, INPUTSIMPLE::pmax); + } gen->Embed(1); gen->Verbosity(Input::SIMPLE_VERBOSITY); se->registerSubsystem(gen); From 1cb3fce483b27435825fc6401d57e32cc6a372c3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 13:25:29 -0400 Subject: [PATCH 0715/1222] clang-format --- macros/g4simulations/G4_Input_Simple.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index 3b8bf6216..39a1231b3 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -133,11 +133,11 @@ void InputSimpleInit() gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); if (isfinite(INPUTSIMPLE::ptmin) && isfinite(INPUTSIMPLE::ptmax)) { - gen->set_pt_range(INPUTSIMPLE::ptmin, INPUTSIMPLE::ptmax); + gen->set_pt_range(INPUTSIMPLE::ptmin, INPUTSIMPLE::ptmax); } else if (isfinite(INPUTSIMPLE::pmin) && isfinite(INPUTSIMPLE::pmax)) { - gen->set_p_range(INPUTSIMPLE::pmin, INPUTSIMPLE::pmax); + gen->set_p_range(INPUTSIMPLE::pmin, INPUTSIMPLE::pmax); } gen->Embed(1); gen->Verbosity(Input::SIMPLE_VERBOSITY); From 68e2671940cff75354a21f87c9e40fd39039ed95 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 13:25:56 -0400 Subject: [PATCH 0716/1222] cleanup, add comments --- macros/g4simulations/Fun4All_G4_EICDetector.C | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 5d17414d3..6d1dfa174 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -20,7 +20,6 @@ #include R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) int Fun4All_G4_EICDetector( const int nEvents = 1, @@ -56,6 +55,8 @@ int Fun4All_G4_EICDetector( // Or: // Use one or more particle generators + // It is run if Input:: is set to true + // all other options only play a role if it is active // Use Pythia 8 // Input::PYTHIA8 = true; @@ -68,12 +69,14 @@ int Fun4All_G4_EICDetector( // Input::SARTRE = true; // Simple multi particle generator in eta/phi/pt ranges - // Input::SIMPLE = true; + Input::SIMPLE = true; Input::SIMPLE_VERBOSITY = 1; INPUTSIMPLE::AddParticle("pi-", 5); INPUTSIMPLE::set_eta_range(-3, 3); INPUTSIMPLE::set_phi_range(-M_PI, M_PI); INPUTSIMPLE::set_pt_range(0.1, 20.); +// or if you want to set the momentum, not pt range +// INPUTSIMPLE::set_p_range(0.1, 20.); INPUTSIMPLE::set_vtx_mean(0., 0., 0.); INPUTSIMPLE::set_vtx_width(0., 0., 5.); @@ -85,7 +88,7 @@ int Fun4All_G4_EICDetector( //INPUTGUN::set_vtx(0,0,0); // Upsilon generator - Input::UPSILON = true; + //Input::UPSILON = true; Input::UPSILON_VERBOSITY = 0; INPUTUPSILON::AddDecayParticles("e+", "e-", 0); @@ -411,7 +414,3 @@ int Fun4All_G4_EICDetector( gSystem->Exit(0); return 0; } - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunFFALoadTest() {} From b7a114cb602eec40fd1aebfc480d9d3c3015bbe8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 15:32:09 -0400 Subject: [PATCH 0717/1222] replace G4HIT_SVTXSUPPORT by G4HIT_FIELDCAGE --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 0d60abf91..e3a3352dc 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -309,7 +309,7 @@ void ShowerCompress() PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); + compress->AddHitContainer("G4HIT_FIELDCAGE"); compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); compress->AddHitContainer("G4HIT_CEMC"); compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); From 43d4ec7774da7ef7144df135ab75c7ef87b9dd02 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 18:08:03 -0400 Subject: [PATCH 0718/1222] move later implemented function to top of list --- macros/g4simulations/G4_Input_Simple.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C index 39a1231b3..beb44e9dd 100644 --- a/macros/g4simulations/G4_Input_Simple.C +++ b/macros/g4simulations/G4_Input_Simple.C @@ -37,18 +37,21 @@ namespace INPUTSIMPLE double pmax = NAN; map particles; void AddParticle(const string &name, const unsigned int num); + void set_p_range(double d1, double d2); + void set_pt_range(double d1, double d2); + void set_eta_range(double d1, double d2) { etamin = d1; etamax = d2; } + void set_phi_range(double d1, double d2) { phimin = d1; phimax = d2; } - void set_p_range(double d1, double d2); - void set_pt_range(double d1, double d2); + void set_vtx_mean(double vx, double vy, double vz) { vxmean = vx; From 3333ce56a00e120eedd5b88af2724e8f24cafee1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Jun 2020 18:09:50 -0400 Subject: [PATCH 0719/1222] go back to SvtxTrackMap as track node name, otherwise barrel and forward tracks end up in different places --- macros/g4simulations/G4_FGEM_fsPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C index d72153a34..dcee2d1b1 100644 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ b/macros/g4simulations/G4_FGEM_fsPHENIX.C @@ -35,7 +35,7 @@ void FGEM_Init() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); - TRACKING::TrackNodeName = "TrackMap"; // node name for tracks + TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -248,7 +248,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); kalman->set_vertex_xy_resolution(50E-4); kalman->set_vertex_z_resolution(50E-4); - kalman->set_sub_top_node_name("TRACKS"); + kalman->set_sub_top_node_name("SVTX"); kalman->set_trackmap_out_name(TRACKING::TrackNodeName); // MAPS in MVTX detector From 01e136e0d1fd8458d1df096e532416ca39dbea50 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 19:17:44 -0400 Subject: [PATCH 0720/1222] merge with main --- macros/g4simulations/GlobalVariables.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 2b732af81..455771483 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -13,6 +13,7 @@ namespace Input bool HEPMC = false; int HEPMC_VERBOSITY = 0; bool EMBED = false; + bool READEIC = false; } // Global settings affecting multiple subsystems @@ -41,3 +42,9 @@ namespace G4P6DECAYER { EDecayType decayType = EDecayType::kAll; } + +// our various tracking macro +namespace TRACKING +{ + string TrackNodeName = "SvtxTrackMap"; +} From b398a8076fb2c1ee9364752cafac655673dce2f9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 19:18:16 -0400 Subject: [PATCH 0721/1222] merge with main --- macros/g4simulations/G4_Tracking_EIC.C | 207 ++++++++++++++----------- 1 file changed, 114 insertions(+), 93 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 6161bc4ce..91a355cf5 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -26,13 +26,27 @@ R__LOAD_LIBRARY(libg4trackfastsim.so) namespace Enable { bool TRACKING = false; -} + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; +} // namespace Enable + +namespace G4TRACKING +{ + bool DISPLACED_VERTEX = false; + bool PROJECTION_CEMC = false; + bool PROJECTION_FEMC = false; + bool PROJECTION_FHCAL = false; +} // namespace G4TRACKING + //-----------------------------------------------------------------------------// -void TrackingInit() {} +void TrackingInit() +{ + TRACKING::TrackNodeName = "TrackMap"; +} //-----------------------------------------------------------------------------// -void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) +void Tracking_Reco() { - int i; + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- @@ -42,145 +56,151 @@ void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); // kalman->Verbosity(); // kalman->Smearing(false); - if (displaced_vertex) - { - //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(1); - kalman->set_vertex_z_resolution(1); - kalman->enable_vertexing(true); - } + if (G4TRACKING::DISPLACED_VERTEX) + { + //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(1); + kalman->set_vertex_z_resolution(1); + kalman->enable_vertexing(true); + } else - { - // constraint to a primary vertex and use it as part of the fitting level arm - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50e-4); - kalman->set_vertex_z_resolution(50e-4); - } + { + // constraint to a primary vertex and use it as part of the fitting level arm + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50e-4); + kalman->set_vertex_z_resolution(50e-4); + } - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); + kalman->set_sub_top_node_name("TRACKS"); + kalman->set_trackmap_out_name(TRACKING::TrackNodeName); //------------------------- // Barrel //------------------------- - if (Enable::BARREL) { + if (Enable::BARREL) + { kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise } //------------------------- // MVTX //------------------------- if (Enable::MVTX) - { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } + { + // MAPS + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } //------------------------- // TPC //------------------------- if (Enable::TPC) - { - kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } + { + kalman->add_phg4hits( + "G4HIT_TPC", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } //------------------------- // EGEM //------------------------- if (Enable::EGEM) + { + // GEM, 70um azimuthal resolution, 1cm radial strips + for (int i = 0; i < 4; i++) { - // GEM, 70um azimuthal resolution, 1cm radial strips - for (i=0;i<4;i++) { - kalman->add_phg4hits( - Form("G4HIT_EGEM_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } + kalman->add_phg4hits( + Form("G4HIT_EGEM_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); } + } //------------------------- // FGEM //------------------------- if (Enable::FGEM) + { + // GEM2, 70um azimuthal resolution, 1cm radial strips + for (int i = 2; i < 5; i++) { - // GEM2, 70um azimuthal resolution, 1cm radial strips - for (i=2;i<5;i++) { - kalman->add_phg4hits(Form("G4HIT_FGEM_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise - } + kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise } + } //------------------------- // FST //------------------------- - if (Enable::FST) { - for (i=0;i<5;i++) { - kalman->add_phg4hits(Form("G4HIT_FST_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0); // const float noise + if (Enable::FST) + { + for (int i = 0; i < 5; i++) + { + kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0); // const float noise } - } + } //------------------------- // FEMC //------------------------- // Saved track states (projections) if (Enable::FEMC) - { - // kalman->add_state_name("FEMC"); - } + { + // kalman->add_state_name("FEMC"); + } //------------------------- // FHCAL //------------------------- if (Enable::FHCAL) - { - // kalman->add_state_name("FHCAL"); - } + { + // kalman->add_state_name("FHCAL"); + } //------------------------- // CEMC //------------------------- if (Enable::CEMC) - { - // kalman->add_state_name("CEMC"); - } + { + // kalman->add_state_name("CEMC"); + } se->registerSubsystem(kalman); return; } //-----------------------------------------------------------------------------// -void Tracking_Eval(std::string outputfile, int verbosity = 0) +void Tracking_Eval(const std::string &outputfile) { + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server //--------------- @@ -192,6 +212,7 @@ void Tracking_Eval(std::string outputfile, int verbosity = 0) //---------------- PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_filename(outputfile.c_str()); + fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); + fast_sim_eval->set_filename(outputfile); se->registerSubsystem(fast_sim_eval); } From 2f3bb927b70ba3769e5edcfb44f456ecbe979e5a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 19:18:40 -0400 Subject: [PATCH 0722/1222] remote TMath.h --- macros/g4simulations/G4_GEM_EIC.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C index 19bd1cd72..e62053acd 100644 --- a/macros/g4simulations/G4_GEM_EIC.C +++ b/macros/g4simulations/G4_GEM_EIC.C @@ -1,9 +1,11 @@ #pragma once #include "GlobalVariables.C" + #include + #include -#include + #include R__LOAD_LIBRARY(libg4detectors.so) @@ -187,7 +189,7 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, if (zpos < 0) { zpos = -zpos; - polar_angle = TMath::Pi(); + polar_angle = M_PI; } if (etamax < etamin) { From e053afab612b2df3c39a4cf0744f4b4d56f166dc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:23:27 -0400 Subject: [PATCH 0723/1222] add dimensions of surrounding Black Hole --- macros/g4simulations/G4_Barrel_EIC.C | 98 ++++++++++++++-------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 75a49744b..82454648f 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -1,14 +1,15 @@ -/*--------------------------------------------------------------------* - * 06-15-2020 * - * Ping: Base on G4_TPC_EIC.C * - *--------------------------------------------------------------------*/ #pragma once #include "GlobalVariables.C" + #include + #include + #include + #include + #include #include @@ -17,71 +18,72 @@ R__LOAD_LIBRARY(libg4mvtx.so) //---------------------------------------------------------------------// namespace Enable { - static bool BARREL = false; -} -//---------------------------------------------------------------------// -namespace G4Barrel -{ -} // namespace G4Barrel + bool BARREL = false; + bool BARREL_ABSORBER = false; +} // namespace Enable //---------------------------------------------------------------------// -void BarrelInit(int verbosity = 0) +void BarrelInit() { } //---------------------------------------------------------------------// -double Barrel(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) +double Barrel(PHG4Reco* g4Reco, double radius) { - int i,j; + const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; //--------------------------------- //build barrel detector //--------------------------------- - const int nLayer=5; - const int nSubLayer=7; - const float um=0.0001; //convert um to cm + const int nLayer = 5; + const int nSubLayer = 7; + const float um = 0.0001; //convert um to cm + + double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm + double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm - double r[nLayer]={3.64, 4.81, 5.98, 16.0, 22.0}; //cm - double halfLength[nLayer]={20, 20, 25, 25, 25}; //cm - - string layerName[nSubLayer]={"SiliconSensor","Metalconnection","HDI","Cooling", - "Support1","Support_Gap","Support2"}; - string material[nSubLayer]={"G4_Si","G4_Al","G4_KAPTON","G4_WATER", - "G4_GRAPHITE","G4_AIR","G4_GRAPHITE"}; - double thickness[nSubLayer]={285 * um, 15 * um, 20 * um, 100 * um, - 50 * um, 1, 50 * um}; - - int k=0; //layer id. Must be unique. - PHG4CylinderSubsystem* cyl; - for (i=0;i2) continue; - for (j=0;jset_double_param("radius", r[i]); - else cyl->set_double_param("radius", r[i]+thickness[j-1]); + for (int j = 0; j < nSubLayer; j++) + { + cyl = new PHG4CylinderSubsystem(Form("Barrel_%s", layerName[j].c_str()), k); + if (j == 0) + cyl->set_double_param("radius", r[i]); + else + cyl->set_double_param("radius", r[i] + thickness[j - 1]); - cyl->set_double_param("length", 2.0*halfLength[i]); + cyl->set_double_param("length", 2.0 * halfLength[i]); cyl->set_string_param("material", material[j].c_str()); cyl->set_double_param("thickness", thickness[j]); + max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); cyl->SuperDetector("BARREL"); - if (j==0) cyl->SetActive(); //only the Silicon Sensor is active - + if (j == 0) + { + cyl->SetActive(); //only the Silicon Sensor is active + } + else + { + if (AbsorberActive) cyl->SetActive(); + } g4Reco->registerSubsystem(cyl); k++; } } - //fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); - //fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - //fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - //fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - //fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - //fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - //fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); - // update now that we know the outer radius - //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); //return radius; - return r[nLayer-1]; + return max_bh_radius; } //---------------------------------------------------------------------// From 98c2a04df4c34a7c147ed2594acc36337cb7aae8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:24:41 -0400 Subject: [PATCH 0724/1222] clang-format --- macros/g4simulations/G4_Barrel_EIC.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 82454648f..5ad375a88 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -57,10 +57,13 @@ double Barrel(PHG4Reco* g4Reco, double radius) { cyl = new PHG4CylinderSubsystem(Form("Barrel_%s", layerName[j].c_str()), k); if (j == 0) + { cyl->set_double_param("radius", r[i]); + } else + { cyl->set_double_param("radius", r[i] + thickness[j - 1]); - + } cyl->set_double_param("length", 2.0 * halfLength[i]); cyl->set_string_param("material", material[j].c_str()); cyl->set_double_param("thickness", thickness[j]); @@ -83,7 +86,6 @@ double Barrel(PHG4Reco* g4Reco, double radius) BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); - //return radius; return max_bh_radius; } //---------------------------------------------------------------------// From d7040c086362be618b568b6b047e687cf51fcf46 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:36:19 -0400 Subject: [PATCH 0725/1222] get rid of TMath.h --- macros/g4simulations/G4_FST_EIC.C | 39 ++++++++----------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C index b0d40077b..9f7a3225c 100644 --- a/macros/g4simulations/G4_FST_EIC.C +++ b/macros/g4simulations/G4_FST_EIC.C @@ -1,9 +1,11 @@ #pragma once #include "GlobalVariables.C" + #include + #include -#include + #include R__LOAD_LIBRARY(libg4detectors.so) @@ -24,14 +26,6 @@ void FST_Init() //-----------------------------------------------------------------------------------// void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { - //const double tilt = .1; - /* - string name; - double etamax; - double etamin; - double zpos; - */ - //Design from Xuan Li @LANL make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); @@ -53,11 +47,11 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double polar_angle = 0; if (zpos < 0) { zpos = -zpos; - polar_angle = TMath::Pi(); + polar_angle = M_PI; } - double min_polar_angle = TMath::ATan2(Rmin, zpos); - double max_polar_angle = TMath::ATan2(Rmax, zpos); + double min_polar_angle = atan2(Rmin, zpos); + double max_polar_angle = atan2(Rmax, zpos); if (max_polar_angle < min_polar_angle) { double t = max_polar_angle; @@ -66,19 +60,16 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, } PHG4SectorSubsystem *fst; - fst = new PHG4SectorSubsystem(name.c_str()); + fst = new PHG4SectorSubsystem(name); fst->SuperDetector(name); fst->get_geometry().set_normal_polar_angle(polar_angle); - fst->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + fst->get_geometry().set_normal_start(zpos * PHG4Sector::Sector_Geometry::Unit_cm()); fst->get_geometry().set_min_polar_angle(min_polar_angle); fst->get_geometry().set_max_polar_angle(max_polar_angle); - fst->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); fst->get_geometry().set_N_Sector(1); fst->get_geometry().set_material("G4_AIR"); fst->OverlapCheck(overlapcheck); @@ -88,16 +79,6 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, const double um = 1e-3 * mm; // build up layers - /* - fst->get_geometry().AddLayer("SliconSensor", "G4_Si", 18 * um, true, 100); - fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - fst->get_geometry().AddLayer("SliconSupport", "G4_Al", 285 * um, false, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); - */ fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); From 6eb874c919f33b24e04387a13fcc43a38ecf41a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:46:47 -0400 Subject: [PATCH 0726/1222] adjust black hole dimensions --- macros/g4simulations/G4_FST_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C index 9f7a3225c..7489d1f66 100644 --- a/macros/g4simulations/G4_FST_EIC.C +++ b/macros/g4simulations/G4_FST_EIC.C @@ -20,7 +20,7 @@ namespace Enable //-----------------------------------------------------------------------------------// void FST_Init() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } //-----------------------------------------------------------------------------------// From 38af5ef946931088e43a7ec630f2dd45df6323e5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:47:13 -0400 Subject: [PATCH 0727/1222] remove c_str() interfaces --- macros/g4simulations/G4_Barrel_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 5ad375a88..42e256951 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -55,7 +55,7 @@ double Barrel(PHG4Reco* g4Reco, double radius) //if (i>2) continue; for (int j = 0; j < nSubLayer; j++) { - cyl = new PHG4CylinderSubsystem(Form("Barrel_%s", layerName[j].c_str()), k); + cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); if (j == 0) { cyl->set_double_param("radius", r[i]); @@ -65,7 +65,7 @@ double Barrel(PHG4Reco* g4Reco, double radius) cyl->set_double_param("radius", r[i] + thickness[j - 1]); } cyl->set_double_param("length", 2.0 * halfLength[i]); - cyl->set_string_param("material", material[j].c_str()); + cyl->set_string_param("material", material[j]); cyl->set_double_param("thickness", thickness[j]); max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); cyl->SuperDetector("BARREL"); From 686640fcaab032c3f267f2c05cfcfa698142f653 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:47:45 -0400 Subject: [PATCH 0728/1222] remove absorberactive paramaeter --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index c0a11adf2..0a7ceb839 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -213,7 +213,7 @@ int G4Setup() } if (Enable::BARREL) { - Barrel(g4Reco, radius, absorberactive); + Barrel(g4Reco, radius); } if (Enable::MVTX) { From 87aa4f3cc815f1d1c86cbd47f6fefe13c79e549c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 21:49:05 -0400 Subject: [PATCH 0729/1222] clang-format --- macros/g4simulations/G4Setup_EICDetector.C | 2 +- macros/g4simulations/G4_FST_EIC.C | 33 +++++++++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 0a7ceb839..6d271da9c 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -206,7 +206,7 @@ int G4Setup() if (Enable::FGEM) { FGEMSetup(g4Reco); - } + } if (Enable::FST) { FSTSetup(g4Reco); diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C index 7489d1f66..15e363f6d 100644 --- a/macros/g4simulations/G4_FST_EIC.C +++ b/macros/g4simulations/G4_FST_EIC.C @@ -27,17 +27,16 @@ void FST_Init() void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); - } //-----------------------------------------------------------------------------------// -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax) +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, + double zpos, double Rmin, double Rmax) { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " @@ -45,7 +44,8 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, // always facing the interaction point double polar_angle = 0; - if (zpos < 0) { + if (zpos < 0) + { zpos = -zpos; polar_angle = M_PI; } @@ -53,7 +53,8 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double min_polar_angle = atan2(Rmin, zpos); double max_polar_angle = atan2(Rmax, zpos); - if (max_polar_angle < min_polar_angle) { + if (max_polar_angle < min_polar_angle) + { double t = max_polar_angle; max_polar_angle = min_polar_angle; min_polar_angle = t; @@ -79,13 +80,13 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); - fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); + fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); g4Reco->registerSubsystem(fst); return 0; From e36c3abf0c1e6508514d52ea3a308860764157e1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:01:56 -0400 Subject: [PATCH 0730/1222] check for bad subsystem combinations and quit --- macros/g4simulations/G4Setup_EICDetector.C | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C index 6d271da9c..a64fc86a2 100644 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ b/macros/g4simulations/G4Setup_EICDetector.C @@ -42,10 +42,21 @@ R__LOAD_LIBRARY(libg4decayer.so) R__LOAD_LIBRARY(libg4detectors.so) -void RunLoadTest() {} - void G4Init() { +// First some check for subsystems which do not go together + + if (Enable::TPC && Enable::FST) + { + cout << "TPC and FST cannot be enabled together" << endl; + gSystem->Exit(1); + } + else if ((Enable::TPC || Enable::MVTX) && Enable::BARREL) + { + cout << "TPC/MVTX and BARREL cannot be enabled together" << endl; + gSystem->Exit(1); + } + // load detector/material macros and execute Init() function if (Enable::PIPE) { From ccadebafb97d1841bf5c14d9e47af1df4ff74ea9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:03:25 -0400 Subject: [PATCH 0731/1222] Add barrel tracker with FST --- macros/g4simulations/Fun4All_G4_EICDetector.C | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index a2d89f55d..0b12a6308 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -125,7 +125,6 @@ int Fun4All_G4_EICDetector( // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; - // sPHENIX barrel Enable::BBC = true; // whether to simulate the Be section of the beam pipe @@ -133,12 +132,15 @@ int Fun4All_G4_EICDetector( // EIC beam pipe extension beyond the Be-section: //G4PIPE::use_forward_pipes = true; - Enable::EGEM = false; - Enable::FGEM = false; - Enable::FST = true; - Enable::BARREL = true; //barrel tracker - Enable::MVTX = false; - Enable::TPC = false; + Enable::EGEM = true; + Enable::FGEM = true; +// barrel tracker + Enable::BARREL = false; + Enable::FST = false; +// mvtx/tpc tracker + Enable::MVTX = true; + Enable::TPC = true; + Enable::TRACKING = true; Enable::TRACKING_EVAL = Enable::TRACKING && true; G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes @@ -221,7 +223,7 @@ int Fun4All_G4_EICDetector( // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; + BlackHoleGeometry::visible = false; // establish the geometry and reconstruction setup G4Init(); From dbd48d293c0402e2612f2bee0290458bad3eaa99 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:29:46 -0400 Subject: [PATCH 0732/1222] Add Barrel and FST --- macros/g4simulations/G4_DSTReader_EICDetector.C | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index 85b34373c..ecdbbfd50 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -3,6 +3,8 @@ #include "GlobalVariables.C" #include "G4_GEM_EIC.C" +#include "G4_FST_EIC.C" +#include "G4_Barrel_EIC.C" #include "G4_Mvtx_EIC.C" #include "G4_TPC_EIC.C" #include "G4_CEmc_EIC.C" @@ -61,6 +63,10 @@ G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") if (G4DSTREADER::save_g4_raw) { + if (Enable::BARREL) + { + ana->AddNode("BARREL"); + } if (Enable::MVTX) { ana->AddNode("MVTX"); @@ -82,6 +88,9 @@ G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") ana->AddNode("FGEM_2"); ana->AddNode("FGEM_3"); ana->AddNode("FGEM_4"); + } + if (Enable::FST) + { ana->AddNode("FST_0"); ana->AddNode("FST_1"); ana->AddNode("FST_2"); From c7424825bc8b606f3795ecf33059a46343dba9c2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:31:28 -0400 Subject: [PATCH 0733/1222] set filename in calling routing --- macros/g4simulations/G4_DSTReader_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index ecdbbfd50..c18aaca00 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -53,7 +53,7 @@ G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader(outputFile + string("_DSTReader.root")); + PHG4DSTReader* ana = new PHG4DSTReader(outputFile); ana->set_save_particle(true); ana->set_load_all_particle(false); ana->set_load_active_particle(true); From d0f8b69ff1f95e46846e7d29223193dddd9565cf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:32:20 -0400 Subject: [PATCH 0734/1222] strip .root from output filename and use this to generate eval filenames --- macros/g4simulations/Fun4All_G4_EICDetector.C | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 0b12a6308..2e82ff21e 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -351,28 +351,36 @@ int Fun4All_G4_EICDetector( if (Enable::FWDJETS) Jet_FwdReco(); - if (Enable::DSTREADER) G4DSTreader_EICDetector(outputFile); + 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::DSTREADER) G4DSTreader_EICDetector(outputroot + "_DSTReader.root"); //---------------------- // Simulation evaluation //---------------------- - if (Enable::TRACKING_EVAL) Tracking_Eval(string(outputFile) + "_g4tracking_eval.root"); + if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4tracking_eval.root"); - if (Enable::CEMC_EVAL) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); + if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root"); - if (Enable::HCALIN_EVAL) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); + if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); - if (Enable::HCALOUT_EVAL) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); + if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); - if (Enable::FEMC_EVAL) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); + if (Enable::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); - if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); + if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); - if (Enable::EEMC_EVAL) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); + if (Enable::EEMC_EVAL) EEMC_Eval(outputroot + "_g4eemc_eval.root"); - if (Enable::JETS_EVAL) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); - if (Enable::FWDJETS_EVAL) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); + if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); //-------------- // Set up Input Managers From c41abfc2da50755cf87b69a586262401436e929d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 22 Jun 2020 22:33:37 -0400 Subject: [PATCH 0735/1222] clang-format --- macros/g4simulations/Fun4All_G4_EICDetector.C | 10 ++-- .../g4simulations/G4_DSTReader_EICDetector.C | 50 +++++++++---------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 2e82ff21e..1c7a41a74 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -75,8 +75,8 @@ int Fun4All_G4_EICDetector( INPUTSIMPLE::set_eta_range(-3, 3); INPUTSIMPLE::set_phi_range(-M_PI, M_PI); INPUTSIMPLE::set_pt_range(0.1, 20.); -// or if you want to set the momentum, not pt range -// INPUTSIMPLE::set_p_range(0.1, 20.); + // or if you want to set the momentum, not pt range + // INPUTSIMPLE::set_p_range(0.1, 20.); INPUTSIMPLE::set_vtx_mean(0., 0., 0.); INPUTSIMPLE::set_vtx_width(0., 0., 5.); @@ -134,10 +134,10 @@ int Fun4All_G4_EICDetector( Enable::EGEM = true; Enable::FGEM = true; -// barrel tracker + // barrel tracker Enable::BARREL = false; Enable::FST = false; -// mvtx/tpc tracker + // mvtx/tpc tracker Enable::MVTX = true; Enable::TPC = true; @@ -356,7 +356,7 @@ int Fun4All_G4_EICDetector( size_t pos = outputroot.find(remove_this); if (pos != string::npos) { - outputroot.erase(pos,remove_this.length()); + outputroot.erase(pos, remove_this.length()); } if (Enable::DSTREADER) G4DSTreader_EICDetector(outputroot + "_DSTReader.root"); diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C index c18aaca00..8d4f47cfe 100644 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ b/macros/g4simulations/G4_DSTReader_EICDetector.C @@ -2,18 +2,18 @@ #include "GlobalVariables.C" -#include "G4_GEM_EIC.C" -#include "G4_FST_EIC.C" #include "G4_Barrel_EIC.C" -#include "G4_Mvtx_EIC.C" -#include "G4_TPC_EIC.C" #include "G4_CEmc_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" #include "G4_EEMC.C" #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" +#include "G4_FST_EIC.C" +#include "G4_GEM_EIC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_Mvtx_EIC.C" +#include "G4_TPC_EIC.C" #include @@ -21,7 +21,6 @@ R__LOAD_LIBRARY(libg4eval.so) - ////////////////////////////////////////////////////////////////// /*! \file G4_DSTReader.C @@ -35,25 +34,22 @@ 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 G4DSTreader_EICDetectorInit() {} -void -G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") +void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") { - //! debug output on screen? - int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); - + int verbosity = max(Enable::VERBOSITY, Enable::DSTREADER_VERBOSITY); // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader(outputFile); + PHG4DSTReader *ana = new PHG4DSTReader(outputFile); ana->set_save_particle(true); ana->set_load_all_particle(false); ana->set_load_active_particle(true); @@ -195,17 +191,17 @@ G4DSTreader_EICDetector( const string &outputFile = "G4sPHENIXCells.root") 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"); -// } + // 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); From 8a6f1a9c733853963a7a4f90fe3559f9c4e380dc Mon Sep 17 00:00:00 2001 From: bogui56 Date: Tue, 23 Jun 2020 09:34:53 -0400 Subject: [PATCH 0736/1222] making PHTpcTracker default seeding algo --- macros/g4simulations/G4_Tracking.C | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index b70ddb62f..81891175e 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -44,6 +44,8 @@ #include #include + +#include R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) @@ -54,6 +56,7 @@ R__LOAD_LIBRARY(libmvtx.so) R__LOAD_LIBRARY(libtpc.so) R__LOAD_LIBRARY(libmicromegas.so) R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libPHTpcTracker.so) #endif @@ -96,6 +99,10 @@ const int n_micromegas_layer = 2; // Tracking reconstruction setup parameters and flags //===================================== const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events +//default seed is PHTpcTracker +const bool use_hough_seeding = false; //choose seeding algo +const bool use_ca_seeding = false; + const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -507,6 +514,7 @@ void Tracking_Reco(int verbosity = 0) //--------------- gSystem->Load("libfun4all.so"); gSystem->Load("libtrack_reco.so"); + gSystem->Load("libPHTpcTracker.so"); //--------------- // Fun4All server @@ -543,14 +551,24 @@ void Tracking_Reco(int verbosity = 0) init_zvtx->Verbosity(0); se->registerSubsystem(init_zvtx); } - - // find seed tracks using a subset of TPC layers - int min_layers = 4; - int nlayers_seeds = 12; - auto track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(0); - se->registerSubsystem(track_seed); - + if(use_hough_seeding){ + // find seed tracks using a subset of TPC layers + int min_layers = 4; + int nlayers_seeds = 12; + auto track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); + track_seed->Verbosity(0); + se->registerSubsystem(track_seed); + }else if(use_ca_seeding){ + }else{ + 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... + se->registerSubsystem(tracker); + } // Find all clusters associated with each seed track auto track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer, enable_micromegas ? n_micromegas_layer:0); track_prop->Verbosity(0); From f3d4fd176bdcbe28adcbe4e522fef05463b403d3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 23 Jun 2020 11:23:03 -0400 Subject: [PATCH 0737/1222] clean up accidental checkin --- macros/g4simulation/Fun4All_G4_EICDetector.C | 614 ------------------- macros/g4simulation/G4_GEM_EIC.C | 218 ------- macros/g4simulation/G4_Tracking_EIC.C | 197 ------ 3 files changed, 1029 deletions(-) delete mode 100644 macros/g4simulation/Fun4All_G4_EICDetector.C delete mode 100644 macros/g4simulation/G4_GEM_EIC.C delete mode 100644 macros/g4simulation/G4_Tracking_EIC.C diff --git a/macros/g4simulation/Fun4All_G4_EICDetector.C b/macros/g4simulation/Fun4All_G4_EICDetector.C deleted file mode 100644 index ef6b15e41..000000000 --- a/macros/g4simulation/Fun4All_G4_EICDetector.C +++ /dev/null @@ -1,614 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_EICDetector.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_EICDetector.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_HIJetReco.C" -#include "G4_Jets.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(libg4testbench.so) -R__LOAD_LIBRARY(libPHPythia6.so) -R__LOAD_LIBRARY(libPHPythia8.so) -R__LOAD_LIBRARY(libPHSartre.so) - -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") //"G4EICDetector.root") -{ - //=============== - // 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 = 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; - - // Write the DST - Enable::DSTOUT = false; - // Compress DST files - Enable::DSTOUT_COMPRESS = false; - //Option to convert DST to human command readable TTree for quick poke around the outputs - const bool do_DSTReader = false; - - //====================== - // What to run - //====================== - - // sPHENIX barrel - bool do_bbc = true; - - // whether to simulate the Be section of the beam pipe - Enable::PIPE = false; - // EIC beam pipe extension beyond the Be-section can be turned on with use_forward_pipes = true in G4_Pipe_EIC.C - - Enable::EGEM = false; - Enable::FGEM = false; - Enable::FST = true; - Enable::BARREL = true; //barrel tracker - Enable::MVTX = false; - Enable::TPC = false; - Enable::TRACKING = true; - bool do_tracking_cell = Enable::TRACKING && true; - bool do_tracking_track = do_tracking_cell && true; - bool do_tracking_eval = do_tracking_track && true; - bool do_vertex_finding = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - - Enable::CEMC = false; - bool do_cemc_cell = Enable::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; - - Enable::HCALIN = false; - bool do_hcalin_cell = Enable::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; - - Enable::MAGNET = true; - - Enable::HCALOUT = false; - bool do_hcalout_cell = Enable::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 - Enable::DIRC = false; - - // EICDetector geometry - 'hadron' direction - Enable::RICH = false; - Enable::AEROGEL = false; - - Enable::FEMC = false; - bool do_FEMC_cell = Enable::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; - - Enable::FHCAL = false; - bool do_FHCAL_cell = Enable::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 - Enable::EEMC = false; - bool do_EEMC_cell = Enable::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; - - Enable::PLUGDOOR = false; - - // Other options - bool do_global = true; - bool do_global_fastsim = true; - - bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - // Select only one jet reconstruction- they currently use the same - // output collections on the node tree! - bool do_jet_reco = false; - bool do_jet_eval = do_jet_reco && true; - - bool do_fwd_jet_reco = false; - 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; - - // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = true; - - //--------------- - // Load libraries - //--------------- - - // establish the geometry and reconstruction setup - G4Init(); - - int absorberactive = 0; // set to 1 to make all absorbers active volumes - // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field. Reverse field sign to get around a bug in RAVE - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(01); // 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) - { - // action is performed in later stage at the input manager level - } - 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); - } - else if (runpythia8) - { - PHPythia8 *pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - } - else if (runpythia6) - { - PHPythia6 *pythia6 = new PHPythia6(); - // see coresoftware/generators/PHPythia6 for example config - pythia6->set_config_file("phpythia6_ep.cfg"); - se->registerSubsystem(pythia6); - } - /* - 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); - } -*/ - 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 - - 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); - } - - // 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(-3, 3); - gen->set_eta_range(2,2); - gen->set_phi_range(TMath::Pi()/2.0,TMath::Pi()/2.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->set_pt_range(3,3); - 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("mu-"); - pgen->set_z_range(0, 0); - pgen->set_eta_range(-4.0, 0.0); - pgen->set_mom_range(30, 30); - 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); - } - - // 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, EDecayType::kAll, - magfield_rescale); - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (do_tracking_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 (Enable::DSTOUT_COMPRESS) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_tracking_track) Tracking_Reco(0, do_vertex_finding); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - Global_Reco(); - } - - else if (do_global_fastsim) - { - Global_FastSim(); - } - - //----------------- - // Calo Trigger Simulation - //----------------- - - if (do_calotrigger) - { - CaloTrigger_Sim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - Jet_Reco(); - } - - if (do_HIjetreco) - { - HIJetReco(); - } - - if (do_fwd_jet_reco) - { - Jet_FwdReco(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - if (do_tracking_eval) Tracking_Eval(string(outputFile) + "_g4tracking_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 - G4DSTreader_EICDetector(outputFile, // - /*int*/ absorberactive, - /*bool*/ Enable::TRACKING, - /*bool*/ Enable::CEMC, - /*bool*/ Enable::HCALIN, - /*bool*/ Enable::MAGNET, - /*bool*/ Enable::HCALOUT, - /*bool*/ do_cemc_twr, - /*bool*/ do_hcalin_twr, - /*bool*/ do_hcalout_twr, - /*bool*/ Enable::FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ Enable::FEMC, - /*bool*/ do_FEMC_twr, - /*bool*/ Enable::EEMC, - /*bool*/ do_EEMC_twr); - } - - if(Enable::DSTOUT) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (Enable::DSTOUT_COMPRESS) DstCompress(out); - se->registerOutputManager(out); - } - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return 0; - } - // 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 0; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 0; -} - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunFFALoadTest() {} diff --git a/macros/g4simulation/G4_GEM_EIC.C b/macros/g4simulation/G4_GEM_EIC.C deleted file mode 100644 index 19bd1cd72..000000000 --- a/macros/g4simulation/G4_GEM_EIC.C +++ /dev/null @@ -1,218 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" -#include -#include -#include -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); -void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); - -namespace Enable -{ - bool EGEM = false; - bool FGEM = false; -} // namespace Enable - -void EGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); - // extends only to -z - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -160.); -} - -void FGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); -} - -void EGEMSetup(PHG4Reco *g4Reco) -{ - /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be - * drawn in event display but will NOT register any hits. - * - * Geometric constraints: - * TPC length = 211 cm --> from z = -105.5 to z = +105.5 - */ - float thickness = 3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); -} - -void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // - const double min_eta = 1.245 // -) -{ - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - etamax = 2; - etamin = min_eta; - zpos = 134.0; - - gem = new PHG4SectorSubsystem(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(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(Enable::OVERLAPCHECK); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_3"; - etamax = 2; - etamin = min_eta; - zpos = 157.0; - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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(etamax)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - 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(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(Enable::OVERLAPCHECK); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_4"; - etamax = 3.5; - etamin = min_eta; - zpos = 271.0; - gem = new PHG4SectorSubsystem(name); - - 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(Enable::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(Enable::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 = 0.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++) - { - ostringstream 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); - - 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(Enable::OVERLAPCHECK); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - return 0; -} diff --git a/macros/g4simulation/G4_Tracking_EIC.C b/macros/g4simulation/G4_Tracking_EIC.C deleted file mode 100644 index 6161bc4ce..000000000 --- a/macros/g4simulation/G4_Tracking_EIC.C +++ /dev/null @@ -1,197 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_CEmc_EIC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_GEM_EIC.C" -#include "G4_Mvtx_EIC.C" -#include "G4_TPC_EIC.C" - -#include - -#include - -#include - -#include - -#include - -class SubsysReco; -R__LOAD_LIBRARY(libtrack_reco.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) - -namespace Enable -{ - bool TRACKING = false; -} -//-----------------------------------------------------------------------------// -void TrackingInit() {} -//-----------------------------------------------------------------------------// -void Tracking_Reco(int verbosity = 0, bool displaced_vertex = false) -{ - int i; - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - // kalman->Verbosity(); - // kalman->Smearing(false); - if (displaced_vertex) - { - //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(1); - kalman->set_vertex_z_resolution(1); - kalman->enable_vertexing(true); - } - else - { - // constraint to a primary vertex and use it as part of the fitting level arm - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50e-4); - kalman->set_vertex_z_resolution(50e-4); - } - - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); - - //------------------------- - // Barrel - //------------------------- - if (Enable::BARREL) { - kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise - } - //------------------------- - // MVTX - //------------------------- - if (Enable::MVTX) - { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // TPC - //------------------------- - if (Enable::TPC) - { - kalman->add_phg4hits( - "G4HIT_SVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // EGEM - //------------------------- - if (Enable::EGEM) - { - // GEM, 70um azimuthal resolution, 1cm radial strips - for (i=0;i<4;i++) { - kalman->add_phg4hits( - Form("G4HIT_EGEM_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - } - //------------------------- - // FGEM - //------------------------- - if (Enable::FGEM) - { - // GEM2, 70um azimuthal resolution, 1cm radial strips - for (i=2;i<5;i++) { - kalman->add_phg4hits(Form("G4HIT_FGEM_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FST - //------------------------- - if (Enable::FST) { - for (i=0;i<5;i++) { - kalman->add_phg4hits(Form("G4HIT_FST_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FEMC - //------------------------- - // Saved track states (projections) - if (Enable::FEMC) - { - // kalman->add_state_name("FEMC"); - } - //------------------------- - // FHCAL - //------------------------- - if (Enable::FHCAL) - { - // kalman->add_state_name("FHCAL"); - } - //------------------------- - // CEMC - //------------------------- - if (Enable::CEMC) - { - // kalman->add_state_name("CEMC"); - } - se->registerSubsystem(kalman); - - return; -} -//-----------------------------------------------------------------------------// -void Tracking_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // Fast Tracking evaluation - //---------------- - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_filename(outputfile.c_str()); - se->registerSubsystem(fast_sim_eval); -} From 5b23585fab01b7fa256a7846d24315f4407aace5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 23 Jun 2020 11:24:06 -0400 Subject: [PATCH 0738/1222] make PHTpcTracker include dir lower case --- macros/g4simulations/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 81891175e..84e74bc26 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -45,7 +45,8 @@ #include -#include +#include + R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libg4mvtx.so) From 36dad80597f044eff57b95d1948296c9141f1a54 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 29 Jun 2020 13:27:24 -0400 Subject: [PATCH 0739/1222] updated g4tracking with acts --- macros/g4simulations/G4_Tracking.C | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 84e74bc26..f35b75e47 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -42,6 +42,11 @@ #include #include #include +#include +#include +#include +#include +#include #include @@ -523,6 +528,11 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); + + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + se->registerSubsystem(sl); + //------------- // Tracking //------------ @@ -603,6 +613,27 @@ void Tracking_Reco(int verbosity = 0) // Fitting of tracks using Kalman Filter //------------------------------------------------ + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + /// Always run PHActsTracks first to take the SvtxTrack and convert it + /// to a form that Acts can process + + /// If you run PHActsTrkProp, disable PHGenFitTrkProp + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->setTimeAnalysis(true); + se->registerSubsystem(actsFit); + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); kalman->Verbosity(0); @@ -613,14 +644,14 @@ void Tracking_Reco(int verbosity = 0) kalman->set_vertexing_method(vmethod); kalman->set_use_truth_vertex(false); - se->registerSubsystem(kalman); + //se->registerSubsystem(kalman); //------------------ // Track Projections //------------------ PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); - se->registerSubsystem(projection); + //se->registerSubsystem(projection); return; } @@ -659,6 +690,11 @@ void Tracking_Reco(int verbosity = 0) eval->Verbosity(0); se->registerSubsystem(eval); + + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + se->registerSubsystem(actsEval); + if (use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From 86b077acb3cdf811519592d6f6df5d4419a90749 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Jun 2020 16:28:56 -0400 Subject: [PATCH 0740/1222] use same VERBOSITY for all input managers --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 2 +- macros/g4simulations/G4_Input.C | 7 ++++--- macros/g4simulations/GlobalVariables.C | 1 - 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 1c7a41a74..babf2d793 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -100,7 +100,7 @@ int Fun4All_G4_EICDetector( // HepMC2 files // Input::HEPMC = true; - Input::HEPMC_VERBOSITY = 1; + Input::VERBOSITY = 1; INPUTHEPMC::filename = inputFile; //----------------- diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 4a9e18d62..541d0a157 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -91,7 +91,7 @@ INPUTSIMPLE::set_vtx_width(0.,0.,5.); //INPUTGUN::set_vtx(0,0,0); // Input::HEPMC = true; - Input::HEPMC_VERBOSITY = 0; + Input::VERBOSITY = 0; INPUTHEPMC::filename = inputFile; //----------------- diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index c058df60e..65b00f26c 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -36,6 +36,7 @@ namespace Input bool PYTHIA6 = false; bool PYTHIA8 = false; bool SARTRE = false; + int VERBOSITY = 0; } // namespace Input namespace INPUTHEPMC @@ -159,7 +160,7 @@ void InputManagers() if (Input::HEPMC) { Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); - in->Verbosity(Input::HEPMC_VERBOSITY); + in->Verbosity(Input::VERBOSITY); se->registerInputManager(in); se->fileopen(in->Name(), INPUTHEPMC::filename); } @@ -167,13 +168,13 @@ void InputManagers() { Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); hitsin->fileopen(INPUTREADHITS::filename); - hitsin->Verbosity(1); + hitsin->Verbosity(Input::VERBOSITY); se->registerInputManager(hitsin); } else { Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); - in->Verbosity(1); + in->Verbosity(Input::VERBOSITY); se->registerInputManager(in); } } diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C index 455771483..b10fd6436 100644 --- a/macros/g4simulations/GlobalVariables.C +++ b/macros/g4simulations/GlobalVariables.C @@ -11,7 +11,6 @@ static double no_overlapp = 0.0001; // added to radii to avoid overlapping volu namespace Input { bool HEPMC = false; - int HEPMC_VERBOSITY = 0; bool EMBED = false; bool READEIC = false; } From 08071ab85f721dc65bae6fdd0f31dc3847091e58 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Jun 2020 16:33:08 -0400 Subject: [PATCH 0741/1222] clang-format --- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C index 541d0a157..ed85ad8be 100644 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_fsPHENIX.C @@ -75,11 +75,11 @@ int Fun4All_G4_fsPHENIX( INPUTSIMPLE::AddParticle("pi-", 5); // INPUTSIMPLE::AddParticle("e-",0); // INPUTSIMPLE::AddParticle("pi-",10); -INPUTSIMPLE::set_eta_range(-1,3); -INPUTSIMPLE::set_phi_range(-M_PI,M_PI); -INPUTSIMPLE::set_pt_range(0.5,50.); -INPUTSIMPLE::set_vtx_mean(0.,0.,0.); -INPUTSIMPLE::set_vtx_width(0.,0.,5.); + INPUTSIMPLE::set_eta_range(-1, 3); + INPUTSIMPLE::set_phi_range(-M_PI, M_PI); + INPUTSIMPLE::set_pt_range(0.5, 50.); + INPUTSIMPLE::set_vtx_mean(0., 0., 0.); + INPUTSIMPLE::set_vtx_width(0., 0., 5.); // Input::PYTHIA6 = true; From 5207c5def676bb929b13e6d090894da970a67ae6 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 9 Jul 2020 14:48:22 -0400 Subject: [PATCH 0742/1222] update vertex parameter in track reco module --- macros/g4simulations/G4_Tracking_EIC.C | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index adebe691e..5d63476b4 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -58,11 +58,13 @@ void Tracking_Reco() // kalman->Smearing(false); if (G4TRACKING::DISPLACED_VERTEX) { - //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(1); - kalman->set_vertex_z_resolution(1); - kalman->enable_vertexing(true); + // do not use truth vertex in the track fitting, + // which would lead to worse momentum resolution for prompt tracks + // but this allows displaced track analysis including DCA and vertex finding + kalman->set_use_vertex_in_fitting(false); + kalman->set_vertex_xy_resolution(0);// do not smear the vertex used in the built-in DCA calculation + kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation + kalman->enable_vertexing(true); // enable vertex finding and fitting } else { From 3d66c6eff09ee6c1d9c728a7a50345e5add8a671 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 9 Jul 2020 14:51:16 -0400 Subject: [PATCH 0743/1222] silent verbosity and use random seed per job --- macros/g4simulations/Fun4All_G4_EICDetector.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index babf2d793..9be9fbe93 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -39,7 +39,7 @@ int Fun4All_G4_EICDetector( // PHRandomSeed() which reads /dev/urandom to get its seed // if the RANDOMSEED flag is set its value is taken as initial seed // which will produce identical results so you can debug your code - rc->set_IntFlag("RANDOMSEED", 12345); + // rc->set_IntFlag("RANDOMSEED", 12345); //=============== // Input options @@ -70,7 +70,7 @@ int Fun4All_G4_EICDetector( // Simple multi particle generator in eta/phi/pt ranges Input::SIMPLE = true; - Input::SIMPLE_VERBOSITY = 1; + Input::SIMPLE_VERBOSITY = 0; INPUTSIMPLE::AddParticle("pi-", 5); INPUTSIMPLE::set_eta_range(-3, 3); INPUTSIMPLE::set_phi_range(-M_PI, M_PI); @@ -100,7 +100,7 @@ int Fun4All_G4_EICDetector( // HepMC2 files // Input::HEPMC = true; - Input::VERBOSITY = 1; + Input::VERBOSITY = 0; INPUTHEPMC::filename = inputFile; //----------------- From 9d9f6c060d45d1032de5748945b06bec4f28d26b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 10 Jul 2020 16:30:14 -0400 Subject: [PATCH 0744/1222] preliminary add our subsystem macros --- common/G4_Aerogel.C | 57 ++++ common/G4_Barrel_EIC.C | 93 ++++++ common/G4_Bbc.C | 39 +++ common/G4_BlackHole.C | 97 ++++++ common/G4_CEmc_Albedo.C | 46 +++ common/G4_CEmc_EIC.C | 318 ++++++++++++++++++++ common/G4_CEmc_Spacal.C | 469 ++++++++++++++++++++++++++++++ common/G4_CaloTrigger.C | 34 +++ common/G4_DIRC.C | 106 +++++++ common/G4_DSTReader.C | 157 ++++++++++ common/G4_DSTReader_EICDetector.C | 210 +++++++++++++ common/G4_DSTReader_fsPHENIX.C | 191 ++++++++++++ common/G4_EEMC.C | 170 +++++++++++ common/G4_FEMC.C | 267 +++++++++++++++++ common/G4_FEMC_EIC.C | 270 +++++++++++++++++ common/G4_FGEM_fsPHENIX.C | 354 ++++++++++++++++++++++ common/G4_FHCAL.C | 171 +++++++++++ common/G4_FST_EIC.C | 99 +++++++ common/G4_FwdJets.C | 82 ++++++ common/G4_GEM_EIC.C | 222 ++++++++++++++ common/G4_Global.C | 58 ++++ common/G4_HIJetReco.C | 135 +++++++++ common/G4_HcalIn_ref.C | 302 +++++++++++++++++++ common/G4_HcalOut_ref.C | 228 +++++++++++++++ common/G4_Input.C | 250 ++++++++++++++++ common/G4_Intt.C | 187 ++++++++++++ common/G4_Jets.C | 117 ++++++++ common/G4_Magnet.C | 106 +++++++ common/G4_Micromegas.C | 94 ++++++ common/G4_Mvtx.C | 104 +++++++ common/G4_Mvtx_EIC.C | 89 ++++++ common/G4_PSTOF.C | 38 +++ common/G4_ParticleFlow.C | 47 +++ common/G4_Pipe.C | 141 +++++++++ common/G4_Pipe_EIC.C | 125 ++++++++ common/G4_Piston.C | 126 ++++++++ common/G4_PlugDoor.C | 71 +++++ common/G4_PlugDoor_EIC.C | 59 ++++ common/G4_PlugDoor_fsPHENIX.C | 69 +++++ common/G4_Production.C | 33 +++ common/G4_RICH.C | 64 ++++ common/G4_TPC.C | 151 ++++++++++ common/G4_TPC_EIC.C | 126 ++++++++ common/G4_TopoClusterReco.C | 72 +++++ common/G4_Tracking.C | 229 +++++++++++++++ common/G4_Tracking_EIC.C | 226 ++++++++++++++ common/G4_User.C | 29 ++ common/G4_World.C | 34 +++ common/GlobalVariables.C | 55 ++++ 49 files changed, 6817 insertions(+) create mode 100644 common/G4_Aerogel.C create mode 100644 common/G4_Barrel_EIC.C create mode 100644 common/G4_Bbc.C create mode 100644 common/G4_BlackHole.C create mode 100644 common/G4_CEmc_Albedo.C create mode 100644 common/G4_CEmc_EIC.C create mode 100644 common/G4_CEmc_Spacal.C create mode 100644 common/G4_CaloTrigger.C create mode 100644 common/G4_DIRC.C create mode 100644 common/G4_DSTReader.C create mode 100644 common/G4_DSTReader_EICDetector.C create mode 100644 common/G4_DSTReader_fsPHENIX.C create mode 100644 common/G4_EEMC.C create mode 100644 common/G4_FEMC.C create mode 100644 common/G4_FEMC_EIC.C create mode 100644 common/G4_FGEM_fsPHENIX.C create mode 100644 common/G4_FHCAL.C create mode 100644 common/G4_FST_EIC.C create mode 100644 common/G4_FwdJets.C create mode 100644 common/G4_GEM_EIC.C create mode 100644 common/G4_Global.C create mode 100644 common/G4_HIJetReco.C create mode 100644 common/G4_HcalIn_ref.C create mode 100644 common/G4_HcalOut_ref.C create mode 100644 common/G4_Input.C create mode 100644 common/G4_Intt.C create mode 100644 common/G4_Jets.C create mode 100644 common/G4_Magnet.C create mode 100644 common/G4_Micromegas.C create mode 100644 common/G4_Mvtx.C create mode 100644 common/G4_Mvtx_EIC.C create mode 100644 common/G4_PSTOF.C create mode 100644 common/G4_ParticleFlow.C create mode 100644 common/G4_Pipe.C create mode 100644 common/G4_Pipe_EIC.C create mode 100644 common/G4_Piston.C create mode 100644 common/G4_PlugDoor.C create mode 100644 common/G4_PlugDoor_EIC.C create mode 100644 common/G4_PlugDoor_fsPHENIX.C create mode 100644 common/G4_Production.C create mode 100644 common/G4_RICH.C create mode 100644 common/G4_TPC.C create mode 100644 common/G4_TPC_EIC.C create mode 100644 common/G4_TopoClusterReco.C create mode 100644 common/G4_Tracking.C create mode 100644 common/G4_Tracking_EIC.C create mode 100644 common/G4_User.C create mode 100644 common/G4_World.C create mode 100644 common/GlobalVariables.C diff --git a/common/G4_Aerogel.C b/common/G4_Aerogel.C new file mode 100644 index 000000000..cdde4cbf8 --- /dev/null +++ b/common/G4_Aerogel.C @@ -0,0 +1,57 @@ +#ifndef MACRO_G4AEROGEL_C +#define MACRO_G4AEROGEL_C + +#include "GlobalVariables.C" + +#include + +#include + +/*! + * \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 $ + */ + +namespace Enable +{ + bool AEROGEL = false; + bool AEROGEL_OVERLAPCHECK = false; +} // namespace Enable + +void AerogelInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 164.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 287.); +} + +void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // + const double min_eta = 1.242) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::AEROGEL_OVERLAPCHECK; + + PHG4SectorSubsystem* 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.85)); + 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 = 18.; // 10.; + + ag->get_geometry().AddLayers_AeroGel_ePHENIX(radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), + expansion_length * PHG4Sector::Sector_Geometry::Unit_cm()); + g4Reco->registerSubsystem(ag); +} +#endif diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C new file mode 100644 index 000000000..75c96f0f7 --- /dev/null +++ b/common/G4_Barrel_EIC.C @@ -0,0 +1,93 @@ +#ifndef MACRO_G4BARRELEIC_C +#define MACRO_G4BARRELEIC_C + +#include "GlobalVariables.C" + +#include + +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) +//---------------------------------------------------------------------// +namespace Enable +{ + bool BARREL = false; + bool BARREL_ABSORBER = false; +} // namespace Enable +//---------------------------------------------------------------------// +void BarrelInit() +{ +} +//---------------------------------------------------------------------// +double Barrel(PHG4Reco* g4Reco, double radius) +{ + const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; + + //--------------------------------- + //build barrel detector + //--------------------------------- + const int nLayer = 5; + const int nSubLayer = 7; + const float um = 0.0001; //convert um to cm + + double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm + double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm + + string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", + "Support1", "Support_Gap", "Support2"}; + string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", + "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; + double thickness[nSubLayer] = {285 * um, 15 * um, 20 * um, 100 * um, + 50 * um, 1, 50 * um}; + + int k = 0; //layer id. Must be unique. + double max_bh_radius = 0.; + PHG4CylinderSubsystem* cyl; + for (int i = 0; i < nLayer; i++) + { + //if (i>2) continue; + for (int j = 0; j < nSubLayer; j++) + { + cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); + if (j == 0) + { + cyl->set_double_param("radius", r[i]); + } + else + { + cyl->set_double_param("radius", r[i] + thickness[j - 1]); + } + cyl->set_double_param("length", 2.0 * halfLength[i]); + cyl->set_string_param("material", material[j]); + cyl->set_double_param("thickness", thickness[j]); + max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); + cyl->SuperDetector("BARREL"); + if (j == 0) + { + cyl->SetActive(); //only the Silicon Sensor is active + } + else + { + if (AbsorberActive) cyl->SetActive(); + } + g4Reco->registerSubsystem(cyl); + k++; + } + } + + // update now that we know the outer radius + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); + return max_bh_radius; +} +//---------------------------------------------------------------------// +#endif diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C new file mode 100644 index 000000000..ffdcc5cbf --- /dev/null +++ b/common/G4_Bbc.C @@ -0,0 +1,39 @@ +#ifndef MACRO_G4BBC_C +#define MACRO_G4BBC_C + +#include + +#include + +R__LOAD_LIBRARY(libg4bbc.so) + +namespace Enable +{ + bool BBC = false; +} + +namespace G4BBC +{ + double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC + double t_smearing = 0.002; // 20ps timing resolution +} + +void BbcInit() {} + +void Bbc_Reco(int verbosity = 0) { + + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); + bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing + bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps + se->registerSubsystem(bbcvertex); + + return; +} +#endif diff --git a/common/G4_BlackHole.C b/common/G4_BlackHole.C new file mode 100644 index 000000000..b6cfca88b --- /dev/null +++ b/common/G4_BlackHole.C @@ -0,0 +1,97 @@ +#ifndef MACRO_G4BLACKHOLE_C +#define MACRO_G4BLACKHOLE_C + +#include "GlobalVariables.C" + +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool BLACKHOLE = false; + bool BLACKHOLE_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) + { + 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) + { + 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..3d5b3ab91 --- /dev/null +++ b/common/G4_CEmc_Albedo.C @@ -0,0 +1,46 @@ +#ifndef MACRO_G4CEMCALBEDO_C +#define MACRO_G4CEMCALBEDO_C + +#include "GlobalVariables.C" + +#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_EIC.C b/common/G4_CEmc_EIC.C new file mode 100644 index 000000000..b5e7aeb3e --- /dev/null +++ b/common/G4_CEmc_EIC.C @@ -0,0 +1,318 @@ +#ifndef MACRO_G4CEMCEIC_C +#define MACRO_G4CEMCEIC_C + +#include "GlobalVariables.C" + +#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 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; + int CEMC_VERBOSITY = 0; +} + +namespace G4CEMC +{ + double cemcdepth = 9; + // tungs to scint width ratio of ~10:1 + // corresponds to approx 2% sampling fraction + + // 18 radiation lengths for 40 layers + double scint_width = 0.05; + double tungs_width = 0.245; + double electronics_width = 0.5; + + int min_cemc_layer = 1; + int max_cemc_layer = 41; + + double topradius = 106.8; // cm + double bottomradius = 95; // cm + double negrapidity = -1.5; + double posrapidity = 1.24; + // this is default set to -1.5 95) + { + cout << "inconsistency, radius: " << radius + << " larger than allowed inner radius for CEMC = 95 cm" << endl; + gSystem->Exit(-1); + } + + radius = 95; + + PHG4CylinderSubsystem *cemc; + + // determine the length of the calorimeter + // can adjust length coverage by just adjusting these values + // rapidity coverage will be determined by z shift of EMCAl + // as indicated in the loop below + + // eta = -ln(tan(theta/2)) + double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::posrapidity)); + double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::negrapidity)); + // get the angle between the beam pipe and negative pseudorapidity axis + theta2 = M_PI - theta2; + + double z1 = G4CEMC::topradius / TMath::Tan(theta1); + double z2 = G4CEMC::topradius / TMath::Tan(theta2); + + double z3 = G4CEMC::bottomradius / TMath::Tan(theta1); + double z4 = G4CEMC::bottomradius / TMath::Tan(theta2); + + // this is the top layer length + double totaltoplength = z1 + z2; + // this is the bottom layer length + double totalbottomlength = z3 + z4; + + //Added by Barak, 12/12/19 + double ztemp = 0; + double layer_shift = 0; + + double height = 0; + for (int thislayer = G4CEMC::min_cemc_layer; thislayer <= G4CEMC::max_cemc_layer; + thislayer++) + { + // the length for a particular layer is determined from the bottom length + double thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); + + cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); + cemc->set_double_param("radius", radius); + cemc->set_string_param("material", "Spacal_W_Epoxy"); + cemc->set_double_param("thickness", G4CEMC::tungs_width); + cemc->set_double_param("length", thislength); + cemc->set_int_param("lengthviarapidity", 0); + + // starts centered around IP + // shift backwards 30 cm for total 370 cm length to cover -1.5set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + ztemp = radius / TMath::Tan(theta2); + layer_shift = -1. * (ztemp - (thislength / 2.)); + cemc->set_double_param("place_z", layer_shift); + + cemc->SuperDetector("ABSORBER_CEMC"); + if (AbsorberActive) cemc->SetActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + radius += G4CEMC::tungs_width; + radius += no_overlapp; + + height += G4CEMC::tungs_width; + height += no_overlapp; //Added by Barak, 12/13/19 + + //Added by Barak, 12/13/19 + thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); + + cemc = new PHG4CylinderSubsystem("CEMC", thislayer); + cemc->set_double_param("radius", radius); + cemc->set_string_param("material", "PMMA"); + cemc->set_double_param("thickness", G4CEMC::scint_width); + cemc->set_int_param("lightyield", 1); + cemc->set_int_param("lengthviarapidity", 0); + cemc->set_double_param("length", thislength); + + // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + cemc->set_double_param("place_z", layer_shift); + + cemc->SuperDetector("CEMC"); + + cemc->SetActive(); + cemc->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cemc); + + radius += G4CEMC::scint_width; + radius += no_overlapp; + + height += G4CEMC::scint_width; + height += no_overlapp; //Added by Barak, 12/13/19 + } + + PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cemc_cyl->set_double_param("radius", radius); + cemc_cyl->set_string_param("material", "G4_TEFLON"); + cemc_cyl->set_double_param("thickness", G4CEMC::electronics_width); + + double l1 = (radius + 0.5) / TMath::Tan(theta1); + double l2 = (radius + 0.5) / TMath::Tan(theta2); + cemc_cyl->set_int_param("lengthviarapidity", 0); + cemc_cyl->set_double_param("length", l1 + l2); + // shift back -30 cm to cover -1.4set_double_param("place_z", -30); + + //Modified by Barak, 12/12/19 + layer_shift = -1. * ((l2 - l1) / 2.); + cemc_cyl->set_double_param("place_z", layer_shift); + + if (AbsorberActive) cemc_cyl->SetActive(); + cemc_cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cemc_cyl); + // update black hole settings since we have the values here + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + G4CEMC::electronics_width); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2) / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift - (l1 + l2) / 2.); + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + double radius = 95; + for (int i = G4CEMC::min_cemc_layer; i <= G4CEMC::max_cemc_layer; i++) + { + //Added by Barak, 12/13/19 + radius += (G4CEMC::tungs_width + no_overlapp); + if (i > 1) radius += (G4CEMC::scint_width + no_overlapp); + + cemc_cells->cellsize(i, 2. * M_PI / 256. * radius, 2. * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + CemcTowerBuilder->Detector("CEMC"); + CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); + CemcTowerBuilder->Verbosity(verbosity); + se->registerSubsystem(CemcTowerBuilder); + + const double photoelectron_per_GeV = 500; // 500 photon per total GeV deposition + // just set a 4% sampling fraction - already tuned by tungs/scint width ratio + double sampling_fraction = 4e-02; + RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + CemcTowerDigitizer->Detector("CEMC"); + CemcTowerDigitizer->Verbosity(verbosity); + CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); + CemcTowerDigitizer->set_pedstal_central_ADC(0); + CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error + CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + se->registerSubsystem(CemcTowerDigitizer); + + RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + CemcTowerCalibration->Detector("CEMC"); + CemcTowerCalibration->Verbosity(verbosity); + CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); + CemcTowerCalibration->set_pedstal_ADC(0); + + se->registerSubsystem(CemcTowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + cemc_clusterbuilder->Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + + cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + cemc_clusterbuilder->LoadProfile(femc_prof); + se->registerSubsystem(cemc_clusterbuilder); + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + cemc_clusterbuilder->Detector("CEMC"); + cemc_clusterbuilder->Verbosity(verbosity); + se->registerSubsystem(cemc_clusterbuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; + exit(1); + } + 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.c_str()); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + return; +} +#endif diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C new file mode 100644 index 000000000..2cd2c9661 --- /dev/null +++ b/common/G4_CEmc_Spacal.C @@ -0,0 +1,469 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include "GlobalVariables.C" + +#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) + +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; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + 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; + + 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; + + 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_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 * TMath::Pi() / 256. * radius, 2 * TMath::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 + + 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 (G4CEMC::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 (G4CEMC::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 + { + cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + 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; +} +#endif diff --git a/common/G4_CaloTrigger.C b/common/G4_CaloTrigger.C new file mode 100644 index 000000000..c22613ccc --- /dev/null +++ b/common/G4_CaloTrigger.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4CALOTRIGGER_C +#define MACRO_G4CALOTRIGGER_C + +#include "GlobalVariables.C" + +#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_DIRC.C b/common/G4_DIRC.C new file mode 100644 index 000000000..4ab87fe64 --- /dev/null +++ b/common/G4_DIRC.C @@ -0,0 +1,106 @@ +#ifndef MACRO_G4DIRC_C +#define MACRO_G4DIRC_C + +#include "GlobalVariables.C" + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +/*! + * \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 $ + */ + +namespace Enable +{ + bool DIRC = false; + bool DIRC_OVERLAPCHECK = false; +} // namespace Enable + +namespace G4DIRC +{ + double radiator_R = 83.65; + double length = 400; + double z_shift = -75; //115 + double z_start = z_shift + length / 2.; + double z_end = z_shift - length / 2.; + double outer_skin_radius = 89.25; +} // namespace G4DIRC + +void DIRCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4DIRC::outer_skin_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4DIRC::z_start); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4DIRC::z_end); +} + +//! 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) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::DIRC_OVERLAPCHECK; + + PHG4SectorSubsystem *dirc; + dirc = new PHG4SectorSubsystem("DIRC"); + dirc->get_geometry().set_normal_polar_angle(M_PI / 2); + dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); + dirc->get_geometry().set_min_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::z_start)); + dirc->get_geometry().set_max_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::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_double_param("length", G4DIRC::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", G4DIRC::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", G4DIRC::outer_skin_radius - 0.076); + cyl->set_double_param("length", G4DIRC::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", G4DIRC::z_shift); + cyl->SetActive(0); + cyl->SuperDetector("DIRC"); + cyl->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cyl); + + // Done + return G4DIRC::outer_skin_radius; +} +#endif diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C new file mode 100644 index 000000000..81e7c56b5 --- /dev/null +++ b/common/G4_DSTReader.C @@ -0,0 +1,157 @@ +#ifndef MACRO_G4DSTREADER_C +#define MACRO_G4DSTREADER_C + +#include "GlobalVariables.C" + +#include "G4_BlackHole.C" +#include "G4_CEmc_Spacal.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Intt.C" +#include "G4_Magnet.C" +#include "G4_Mvtx.C" +#include "G4_TPC.C" + +#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::PSTOF) + { + ana->AddNode("PSTOF_0"); + } + + 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::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_DSTReader_EICDetector.C b/common/G4_DSTReader_EICDetector.C new file mode 100644 index 000000000..3bbe926f3 --- /dev/null +++ b/common/G4_DSTReader_EICDetector.C @@ -0,0 +1,210 @@ +#ifndef MACRO_G4DSTREADEREICDETECTOR_C +#define MACRO_G4DSTREADEREICDETECTOR_C + +#include "GlobalVariables.C" + +#include "G4_Barrel_EIC.C" +#include "G4_CEmc_EIC.C" +#include "G4_EEMC.C" +#include "G4_FEMC_EIC.C" +#include "G4_FHCAL.C" +#include "G4_FST_EIC.C" +#include "G4_GEM_EIC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_Mvtx_EIC.C" +#include "G4_TPC_EIC.C" + +#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 G4DSTreader_EICDetectorInit() {} +void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") +{ + //! debug output on screen? + 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::BARREL) + { + ana->AddNode("BARREL"); + } + if (Enable::MVTX) + { + ana->AddNode("MVTX"); + } + if (Enable::TPC) + { + ana->AddNode("TPC"); + } + + if (Enable::EGEM) + { + ana->AddNode("EGEM_0"); + ana->AddNode("EGEM_1"); + ana->AddNode("EGEM_2"); + ana->AddNode("EGEM_3"); + } + if (Enable::FGEM) + { + ana->AddNode("FGEM_2"); + ana->AddNode("FGEM_3"); + ana->AddNode("FGEM_4"); + } + if (Enable::FST) + { + ana->AddNode("FST_0"); + ana->AddNode("FST_1"); + ana->AddNode("FST_2"); + ana->AddNode("FST_3"); + ana->AddNode("FST_4"); + ana->AddNode("FST_5"); + } + } + + 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::FHCAL) + { + ana->AddNode("FHCAL"); + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) + ana->AddNode("ABSORBER_FHCAL"); + } + + if (Enable::FEMC) + { + ana->AddNode("FEMC"); + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) + ana->AddNode("ABSORBER_FEMC"); + } + + if (Enable::EEMC) + { + ana->AddNode("EEMC"); + } + + 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"); + } + if (Enable::FHCAL_TOWER) + { + ana->AddTower("SIM_FHCAL"); + ana->AddTower("RAW_FHCAL"); + ana->AddTower("CALIB_FHCAL"); + } + if (Enable::FEMC_TOWER) + { + ana->AddTower("SIM_FEMC"); + ana->AddTower("RAW_FEMC"); + ana->AddTower("CALIB_FEMC"); + } + if (Enable::FEMC_TOWER) + { + 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); +} +#endif diff --git a/common/G4_DSTReader_fsPHENIX.C b/common/G4_DSTReader_fsPHENIX.C new file mode 100644 index 000000000..35fb7c546 --- /dev/null +++ b/common/G4_DSTReader_fsPHENIX.C @@ -0,0 +1,191 @@ +#ifndef MACRO_G4DSTREADERFSPHENIX_C +#define MACRO_G4DSTREADERFSPHENIX_C + +#include "GlobalVariables.C" + +#include "G4_Intt.C" +#include "G4_Mvtx.C" +#include "G4_TPC.C" +#include "G4_CEmc_Spacal.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_FHCAL.C" +#include "G4_FEMC.C" +#include "G4_FGEM_fsPHENIX.C" + + +#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 G4DSTREADER +{ + bool save_g4_raw = true; + double tower_zero_supp = 1.e-6; +} + + + + +void G4DSTreader_fsPHENIXInit() {} + +void +G4DSTreader_fsPHENIX( const string &outputFile = "G4sPHENIXCells.root") +{ + + //! debug output on screen? + 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::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::FHCAL) + { + ana->AddNode("FHCAL"); + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) + ana->AddNode("ABSORBER_FHCAL"); + } + + if (Enable::FEMC) + { + ana->AddNode("FEMC"); + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) + ana->AddNode("ABSORBER_FEMC"); + } + + if (Enable::FGEM) + { + ana->AddNode("FGEM_0"); + ana->AddNode("FGEM_1"); + ana->AddNode("FGEM_2"); + ana->AddNode("FGEM_3"); + ana->AddNode("FGEM_4"); + } + 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"); + } + if (Enable::FHCAL_TOWER) + { + ana->AddTower("SIM_FHCAL"); + ana->AddTower("RAW_FHCAL"); + ana->AddTower("CALIB_FHCAL"); + } + if (Enable::FEMC_TOWER) + { + ana->AddTower("SIM_FEMC"); + ana->AddTower("RAW_FEMC"); + ana->AddTower("CALIB_FEMC"); + } + + // Jets disabled for now +// if (Enable::JETS) +// { +// +// 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_EEMC.C b/common/G4_EEMC.C new file mode 100644 index 000000000..13880bd70 --- /dev/null +++ b/common/G4_EEMC.C @@ -0,0 +1,170 @@ +#ifndef MACRO_G4EEMC_C +#define MACRO_G4EEMC_C + +#include "GlobalVariables.C" + +#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 EEMC = false; + bool EEMC_CELL = false; + bool EEMC_TOWER = false; + bool EEMC_CLUSTER = false; + bool EEMC_EVAL = false; + bool EEMC_OVERLAPCHECK = false; + int EEMC_VERBOSITY = 0; +} + +namespace G4EEMC +{ + int use_projective_geometry = 0; + double Gdz = 18. + 0.0001; + double Gz0 = -170.; +} // namespace G4EEMC + +void EEMCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); +} + +void EEMCSetup(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::EEMC_OVERLAPCHECK; + + /** Use dedicated EEMC module */ + PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); + + /* path to central copy of calibrations repositry */ + ostringstream mapping_eemc; + + /* Use non-projective geometry */ + if (!G4EEMC::use_projective_geometry) + { + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; + eemc->SetTowerMappingFile(mapping_eemc.str()); + } + + /* use projective geometry */ + else + { + ostringstream mapping_eemc_4x4construct; + + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; + mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; + eemc->SetProjectiveGeometry(mapping_eemc.str(), mapping_eemc_4x4construct.str()); + } + + eemc->OverlapCheck(OverlapCheck); + + // SetAbsorberActive method not implemented + // if (AbsorberActive) eemc->SetAbsorberActive(); + + /* register Ecal module */ + g4Reco->registerSubsystem(eemc); +} + +void EEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); + hc->Detector("EEMC"); + se->registerSubsystem(hc); + + return; +} + +void EEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + ostringstream mapping_eemc; + mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.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 = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + + return; +} + +void EEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str()); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C new file mode 100644 index 000000000..99193374a --- /dev/null +++ b/common/G4_FEMC.C @@ -0,0 +1,267 @@ +#ifndef MACRO_G4FEMC_C +#define MACRO_G4FEMC_C + +#include "GlobalVariables.C" + +#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 FEMC = false; + bool FEMC_ABSORBER = false; + bool FEMC_CELL = false; + bool FEMC_TOWER = false; + bool FEMC_CLUSTER = false; + bool FEMC_EVAL = false; + bool FEMC_OVERLAPCHECK = false; + int FEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4FEMC +{ + // from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt + double Gz0 = 305.; + double Gdz = 40.; + double outer_radius = 180.; + string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + enum enu_Femc_clusterizer + { + kFemcGraphClusterizer, + kFemcTemplateClusterizer + }; + + //template clusterizer, as developed by Sasha Bazilevsky + enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; + // graph clusterizer + //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +} // namespace G4FEMC + +void FEMCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); +} + +void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive>0); + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; + + Fun4AllServer *se = Fun4AllServer::instance(); + + /** Use dedicated FEMC module */ + PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); + + ostringstream mapping_femc; + + // fsPHENIX ECAL + femc->SetfsPHENIXDetector(); + mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; + + // cout << mapping_femc.str() << endl; + femc->SetTowerMappingFile(mapping_femc.str()); + femc->OverlapCheck(OverlapCheck); + femc->SetActive(); + femc->SuperDetector("FEMC"); + if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); + + g4Reco->registerSubsystem(femc); +} + +void FEMC_Cells() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); + hc->Detector("FEMC"); + se->registerSubsystem(hc); + + return; +} + +void FEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + ostringstream mapping_femc; + + // fsPHENIX ECAL + mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; + + 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 ); + + // E864 towers (three types for three sizes) + RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); + TowerDigitizer3->Detector("FEMC"); + TowerDigitizer3->TowerType(3); + TowerDigitizer3->Verbosity(verbosity); + TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer3); + + RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); + TowerDigitizer4->Detector("FEMC"); + TowerDigitizer4->TowerType(4); + TowerDigitizer4->Verbosity(verbosity); + TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer4); + + RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); + TowerDigitizer5->Detector("FEMC"); + TowerDigitizer5->TowerType(5); + TowerDigitizer5->Verbosity(verbosity); + TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer5); + + RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); + TowerDigitizer6->Detector("FEMC"); + TowerDigitizer6->TowerType(6); + TowerDigitizer6->Verbosity(verbosity); + TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer6); + + // 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 ); + + // E864 towers (three types for three sizes) + RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); + TowerCalibration3->Detector("FEMC"); + TowerCalibration3->TowerType(3); + TowerCalibration3->Verbosity(verbosity); + TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration3->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 + TowerCalibration3->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration3); + + RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); + TowerCalibration4->Detector("FEMC"); + TowerCalibration4->TowerType(4); + TowerCalibration4->Verbosity(verbosity); + TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration4->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 + TowerCalibration4->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration4); + + RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); + TowerCalibration5->Detector("FEMC"); + TowerCalibration5->TowerType(5); + TowerCalibration5->Verbosity(verbosity); + TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration5->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 + TowerCalibration5->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration5); + + RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); + TowerCalibration6->Detector("FEMC"); + TowerCalibration6->TowerType(6); + TowerCalibration6->Verbosity(verbosity); + TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration6->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 + TowerCalibration6->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration6); +} + +void FEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(ClusterBuilder); + } + else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); + + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void FEMC_Eval(std::string outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C new file mode 100644 index 000000000..0199172f6 --- /dev/null +++ b/common/G4_FEMC_EIC.C @@ -0,0 +1,270 @@ +#ifndef MACRO_G4FEMCEIC_C +#define MACRO_G4FEMCEIC_C + +#include "GlobalVariables.C" + +#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 FEMC = false; + bool FEMC_ABSORBER = false; + bool FEMC_CELL = false; + bool FEMC_TOWER = false; + bool FEMC_CLUSTER = false; + bool FEMC_EVAL = false; + bool FEMC_OVERLAPCHECK = false; + int FEMC_VERBOSITY = 0; +} + +namespace G4FEMC +{ + // from ForwardEcal/mapping/towerMap_FEMC_v007.txt + const double Gz0 = 310.; + const double Gdz = 36.5; + const double outer_radius = 182.655; + enum enu_Femc_clusterizer + { + kFemcGraphClusterizer, + kFemcTemplateClusterizer + }; + //template clusterizer, as developed by Sasha Bazilevsky + enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; + // graph clusterizer + //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; +} // namespace G4FEMC + +void FEMCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); +} + +void FEMCSetup(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; + + Fun4AllServer *se = Fun4AllServer::instance(); + + /** Use dedicated FEMC module */ + PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); + + ostringstream mapping_femc; + + // femc->SetEICDetector(); + + // fsPHENIX ECAL + // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + + cout << mapping_femc.str() << endl; + femc->SetTowerMappingFile(mapping_femc.str()); + femc->OverlapCheck(OverlapCheck); + femc->SetActive(); + femc->SuperDetector("FEMC"); + if (AbsorberActive) femc->SetAbsorberActive(); + + g4Reco->registerSubsystem(femc); +} + +void FEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); + hc->Detector("FEMC"); + se->registerSubsystem(hc); + + return; +} + +void FEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + ostringstream mapping_femc; + + // // fsPHENIX ECAL + // mapping_femc << getenv("CALIBRATIONROOT") << + // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.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); + + // // E864 towers (three types for three sizes) + // RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); + // TowerDigitizer3->Detector("FEMC"); + // TowerDigitizer3->TowerType(3); + // TowerDigitizer3->Verbosity(verbosity); + // TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer3 ); + // + // RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); + // TowerDigitizer4->Detector("FEMC"); + // TowerDigitizer4->TowerType(4); + // TowerDigitizer4->Verbosity(verbosity); + // TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer4 ); + // + // RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); + // TowerDigitizer5->Detector("FEMC"); + // TowerDigitizer5->TowerType(5); + // TowerDigitizer5->Verbosity(verbosity); + // TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer5 ); + // + // RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); + // TowerDigitizer6->Detector("FEMC"); + // TowerDigitizer6->TowerType(6); + // TowerDigitizer6->Verbosity(verbosity); + // TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + // se->registerSubsystem( TowerDigitizer6 ); + + // 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); + + // // E864 towers (three types for three sizes) + // RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); + // TowerCalibration3->Detector("FEMC"); + // TowerCalibration3->TowerType(3); + // TowerCalibration3->Verbosity(verbosity); + // TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration3->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration3 ); + // + // RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); + // TowerCalibration4->Detector("FEMC"); + // TowerCalibration4->TowerType(4); + // TowerCalibration4->Verbosity(verbosity); + // TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration4->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration4 ); + // + // RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); + // TowerCalibration5->Detector("FEMC"); + // TowerCalibration5->TowerType(5); + // TowerCalibration5->Verbosity(verbosity); + // TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration5->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration5 ); + // + // RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); + // TowerCalibration6->Detector("FEMC"); + // TowerCalibration6->TowerType(6); + // TowerCalibration6->Verbosity(verbosity); + // TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + // TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 + // TowerCalibration6->set_pedstal_ADC(0); + // se->registerSubsystem( TowerCalibration6 ); +} + +void FEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below + std::string femc_prof = getenv("CALIBRATIONROOT"); + femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; + ClusterBuilder->LoadProfile(femc_prof.c_str()); + se->registerSubsystem(ClusterBuilder); + } + else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); + + ClusterBuilder->Detector("FEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.010); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void FEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C new file mode 100644 index 000000000..d3cb8850c --- /dev/null +++ b/common/G4_FGEM_fsPHENIX.C @@ -0,0 +1,354 @@ +#ifndef MACRO_G4FGEMFSPHENIX_C +#define MACRO_G4FGEMFSPHENIX_C + +#include "GlobalVariables.C" + +#include "G4_FEMC.C" +#include "G4_FHCAL.C" + +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4trackfastsim.so) + +int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, + double etamax, const int N_Sector = 8); +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); + +namespace Enable +{ + bool FGEM = false; + bool FGEM_OVERLAPCHECK = false; + bool FGEM_TRACK = false; + bool FGEM_EVAL = false; + int FGEM_VERBOSITY = 0; +} + +void FGEM_Init() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); + TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks +} + +void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // + const double min_eta = 1.45 // +) +{ + const double tilt = .1; + + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; + + 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); + + 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); + + 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); + + 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; + + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; + + 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); + + 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); + return 0; +} + +void FGEM_FastSim_Reco() +{ +int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + kalman->Verbosity(verbosity); + + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50E-4); + kalman->set_vertex_z_resolution(50E-4); + + kalman->set_sub_top_node_name("SVTX"); + kalman->set_trackmap_out_name(TRACKING::TrackNodeName); + + // MAPS in MVTX detector + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM0, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM1, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // TPC + kalman->add_phg4hits( + "G4HIT_TPC", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // GEM2, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_2", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM3, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_3", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + // GEM4, 70um azimuthal resolution, 1cm radial strips + kalman->add_phg4hits( + "G4HIT_FGEM_4", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + + // Saved track states (projections) + + if (Enable::FEMC) + { + kalman->add_state_name("FEMC"); + } + if (Enable::FHCAL) + { + kalman->add_state_name("FHCAL"); + } + se->registerSubsystem(kalman); +} + +void FGEM_FastSim_Eval(const std::string &outputfile) +{ +int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); + fast_sim_eval->set_filename(outputfile); + se->registerSubsystem(fast_sim_eval); + + return; +} +#endif diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C new file mode 100644 index 000000000..8e7f9157d --- /dev/null +++ b/common/G4_FHCAL.C @@ -0,0 +1,171 @@ +#ifndef MACRO_G4FHCAL_C +#define MACRO_G4FHCAL_C + +#include "GlobalVariables.C" + +#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 FHCAL = false; + bool FHCAL_ABSORBER = false; + bool FHCAL_CELL = false; + bool FHCAL_TOWER = false; + bool FHCAL_CLUSTER = false; + bool FHCAL_EVAL = false; + bool FHCAL_OVERLAPCHECK = false; + int FHCAL_VERBOSITY = 0; +} // namespace Enable + +namespace G4FHCAL +{ + // from ForwardHcal/mapping/towerMap_FHCAL_v005.txt + double Gz0 = 400.; + double Gdz = 100.; + double outer_radius = 262.; +} // namespace G4FHCAL + +void FHCALInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); +} + +void FHCALSetup(PHG4Reco *g4Reco) +{ + const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FHCAL_OVERLAPCHECK; + 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_v005.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_Cells(int verbosity = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); + hc->Detector("FHCAL"); + se->registerSubsystem(hc); + + return; +} + +void FHCAL_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + ostringstream mapping_fhcal; + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_v005.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 = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); + 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(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str()); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C new file mode 100644 index 000000000..9436d905e --- /dev/null +++ b/common/G4_FST_EIC.C @@ -0,0 +1,99 @@ +#ifndef MACRO_G4FSTEIC_C +#define MACRO_G4FSTEIC_C + +#include "GlobalVariables.C" + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax); +//-----------------------------------------------------------------------------------// +namespace Enable +{ + bool FST = false; + bool FST_OVERLAPCHECK = false; +} // namespace Enable +//-----------------------------------------------------------------------------------// +void FST_Init() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); +} +//-----------------------------------------------------------------------------------// +void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) +{ + //Design from Xuan Li @LANL + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); + //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); +} +//-----------------------------------------------------------------------------------// +int make_LANL_FST_station(string name, PHG4Reco *g4Reco, + double zpos, double Rmin, double Rmax) +{ + // cout + // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " + // << name << endl; + + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK; + + // always facing the interaction point + double polar_angle = 0; + if (zpos < 0) + { + zpos = -zpos; + polar_angle = M_PI; + } + + double min_polar_angle = atan2(Rmin, zpos); + double max_polar_angle = atan2(Rmax, zpos); + + if (max_polar_angle < min_polar_angle) + { + double t = max_polar_angle; + max_polar_angle = min_polar_angle; + min_polar_angle = t; + } + + PHG4SectorSubsystem *fst; + fst = new PHG4SectorSubsystem(name); + + fst->SuperDetector(name); + + fst->get_geometry().set_normal_polar_angle(polar_angle); + fst->get_geometry().set_normal_start(zpos * PHG4Sector::Sector_Geometry::Unit_cm()); + fst->get_geometry().set_min_polar_angle(min_polar_angle); + fst->get_geometry().set_max_polar_angle(max_polar_angle); + fst->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); + fst->get_geometry().set_N_Sector(1); + fst->get_geometry().set_material("G4_AIR"); + fst->OverlapCheck(OverlapCheck); + + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + // build up layers + + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); + fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); + fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); + fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); + fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); + fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); + + g4Reco->registerSubsystem(fst); + return 0; +} +//-----------------------------------------------------------------------------------// +#endif diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C new file mode 100644 index 000000000..c21f4bcbb --- /dev/null +++ b/common/G4_FwdJets.C @@ -0,0 +1,82 @@ +#ifndef MACRO_G4FWDJETS_C +#define MACRO_G4FWDJETS_C + +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) + +namespace Enable +{ + bool FWDJETS = false; + bool FWDJETS_EVAL = false; + int FWDJETS_VERBOSITY = 0; +} + +void Jet_FwdRecoInit() {} + +void Jet_FwdReco() +{ +int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); + + 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(const std::string &outfilename = "g4fwdjets_eval.root") +{ +int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", + "AntiKt_Tower_r05", + "AntiKt_Truth_r05", + outfilename); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C new file mode 100644 index 000000000..edfbda84b --- /dev/null +++ b/common/G4_GEM_EIC.C @@ -0,0 +1,222 @@ +#ifndef MACRO_G4GEMEIC_C +#define MACRO_G4GEMEIC_C + +#include "GlobalVariables.C" + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); +void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); + +namespace Enable +{ + bool EGEM = false; + bool FGEM = false; +} // namespace Enable + +void EGEM_Init() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); + // extends only to -z + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -160.); +} + +void FGEM_Init() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); +} + +void EGEMSetup(PHG4Reco *g4Reco) +{ + /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be + * drawn in event display but will NOT register any hits. + * + * Geometric constraints: + * TPC length = 211 cm --> from z = -105.5 to z = +105.5 + */ + float thickness = 3.; + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); +} + +void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // + const double min_eta = 1.245 // +) +{ + const double tilt = .1; + + string name; + double etamax; + double etamin; + double zpos; + PHG4SectorSubsystem *gem; + + /////////////////////////////////////////////////////////////////////////// + + name = "FGEM_2"; + etamax = 2; + etamin = min_eta; + zpos = 134.0; + + gem = new PHG4SectorSubsystem(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(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(Enable::OVERLAPCHECK); + AddLayers_MiniTPCDrift(gem); + gem->get_geometry().AddLayers_HBD_GEM(); + g4Reco->registerSubsystem(gem); + + /////////////////////////////////////////////////////////////////////////// + + name = "FGEM_3"; + etamax = 2; + etamin = min_eta; + zpos = 157.0; + + gem = new PHG4SectorSubsystem(name + "_LowerEta"); + gem->SuperDetector(name); + + zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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(etamax)) / 2); + gem->get_geometry().set_normal_start( + zpos * PHG4Sector::Sector_Geometry::Unit_cm(), + PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); + 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(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(Enable::OVERLAPCHECK); + g4Reco->registerSubsystem(gem); + + /////////////////////////////////////////////////////////////////////////// + + name = "FGEM_4"; + etamax = 3.5; + etamin = min_eta; + zpos = 271.0; + gem = new PHG4SectorSubsystem(name); + + 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(Enable::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(Enable::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 = 0.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++) + { + ostringstream 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 = M_PI; + } + if (etamax < etamin) + { + double t = etamax; + etamax = etamin; + etamin = t; + } + + PHG4SectorSubsystem *gem; + gem = new PHG4SectorSubsystem(name); + + 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(Enable::OVERLAPCHECK); + + AddLayers_MiniTPCDrift(gem); + gem->get_geometry().AddLayers_HBD_GEM(); + g4Reco->registerSubsystem(gem); + return 0; +} +#endif 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..89b321ce5 --- /dev/null +++ b/common/G4_HIJetReco.C @@ -0,0 +1,135 @@ +#ifndef MACRO_G4HIJETRECO_C +#define MACRO_G4HIJETRECO_C + +#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..54b229c28 --- /dev/null +++ b/common/G4_HcalIn_ref.C @@ -0,0 +1,302 @@ +//Inner HCal reconstruction macro +#ifndef MACRO_G4HCALINREF_C +#define MACRO_G4HCALINREF_C + +#include "GlobalVariables.C" + +#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) + + 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; + 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; + + 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::ABSORBER || Enable::HCALIN_ABSORBER; + + 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); + 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"); + 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 (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_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 = 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(); + 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; +} +#endif diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C new file mode 100644 index 000000000..857ba4883 --- /dev/null +++ b/common/G4_HcalOut_ref.C @@ -0,0 +1,228 @@ +#ifndef MACRO_G4HCALOUTREF_C +#define MACRO_G4HCALOUTREF_C + +#include "GlobalVariables.C" + +#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 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; + int HCALOUT_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALOUT +{ + double outer_radius = 264.71; + double size_z = 304.91 * 2; + 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); + 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"); + 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 = 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(); + 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; +} +#endif diff --git a/common/G4_Input.C b/common/G4_Input.C new file mode 100644 index 000000000..451d40313 --- /dev/null +++ b/common/G4_Input.C @@ -0,0 +1,250 @@ +#ifndef MACRO_G4INPUT_C +#define MACRO_G4INPUT_C + +#include "GlobalVariables.C" + +#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) + +namespace Input +{ + bool GUN = false; + int GUN_VERBOSITY = 0; + bool READHITS = false; + bool PYTHIA6 = false; + bool PYTHIA8 = false; + bool SARTRE = false; + bool SIMPLE = false; + int SIMPLE_VERBOSITY = 0; + bool UPSILON = false; + int UPSILON_VERBOSITY = 0; + double PILEUPRATE = 0.; + int VERBOSITY = 0; +} // namespace Input + +namespace INPUTHEPMC +{ + string filename; +} + +namespace INPUTREADEIC +{ + string filename; +} + +namespace INPUTREADHITS +{ + string filename; +} + +namespace INPUTEMBED +{ + string filename; +} + +namespace PYTHIA6 +{ + string config_file = "phpythia6.cfg"; +} + +namespace PYTHIA8 +{ + string config_file = "phpythia8.cfg"; +} + +namespace SARTRE +{ + string config_file = "sartre.cfg"; +} + +namespace PILEUP +{ + string pileupfile = "/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"; + double TpcDriftVelocity = 8.0 / 1000.0; +} // namespace PILEUP + +// collection of pointers to particle generators we can grab in the Fun4All macro +namespace INPUTGENERATOR +{ + PHG4ParticleGeneratorVectorMeson *VectorMesonGenerator = nullptr; + PHG4SimpleEventGenerator *SimpleEventGenerator = nullptr; + PHG4ParticleGun *Gun = nullptr; + PHPythia6 *Pythia6 = nullptr; + PHPythia8 *Pythia8 = nullptr; + PHSartre *Sartre = nullptr; + PHSartreParticleTrigger *SartreTrigger = nullptr; +} // namespace INPUTGENERATOR + +void InputInit() +{ + // 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::PYTHIA6 && Input::PYTHIA8) + { + cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; + gSystem->Exit(1); + } + + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + INPUTGENERATOR::Pythia6 = new PHPythia6(); + INPUTGENERATOR::Pythia6->set_config_file(PYTHIA6::config_file); + } + if (Input::PYTHIA8) + { + INPUTGENERATOR::Pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + INPUTGENERATOR::Pythia8->set_config_file(PYTHIA8::config_file); + } + if (Input::SARTRE) + { + 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(); + } + + if (Input::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator = new PHG4SimpleEventGenerator(); + } + if (Input::GUN) + { + INPUTGENERATOR::Gun = new PHG4ParticleGun(); + } + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator = new PHG4ParticleGeneratorVectorMeson(); + } +} + +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::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator->Verbosity(Input::SIMPLE_VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator); + } + if (Input::UPSILON) + { + if (Input::HEPMC || Input::SIMPLE) + { + INPUTGENERATOR::VectorMesonGenerator->set_reuse_existing_vertex(true); + } + INPUTGENERATOR::VectorMesonGenerator->Verbosity(Input::UPSILON_VERBOSITY); + INPUTGENERATOR::VectorMesonGenerator->Embed(2); + se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator); + } + if (Input::GUN) + { + INPUTGENERATOR::Gun->Verbosity(Input::GUN_VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::Gun); + } + // here are the various utility modules which read particles and + // put them onto the G4 particle stack + if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) + { + // read-in HepMC events to Geant4 if there is any + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + } + if (Input::READEIC) + { + ReadEICFiles *eicr = new ReadEICFiles(); + eicr->OpenInputFile(INPUTREADEIC::filename); + se->registerSubsystem(eicr); + } +} + +void InputManagers() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::EMBED) + { + gSystem->Load("libg4dst.so"); + Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); + in1->AddFile(INPUTEMBED::filename); // if one use a single input file + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning + se->registerInputManager(in1); + } + if (Input::HEPMC) + { + Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); + in->Verbosity(Input::VERBOSITY); + se->registerInputManager(in); + se->fileopen(in->Name(), INPUTHEPMC::filename); + } + else if (Input::READHITS) + { + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); + hitsin->fileopen(INPUTREADHITS::filename); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); + } + else + { + Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + in->Verbosity(Input::VERBOSITY); + se->registerInputManager(in); + } + if (Input::PILEUPRATE > 0) + { + Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + pileup->Verbosity(Input::VERBOSITY); + pileup->AddFile(PILEUP::pileupfile); + pileup->set_collision_rate(Input::PILEUPRATE); + double time_window = 105.5 / PILEUP::TpcDriftVelocity; + pileup->set_time_window(-time_window, time_window); + se->registerInputManager(pileup); + } +} +#endif diff --git a/common/G4_Intt.C b/common/G4_Intt.C new file mode 100644 index 000000000..0d3e8f3ec --- /dev/null +++ b/common/G4_Intt.C @@ -0,0 +1,187 @@ +#ifndef MACRO_G4INTT_C +#define MACRO_G4INTT_C + +#include "GlobalVariables.C" + +#include "G4_Mvtx.C" + +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libintt.so) + +namespace Enable +{ + bool INTT = false; + bool INTT_OVERLAPCHECK = false; + bool INTT_CELL = false; + bool INTT_CLUSTER = 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] = {15, 15, 18, 18}; + double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default + 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 + kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. + kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + }; + enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + +} // namespace G4INTT + +void InttInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 16.85 + 0.6); // rail radius + rail outer radius + 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); + 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(); + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + // The timing windows are hard-coded in the INTT ladder model, they can be overridden here + //reco->set_double_param("tmax",80.0); + //reco->set_double_param("tmin",-20.0); + reco->Verbosity(verbosity); + se->registerSubsystem(reco); + return; +} + +void Intt_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + // Intt + //===== + // 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); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + 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); +} +#endif diff --git a/common/G4_Jets.C b/common/G4_Jets.C new file mode 100644 index 000000000..8ba618029 --- /dev/null +++ b/common/G4_Jets.C @@ -0,0 +1,117 @@ +#ifndef MACRO_G4JETS_C +#define MACRO_G4JETS_C + +#include "GlobalVariables.C" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) + +namespace Enable +{ + bool JETS = false; + bool JETS_EVAL = false; + int JETS_VERBOSITY = 0; +} + +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; +} +#endif diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C new file mode 100644 index 000000000..48a2acd64 --- /dev/null +++ b/common/G4_Magnet.C @@ -0,0 +1,106 @@ +#ifndef MACRO_G4MAGNET_C +#define MACRO_G4MAGNET_C + +#include "GlobalVariables.C" + +#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.; + double magfield_rescale = 1; + string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + +} // namespace G4MAGNET + +void MagnetInit() +{ + 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..b6d21ba11 --- /dev/null +++ b/common/G4_Micromegas.C @@ -0,0 +1,94 @@ +#ifndef MACRO_G4MICROMEGAS_C +#define MACRO_G4MICROMEGAS_C + +#include "GlobalVariables.C" + +#include "G4_Intt.C" +#include "G4_Mvtx.C" +#include "G4_TPC.C" + +#include +#include +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libmicromegas.so) +R__LOAD_LIBRARY(libg4micromegas.so) + +namespace Enable +{ + bool MICROMEGAS = false; + bool MICROMEGAS_CELL = false; + bool MICROMEGAS_CLUSTER = false; +} // namespace Enable + +namespace G4MICROMEGAS +{ + int n_micromegas_layer = 2; +} + +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, 83.); + 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->SetActive(); + mm->set_double_param("mm_length", 220); + mm->set_double_param("mm_radius", 82); + g4Reco->registerSubsystem(mm); +} + +void Micromegas_Cells() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + // micromegas + auto reco = new PHG4MicromegasHitReco; + reco->Verbosity(0); + + static constexpr double radius = 82; + static constexpr double tile_length = 50; + static constexpr double tile_width = 25; + + // 12 tiles at mid rapidity, one in front of each TPC sector + static constexpr int ntiles = 12; + MicromegasTile::List tiles; + for (int i = 0; i < ntiles; ++i) + { + tiles.push_back({{2. * M_PI * (0.5 + i) / ntiles, 0, tile_width / radius, tile_length}}); + } + reco->set_tiles(tiles); + + se->registerSubsystem(reco); +} + +void Micromegas_Clustering() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + se->registerSubsystem(new PHG4MicromegasDigitizer); + se->registerSubsystem(new MicromegasClusterizer); +} +#endif diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C new file mode 100644 index 000000000..b9d07e6f1 --- /dev/null +++ b/common/G4_Mvtx.C @@ -0,0 +1,104 @@ +#ifndef MACRO_G4MVTX_C +#define MACRO_G4MVTX_C + +#include "GlobalVariables.C" + +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libmvtx.so) + +namespace Enable +{ + bool MVTX = false; + bool MVTX_OVERLAPCHECK = false; + bool MVTX_CELL = false; + bool MVTX_CLUSTER = 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 + +void MvtxInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +} + +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]; + if (verbosity) + { + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + } + radius = radius_lyr / 10.; + } + 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); + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); + return; +} + +void Mvtx_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + 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); + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); +} +#endif diff --git a/common/G4_Mvtx_EIC.C b/common/G4_Mvtx_EIC.C new file mode 100644 index 000000000..dc2252c23 --- /dev/null +++ b/common/G4_Mvtx_EIC.C @@ -0,0 +1,89 @@ +#ifndef MACRO_G4MVTXEIC_C +#define MACRO_G4MVTXEIC_C + +#include "GlobalVariables.C" + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4mvtx.so) + +namespace Enable +{ + bool MVTX = false; + bool MVTX_OVERLAPCHECK = 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 + vector N_staves = {18, 24, 30}; + vector nom_radius = {36.4, 48.1, 59.8}; +} // namespace G4MVTX + +void MvtxInit(int verbosity = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10. + 0.7); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); +} + +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); + + // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + // H?kan Wennl?f : + // Without time-stamping layer: + // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves + // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 + // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 + // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 + // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 + + // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30}; + // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; + if (G4MVTX::N_staves.size() < G4MVTX::n_maps_layer) + { + cout << "vector N_staves too small: " << G4MVTX::N_staves.size() + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + gSystem->Exit(1); + } + if (G4MVTX::nom_radius.size() < G4MVTX::n_maps_layer) + { + cout << "vector nom_radius too small: " << G4MVTX::nom_radius.size() + << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; + gSystem->Exit(1); + } + for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) + { + mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem + mvtx->set_int_param(ilyr, "layer", ilyr); + mvtx->set_int_param(ilyr, "N_staves", G4MVTX::N_staves[ilyr]); + mvtx->set_double_param(ilyr, "layer_nominal_radius", G4MVTX::nom_radius[ilyr]); // mm + mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); + mvtx->set_double_param(ilyr, "phi0", 0); + } + + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); + mvtx->SetActive(1); + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm +} +#endif diff --git a/common/G4_PSTOF.C b/common/G4_PSTOF.C new file mode 100644 index 000000000..23098f8d3 --- /dev/null +++ b/common/G4_PSTOF.C @@ -0,0 +1,38 @@ +#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..d75058495 --- /dev/null +++ b/common/G4_ParticleFlow.C @@ -0,0 +1,47 @@ +#ifndef MACRO_G4PARTICLEFLOW_C +#define MACRO_G4PARTICLEFLOW_C + +#include "GlobalVariables.C" + +#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->Verbosity(verbosity); + se->registerSubsystem(pfr); + + JetReco *particleflowjetreco = new JetReco("PARTICLEFLOWJETRECO"); + particleflowjetreco->add_input(new ParticleFlowJetInput()); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_ParticleFlow_r04"); + 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..8effed77f --- /dev/null +++ b/common/G4_Pipe.C @@ -0,0 +1,141 @@ +#ifndef MACRO_G4PIPE_C +#define MACRO_G4PIPE_C + +#include "GlobalVariables.C" + +#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 +{ + 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 +} // namespace G4PIPE + +void PipeInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length)); +} + +double Pipe(PHG4Reco* g4Reco, double radius) +{ + 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); + } + + // 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", 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", 1); + cyl->set_double_param("radius", G4PIPE::be_pipe_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 + cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); + cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_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", 3); + cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + 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_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 aluminum pipe + cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); + cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_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", 5); + cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - 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_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); + + radius = G4PIPE::al_pipe_radius + G4PIPE::al_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_Pipe_EIC.C b/common/G4_Pipe_EIC.C new file mode 100644 index 000000000..558c30c3d --- /dev/null +++ b/common/G4_Pipe_EIC.C @@ -0,0 +1,125 @@ +#ifndef MACRO_G4PIPEEIC_C +#define MACRO_G4PIPEEIC_C + +#include "GlobalVariables.C" + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +// This creates the Enable Flag to be used in the main steering macro +namespace Enable +{ + bool PIPE = false; + bool PIPE_ABSORBER = false; + bool PIPE_OVERLAPCHECK = false; + int PIPE_VERBOSITY = 0; +} + +namespace G4PIPE +{ + // Central pipe dimension + // Extracted via mechanical model: Detector chamber 3-20-20 + // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. + // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here + double be_pipe_radius = 3.1000; + double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX + double be_pipe_length_plus = 66.8; // +z beam pipe extend. + double be_pipe_length_neg = -79.8; // -z beam pipe extend. + bool use_forward_pipes = false; +} // namespace G4PIPE + +void PipeInit() +{ + if (G4PIPE::use_forward_pipes) + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 23.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 450.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -463.); + } + else + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); + } +} + +//! construct beam pipe +double Pipe(PHG4Reco* g4Reco, + double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); + // process pipe extentions? + const bool do_pipe_hadron_forward_extension = G4PIPE::use_forward_pipes && true; + const bool do_pipe_electron_forward_extension = G4PIPE::use_forward_pipes && true; + + const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length + const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); + + if (radius > G4PIPE::be_pipe_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; + gSystem->Exit(-1); + } + + // 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_double_param("place_z", be_pipe_center); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); + cyl->SuperDetector("PIPE"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); + cyl->set_double_param("radius", G4PIPE::be_pipe_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", be_pipe_length); + cyl->set_double_param("place_z", be_pipe_center); + cyl->set_string_param("material", "G4_Be"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); + cyl->SuperDetector("PIPE"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius = G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness; + + radius += no_overlapp; + + if (do_pipe_electron_forward_extension) + { + PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(gdml); + } + + if (do_pipe_hadron_forward_extension) + { + PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); + gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance + gdml->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(gdml); + } + + return radius; +} +#endif diff --git a/common/G4_Piston.C b/common/G4_Piston.C new file mode 100644 index 000000000..1b1264a05 --- /dev/null +++ b/common/G4_Piston.C @@ -0,0 +1,126 @@ +#ifndef MACRO_G4PISTON_C +#define MACRO_G4PISTON_C + +#include "GlobalVariables.C" + +#include "G4_Pipe.C" + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool PISTON = false; + bool PISTON_ABSORBER = false; + bool PISTON_OVERLAPCHECK = false; + int PISTON_VERBOSITY = 0; +} // namespace Enable + +namespace G4PISTON +{ + double zpos1 = 305. - 20.; // front of forward ECal/MPC + double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap + double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that +} // namespace G4PISTON + +void PistonInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter/2.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,((G4PISTON::zpos2 + G4PISTON::zpos1) / 2.+(G4PISTON::zpos2 - G4PISTON::zpos1)/2.) ); +} + +void Piston(PHG4Reco* g4Reco, + const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::PISTON_ABSORBER || absorberactive; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PISTON_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PISTON_VERBOSITY); + + string name = "magpiston"; + const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::be_pipe_length * 0.5; // first large GEM station + + const double beampipe_radius = G4PIPE::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 + (G4PISTON::zpos1 - zpos0) / 2; +// cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos +// << endl; + + PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); + magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); + magpiston->SetPlaceZ((G4PISTON::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)) * G4PISTON::zpos1); + magpiston->SetMaterial("G4_Fe"); + magpiston->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(magpiston); + +// PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); +// magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); +// magpiston->SetPlaceZ(pos); +// magpiston->Set_eta_range(eta_outter, eta_inner); +// magpiston->SetMaterial("G4_Fe"); +// magpiston->SuperDetector(name); +// 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); + if (AbsorberActive) magpiston->SetActive(); + magpiston->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(magpiston); + pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); + } + + // last piece connect to the field return + PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); + magpiston2->set_double_param("length",G4PISTON::zpos2 - G4PISTON::zpos1); + magpiston2->set_double_param("place_z", (G4PISTON::zpos2 + G4PISTON::zpos1) / 2.); + magpiston2->set_double_param("radius",beampipe_radius); + magpiston2->set_double_param("thickness",G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); + magpiston2->set_string_param("material","G4_Fe"); + magpiston2->SuperDetector(name); + if (AbsorberActive) magpiston2->SetActive(); + magpiston2->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(magpiston2); + + return; +} +#endif diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C new file mode 100644 index 000000000..ab86f4b50 --- /dev/null +++ b/common/G4_PlugDoor.C @@ -0,0 +1,71 @@ +#ifndef MACRO_G4PLUGDOOR_C +#define MACRO_G4PLUGDOOR_C + +#include "GlobalVariables.C" + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + + +namespace Enable +{ + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = 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.; +} // 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.)); +} +void PlugDoor(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + + const string material("Steel_1006"); + + + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); + 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); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + 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); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} +#endif diff --git a/common/G4_PlugDoor_EIC.C b/common/G4_PlugDoor_EIC.C new file mode 100644 index 000000000..e8aaf7e7a --- /dev/null +++ b/common/G4_PlugDoor_EIC.C @@ -0,0 +1,59 @@ +#ifndef MACRO_G4PLUGDOOREIC_C +#define MACRO_G4PLUGDOOREIC_C + +#include "GlobalVariables.C" + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; +} + +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.; +} // namespace G4PLUGDOOR + +void PlugDoorInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); +} + +void PlugDoor(PHG4Reco *g4Reco) +{ + //---------------------------------------- + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + + const string material("Steel_1006"); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + 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); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} +#endif diff --git a/common/G4_PlugDoor_fsPHENIX.C b/common/G4_PlugDoor_fsPHENIX.C new file mode 100644 index 000000000..4d1739fb8 --- /dev/null +++ b/common/G4_PlugDoor_fsPHENIX.C @@ -0,0 +1,69 @@ +#ifndef MACRO_G4PLUGDOORFSPHENIX_C +#define MACRO_G4PLUGDOORFSPHENIX_C + +#include "GlobalVariables.C" + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; +} // namespace Enable + +namespace G4PLUGDOOR +{ + double place_z = 335.9; + double length = 10.2; + double inner_radius = 2.1; + double thickness = 258.5; +} // namespace G4PLUGDOOR + +void PlugDoorInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::inner_radius + G4PLUGDOOR::thickness); + 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.)); +} + +void PlugDoor(PHG4Reco *g4Reco) +{ + + + //---------------------------------------- + // fsPHENIX forward flux return(s) + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + + const string material("Steel_1006"); + + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::inner_radius); + flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); + 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); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::inner_radius); + flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); + 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); + g4Reco->registerSubsystem(flux_return_minus); + + return; +} +#endif diff --git a/common/G4_Production.C b/common/G4_Production.C new file mode 100644 index 000000000..bf0caef65 --- /dev/null +++ b/common/G4_Production.C @@ -0,0 +1,33 @@ +#ifndef MACRO_G4PRODUCTION_C +#define MACRO_G4PRODUCTION_C + +#include "GlobalVariables.C" + +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_RICH.C b/common/G4_RICH.C new file mode 100644 index 000000000..acc1b68b2 --- /dev/null +++ b/common/G4_RICH.C @@ -0,0 +1,64 @@ +/*! + * \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 $ + */ +#ifndef MACRO_G4RICH_C +#define MACRO_G4RICH_C + +#include "GlobalVariables.C" + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool RICH = false; +} + +void RICHInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 135.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 268.); +} + +//! 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.3, // + const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) + const double z_shift = 75, // cm + const double R_shift = 18.5, // cm + const double R_beampipe_front = 8, // clearance for EIC beam pipe flange + const double R_beampipe_back = 27 // clearance for EIC beam pipe flange +) +{ + /* 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()); + + rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); + rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); + + rich->OverlapCheck(Enable::OVERLAPCHECK); + + /* Register RICH module */ + g4Reco->registerSubsystem(rich); +} +#endif diff --git a/common/G4_TPC.C b/common/G4_TPC.C new file mode 100644 index 000000000..9f7338e60 --- /dev/null +++ b/common/G4_TPC.C @@ -0,0 +1,151 @@ +#ifndef MACRO_G4TPC_C +#define MACRO_G4TPC_C + +#include "GlobalVariables.C" + +#include "G4_Intt.C" +#include "G4_Mvtx.C" + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libtpc.so) + +namespace Enable +{ + bool TPC = false; + bool TPC_ABSORBER = false; + bool TPC_OVERLAPCHECK = false; + bool TPC_CELL = false; + bool TPC_CLUSTER = false; + 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.; +} // namespace G4TPC + +void TPCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); + 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; + } +} + +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); + + radius = G4TPC::tpc_outer_radius; + + radius += no_overlapp; + + return radius; +} + +void TPC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + //========================= + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout + //========================= + + PHG4TpcPadPlane* padplane = new PHG4TpcPadPlaneReadout(); + padplane->Verbosity(verbosity); + + PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); + edrift->Detector("TPC"); + edrift->Verbosity(verbosity); + // 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->set_double_param("added_smear_trans",0.085); + //edrift->set_double_param("added_smear_long",0.105); + 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); +} + +void TPC_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + + // Tpc + //==== + 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); + + //------------- + // Cluster Hits + //------------- + + // For the Tpc + //========== + TpcClusterizer* tpcclusterizer = new TpcClusterizer(); + tpcclusterizer->Verbosity(verbosity); + se->registerSubsystem(tpcclusterizer); +} +#endif diff --git a/common/G4_TPC_EIC.C b/common/G4_TPC_EIC.C new file mode 100644 index 000000000..d93822681 --- /dev/null +++ b/common/G4_TPC_EIC.C @@ -0,0 +1,126 @@ +#ifndef MACRO_G4TPCEIC_C +#define MACRO_G4TPCEIC_C + +#include "GlobalVariables.C" + +#include "G4_Mvtx_EIC.C" + +#include + +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4mvtx.so) + +namespace Enable +{ + bool TPC = false; +} + +namespace G4TPC +{ + int n_tpc_layer_inner = 16; + double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. + int tpc_layer_rphi_count_inner = 1152; + + int n_tpc_layer_mid = 16; + double tpc_layer_thick_mid = 1.25; + int tpc_layer_rphi_count_mid = 1536; + + int n_tpc_layer_outer = 16; + double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm + int tpc_layer_rphi_count_outer = 2304; + + double outer_radius = 78.; + double inner_cage_radius = 20.; + 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 + + string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc + +} // namespace G4TPC + +void TPCInit(int verbosity = 0) +{ + // BlackHoleGeometry::max_radius set at the end of the TPC function + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length / 2.); +} + +double TPC(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + // time projection chamber layers -------------------------------------------- + + PHG4CylinderSubsystem* cyl; + + radius = G4TPC::inner_cage_radius; + + // inner field cage + cyl = new PHG4CylinderSubsystem("FIELDCAGE", G4MVTX::n_maps_layer); + cyl->set_double_param("radius", radius); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", "G4_KAPTON"); + cyl->set_double_param("thickness", G4TPC::cage_thickness); + cyl->SuperDetector("FIELDCAGE"); + cyl->Verbosity(0); + g4Reco->registerSubsystem(cyl); + + radius += G4TPC::cage_thickness; + + // double inner_readout_radius = radius; + // if (inner_readout_radius < radius) inner_readout_radius = radius; + // + // + + int n_tpc_layers[3] = {16, 16, 16}; + int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; + + double tpc_region_thickness[3] = {20., 20., 18.}; + // Active layers of the TPC (inner layers) + int nlayer = G4MVTX::n_maps_layer; + for (int irange = 0; irange < 3; irange++) + { + double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer + for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) + { + cyl = new PHG4CylinderSubsystem("TPC", nlayer); + cyl->set_double_param("radius", radius); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", G4TPC::tpcgas); + cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); + cyl->SetActive(); + cyl->SuperDetector("TPC"); + g4Reco->registerSubsystem(cyl); + + radius += tpc_layer_thickness; + nlayer++; + } + } + + // outer field cage + cyl = new PHG4CylinderSubsystem("FIELDCAGE", nlayer); + cyl->set_double_param("radius", radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4TPC::cage_length); + cyl->set_string_param("material", "G4_KAPTON"); + cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm + cyl->SuperDetector("FIELDCAGE"); + g4Reco->registerSubsystem(cyl); + + radius += G4TPC::cage_thickness; + + // update now that we know the outer radius + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); + return radius; +} +#endif diff --git a/common/G4_TopoClusterReco.C b/common/G4_TopoClusterReco.C new file mode 100644 index 000000000..3b4374179 --- /dev/null +++ b/common/G4_TopoClusterReco.C @@ -0,0 +1,72 @@ +#ifndef MACRO_G4TOPOCLUSTERRECO_C +#define MACRO_G4TOPOCLUSTERRECO_C + +#include "GlobalVariables.C" + +#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..4d0bc9c77 --- /dev/null +++ b/common/G4_Tracking.C @@ -0,0 +1,229 @@ +#ifndef MACRO_G4TRACKING_C +#define MACRO_G4TRACKING_C + +#include "GlobalVariables.C" + +#include "G4_Intt.C" +#include "G4_Mvtx.C" +#include "G4_TPC.C" +#include "G4_Micromegas.C" + +#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(libPHTpcTracker.so) + +namespace Enable +{ + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; +} // namespace Enable + +namespace G4TRACKING +{ + // Tracking reconstruction setup parameters and flags + //===================================== + int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events + //default seed is PHTpcTracker + bool use_hough_seeding = false; //choose seeding algo + bool use_ca_seeding = false; + + bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead + bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples + + // This is the setup we have been using before PHInitZVertexing was implemented - 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: + bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex + + // This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event + //const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex + //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. +} // namespace G4TRACKING + +void TrackingInit() +{ + if (!Enable::MICROMEGAS) + { + G4MICROMEGAS::n_micromegas_layer = 0; + } +} + +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 + //------------ + + if (G4TRACKING::use_track_prop) + { + //-------------------------------------------------- + // Normal track seeding and propagation + //-------------------------------------------------- + + if (G4TRACKING::use_truth_vertex) + { + // We cheat to get the initial vertex for the full track reconstruction case + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + } + else + { + // get the initial vertex for track fitting from the MVTX hits + PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); + int seed_layer[7] = {0, 1, 2, 3, 4, 5, 6}; + init_zvtx->set_seeding_layer(seed_layer, 7); + // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. + // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). + init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); + init_zvtx->Verbosity(verbosity); + se->registerSubsystem(init_zvtx); + } + if (G4TRACKING::use_hough_seeding) + { + // find seed tracks using a subset of TPC layers + int min_layers = 4; + int nlayers_seeds = 12; + auto track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer, nlayers_seeds, min_layers); + track_seed->Verbosity(verbosity); + se->registerSubsystem(track_seed); + } + else if (G4TRACKING::use_ca_seeding) + { + } + else + { + 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... + se->registerSubsystem(tracker); + } + // 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); + } + } + else + { + //------------------------------------------------------- + // Track finding using truth information only + //------------------------------------------------------ + + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + + // For each truth particle, create a track and associate clusters with it using truth information + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); + pat_rec->Verbosity(verbosity); + se->registerSubsystem(pat_rec); + } + + //------------------------------------------------ + // Fitting of tracks using Kalman Filter + //------------------------------------------------ + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + + if (G4TRACKING::use_primary_vertex) + { + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + } + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // 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); + 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(false); + eval->do_eval_light(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); + 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(verbosity); + se->registerSubsystem(evalp); + } + + return; +} +#endif diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C new file mode 100644 index 000000000..7cbf66ee5 --- /dev/null +++ b/common/G4_Tracking_EIC.C @@ -0,0 +1,226 @@ +#ifndef MACRO_G4TRACKINGEIC_C +#define MACRO_G4TRACKINGEIC_C + +#include "GlobalVariables.C" + +#include "G4_CEmc_EIC.C" +#include "G4_FEMC_EIC.C" +#include "G4_FHCAL.C" +#include "G4_GEM_EIC.C" +#include "G4_Mvtx_EIC.C" +#include "G4_TPC_EIC.C" + +#include + +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libg4trackfastsim.so) + +namespace Enable +{ + bool TRACKING = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; +} // namespace Enable + +namespace G4TRACKING +{ + bool DISPLACED_VERTEX = false; + bool PROJECTION_CEMC = false; + bool PROJECTION_FEMC = false; + bool PROJECTION_FHCAL = false; +} // namespace G4TRACKING + +//-----------------------------------------------------------------------------// +void TrackingInit() +{ + TRACKING::TrackNodeName = "TrackMap"; +} +//-----------------------------------------------------------------------------// +void Tracking_Reco() +{ + + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); + // kalman->Verbosity(); + // kalman->Smearing(false); + if (G4TRACKING::DISPLACED_VERTEX) + { + // do not use truth vertex in the track fitting, + // which would lead to worse momentum resolution for prompt tracks + // but this allows displaced track analysis including DCA and vertex finding + kalman->set_use_vertex_in_fitting(false); + kalman->set_vertex_xy_resolution(0);// do not smear the vertex used in the built-in DCA calculation + kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation + kalman->enable_vertexing(true); // enable vertex finding and fitting + } + else + { + // constraint to a primary vertex and use it as part of the fitting level arm + kalman->set_use_vertex_in_fitting(true); + kalman->set_vertex_xy_resolution(50e-4); + kalman->set_vertex_z_resolution(50e-4); + } + + kalman->set_sub_top_node_name("TRACKS"); + kalman->set_trackmap_out_name(TRACKING::TrackNodeName); + + //------------------------- + // Barrel + //------------------------- + if (Enable::BARREL) + { + kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise + } + //------------------------- + // MVTX + //------------------------- + if (Enable::MVTX) + { + // MAPS + kalman->add_phg4hits( + "G4HIT_MVTX", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 5e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + //------------------------- + // TPC + //------------------------- + if (Enable::TPC) + { + kalman->add_phg4hits( + "G4HIT_TPC", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 1, // const float radres, + 200e-4, // const float phires, + 500e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + //------------------------- + // EGEM + //------------------------- + if (Enable::EGEM) + { + // GEM, 70um azimuthal resolution, 1cm radial strips + for (int i = 0; i < 4; i++) + { + kalman->add_phg4hits( + Form("G4HIT_EGEM_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0 // const float noise + ); + } + } + //------------------------- + // FGEM + //------------------------- + if (Enable::FGEM) + { + // GEM2, 70um azimuthal resolution, 1cm radial strips + for (int i = 2; i < 5; i++) + { + kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 1. / sqrt(12.), // const float radres, + 70e-4, // const float phires, + 100e-4, // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } + //------------------------- + // FST + //------------------------- + if (Enable::FST) + { + for (int i = 0; i < 5; i++) + { + kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, + 5e-4, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, + 1, // const float eff, + 0); // const float noise + } + } + //------------------------- + // FEMC + //------------------------- + // Saved track states (projections) + if (Enable::FEMC && G4TRACKING::PROJECTION_FEMC) + { + kalman->add_state_name("FEMC"); + } + + //------------------------- + // FHCAL + //------------------------- + if (Enable::FHCAL && G4TRACKING::PROJECTION_FHCAL) + { + kalman->add_state_name("FHCAL"); + } + //------------------------- + // CEMC + //------------------------- + + if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) + { + kalman->add_state_name("CEMC"); + } + se->registerSubsystem(kalman); + + return; +} + +//-----------------------------------------------------------------------------// + +void Tracking_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + //---------------- + // Fast Tracking evaluation + //---------------- + + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); + fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); + fast_sim_eval->set_filename(outputfile); + se->registerSubsystem(fast_sim_eval); +} +#endif diff --git a/common/G4_User.C b/common/G4_User.C new file mode 100644 index 000000000..95a3bd7c5 --- /dev/null +++ b/common/G4_User.C @@ -0,0 +1,29 @@ +#ifndef MACRO_G4USER_C +#define MACRO_G4USER_C + +namespace Enable +{ + bool USER = false; +} + +namespace G4USER +{ + int myparam = 0; +} + +void UserInit(int verbosity = 0) +{ + // 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); +} + +void UserDetector(PHG4Reco *g4Reco) +{ + return; +} +#endif diff --git a/common/G4_World.C b/common/G4_World.C new file mode 100644 index 000000000..9eebe2b82 --- /dev/null +++ b/common/G4_World.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4WORLD_C +#define MACRO_G4WORLD_C + +#include "GlobalVariables.C" + +#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 = "QGSP_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(radius, BlackHoleGeometry::max_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, -((g4Reco->GetWorldSizeZ() - 100) / 2.)); + double max_zval = std::max(BlackHoleGeometry::max_z, (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/GlobalVariables.C b/common/GlobalVariables.C new file mode 100644 index 000000000..9513df2ce --- /dev/null +++ b/common/GlobalVariables.C @@ -0,0 +1,55 @@ +#ifndef MACRO_GLOBALVARIABLES_C +#define MACRO_GLOBALVARIABLES_C + +#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; +} // namespace Input + +namespace DstOut +{ + string OutputDir = "."; + string OutputFile = "test.root"; +} // namespace DstOut + +// Global settings affecting multiple subsystems +namespace Enable +{ + bool OVERLAPCHECK = false; + bool ABSORBER = false; + bool DSTOUT = false; + bool DSTOUT_COMPRESS = 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 +{ + string TrackNodeName = "SvtxTrackMap"; +} +#endif From 97b0f7f61054a5bd0d270eff534500f68302df65 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 10 Jul 2020 21:53:35 -0400 Subject: [PATCH 0745/1222] add display macro so we do not have to drag it around --- common/DisplayOn.C | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 common/DisplayOn.C diff --git a/common/DisplayOn.C b/common/DisplayOn.C new file mode 100644 index 000000000..72b69734e --- /dev/null +++ b/common/DisplayOn.C @@ -0,0 +1,62 @@ +#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 +// 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.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; +} +// 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; +} From 925e4a1f5e004c3cd6611c72e3c5422fae161252 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 10 Jul 2020 21:57:38 -0400 Subject: [PATCH 0746/1222] Add sPHENIX --- detectors/sPHENIX/DisplayOn.C | 64 ++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 482 +++++++++++++++++++++++++ detectors/sPHENIX/G4Setup_sPHENIX.C | 282 +++++++++++++++ detectors/sPHENIX/init_gui_vis.mac | 20 + detectors/sPHENIX/vis.mac | 82 +++++ 5 files changed, 930 insertions(+) create mode 100644 detectors/sPHENIX/DisplayOn.C create mode 100644 detectors/sPHENIX/Fun4All_G4_sPHENIX.C create mode 100644 detectors/sPHENIX/G4Setup_sPHENIX.C create mode 100644 detectors/sPHENIX/init_gui_vis.mac create mode 100644 detectors/sPHENIX/vis.mac diff --git a/detectors/sPHENIX/DisplayOn.C b/detectors/sPHENIX/DisplayOn.C new file mode 100644 index 000000000..028620802 --- /dev/null +++ b/detectors/sPHENIX/DisplayOn.C @@ -0,0 +1,64 @@ +#ifndef MACRO_DISPLAYON_C +#define MACRO_DISPLAYON_C + +#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 +// 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.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; +} +// 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; +} +#endif diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C new file mode 100644 index 000000000..025c071af --- /dev/null +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -0,0 +1,482 @@ +#ifndef MACRO_FUN4ALLG4SPHENIX_C +#define MACRO_FUN4ALLG4SPHENIX_C + +#include "GlobalVariables.C" + +#include "DisplayOn.C" +#include "G4Setup_sPHENIX.C" +#include "G4_Bbc.C" +#include "G4_CaloTrigger.C" +#include "G4_DSTReader.C" +#include "G4_Global.C" +#include "G4_HIJetReco.C" +#include "G4_Input.C" +#include "G4_Jets.C" +#include "G4_ParticleFlow.C" +#include "G4_Production.C" +#include "G4_TopoClusterReco.C" +#include "G4_Tracking.C" + +#include +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) + +int Fun4All_G4_sPHENIX( + const int nEvents = 1, + const string &inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.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", 12345); + + //=============== + // Input options + //=============== + // 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 = 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 = embed_input_file; + + Input::SIMPLE = true; + //Input::SIMPLE_VERBOSITY = 1; + + // Input::PYTHIA6 = true; + + // Input::PYTHIA8 = true; + + // Input::GUN = true; + //Input::GUN_VERBOSITY = 1; + + // Upsilon generator + // Input::UPSILON = true; + Input::UPSILON_VERBOSITY = 0; + + // Input::HEPMC = true; + Input::VERBOSITY = 0; + 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 (Input::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + } + INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 1); + INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); + } + // Upsilons + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator->add_decay_particles("e", 0); + INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); + INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + // Y species - select only one, last one wins + INPUTGENERATOR::VectorMesonGenerator->set_upsilon_1s(); + } + // particle gun + if (Input::GUN) + { + INPUTGENERATOR::Gun->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + } + + // register all input generators with Fun4All + InputRegister(); + +// 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 = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::BBC = true; + + Enable::PIPE = true; + Enable::PIPE_ABSORBER = true; + + //Enable::PSTOF = true; + + // central tracking + Enable::MVTX = true; + Enable::MVTX_CELL = Enable::MVTX && true; + Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; + + Enable::INTT = true; + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + + Enable::TPC = true; + Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; + + //Enable::MICROMEGAS = true; + Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; + Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; + + Enable::TRACKING_TRACK = true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && 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 = true; + Enable::CEMC_ABSORBER = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && false; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; + Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + + Enable::HCALIN = true; + 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::MAGNET = true; + Enable::MAGNET_ABSORBER = true; + + Enable::HCALOUT = true; + 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; + + // forward EMC + //Enable::FEMC = true; + Enable::FEMC_ABSORBER = true; + Enable::FEMC_CELL = Enable::FEMC && true; + Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; + Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; + + //! forward flux return plug door. Out of acceptance and off by default. + //Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; + + 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; + + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + //BlackHoleGeometry::visible = true; + + //--------------- + // World Settings + //--------------- + // G4WORLD::PhysicsList = "QGSP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans + + //--------------- + // 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.4 / 1.5; // 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(); + } + + //--------- + // BBC Reco + //--------- + + if (Enable::BBC) + { + BbcInit(); + Bbc_Reco(); + } + //------------------ + // Detector Division + //------------------ + + 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(); + + if (Enable::FEMC_CELL) FEMC_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::FEMC_TOWER) FEMC_Towers(); + if (Enable::FEMC_CLUSTER) FEMC_Clusters(); + + 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()); + } + + 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::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); + + if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); + + //-------------- + // 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) DstCompress(out); + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + 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; + } + + if (Enable::DISPLAY) + { + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; + } + + se->skip(skip); + se->run(nEvents); + + //----- + // 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..ac68c2179 --- /dev/null +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -0,0 +1,282 @@ +#ifndef MACRO_G4SETUPSPHENIX_C +#define MACRO_G4SETUPSPHENIX_C + +#include "GlobalVariables.C" + +#include "G4_BlackHole.C" +#include "G4_CEmc_Spacal.C" +#include "G4_CEmc_Albedo.C" +#include "G4_FEMC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Intt.C" +#include "G4_Magnet.C" +#include "G4_Micromegas.C" +#include "G4_Mvtx.C" +#include "G4_PSTOF.C" +#include "G4_Pipe.C" +#include "G4_PlugDoor.C" +#include "G4_TPC.C" +#include "G4_User.C" +#include "G4_World.C" + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void G4Init() +{ + // 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::PSTOF) + { + PSTOFInit(); + } + + if (Enable::CEMCALBEDO) + { + CEmcAlbedoInit(); + } + + if (Enable::CEMC) + { + if (Enable::CEMCALBEDO) + { + cout << "Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously" << endl; + gSystem->Exit(1); + } + CEmcInit(); // make it 2*2*2*3*3 so we can try other combinations + } + + if (Enable::HCALIN) + { + HCalInnerInit(); + } + + if (Enable::MAGNET) + { + MagnetInit(); + } + if (Enable::HCALOUT) + { + HCalOuterInit(); + } + + if (Enable::PLUGDOOR) + { + PlugDoorInit(); + } + if (Enable::FEMC) + { + FEMCInit(); + } + 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("sPHENIX.root") != string::npos) + { + 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); + + double radius = 0.; + + //---------------------------------------- + // PIPE + if (Enable::PIPE) radius = Pipe(g4Reco, radius); + + //---------------------------------------- + // TRACKING + 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); + + //---------------------------------------- + // PSTOF + + if (Enable::PSTOF) radius = PSTOF(g4Reco, radius); + + //---------------------------------------- + // CEMC (it is checked above that not both of them are set + if (Enable::CEMCALBEDO) CEmcAlbedo(g4Reco); + + if (Enable::CEMC) radius = CEmc(g4Reco, radius, 8); + + //---------------------------------------- + // HCALIN + + if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4); + + //---------------------------------------- + // MAGNET + + if (Enable::MAGNET) radius = Magnet(g4Reco, radius); + + //---------------------------------------- + // HCALOUT + + if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); + + //---------------------------------------- + // sPHENIX forward flux return door + if (Enable::PLUGDOOR) PlugDoor(g4Reco); + + // forward EMC + if (Enable::FEMC) FEMCSetup(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->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->AddCellContainer("G4CELL_FEMC"); + compress->AddTowerContainer("TOWER_SIM_FEMC"); + compress->AddTowerContainer("TOWER_RAW_FEMC"); + compress->AddTowerContainer("TOWER_CALIB_FEMC"); + 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("G4CELL_FEMC"); + } +} +#endif 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/detectors/sPHENIX/vis.mac b/detectors/sPHENIX/vis.mac new file mode 100644 index 000000000..47db266aa --- /dev/null +++ b/detectors/sPHENIX/vis.mac @@ -0,0 +1,82 @@ +# $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 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 +# 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 2 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. From 5248376f8c067055417f15f969b675ef4174f4de Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 10 Jul 2020 21:58:57 -0400 Subject: [PATCH 0747/1222] Add fsPHENIX --- detectors/fsPHENIX/DisplayOn.C | 64 +++ detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 498 +++++++++++++++++++++++ detectors/fsPHENIX/G4Setup_fsPHENIX.C | 337 +++++++++++++++ detectors/fsPHENIX/init_gui_vis.mac | 20 + detectors/fsPHENIX/vis.mac | 82 ++++ 5 files changed, 1001 insertions(+) create mode 100644 detectors/fsPHENIX/DisplayOn.C create mode 100644 detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C create mode 100644 detectors/fsPHENIX/G4Setup_fsPHENIX.C create mode 100644 detectors/fsPHENIX/init_gui_vis.mac create mode 100644 detectors/fsPHENIX/vis.mac diff --git a/detectors/fsPHENIX/DisplayOn.C b/detectors/fsPHENIX/DisplayOn.C new file mode 100644 index 000000000..028620802 --- /dev/null +++ b/detectors/fsPHENIX/DisplayOn.C @@ -0,0 +1,64 @@ +#ifndef MACRO_DISPLAYON_C +#define MACRO_DISPLAYON_C + +#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 +// 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.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; +} +// 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; +} +#endif diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C new file mode 100644 index 000000000..b278267d3 --- /dev/null +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -0,0 +1,498 @@ +#ifndef MACRO_FUN4ALLG4FSPHENIX_C +#define MACRO_FUN4ALLG4FSPHENIX_C + +#include "GlobalVariables.C" + +#include "DisplayOn.C" +#include "G4Setup_fsPHENIX.C" +#include "G4_Bbc.C" +#include "G4_CaloTrigger.C" +#include "G4_DSTReader_fsPHENIX.C" +#include "G4_FwdJets.C" +#include "G4_Global.C" +#include "G4_Input.C" +#include "G4_Jets.C" +#include "G4_Production.C" + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +// If using the default embedding file results in a error, try +// TFile *f1 = TFile::Open("http://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") +// if it returns a certificate error, something like +// Error in : can not open file with davix: Failure (Neon): Server certificate verification failed: bad certificate chain after 3 attempts (6) +// add the line +// Davix.GSI.CACheck: n +// to your .rootrc + +int Fun4All_G4_fsPHENIX( + const int nEvents = 2, + const string &inputFile = "/sphenix/sim/sim01/production/2016-07-21/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", + const string &outputFile = "G4fsPHENIX.root", + const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", + const int skip = 0, + const string &outdir = ".") +{ + //--------------- + // Fun4All server + //--------------- + + 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 initial seed + // which will produce identical results so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // 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 + Input::READHITS = false; + INPUTREADHITS::filename = 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 = embed_input_file; + + Input::SIMPLE = true; + //Input::SIMPLE_VERBOSITY = 1; + + // Input::PYTHIA6 = true; + + // Input::PYTHIA8 = true; + + // Input::GUN = true; + //Input::GUN_VERBOSITY = 0; + + // Input::HEPMC = true; + //Input::VERBOSITY = 0; + INPUTHEPMC::filename = inputFile; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + InputInit(); + + //-------------- + // Set generator specific options + //-------------- + // can only be set after InputInit() is called + + // Simple Input generator: + if (Input::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + } + INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 3); + INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.5, 50.); + } + // Upsilons + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator->add_decay_particles("mu", 0); + INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); + INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + // Y species - select only one, last one wins + INPUTGENERATOR::VectorMesonGenerator->set_upsilon_1s(); + } + // particle gun + if (Input::GUN) + { + INPUTGENERATOR::Gun->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + } + + // register all input generators with Fun4All + InputRegister(); + +// 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 = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::BBC = true; + + Enable::PIPE = true; + Enable::PIPE_ABSORBER = true; + // Enable::PIPE_OVERLAPCHECK = true; + + // central tracking + Enable::MVTX = true; + Enable::MVTX_CELL = Enable::MVTX && true; + Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; + + Enable::INTT = true; + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + + Enable::TPC = true; + // Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; + + Enable::TRACKING_TRACK = Enable::TPC_CELL && Enable::INTT_CELL && Enable::MVTX_CELL && true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; + + // central calorimeters, which is a detailed simulation and slow to run + Enable::CEMC = true; + // 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::HCALIN = true; + // 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::MAGNET = true; + // Enable::MAGNET_ABSORBER = true; + + Enable::HCALOUT = true; + // 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::GLOBAL_RECO = true; + // Enable::GLOBAL_FASTSIM = true; + + Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && true; + + Enable::JETS = true; + Enable::JETS_EVAL = Enable::JETS && true; + + Enable::FWDJETS = true; + Enable::FWDJETS_EVAL = Enable::FWDJETS && true; + + // fsPHENIX geometry + + Enable::FGEM = true; + Enable::FGEM_TRACK = Enable::FGEM && Enable::MVTX && true; + Enable::FGEM_EVAL = Enable::FGEM_TRACK && true; + + Enable::FEMC = true; + Enable::FEMC_ABSORBER = true; + Enable::FEMC_CELL = Enable::FEMC && true; + Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; + + Enable::FHCAL = true; + Enable::FHCAL_ABSORBER = true; + Enable::FHCAL_CELL = Enable::FHCAL && true; + Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; + Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; + + // Enable::PISTON = true; + Enable::PISTON_ABSORBER = true; + Enable::PISTON_OVERLAPCHECK = false; + + Enable::PLUGDOOR = true; + // Enable::PLUGDOOR_ABSORBER = true; + Enable::PLUGDOOR_OVERLAPCHECK = false; + + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + // BlackHoleGeometry::visible = true; + + //--------------- + // World Settings + //--------------- + // G4WORLD::PhysicsList = "QGSP_BERT"; // FTFP_BERT_HP best for calo + // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans + + //--------------- + // 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.4 / 1.5; // 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(); + + if (!Input::READHITS) + { + //--------------------- + // Set up G4 only if we do not read hits + //--------------------- + G4Setup(); + } + + //--------- + // BBC Reco, just smeared vertex + //--------- + + if (Enable::BBC) + { + BbcInit(); + Bbc_Reco(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + if (Enable::FEMC_CELL) FEMC_Cells(); + if (Enable::FHCAL_CELL) FHCAL_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 (Enable::FEMC_TOWER) FEMC_Towers(); + if (Enable::FEMC_CLUSTER) FEMC_Clusters(); + + if (Enable::FHCAL_TOWER) FHCAL_Towers(); + if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); + + 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::TRACKING_TRACK) + { + TrackingInit(); + Tracking_Reco(); + } + + //-------------- + // FGEM tracking + //-------------- + + if (Enable::FGEM_TRACK) FGEM_FastSim_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::FWDJETS) Jet_FwdReco(); + + //---------------------- + // 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 + "g4tracking_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::FEMC_EVAL) FEMC_Eval(outputroot + "g4femc_eval.root"); + + if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "g4jet_eval.root"); + + if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "g4fwdjet_eval.root"); + + if (Enable::FGEM_EVAL) FGEM_FastSim_Eval(outputroot + "g4tracking_fgem_eval.root"); + + if (Enable::DSTREADER) G4DSTreader_fsPHENIX(outputroot + "_DSTReader.root"); + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + //-------------- + // Set up Output Managers + //-------------- + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + + //----------------- + // Event processing + //----------------- + 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; + } + + if (Enable::DISPLAY) + { + DisplayOn(); + // prevent macro from finishing so can see display + int i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; + } + + se->skip(skip); + se->run(nEvents); + + //----- + // Exit + //----- + + se->End(); + std::cout << "All done" << std::endl; + delete se; + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + gSystem->Exit(0); + return 0; +} + +void G4Cmd(const char *cmd) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); + g4->ApplyCommand(cmd); +} +#endif diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C new file mode 100644 index 000000000..ec8d67933 --- /dev/null +++ b/detectors/fsPHENIX/G4Setup_fsPHENIX.C @@ -0,0 +1,337 @@ +#ifndef MACRO_G4SETUPFSPHENIX_C +#define MACRO_G4SETUPFSPHENIX_C + +#include "GlobalVariables.C" + +#include "G4_BlackHole.C" +#include "G4_CEmc_Spacal.C" +#include "G4_FEMC.C" +#include "G4_FGEM_fsPHENIX.C" +#include "G4_FHCAL.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Magnet.C" +#include "G4_Mvtx.C" +#include "G4_Pipe.C" +#include "G4_Piston.C" +#include "G4_PlugDoor_fsPHENIX.C" +#include "G4_TPC.C" +#include "G4_Tracking.C" +#include "G4_User.C" +#include "G4_World.C" + +#include + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void ShowerCompress(int verbosity = 0); +void DstCompress(Fun4AllDstOutputManager *out); + +void RunLoadTest() {} + +void G4Init() +{ + // 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::CEMC) + { + CEmcInit(); + } + + if (Enable::HCALIN) + { + HCalInnerInit(); + } + + if (Enable::MAGNET) + { + MagnetInit(); + } + if (Enable::HCALOUT) + { + HCalOuterInit(); + } + + if (Enable::FGEM) + { + FGEM_Init(); + } + + if (Enable::FEMC) + { + FEMCInit(); + } + + if (Enable::FHCAL) + { + FHCALInit(); + } + if (Enable::PISTON) + { + PistonInit(); + } + + if (Enable::PLUGDOOR) + { + PlugDoorInit(); + } + if (Enable::USER) + { + UserInit(); + } + + if (Enable::BLACKHOLE) + { + BlackHoleInit(); + } +} + +int G4Setup() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4Reco *g4Reco = new PHG4Reco(); + g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST + WorldInit(g4Reco); + g4Reco->set_rapidity_coverage(1.1); // according to drawings + 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("sPHENIX.root") != string::npos) + { + 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); + + double radius = 0.; + + //---------------------------------------- + // PIPE + 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); + } + //---------------------------------------- + // CEMC + // + if (Enable::CEMC) + { + radius = CEmc(g4Reco, radius, 8); + } + + //---------------------------------------- + // HCALIN + + if (Enable::HCALIN) + { + radius = HCalInner(g4Reco, radius, 4); + } + + //---------------------------------------- + // MAGNET + + if (Enable::MAGNET) + { + radius = Magnet(g4Reco, radius); + } + + //---------------------------------------- + // HCALOUT + + if (Enable::HCALOUT) + { + radius = HCalOuter(g4Reco, radius, 4); + } + + //---------------------------------------- + // Forward tracking + + if (Enable::FGEM) + { + FGEMSetup(g4Reco); + } + + //---------------------------------------- + // FEMC + + if (Enable::FEMC) + { + FEMCSetup(g4Reco); + } + //---------------------------------------- + // FHCAL + + if (Enable::FHCAL) + { + FHCALSetup(g4Reco); + } + if (Enable::PISTON) + { + Piston(g4Reco); + } + + if (Enable::PLUGDOOR) + { + PlugDoor(g4Reco); + } + + if (Enable::USER) + { + UserDetector(g4Reco); + } + + 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->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"); + } +} +#endif diff --git a/detectors/fsPHENIX/init_gui_vis.mac b/detectors/fsPHENIX/init_gui_vis.mac new file mode 100644 index 000000000..8aca21396 --- /dev/null +++ b/detectors/fsPHENIX/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/detectors/fsPHENIX/vis.mac b/detectors/fsPHENIX/vis.mac new file mode 100644 index 000000000..47db266aa --- /dev/null +++ b/detectors/fsPHENIX/vis.mac @@ -0,0 +1,82 @@ +# $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 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 +# 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 2 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. From 93e9b24b6f9e00e0aa0035a588b036b01e41f4f9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 10 Jul 2020 22:00:21 -0400 Subject: [PATCH 0748/1222] Add EIC Detector --- detectors/EICDetector/DisplayOn.C | 64 +++ .../EICDetector/Fun4All_G4_EICDetector.C | 492 ++++++++++++++++++ detectors/EICDetector/G4Setup_EICDetector.C | 427 +++++++++++++++ detectors/EICDetector/init_gui_vis.mac | 20 + detectors/EICDetector/vis.mac | 82 +++ 5 files changed, 1085 insertions(+) create mode 100644 detectors/EICDetector/DisplayOn.C create mode 100644 detectors/EICDetector/Fun4All_G4_EICDetector.C create mode 100644 detectors/EICDetector/G4Setup_EICDetector.C create mode 100644 detectors/EICDetector/init_gui_vis.mac create mode 100644 detectors/EICDetector/vis.mac diff --git a/detectors/EICDetector/DisplayOn.C b/detectors/EICDetector/DisplayOn.C new file mode 100644 index 000000000..028620802 --- /dev/null +++ b/detectors/EICDetector/DisplayOn.C @@ -0,0 +1,64 @@ +#ifndef MACRO_DISPLAYON_C +#define MACRO_DISPLAYON_C + +#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 +// 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.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; +} +// 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; +} +#endif diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C new file mode 100644 index 000000000..2cd1c9e1c --- /dev/null +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -0,0 +1,492 @@ +#ifndef MACRO_FUN4ALLG4EICDETECTOR_C +#define MACRO_FUN4ALLG4EICDETECTOR_C + +#include "GlobalVariables.C" + +#include "DisplayOn.C" +#include "G4Setup_EICDetector.C" +#include "G4_Bbc.C" +#include "G4_CaloTrigger.C" +#include "G4_DSTReader_EICDetector.C" +#include "G4_FwdJets.C" +#include "G4_Global.C" +#include "G4_HIJetReco.C" +#include "G4_Input.C" +#include "G4_Jets.C" +#include "G4_Production.C" + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +int Fun4All_G4_EICDetector( + const int nEvents = 1, + const string &inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", + const string &outputFile = "G4EICDetector.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 = ".") +{ + //--------------- + // Fun4All server + //--------------- + 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 initial seed + // which will produce identical results so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // 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 + // + //Input::READHITS = true; + INPUTREADHITS::filename = inputFile; + + // Or: + // Use one or more particle generators + // It is run if Input:: is set to true + // all other options only play a role if it is active + // In case embedding into a production output, please double check your G4Setup_EICDetector.C and G4_*.C consistent with those in the production macro folder + // Input::EMBED = true; + INPUTEMBED::filename = embed_input_file; + // Use Pythia 8 + // Input::PYTHIA8 = true; + + // Use Pythia 6 + // Input::PYTHIA6 = true; + + // Use Sartre + // Input::SARTRE = true; + + // Simple multi particle generator in eta/phi/pt ranges + Input::SIMPLE = true; + // Input::SIMPLE_VERBOSITY = 1; + + // Particle gun (same particles in always the same direction) + // Input::GUN = true; + Input::GUN_VERBOSITY = 0; + + // Upsilon generator + //Input::UPSILON = true; + Input::UPSILON_VERBOSITY = 0; + + // And/Or read generated particles from file + + // eic-smear output + // Input::READEIC = true; + INPUTREADEIC::filename = inputFile; + + // HepMC2 files + // Input::HEPMC = true; + Input::VERBOSITY = 0; + INPUTHEPMC::filename = inputFile; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + InputInit(); + //-------------- + // Set generator specific options + //-------------- + // can only be set after InputInit() is called + + // Simple Input generator: + if (Input::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + } + INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-3, 3); + INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); + } + // Upsilons + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator->add_decay_particles("mu", 0); + INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); + INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + // Y species - select only one, last one wins + INPUTGENERATOR::VectorMesonGenerator->set_upsilon_1s(); + } + // particle gun + if (Input::GUN) + { + INPUTGENERATOR::Gun->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + } + // pythia6 + if (Input::PYTHIA6) + { + INPUTGENERATOR::Pythia6->set_config_file("phpythia6_ep.cfg"); + } + + // register all input generators with Fun4All + InputRegister(); + +// set up production relatedstuff +// Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + // Enable::DSTOUT = true; + DstOut::OutputDir = outdir; + DstOut::OutputFile = outputFile; + Enable::DSTOUT_COMPRESS = false; // Compress DST files + + //Option to convert DST to human command readable TTree for quick poke around the outputs + //Enable::DSTREADER = true; + + //====================== + // What to run + //====================== + // Global options (enabled for all subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::BBC = true; + + // whether to simulate the Be section of the beam pipe + Enable::PIPE = true; + // EIC beam pipe extension beyond the Be-section: + //G4PIPE::use_forward_pipes = true; + + Enable::EGEM = true; + Enable::FGEM = true; + // barrel tracker + Enable::BARREL = false; + Enable::FST = false; + // mvtx/tpc tracker + Enable::MVTX = true; + Enable::TPC = true; + + Enable::TRACKING = true; + Enable::TRACKING_EVAL = Enable::TRACKING && true; + G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes + // projections to calorimeters + G4TRACKING::PROJECTION_CEMC = false; + G4TRACKING::PROJECTION_FEMC = false; + G4TRACKING::PROJECTION_FHCAL = false; + + Enable::CEMC = true; + // 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::HCALIN = true; + // 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::MAGNET = true; + + Enable::HCALOUT = true; + // 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; + + // EICDetector geometry - barrel + Enable::DIRC = true; + + // EICDetector geometry - 'hadron' direction + Enable::RICH = true; + Enable::AEROGEL = true; + + Enable::FEMC = true; + // Enable::FEMC_ABSORBER = true; + Enable::FEMC_CELL = Enable::FEMC && true; + Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; + Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; + + Enable::FHCAL = true; + // Enable::FHCAL_ABSORBER = true; + Enable::FHCAL_CELL = Enable::FHCAL && true; + Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; + Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; + + // EICDetector geometry - 'electron' direction + Enable::EEMC = true; + Enable::EEMC_CELL = Enable::EEMC && true; + Enable::EEMC_TOWER = Enable::EEMC_CELL && true; + Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; + Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; + + Enable::PLUGDOOR = true; + + // Other options + Enable::GLOBAL_RECO = true; + Enable::GLOBAL_FASTSIM = true; + + Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // Select only one jet reconstruction- they currently use the same + // output collections on the node tree! + Enable::JETS = true; + Enable::JETS_EVAL = Enable::JETS && true; + + Enable::FWDJETS = true; + Enable::FWDJETS_EVAL = Enable::FWDJETS && 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) + Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + //BlackHoleGeometry::visible = true; + + //--------------- + // World Settings + //--------------- + // G4WORLD::PhysicsList = "QGSP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans + + //--------------- + // 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.4 / 1.5; // 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 "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 (!Input::READHITS) + { + G4Setup(); + } + + //--------- + // BBC Reco + //--------- + + if (Enable::BBC) + { + BbcInit(); + Bbc_Reco(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + if (Enable::FEMC_CELL) FEMC_Cells(); + + if (Enable::FHCAL_CELL) FHCAL_Cells(); + + if (Enable::EEMC_CELL) EEMC_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(); + + //----------------------------- + // e, h direction Calorimeter towering and clustering + //----------------------------- + + if (Enable::FEMC_TOWER) FEMC_Towers(); + if (Enable::FEMC_CLUSTER) FEMC_Clusters(); + + if (Enable::FHCAL_TOWER) FHCAL_Towers(); + if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); + + if (Enable::EEMC_TOWER) EEMC_Towers(); + if (Enable::EEMC_CLUSTER) EEMC_Clusters(); + + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); + + //-------------- + // SVTX tracking + //-------------- + + if (Enable::TRACKING) Tracking_Reco(); + + //----------------- + // Global Vertexing + //----------------- + + 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::FWDJETS) Jet_FwdReco(); + + 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::DSTREADER) G4DSTreader_EICDetector(outputroot + "_DSTReader.root"); + + //---------------------- + // Simulation evaluation + //---------------------- + if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4tracking_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::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); + + if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); + + if (Enable::EEMC_EVAL) EEMC_Eval(outputroot + "_g4eemc_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); + + if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + //-------------- + // Set up Output Manager + //-------------- + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + + //----------------- + // Event processing + //----------------- + if (nEvents < 0) + { + return 0; + } + // if we run any of the particle generators and use 0 it'll run forever + if (nEvents == 0 && !Input::READHITS && !Input::HEPMC && !Input::READEIC) + { + 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); + + //----- + // 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/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C new file mode 100644 index 000000000..743181d0d --- /dev/null +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -0,0 +1,427 @@ +#ifndef MACRO_G4SETUPEICDETECTOR_C +#define MACRO_G4SETUPEICDETECTOR_C + +#include "GlobalVariables.C" + +#include "G4_Aerogel.C" +#include "G4_Barrel_EIC.C" +#include "G4_BlackHole.C" +#include "G4_CEmc_EIC.C" +#include "G4_DIRC.C" +#include "G4_EEMC.C" +#include "G4_FEMC_EIC.C" +#include "G4_FHCAL.C" +#include "G4_FST_EIC.C" +#include "G4_GEM_EIC.C" +#include "G4_HcalIn_ref.C" +#include "G4_HcalOut_ref.C" +#include "G4_Input.C" +#include "G4_Magnet.C" +#include "G4_Mvtx_EIC.C" +#include "G4_Pipe_EIC.C" +#include "G4_PlugDoor_EIC.C" +#include "G4_RICH.C" +#include "G4_TPC_EIC.C" +#include "G4_Tracking_EIC.C" +#include "G4_User.C" +#include "G4_World.C" + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void G4Init() +{ + // First some check for subsystems which do not go together + + if (Enable::TPC && Enable::FST) + { + cout << "TPC and FST cannot be enabled together" << endl; + gSystem->Exit(1); + } + else if ((Enable::TPC || Enable::MVTX) && Enable::BARREL) + { + cout << "TPC/MVTX and BARREL cannot be enabled together" << endl; + gSystem->Exit(1); + } + + // load detector/material macros and execute Init() function + if (Enable::PIPE) + { + PipeInit(); + } + + if (Enable::PLUGDOOR) + { + PlugDoorInit(); + } + + if (Enable::EGEM) + { + EGEM_Init(); + } + if (Enable::FGEM) + { + FGEM_Init(); + } + if (Enable::FST) + { + FST_Init(); + } + if (Enable::BARREL) + { + BarrelInit(); + } + if (Enable::MVTX) + { + MvtxInit(); + } + if (Enable::TPC) + { + TPCInit(); + } + if (Enable::TRACKING) + { + TrackingInit(); + } + + if (Enable::CEMC) + { + CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations + } + + if (Enable::HCALIN) + { + HCalInnerInit(1); + } + + if (Enable::MAGNET) + { + MagnetInit(); + } + if (Enable::HCALOUT) + { + HCalOuterInit(); + } + + if (Enable::FEMC) + { + FEMCInit(); + } + + if (Enable::FHCAL) + { + FHCALInit(); + } + + if (Enable::EEMC) + { + EEMCInit(); + } + + if (Enable::DIRC) + { + DIRCInit(); + } + + if (Enable::RICH) + { + RICHInit(); + } + + if (Enable::AEROGEL) + { + AerogelInit(); + } + if (Enable::USER) + { + UserInit(); + } + + if (Enable::BLACKHOLE) + { + BlackHoleInit(); + } +} + +int G4Setup() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4Reco *g4Reco = new PHG4Reco(); + + WorldInit(g4Reco); + + 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 (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("sPHENIX.root") != string::npos) + { + 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); + + double radius = 0.; + + //---------------------------------------- + // PIPE + if (Enable::PIPE) + { + radius = Pipe(g4Reco, radius); + } + //---------------------------------------- + + if (Enable::EGEM) + { + EGEMSetup(g4Reco); + } + + if (Enable::FGEM) + { + FGEMSetup(g4Reco); + } + if (Enable::FST) + { + FSTSetup(g4Reco); + } + if (Enable::BARREL) + { + Barrel(g4Reco, radius); + } + if (Enable::MVTX) + { + radius = Mvtx(g4Reco, radius); + } + if (Enable::TPC) + { + radius = TPC(g4Reco, radius); + } + + //---------------------------------------- + // CEMC + // + if (Enable::CEMC) + { + radius = CEmc(g4Reco, radius); + } + + //---------------------------------------- + // HCALIN + + if (Enable::HCALIN) + { + radius = HCalInner(g4Reco, radius, 4); + } + //---------------------------------------- + // MAGNET + + if (Enable::MAGNET) + { + radius = Magnet(g4Reco, radius); + } + //---------------------------------------- + // HCALOUT + + if (Enable::HCALOUT) + { + radius = HCalOuter(g4Reco, radius, 4); + } + //---------------------------------------- + // FEMC + + if (Enable::FEMC) + { + FEMCSetup(g4Reco); + } + + //---------------------------------------- + // FHCAL + + if (Enable::FHCAL) + { + FHCALSetup(g4Reco); + } + //---------------------------------------- + // EEMC + + if (Enable::EEMC) + { + EEMCSetup(g4Reco); + } + + //---------------------------------------- + // PID + + if (Enable::DIRC) + { + DIRCSetup(g4Reco); + } + + if (Enable::RICH) + { + RICHSetup(g4Reco); + } + + if (Enable::AEROGEL) + { + AerogelSetup(g4Reco); + } + //---------------------------------------- + // sPHENIX forward flux return door + if (Enable::PLUGDOOR) + { + PlugDoor(g4Reco); + } + if (Enable::USER) + { + UserDetector(g4Reco); + } + //---------------------------------------- + // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions + 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() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + compress->AddHitContainer("G4HIT_PIPE"); + compress->AddHitContainer("G4HIT_FIELDCAGE"); + 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"); + } +} +#endif diff --git a/detectors/EICDetector/init_gui_vis.mac b/detectors/EICDetector/init_gui_vis.mac new file mode 100644 index 000000000..8aca21396 --- /dev/null +++ b/detectors/EICDetector/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/detectors/EICDetector/vis.mac b/detectors/EICDetector/vis.mac new file mode 100644 index 000000000..47db266aa --- /dev/null +++ b/detectors/EICDetector/vis.mac @@ -0,0 +1,82 @@ +# $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 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 +# 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 2 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. From d5328ab3504bf81bd115891cf21f469208faf5ae Mon Sep 17 00:00:00 2001 From: Genki Nukazuka Date: Sat, 11 Jul 2020 16:39:48 +0900 Subject: [PATCH 0749/1222] commits to enable only INTT for implementation. they shouldn't be in the main branch. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 36 +++++++++++++++-------- macros/g4simulations/G4_Tracking.C | 26 +++++++++++----- macros/g4simulations/init_gui_vis.mac | 3 +- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index e8e2f7bcb..b7701a604 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -93,9 +93,11 @@ int Fun4All_G4_sPHENIX( // What to run //====================== - bool do_bbc = true; + // bool do_bbc = true; + bool do_bbc = false; bool do_pipe = true; + do_pipe = false; bool do_tracking = true; bool do_tracking_cell = do_tracking && true; @@ -103,23 +105,28 @@ int Fun4All_G4_sPHENIX( bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; + // bool do_pstof = false; bool do_pstof = false; - bool do_cemc = true; + // bool do_cemc = true; + bool do_cemc = false; 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 = true; + bool do_hcalin = false; 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_magnet = true; + bool do_magnet = false; - bool do_hcalout = true; + // bool do_hcalout = true; + bool do_hcalout = false; bool do_hcalout_cell = do_hcalout && true; bool do_hcalout_twr = do_hcalout_cell && true; bool do_hcalout_cluster = do_hcalout_twr && true; @@ -135,12 +142,14 @@ int Fun4All_G4_sPHENIX( //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; - bool do_global = true; + //bool do_global = true; + bool do_global = false; 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_reco = true; + bool do_jet_reco = false; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -180,14 +189,16 @@ int Fun4All_G4_sPHENIX( // Fun4All server //--------------- - bool display_on = false; + // bool display_on = false; + bool display_on = true; if(display_on) { gROOT->LoadMacro("DisplayOn.C"); } Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); + //se->Verbosity(0); + se->Verbosity( 9999 ); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. PHRandomSeed::Verbosity(1); @@ -624,11 +635,12 @@ int Fun4All_G4_sPHENIX( if(display_on) { - DisplayOn(); + //DisplayOn(); + QTGui(); // prevent macro from finishing so can see display int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; + // cout << "***** Enter any integer to proceed" << endl; + // cin >> i; } se->run(nEvents); diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 84e74bc26..0c1179bc0 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -67,7 +67,8 @@ R__LOAD_LIBRARY(libPHTpcTracker.so) //============================================== ////////////// MVTX -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_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers +const int n_maps_layer = 0; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers /////////////// INTT int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely @@ -75,9 +76,15 @@ int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI}; -int nladder[4] = {15, 15, 18, 18}; -double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +//int nladder[4] = {15, 15, 18, 18}; +//int nladder[4] = {1, 12, 16, 16}; // for debigging +int nladder[4] = {12, 12, 16, 16}; // new 30/05/2020 +//double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default +double sensor_radius[4] = { 7.188, 7.732, 9.680, 10.262}; // radius of center of sensor for layer default, new 30/05/2020 + double offsetphi[4] = {0.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; +//double offsetphi[4] = {90.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 @@ -116,14 +123,13 @@ const bool use_truth_vertex = true; // set to false to get initial vertex from //const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. - void TrackingInit(int verbosity = 0) { } double Tracking(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, - int verbosity = 0) + int verbosity = 1) { // create the three tracker subsystems gSystem->Load("libg4mvtx.so"); @@ -158,7 +164,8 @@ double Tracking(PHG4Reco* g4Reco, double radius, // INTT ladders //------------------- - bool intt_overlapcheck = false; // set to true if you want to check for overlaps + //bool intt_overlapcheck = false; // set to true if you want to check for overlaps + bool intt_overlapcheck = true; // set to true if you want to check for overlaps // instantiate the INTT subsystem and register it // We make one instance of PHG4INTTSubsystem for all four layers of tracker @@ -170,7 +177,9 @@ double Tracking(PHG4Reco* g4Reco, double radius, // The length of vpair is used to determine the number of layers std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < n_intt_layer; i++) + //for (int i = 0; i < 1; i++) // for debigging { // 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(n_maps_layer + i, i)); // sphxlayer=n_maps_layer+i corresponding to inttlayer=i @@ -188,7 +197,7 @@ double Tracking(PHG4Reco* g4Reco, double radius, cout << "Intt has " << n_intt_layer << " layers with layer setup:" << endl; for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); sitrack->set_int_param(i, "nladder", nladder[i]); @@ -196,6 +205,9 @@ double Tracking(PHG4Reco* g4Reco, double radius, sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } + //sitrack->set_int_param(0, "laddertype", laddertype[0]); + cout << string(100, '-' ) << endl << "End of INTT set init params" << endl; + // outer radius marker (translation back to cm) radius = intt_radius_max * 0.1; } diff --git a/macros/g4simulations/init_gui_vis.mac b/macros/g4simulations/init_gui_vis.mac index 8aca21396..e27b08667 100644 --- a/macros/g4simulations/init_gui_vis.mac +++ b/macros/g4simulations/init_gui_vis.mac @@ -17,4 +17,5 @@ # /vis/scene/create # open graphics (opengl QT) -/vis/open OGL +/vis/open OGL 1800x1200-500+500 +/vis/viewer/set/background white \ No newline at end of file From 9f4274ae5d2a58ef60c8f4407d8fefa2a42f7435 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 13 Jul 2020 11:23:51 -0400 Subject: [PATCH 0750/1222] create HepMC Input Manager in Init so Fun4All macro can set options --- common/G4_Input.C | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 451d40313..ed1c9e0aa 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -100,6 +100,11 @@ namespace INPUTGENERATOR PHSartreParticleTrigger *SartreTrigger = nullptr; } // namespace INPUTGENERATOR +namespace INPUTMANAGER +{ + Fun4AllHepMCInputManager *HepMCInputManager = nullptr; +} + void InputInit() { // first consistency checks - not all input generators play nice @@ -151,6 +156,11 @@ void InputInit() { INPUTGENERATOR::VectorMesonGenerator = new PHG4ParticleGeneratorVectorMeson(); } +// input managers for which we might need to set options + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager = new Fun4AllHepMCInputManager("HEPMCin"); + } } void InputRegister() @@ -218,10 +228,9 @@ void InputManagers() } if (Input::HEPMC) { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); - in->Verbosity(Input::VERBOSITY); - se->registerInputManager(in); - se->fileopen(in->Name(), INPUTHEPMC::filename); + INPUTMANAGER::HepMCInputManager->Verbosity(Input::VERBOSITY); + se->registerInputManager(INPUTMANAGER::HepMCInputManager); + se->fileopen(INPUTMANAGER::HepMCInputManager->Name(), INPUTHEPMC::filename); } else if (Input::READHITS) { From 185446392cbe324c2bfa3ef2f536add213b1ab39 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 13 Jul 2020 11:26:38 -0400 Subject: [PATCH 0751/1222] clang-format --- common/DisplayOn.C | 2 +- common/G4_Bbc.C | 19 ++- common/G4_CEmc_EIC.C | 2 +- common/G4_CEmc_Spacal.C | 1 - common/G4_DSTReader_fsPHENIX.C | 233 ++++++++++++++++----------------- common/G4_EEMC.C | 2 +- common/G4_FEMC.C | 8 +- common/G4_FEMC_EIC.C | 2 +- common/G4_FGEM_fsPHENIX.C | 10 +- common/G4_FwdJets.C | 6 +- common/G4_GEM_EIC.C | 2 +- common/G4_HcalIn_ref.C | 2 +- common/G4_HcalOut_ref.C | 10 +- common/G4_Input.C | 2 +- common/G4_Jets.C | 84 ++++++------ common/G4_Magnet.C | 4 +- common/G4_PSTOF.C | 1 - common/G4_Pipe_EIC.C | 2 +- common/G4_Piston.C | 106 ++++++++------- common/G4_PlugDoor.C | 6 +- common/G4_PlugDoor_EIC.C | 2 +- common/G4_PlugDoor_fsPHENIX.C | 2 - common/G4_Production.C | 2 +- common/G4_Tracking.C | 2 +- common/G4_Tracking_EIC.C | 7 +- 25 files changed, 250 insertions(+), 269 deletions(-) diff --git a/common/DisplayOn.C b/common/DisplayOn.C index 72b69734e..f458a1c4b 100644 --- a/common/DisplayOn.C +++ b/common/DisplayOn.C @@ -33,7 +33,7 @@ PHG4Reco *QTGui() // 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(); diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index ffdcc5cbf..9a390edbf 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -14,26 +14,25 @@ namespace Enable namespace G4BBC { - double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC - double t_smearing = 0.002; // 20ps timing resolution -} + double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC + double t_smearing = 0.002; // 20ps timing resolution +} // namespace G4BBC void BbcInit() {} -void Bbc_Reco(int verbosity = 0) { - - +void Bbc_Reco(int verbosity = 0) +{ //--------------- // Fun4All server //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); + Fun4AllServer* se = Fun4AllServer::instance(); BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps + bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing + bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps se->registerSubsystem(bbcvertex); return; -} +} #endif diff --git a/common/G4_CEmc_EIC.C b/common/G4_CEmc_EIC.C index b5e7aeb3e..193e48e7d 100644 --- a/common/G4_CEmc_EIC.C +++ b/common/G4_CEmc_EIC.C @@ -36,7 +36,7 @@ namespace Enable bool CEMC_CLUSTER = false; bool CEMC_EVAL = false; int CEMC_VERBOSITY = 0; -} +} // namespace Enable namespace G4CEMC { diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 2cd2c9661..4d8433b39 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -30,7 +30,6 @@ 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) diff --git a/common/G4_DSTReader_fsPHENIX.C b/common/G4_DSTReader_fsPHENIX.C index 35fb7c546..38bd6ffe4 100644 --- a/common/G4_DSTReader_fsPHENIX.C +++ b/common/G4_DSTReader_fsPHENIX.C @@ -3,17 +3,16 @@ #include "GlobalVariables.C" -#include "G4_Intt.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" #include "G4_CEmc_Spacal.C" +#include "G4_FEMC.C" +#include "G4_FGEM_fsPHENIX.C" +#include "G4_FHCAL.C" #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" +#include "G4_Intt.C" #include "G4_Magnet.C" -#include "G4_FHCAL.C" -#include "G4_FEMC.C" -#include "G4_FGEM_fsPHENIX.C" - +#include "G4_Mvtx.C" +#include "G4_TPC.C" #include @@ -21,7 +20,6 @@ R__LOAD_LIBRARY(libg4eval.so) - ////////////////////////////////////////////////////////////////// /*! \file G4_DSTReader.C @@ -36,154 +34,149 @@ 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 G4DSTreader_fsPHENIXInit() {} -void -G4DSTreader_fsPHENIX( const string &outputFile = "G4sPHENIXCells.root") +void G4DSTreader_fsPHENIX(const string &outputFile = "G4sPHENIXCells.root") { - //! debug output on screen? - int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); + int verbosity = max(Enable::VERBOSITY, Enable::DSTREADER_VERBOSITY); // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader(outputFile); + 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); + ana->Verbosity(verbosity); if (G4DSTREADER::save_g4_raw) + { + if (Enable::MVTX) + { + ana->AddNode("MVTX"); + } + if (Enable::INTT) + { + ana->AddNode("INTT"); + } + if (Enable::TPC) { - if (Enable::MVTX) - { - ana->AddNode("MVTX"); - } - if (Enable::INTT) - { - ana->AddNode("INTT"); - } - if (Enable::TPC) - { - ana->AddNode("TPC"); - } - - 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::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } - - if (Enable::FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - if (Enable::BLACKHOLE) + ana->AddNode("TPC"); + } + + if (Enable::CEMC) + { + ana->AddNode("CEMC"); + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) { - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); + ana->AddNode("ABSORBER_CEMC"); + ana->AddNode("CEMC_ELECTRONICS"); + ana->AddNode("CEMC_SPT"); } } - ana->set_tower_zero_sup(G4DSTREADER::tower_zero_supp); - if (Enable::CEMC_TOWER) + if (Enable::HCALIN) { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); + ana->AddNode("HCALIN"); + if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) + ana->AddNode("ABSORBER_HCALIN"); } - if (Enable::HCALIN_TOWER) + + if (Enable::MAGNET) { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); + if (Enable::ABSORBER || Enable::MAGNET_ABSORBER) + ana->AddNode("MAGNET"); } - if (Enable::HCALOUT_TOWER) + + if (Enable::HCALOUT) { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); + ana->AddNode("HCALOUT"); + if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER) + ana->AddNode("ABSORBER_HCALOUT"); } - if (Enable::FHCAL_TOWER) + + if (Enable::FHCAL) { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); + ana->AddNode("FHCAL"); + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) + ana->AddNode("ABSORBER_FHCAL"); } - if (Enable::FEMC_TOWER) + + if (Enable::FEMC) { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); + ana->AddNode("FEMC"); + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) + ana->AddNode("ABSORBER_FEMC"); } + if (Enable::FGEM) + { + ana->AddNode("FGEM_0"); + ana->AddNode("FGEM_1"); + ana->AddNode("FGEM_2"); + ana->AddNode("FGEM_3"); + ana->AddNode("FGEM_4"); + } + 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"); + } + if (Enable::FHCAL_TOWER) + { + ana->AddTower("SIM_FHCAL"); + ana->AddTower("RAW_FHCAL"); + ana->AddTower("CALIB_FHCAL"); + } + if (Enable::FEMC_TOWER) + { + ana->AddTower("SIM_FEMC"); + ana->AddTower("RAW_FEMC"); + ana->AddTower("CALIB_FEMC"); + } + // Jets disabled for now -// if (Enable::JETS) -// { -// -// ana->AddJet("AntiKt06JetsInPerfect"); -// ana->AddJet("G4TowerJets_6"); -// } -// if (embed_input_file && do_jet_reco) -// { -// ana->AddJet("G4TowerJets_combined_6"); -// } + // if (Enable::JETS) + // { + // + // 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/common/G4_EEMC.C b/common/G4_EEMC.C index 13880bd70..4a92ebbe6 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -31,7 +31,7 @@ namespace Enable bool EEMC_EVAL = false; bool EEMC_OVERLAPCHECK = false; int EEMC_VERBOSITY = 0; -} +} // namespace Enable namespace G4EEMC { diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C index 99193374a..ed94f9ef7 100644 --- a/common/G4_FEMC.C +++ b/common/G4_FEMC.C @@ -63,7 +63,7 @@ void FEMCInit() void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) { - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive>0); + bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive > 0); bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; Fun4AllServer *se = Fun4AllServer::instance(); @@ -100,7 +100,7 @@ void FEMC_Cells() void FEMC_Towers() { - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_femc; @@ -220,7 +220,7 @@ void FEMC_Towers() void FEMC_Clusters() { - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -255,7 +255,7 @@ void FEMC_Clusters() void FEMC_Eval(std::string outputfile) { - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index 0199172f6..da2ce7be3 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -29,7 +29,7 @@ namespace Enable bool FEMC_EVAL = false; bool FEMC_OVERLAPCHECK = false; int FEMC_VERBOSITY = 0; -} +} // namespace Enable namespace G4FEMC { diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C index d3cb8850c..d208dcbab 100644 --- a/common/G4_FGEM_fsPHENIX.C +++ b/common/G4_FGEM_fsPHENIX.C @@ -30,13 +30,13 @@ namespace Enable bool FGEM_TRACK = false; bool FGEM_EVAL = false; int FGEM_VERBOSITY = 0; -} +} // namespace Enable void FGEM_Init() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); - TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks + TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -234,7 +234,7 @@ int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, void FGEM_FastSim_Reco() { -int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); //--------------- // Fun4All server @@ -330,7 +330,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); if (Enable::FEMC) { - kalman->add_state_name("FEMC"); + kalman->add_state_name("FEMC"); } if (Enable::FHCAL) { @@ -341,7 +341,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); void FGEM_FastSim_Eval(const std::string &outputfile) { -int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C index c21f4bcbb..7b11234f0 100644 --- a/common/G4_FwdJets.C +++ b/common/G4_FwdJets.C @@ -18,13 +18,13 @@ namespace Enable bool FWDJETS = false; bool FWDJETS_EVAL = false; int FWDJETS_VERBOSITY = 0; -} +} // namespace Enable void Jet_FwdRecoInit() {} void Jet_FwdReco() { -int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -67,7 +67,7 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") { -int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C index edfbda84b..f58936e0c 100644 --- a/common/G4_GEM_EIC.C +++ b/common/G4_GEM_EIC.C @@ -107,7 +107,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // gem->get_geometry().AddLayers_HBD_GEM(); gem->OverlapCheck(Enable::OVERLAPCHECK); g4Reco->registerSubsystem(gem); - + /////////////////////////////////////////////////////////////////////////// name = "FGEM_4"; diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 54b229c28..7dcd13206 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -26,7 +26,7 @@ R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) R__LOAD_LIBRARY(libg4eval.so) - void HCalInner_SupportRing(PHG4Reco *g4Reco); +void HCalInner_SupportRing(PHG4Reco *g4Reco); namespace Enable { diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 857ba4883..611ed038a 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -66,7 +66,7 @@ double HCalOuter(PHG4Reco *g4Reco, { bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); // hcal->set_double_param("inner_radius", 183.3); @@ -124,7 +124,7 @@ double HCalOuter(PHG4Reco *g4Reco, void HCALOuter_Cells() { - int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -146,7 +146,7 @@ void HCALOuter_Cells() void HCALOuter_Towers() { - int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -185,7 +185,7 @@ void HCALOuter_Towers() void HCALOuter_Clusters() { - int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -215,7 +215,7 @@ void HCALOuter_Clusters() void HCALOuter_Eval(const std::string &outputfile) { - int verbosity = std::max(Enable::VERBOSITY,Enable::HCALOUT_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); diff --git a/common/G4_Input.C b/common/G4_Input.C index ed1c9e0aa..47fda8dde 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -156,7 +156,7 @@ void InputInit() { INPUTGENERATOR::VectorMesonGenerator = new PHG4ParticleGeneratorVectorMeson(); } -// input managers for which we might need to set options + // input managers for which we might need to set options if (Input::HEPMC) { INPUTMANAGER::HepMCInputManager = new Fun4AllHepMCInputManager("HEPMCin"); diff --git a/common/G4_Jets.C b/common/G4_Jets.C index 8ba618029..f90337512 100644 --- a/common/G4_Jets.C +++ b/common/G4_Jets.C @@ -22,26 +22,26 @@ namespace Enable bool JETS = false; bool JETS_EVAL = false; int JETS_VERBOSITY = 0; -} +} // namespace Enable void JetInit() {} -void Jet_Reco() { - -int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); +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->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); @@ -52,13 +52,13 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); 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->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); @@ -69,49 +69,49 @@ int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); 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->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->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); + se->registerSubsystem(trackjetreco); - return; + return; } void Jet_Eval(const std::string &outfilename = "g4jets_eval.root") { -int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); + 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); + JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", + "AntiKt_Tower_r03", + "AntiKt_Truth_r03", + outfilename); eval->Verbosity(verbosity); se->registerSubsystem(eval); - + return; } #endif diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 48a2acd64..385d47426 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -23,7 +23,7 @@ namespace G4MAGNET double magnet_outer_cryostat_wall_thickness = 2.5; double magnet_length = 379.; double magfield_rescale = 1; - string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); } // namespace G4MAGNET @@ -38,7 +38,7 @@ 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); + int verbosity = std::max(Enable::VERBOSITY, Enable::MAGNET_VERBOSITY); double magnet_inner_cryostat_wall_radius = 142; double magnet_inner_cryostat_wall_thickness = 1; diff --git a/common/G4_PSTOF.C b/common/G4_PSTOF.C index 23098f8d3..faa3a9ee4 100644 --- a/common/G4_PSTOF.C +++ b/common/G4_PSTOF.C @@ -26,7 +26,6 @@ void PSTOFInit() double PSTOF(PHG4Reco* g4Reco, double radius) { - PHG4PSTOFSubsystem* pstof = new PHG4PSTOFSubsystem("PSTOF"); pstof->SuperDetector("PSTOF"); // pstof->SetActive(-1,1); // set all modules active diff --git a/common/G4_Pipe_EIC.C b/common/G4_Pipe_EIC.C index 558c30c3d..95036de73 100644 --- a/common/G4_Pipe_EIC.C +++ b/common/G4_Pipe_EIC.C @@ -19,7 +19,7 @@ namespace Enable bool PIPE_ABSORBER = false; bool PIPE_OVERLAPCHECK = false; int PIPE_VERBOSITY = 0; -} +} // namespace Enable namespace G4PIPE { diff --git a/common/G4_Piston.C b/common/G4_Piston.C index 1b1264a05..459fc01c1 100644 --- a/common/G4_Piston.C +++ b/common/G4_Piston.C @@ -22,18 +22,18 @@ namespace Enable namespace G4PISTON { - double zpos1 = 305. - 20.; // front of forward ECal/MPC - double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that + double zpos1 = 305. - 20.; // front of forward ECal/MPC + double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap + double calorimeter_hole_diameter = 9.92331 * 2; // side length of the middle hole of MPC that } // namespace G4PISTON void PistonInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter/2.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,((G4PISTON::zpos2 + G4PISTON::zpos1) / 2.+(G4PISTON::zpos2 - G4PISTON::zpos1)/2.) ); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter / 2.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, ((G4PISTON::zpos2 + G4PISTON::zpos1) / 2. + (G4PISTON::zpos2 - G4PISTON::zpos1) / 2.)); } -void Piston(PHG4Reco* g4Reco, +void Piston(PHG4Reco *g4Reco, const int absorberactive = 0) { bool AbsorberActive = Enable::ABSORBER || Enable::PISTON_ABSORBER || absorberactive; @@ -41,81 +41,77 @@ void Piston(PHG4Reco* g4Reco, int verbosity = std::max(Enable::VERBOSITY, Enable::PISTON_VERBOSITY); string name = "magpiston"; - const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::be_pipe_length * 0.5; // first large GEM station + const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::be_pipe_length * 0.5; // first large GEM station const double beampipe_radius = G4PIPE::be_pipe_radius; // teeth cone section specific const double number_of_wteeth = 100; - const double teeth_thickness = 0.3504 * 2; //2 X0 + 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 + (G4PISTON::zpos1 - zpos0) / 2; -// cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos -// << endl; + // cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos + // << endl; PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); magpiston->SetPlaceZ((G4PISTON::zpos1 + zpos0) / 2); magpiston->SetR1(beampipe_radius, - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * zpos0); + 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)) * G4PISTON::zpos1); + tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * G4PISTON::zpos1); magpiston->SetMaterial("G4_Fe"); magpiston->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(magpiston); -// PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); -// magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); -// magpiston->SetPlaceZ(pos); -// magpiston->Set_eta_range(eta_outter, eta_inner); -// magpiston->SetMaterial("G4_Fe"); -// magpiston->SuperDetector(name); -// magpiston->SetActive(false); -// g4Reco->registerSubsystem(magpiston); + // PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); + // magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); + // magpiston->SetPlaceZ(pos); + // magpiston->Set_eta_range(eta_outter, eta_inner); + // magpiston->SetMaterial("G4_Fe"); + // magpiston->SuperDetector(name); + // 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); - if (AbsorberActive) magpiston->SetActive(); - magpiston->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston); - pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); - } + { + 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); + if (AbsorberActive) magpiston->SetActive(); + magpiston->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(magpiston); + pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); + } // last piece connect to the field return PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_double_param("length",G4PISTON::zpos2 - G4PISTON::zpos1); + magpiston2->set_double_param("length", G4PISTON::zpos2 - G4PISTON::zpos1); magpiston2->set_double_param("place_z", (G4PISTON::zpos2 + G4PISTON::zpos1) / 2.); - magpiston2->set_double_param("radius",beampipe_radius); - magpiston2->set_double_param("thickness",G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); - magpiston2->set_string_param("material","G4_Fe"); + magpiston2->set_double_param("radius", beampipe_radius); + magpiston2->set_double_param("thickness", G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); + magpiston2->set_string_param("material", "G4_Fe"); magpiston2->SuperDetector(name); if (AbsorberActive) magpiston2->SetActive(); magpiston2->OverlapCheck(OverlapCheck); diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C index ab86f4b50..8463b25cf 100644 --- a/common/G4_PlugDoor.C +++ b/common/G4_PlugDoor.C @@ -9,7 +9,6 @@ R__LOAD_LIBRARY(libg4detectors.so) - namespace Enable { bool PLUGDOOR = false; @@ -43,7 +42,6 @@ void PlugDoor(PHG4Reco *g4Reco) const string material("Steel_1006"); - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); flux_return_plus->set_double_param("length", G4PLUGDOOR::length); flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); @@ -51,7 +49,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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->SuperDetector("FLUXRET_ETA_PLUS"); flux_return_plus->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(flux_return_plus); @@ -62,7 +60,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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->SuperDetector("FLUXRET_ETA_MINUS"); flux_return_minus->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(flux_return_minus); diff --git a/common/G4_PlugDoor_EIC.C b/common/G4_PlugDoor_EIC.C index e8aaf7e7a..c3e68dcbe 100644 --- a/common/G4_PlugDoor_EIC.C +++ b/common/G4_PlugDoor_EIC.C @@ -14,7 +14,7 @@ namespace Enable bool PLUGDOOR = false; bool PLUGDOOR_ABSORBER = false; bool PLUGDOOR_OVERLAPCHECK = false; -} +} // namespace Enable namespace G4PLUGDOOR { diff --git a/common/G4_PlugDoor_fsPHENIX.C b/common/G4_PlugDoor_fsPHENIX.C index 4d1739fb8..571706815 100644 --- a/common/G4_PlugDoor_fsPHENIX.C +++ b/common/G4_PlugDoor_fsPHENIX.C @@ -33,8 +33,6 @@ void PlugDoorInit() void PlugDoor(PHG4Reco *g4Reco) { - - //---------------------------------------- // fsPHENIX forward flux return(s) bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; diff --git a/common/G4_Production.C b/common/G4_Production.C index bf0caef65..4993c4cc0 100644 --- a/common/G4_Production.C +++ b/common/G4_Production.C @@ -25,7 +25,7 @@ void Production_MoveOutput() { if (Enable::DSTOUT) { - string fulloutfile = DstOut::OutputDir + "/" + DstOut::OutputFile; + string fulloutfile = DstOut::OutputDir + "/" + DstOut::OutputFile; string mvcmd = "mv " + fulloutfile + " " + PRODUCTION::SaveOutputDir; gSystem->Exec(mvcmd.c_str()); } diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 4d0bc9c77..528fdeae2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -4,9 +4,9 @@ #include "GlobalVariables.C" #include "G4_Intt.C" +#include "G4_Micromegas.C" #include "G4_Mvtx.C" #include "G4_TPC.C" -#include "G4_Micromegas.C" #include diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index 7cbf66ee5..2310fda88 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -46,7 +46,6 @@ void TrackingInit() //-----------------------------------------------------------------------------// void Tracking_Reco() { - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); //--------------- // Fun4All server @@ -63,9 +62,9 @@ void Tracking_Reco() // which would lead to worse momentum resolution for prompt tracks // but this allows displaced track analysis including DCA and vertex finding kalman->set_use_vertex_in_fitting(false); - kalman->set_vertex_xy_resolution(0);// do not smear the vertex used in the built-in DCA calculation - kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation - kalman->enable_vertexing(true); // enable vertex finding and fitting + kalman->set_vertex_xy_resolution(0); // do not smear the vertex used in the built-in DCA calculation + kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation + kalman->enable_vertexing(true); // enable vertex finding and fitting } else { From a0ed5fb8996446bdc11252ec0bba758cadb3e6ae Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 13 Jul 2020 11:28:11 -0400 Subject: [PATCH 0752/1222] set HepMC input manager vertex smearing --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 025c071af..d24face06 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -86,7 +86,7 @@ int Fun4All_G4_sPHENIX( // Input::UPSILON = true; Input::UPSILON_VERBOSITY = 0; - // Input::HEPMC = true; +// Input::HEPMC = true; Input::VERBOSITY = 0; INPUTHEPMC::filename = inputFile; @@ -141,6 +141,23 @@ int Fun4All_G4_sPHENIX( INPUTGENERATOR::Gun->set_vtx(0, 0, 0); } + //-------------- + // Set Input Manager specific options + //-------------- + // can only be set after InputInit() is called + + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,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(2); + } // register all input generators with Fun4All InputRegister(); From ae466ccb4a4dd445455e42aa25f6940805911f06 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 13 Jul 2020 11:29:41 -0400 Subject: [PATCH 0753/1222] set HepMC input manager vertex smearing, disable production setting --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index b278267d3..5fd464b9a 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -135,11 +135,29 @@ int Fun4All_G4_fsPHENIX( INPUTGENERATOR::Gun->set_vtx(0, 0, 0); } + //-------------- + // Set Input Manager specific options + //-------------- + // can only be set after InputInit() is called + + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,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(2); + } + // register all input generators with Fun4All InputRegister(); // set up production relatedstuff - Enable::PRODUCTION = true; +// Enable::PRODUCTION = true; //====================== // Write the DST From 16350824fcf81371d345bc4e3c23cd43fdb758bc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 13 Jul 2020 11:30:46 -0400 Subject: [PATCH 0754/1222] set HepMC input manager vertex smearing, disable production setting --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 2cd1c9e1c..39b4669a0 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -149,6 +149,24 @@ int Fun4All_G4_EICDetector( INPUTGENERATOR::Pythia6->set_config_file("phpythia6_ep.cfg"); } + //-------------- + // Set Input Manager specific options + //-------------- + // can only be set after InputInit() is called + + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,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(2); + } + // register all input generators with Fun4All InputRegister(); From 65e5cc3aa35dae2d8c1fea239919fbbdff49e6fa Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 14 Jul 2020 18:37:44 -0400 Subject: [PATCH 0755/1222] retire zero suppression in the calibration module --- common/G4_HcalIn_ref.C | 1 - common/G4_HcalOut_ref.C | 1 - macros/g4simulations/G4_HcalIn_ref.C | 1 - macros/g4simulations/G4_HcalOut_ref.C | 1 - 4 files changed, 4 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 7dcd13206..d62777b6a 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -253,7 +253,6 @@ void HCALInner_Towers() 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; diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 611ed038a..96a597591 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -177,7 +177,6 @@ void HCALOuter_Towers() 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; diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C index c404134a6..950ea3e5a 100644 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ b/macros/g4simulations/G4_HcalIn_ref.C @@ -255,7 +255,6 @@ void HCALInner_Towers() 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; diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C index 47e389b77..e42700978 100644 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ b/macros/g4simulations/G4_HcalOut_ref.C @@ -177,7 +177,6 @@ void HCALOuter_Towers() 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; From a2241bf84ddd2d739063a3e0ad85413752a34bd5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 15 Jul 2020 11:19:50 -0400 Subject: [PATCH 0756/1222] disable dst writing --- macros/g4simulations/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C index 9be9fbe93..8c63e4c77 100644 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ b/macros/g4simulations/Fun4All_G4_EICDetector.C @@ -112,7 +112,7 @@ int Fun4All_G4_EICDetector( // Write the DST //====================== - Enable::DSTOUT = true; +// Enable::DSTOUT = true; Enable::DSTOUT_COMPRESS = false; // Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs //Enable::DSTREADER = true; From a89cb3a2ad97d67dbd2ce509f95c4aea4b2b8942 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 17 Jul 2020 11:05:36 -0400 Subject: [PATCH 0757/1222] Adding flag to run acts fitter --- macros/g4simulations/G4_Tracking.C | 108 +++++++++++++++-------------- 1 file changed, 57 insertions(+), 51 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f35b75e47..774838db5 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -110,6 +110,7 @@ const bool use_hough_seeding = false; //choose seeding algo const bool use_ca_seeding = false; const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead +const bool useActsFitting = false; // true for PHActsTrkFitter, false for PHGenFitTrkFitter const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -528,11 +529,12 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(0); - se->registerSubsystem(sl); - + if (useActsFitting) + { + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + se->registerSubsystem(sl); + } //------------- // Tracking //------------ @@ -612,47 +614,49 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ // Fitting of tracks using Kalman Filter //------------------------------------------------ - - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - /// Always run PHActsTracks first to take the SvtxTrack and convert it - /// to a form that Acts can process - - /// If you run PHActsTrkProp, disable PHGenFitTrkProp - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->setTimeAnalysis(true); - se->registerSubsystem(actsFit); - - - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); - - if (use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); - kalman->set_use_truth_vertex(false); - - //se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - //se->registerSubsystem(projection); - + if (useActsFitting) + { + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + /// Always run PHActsTracks first to take the SvtxTrack and convert it + /// to a form that Acts can process + + /// If you run PHActsTrkProp, disable PHGenFitTrkProp + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->setTimeAnalysis(false); + se->registerSubsystem(actsFit); + } + else + { + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(0); + + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + return; } @@ -690,11 +694,13 @@ void Tracking_Reco(int verbosity = 0) eval->Verbosity(0); se->registerSubsystem(eval); - - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - se->registerSubsystem(actsEval); - + if(useActsFitting) + { + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + se->registerSubsystem(actsEval); + } + if (use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From ea599b40faada44471745a235a711a0391d4cb57 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 17 Jul 2020 11:11:16 -0400 Subject: [PATCH 0758/1222] Revert "Adding flag to run acts fitter" This reverts commit a89cb3a2ad97d67dbd2ce509f95c4aea4b2b8942. --- macros/g4simulations/G4_Tracking.C | 108 ++++++++++++++--------------- 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 774838db5..f35b75e47 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -110,7 +110,6 @@ const bool use_hough_seeding = false; //choose seeding algo const bool use_ca_seeding = false; const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead -const bool useActsFitting = false; // true for PHActsTrkFitter, false for PHGenFitTrkFitter const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -529,12 +528,11 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - if (useActsFitting) - { - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(0); - se->registerSubsystem(sl); - } + + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + se->registerSubsystem(sl); + //------------- // Tracking //------------ @@ -614,49 +612,47 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ // Fitting of tracks using Kalman Filter //------------------------------------------------ - if (useActsFitting) - { - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - /// Always run PHActsTracks first to take the SvtxTrack and convert it - /// to a form that Acts can process - - /// If you run PHActsTrkProp, disable PHGenFitTrkProp - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->setTimeAnalysis(false); - se->registerSubsystem(actsFit); - } - else - { - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); - - if (use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); - } - + + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + /// Always run PHActsTracks first to take the SvtxTrack and convert it + /// to a form that Acts can process + + /// If you run PHActsTrkProp, disable PHGenFitTrkProp + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->setTimeAnalysis(true); + se->registerSubsystem(actsFit); + + + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(0); + + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + + //se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + //se->registerSubsystem(projection); + return; } @@ -694,13 +690,11 @@ void Tracking_Reco(int verbosity = 0) eval->Verbosity(0); se->registerSubsystem(eval); - if(useActsFitting) - { - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - se->registerSubsystem(actsEval); - } - + + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + se->registerSubsystem(actsEval); + if (use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From 11fe6fafceef948a270b358edb34b1211abbdb2c Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 17 Jul 2020 11:54:00 -0400 Subject: [PATCH 0759/1222] fixed running with/without acts --- macros/g4simulations/G4_Tracking.C | 105 +++++++++++++++-------------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f35b75e47..b8efb6712 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -110,6 +110,7 @@ const bool use_hough_seeding = false; //choose seeding algo const bool use_ca_seeding = false; const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead +const bool useActsFitting = false; // true to use PHActsTrkFitter, false to use PHGenFitTrkFitter const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -528,10 +529,12 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(0); - se->registerSubsystem(sl); + if(useActsFitting) + { + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + se->registerSubsystem(sl); + } //------------- // Tracking @@ -612,46 +615,49 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ // Fitting of tracks using Kalman Filter //------------------------------------------------ - - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - /// Always run PHActsTracks first to take the SvtxTrack and convert it - /// to a form that Acts can process - - /// If you run PHActsTrkProp, disable PHGenFitTrkProp - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->setTimeAnalysis(true); - se->registerSubsystem(actsFit); - - - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); - - if (use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); - kalman->set_use_truth_vertex(false); - - //se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - //se->registerSubsystem(projection); + if(useActsFitting) + { + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + /// Always run PHActsTracks first to take the SvtxTrack and convert it + /// to a form that Acts can process + + /// If you run PHActsTrkProp, disable PHGenFitTrkProp + //PHActsTrkProp *actsProp = new PHActsTrkProp(); + //actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->setTimeAnalysis(true); + se->registerSubsystem(actsFit); + } + else + { + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(0); + + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } return; } @@ -690,11 +696,12 @@ void Tracking_Reco(int verbosity = 0) eval->Verbosity(0); se->registerSubsystem(eval); - - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - se->registerSubsystem(actsEval); - + if(useActsFitting) + { + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + se->registerSubsystem(actsEval); + } if (use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From 66e4f930dd1cc2606922931e896c92569d1cefc3 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 20 Jul 2020 13:16:54 -0400 Subject: [PATCH 0760/1222] Add in c++17 check for acts modules --- macros/g4simulations/G4_Tracking.C | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index b8efb6712..dd2e23b64 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -42,11 +42,14 @@ #include #include #include + +#if __cplusplus >= 201703L #include #include #include #include #include +#endif #include @@ -529,13 +532,17 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); + if(useActsFitting) { + #if __cplusplus >= 201703L PHActsSourceLinks *sl = new PHActsSourceLinks(); sl->Verbosity(0); se->registerSubsystem(sl); + #endif } + //------------- // Tracking //------------ @@ -615,8 +622,10 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ // Fitting of tracks using Kalman Filter //------------------------------------------------ + if(useActsFitting) { + #if __cplusplus >= 201703L PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); @@ -636,6 +645,7 @@ void Tracking_Reco(int verbosity = 0) actsFit->Verbosity(0); actsFit->setTimeAnalysis(true); se->registerSubsystem(actsFit); + #endif } else { @@ -698,10 +708,12 @@ void Tracking_Reco(int verbosity = 0) if(useActsFitting) { + #if __cplusplus >= 201703L ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); se->registerSubsystem(actsEval); - } + #endif + } if (use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From a264ce22e0b41102314951b212ebc8e3d1160317 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Jul 2020 11:32:57 -0400 Subject: [PATCH 0761/1222] adjust HepMCNodeReader --- macros/g4simulations/G4_Input.C | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C index 65b00f26c..a998bfb42 100644 --- a/macros/g4simulations/G4_Input.C +++ b/macros/g4simulations/G4_Input.C @@ -130,20 +130,21 @@ void InputInit() InputUpsilonInit(); } + if (Input::READEIC) + { + ReadEICFiles *eicr = new ReadEICFiles(); + eicr->OpenInputFile(INPUTREADEIC::filename); + se->registerSubsystem(eicr); + } + // here are the various utility modules which read particles and // put them onto the G4 particle stack - if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) + if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::READEIC) { // read-in HepMC events to Geant4 if there is any HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); } - if (Input::READEIC) - { - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(INPUTREADEIC::filename); - se->registerSubsystem(eicr); - } } void InputManagers() From c1fe1c27e66b5d05d2eca0cd8c880df17f7e813f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 20 Jul 2020 14:28:42 -0400 Subject: [PATCH 0762/1222] adjust HepMCNodeReader --- common/G4_Input.C | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 47fda8dde..8bb57ff65 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -199,20 +199,20 @@ void InputRegister() INPUTGENERATOR::Gun->Verbosity(Input::GUN_VERBOSITY); se->registerSubsystem(INPUTGENERATOR::Gun); } + if (Input::READEIC) + { + ReadEICFiles *eicr = new ReadEICFiles(); + eicr->OpenInputFile(INPUTREADEIC::filename); + se->registerSubsystem(eicr); + } // here are the various utility modules which read particles and // put them onto the G4 particle stack - if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6) + if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::READEIC) { // read-in HepMC events to Geant4 if there is any HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); } - if (Input::READEIC) - { - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(INPUTREADEIC::filename); - se->registerSubsystem(eicr); - } } void InputManagers() From aa26c9bd33f1fe7fe2e5b22fb3263657b690c4ff Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 21 Jul 2020 18:00:35 -0400 Subject: [PATCH 0763/1222] Beta version of MVTX service barrel This version contains three concentric cylinders of copper, water and finally polyethylene. The layers begin at r = 8.5cm and z = -25cm (the z-gap will likely be filled by the FPC extensions). Each layer is a solid ring, accounting for the total material contribution from 48 staves. The number of service layers can be easily configured by setting the number of layers, layer start position and number of staves supplied by that layer. The calculations and placements are then done by the rest of the macro Additionally, this macro contains code with parameters for all the individual cables and tubing but is currently commented out. For example, this means there is code for the number of ground wires with the inner and outer radii of the wire that each stave requires. A function can be written at a later date to correctly produce each service bundle when this is defined, if required. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 11 +- macros/g4simulations/G4Setup_sPHENIX.C | 15 +- macros/g4simulations/G4_MvtxService.C | 209 ++++++++++++++++++++++ 3 files changed, 229 insertions(+), 6 deletions(-) create mode 100644 macros/g4simulations/G4_MvtxService.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index e8e2f7bcb..0790602a8 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -96,6 +96,7 @@ int Fun4All_G4_sPHENIX( bool do_bbc = true; bool do_pipe = true; + bool do_mvtxservice = true; bool do_tracking = true; bool do_tracking_cell = do_tracking && true; @@ -169,7 +170,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc); + G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_mvtxservice); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -197,12 +198,12 @@ int Fun4All_G4_sPHENIX( // 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() + // 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); + rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -362,10 +363,10 @@ int Fun4All_G4_sPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservice, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservic, emagfield_rescale); #endif } diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index 9d87b3bd5..a9b9be503 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -9,6 +9,7 @@ #include "G4_HcalOut_ref.C" #include "G4_PlugDoor.C" #include "G4_FEMC.C" +#include "G4_MvtxService.C" #include #include @@ -40,7 +41,8 @@ void G4Init(const bool do_tracking = true, const bool do_hcalout = true, const bool do_pipe = true, const bool do_plugdoor = false, - const bool do_FEMC = false + const bool do_FEMC = false, + const bool do_mvtxservice = false ) { @@ -96,6 +98,11 @@ void G4Init(const bool do_tracking = true, gROOT->LoadMacro("G4_FEMC.C"); FEMCInit(); } + if (do_mvtxservice) + { + gROOT->LoadMacro("G4_MvtxService.C"); + MVTXServiceInit(); + } } @@ -117,6 +124,7 @@ int G4Setup(const int absorberactive = 0, const bool do_plugdoor = false, // const bool do_plugdoor = true, const bool do_FEMC = false, + const bool do_mvtxservice = false, const float magfield_rescale = 1.0) { //--------------- @@ -208,6 +216,9 @@ int G4Setup(const int absorberactive = 0, // forward EMC if(do_FEMC) FEMCSetup(g4Reco, absorberactive); + //MVTX service barrel + if(do_mvtxservice) radius = MVTXService(g4Reco, radius); + //---------------------------------------- // BLACKHOLE @@ -297,6 +308,7 @@ void ShowerCompress(int verbosity = 0) { compress->AddTowerContainer("TOWER_SIM_FEMC"); compress->AddTowerContainer("TOWER_RAW_FEMC"); compress->AddTowerContainer("TOWER_CALIB_FEMC"); + compress->AddHitContainer("G4HIT_MVTXSERVICE"); se->registerSubsystem(compress); return; @@ -325,5 +337,6 @@ void DstCompress(Fun4AllDstOutputManager* out) { out->StripNode("G4HIT_FEMC"); out->StripNode("G4HIT_ABSORBER_FEMC"); out->StripNode("G4CELL_FEMC"); + out->StripNode("G4HIT_MVTXSERVICE"); } } diff --git a/macros/g4simulations/G4_MvtxService.C b/macros/g4simulations/G4_MvtxService.C new file mode 100644 index 000000000..1a1809de5 --- /dev/null +++ b/macros/g4simulations/G4_MvtxService.C @@ -0,0 +1,209 @@ +/******************************/ +/* MVTX Service Barrel */ +/* Cameron Dean */ +/* cdean@lanl.gov */ +/* 07/17/2020 */ +/******************************/ + +#ifndef MACRO_G4MVTXSERVICE_C +#define MACRO_G4MVTXSERVICE_C + +#include "GlobalVariables.C" + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +const double pi = 3.14159265358979323846; + +namespace Enable +{ + bool MVTXSERVICE = false; + bool MVTXSERVICE_ABSORBER = false; + bool MVTXSERVICE_OVERLAPCHECK = false; + int MVTXSERVICE_VERBOSITY = 0; +} // namespace Enable + +namespace G4MVTXSERVICE +{ + /* + * These are the parameters for all cables/wires/tubes for the MVTX service barrel + * Uncomment and use these when it is time to make a more detailed service barrel model + * DEFAULT G4 UNITS ARE CM, GEV AND NS + + double signal_wire_copper_area = 0.0102; //[mm^2] Cross sectional area of copper for one signal wire + double signal_wire_plastic_area = 0.0407; //[mm^2] Cross sectional area of plastic for one signal wire + int n_signal_wires_per_stave = 12; //Number of signal wires for each stave + + double digital_power_OR = 1.175; //Digital power parameters, [OR/IR] is the [outer/inner] radius of the cable sheath + double digital_power_IR = 0.775; + double digital_power_copper_area = calculateArea( 0, digital_power_IR ); + double digital_power_plastic_area = calculateArea( digital_power_IR, digital_power_OR ); + int n_digital_power = 2; + + double analogue_power_OR = 0.775; //Analogue power parameters + double analogue_power_IR = 0.375; + double analogue_power_copper_area = calculateArea( 0, analogue_power_IR ); + double analogue_power_plastic_area = calculateArea( analogue_power_IR, analogue_power_OR ); + int n_analogue_power = 2; + + double ground_power_OR = 0.725; //Ground power parameters + double ground_power_IR = 0.325; + double ground_power_copper_area = calculateArea( 0, ground_power_IR ); + double ground_power_plastic_area = calculateArea( ground_power_IR, ground_power_OR ); + int n_ground_power = 6; + + double power_cable_sheath_OR = 4.3; //The power cables are enclosed within their own plastic sheath + double power_cable_sheath_IR = 3.3; + double power_cable_sheath_area = calculateArea( power_cable_sheath_IR, power_cable_sheath_OR ); + + double power_cable_copper_area = n_digital_power*digital_power_copper_area + + n_analogue_power*analogue_power_copper_area + + n_ground_power*ground_power_copper_area; //[mm^2] Cross sectional area of copper for one power cable + double power_cable_plastic_area = power_cable_sheath_area + + n_digital_power*digital_power_plastic_area + + n_analogue_power*analogue_power_plastic_area + + n_ground_power*ground_power_plastic_area; //[mm^2] Cross sectional area of plastic for one power cable + double power_cable_air_area = 27.2; //[mm^2] Free space in each power cable + int n_power_cabless_per_stave = 1; //Number of power cables for each stave + + double cooling_tube_OR = 0.794; //Outer radius of cooling tube + double cooling_tube_IR = 0.397; //Inner radius of cooling tube + double cooling_tube_water_area = calculateArea( 0, cooling_tube_IR); //[mm^2] Cross sectional area of water for one cooling tube + double cooling_tube_plastic_area = calculateArea( cooling_tube_IR, cooling_tube_OR); //[mm^2] Cross sectional area of plastic for one cooling tube + int n_cooling_tubes_per_stave = 2; //Number of cooling tubes for each stave + + */ + double single_stave_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] + double single_stave_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] + double single_stave_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] + + const int n_layers = 1; //Number of service cable layers to generate + double layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] + int n_staves_layer[] = {48}; //Number of staves associated to each layer + + double service_barrel_radius = 10.75; // [cm] From final design review + double service_barrel_start = 25; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) + double service_barrel_length = 120; // [cm] length of service barrel ~(to patch panel) +} // namespace G4MVTXSERVICE + + +double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk +{ + return pi*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); +} + +double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area +{ + return std::sqrt( area/pi + std::pow( inner_radius, 2 ) ); +} + +void calculateMaterialBoundaries(int& layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs +{ + outer_copper_radius = calculateOR( G4MVTXSERVICE::layer_start_radius[layer_ID], G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_copper_area ); + outer_water_radius = calculateOR( outer_copper_radius, G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_water_area ); + outer_plastic_radius = calculateOR( outer_water_radius, G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_plastic_area ); +} + +void MVTXServiceInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTXSERVICE::service_barrel_radius); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start)); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, -G4MVTXSERVICE::service_barrel_start); +} + +double MVTXService(PHG4Reco* g4Reco, double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::MVTXSERVICE_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MVTXSERVICE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTXSERVICE_VERBOSITY); +/* + if (radius > G4MVTXSERVICE::service_barrel_radius) + { + std::cout << "inconsistency: radius: " << radius + << " larger than service barrel radius: " << G4MVTXSERVICE::service_barrel_radius << std::endl; + gSystem->Exit(-1); + } +*/ + // Note, cables are all south + //Setup layers + double copper_OR[G4MVTXSERVICE::n_layers], water_OR[G4MVTXSERVICE::n_layers], plastic_OR[G4MVTXSERVICE::n_layers]; //Objects for material outer radii + std::string copper_name, water_name, plastic_name; + PHG4CylinderSubsystem* cyl; + + for (int i = 0; i < G4MVTXSERVICE::n_layers; ++i) //Build a layer of copper, then water, then plastic + { + calculateMaterialBoundaries(i, copper_OR[i], water_OR[i], plastic_OR[i]); + + copper_name = "MVTX_Service_copper_layer_" + std::to_string(i); + water_name = "MVTX_Service_water_layer_" + std::to_string(i); + plastic_name = "MVTX_Service_plastic_layer_" + std::to_string(i); + + cyl = new PHG4CylinderSubsystem(copper_name, G4MVTXSERVICE::n_layers*i); + cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", G4MVTXSERVICE::layer_start_radius[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); + cyl->set_string_param("material", "G4_Cu"); + cyl->set_double_param("thickness", copper_OR[i] - G4MVTXSERVICE::layer_start_radius[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem(water_name, G4MVTXSERVICE::n_layers*i + 1); + cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", copper_OR[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); + cyl->set_string_param("material", "G4_WATER"); + cyl->set_double_param("thickness", water_OR[i] - copper_OR[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem(plastic_name, G4MVTXSERVICE::n_layers*i + 2); + cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", water_OR[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); + cyl->set_string_param("material", "G4_POLYETHYLENE"); + cyl->set_double_param("thickness", plastic_OR[i] - water_OR[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + } + + radius = G4MVTXSERVICE::service_barrel_radius; + + if (verbosity > 0) + { + cout << "=========================== G4_MVTXService.C::MVTXService() =============================" << endl; + cout << " MVTX Service Material Description:" << endl; + + cout << " Single stave copper area = " << G4MVTXSERVICE::single_stave_copper_area << " cm^2" << endl; + cout << " Single stave water area = " << G4MVTXSERVICE::single_stave_water_area << " cm^2" << endl; + cout << " Single stave plastic area = " << G4MVTXSERVICE::single_stave_plastic_area << " cm^2" << endl; + + for (int j = 0; j < G4MVTXSERVICE::n_layers; ++j) + { + cout << " Layer " << j << " starts at " << G4MVTXSERVICE::layer_start_radius[j] << " cm" << endl; + cout << " Layer " << j << " services " << G4MVTXSERVICE::n_staves_layer[j] << " staves" << endl; + } + + cout << " Service barrel radius = " << G4MVTXSERVICE::service_barrel_radius << " cm" << endl; + cout << " Service barrel start = " << G4MVTXSERVICE::service_barrel_start << " cm" << endl; + cout << " Service barrel length = " << G4MVTXSERVICE::service_barrel_length << " cm" << endl; + cout << "=========================================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} +#endif From e9891f723bc9f80ba84a05cca92680355fcdc43f Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 23 Jul 2020 22:13:54 -0400 Subject: [PATCH 0764/1222] Updates to MVTX service barrel Added outer shell. It's 1mm thick carbon peek Moved service barrel closer to MVTX and made it 30cm longer to match what is in https://indico.bnl.gov/event/7165/contributions/33358/attachments/26404/39985/20200129_MVTX_Review_Mechanics_Bessuille_V2.pdf --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- macros/g4simulations/G4_MvtxService.C | 26 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 0790602a8..c2ae54c94 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -203,7 +203,7 @@ int Fun4All_G4_sPHENIX( // 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); + //rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation diff --git a/macros/g4simulations/G4_MvtxService.C b/macros/g4simulations/G4_MvtxService.C index 1a1809de5..9f97b620b 100644 --- a/macros/g4simulations/G4_MvtxService.C +++ b/macros/g4simulations/G4_MvtxService.C @@ -85,8 +85,8 @@ namespace G4MVTXSERVICE int n_staves_layer[] = {48}; //Number of staves associated to each layer double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = 25; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) - double service_barrel_length = 120; // [cm] length of service barrel ~(to patch panel) + double service_barrel_start = 10; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) + double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTXSERVICE @@ -130,6 +130,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) // Note, cables are all south //Setup layers double copper_OR[G4MVTXSERVICE::n_layers], water_OR[G4MVTXSERVICE::n_layers], plastic_OR[G4MVTXSERVICE::n_layers]; //Objects for material outer radii + int subsystem_layer = 0 std::string copper_name, water_name, plastic_name; PHG4CylinderSubsystem* cyl; @@ -141,7 +142,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) water_name = "MVTX_Service_water_layer_" + std::to_string(i); plastic_name = "MVTX_Service_plastic_layer_" + std::to_string(i); - cyl = new PHG4CylinderSubsystem(copper_name, G4MVTXSERVICE::n_layers*i); + cyl = new PHG4CylinderSubsystem(copper_name, subsystem_layer); cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", G4MVTXSERVICE::layer_start_radius[i]); cyl->set_int_param("lengthviarapidity", 0); @@ -152,8 +153,9 @@ double MVTXService(PHG4Reco* g4Reco, double radius) if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); + subsystem_layer += 1; - cyl = new PHG4CylinderSubsystem(water_name, G4MVTXSERVICE::n_layers*i + 1); + cyl = new PHG4CylinderSubsystem(water_name, subsystem_layer); cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", copper_OR[i]); cyl->set_int_param("lengthviarapidity", 0); @@ -164,8 +166,9 @@ double MVTXService(PHG4Reco* g4Reco, double radius) if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); + subsystem_layer += 1; - cyl = new PHG4CylinderSubsystem(plastic_name, G4MVTXSERVICE::n_layers*i + 2); + cyl = new PHG4CylinderSubsystem(plastic_name, subsystem_layer); cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", water_OR[i]); cyl->set_int_param("lengthviarapidity", 0); @@ -176,9 +179,22 @@ double MVTXService(PHG4Reco* g4Reco, double radius) if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); + subsystem_layer += 1; } + cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_layer", subsystem_layer); + cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", service_barrel_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); + cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) + cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + radius = G4MVTXSERVICE::service_barrel_radius; if (verbosity > 0) From 60769048a454dcc7a2b54eb60e19a4907cbf3c59 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 23 Jul 2020 22:21:12 -0400 Subject: [PATCH 0765/1222] Fixed typo in Fun4All_G4_sPHENIX.C --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index c2ae54c94..1592f3e32 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -366,7 +366,7 @@ int Fun4All_G4_sPHENIX( do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservice, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservic, emagfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservice, magfield_rescale); #endif } From e42e30e435743b16cec1a3a79bcedb528acddf08 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 23 Jul 2020 22:50:09 -0400 Subject: [PATCH 0766/1222] Moved MVTX Service barrel to G4_Mvtx.C --- common/G4_Mvtx.C | 138 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index b9d07e6f1..a6eca4d89 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -20,12 +20,15 @@ R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libmvtx.so) +const double pi = 3.14159265358979323846; + namespace Enable { bool MVTX = false; bool MVTX_OVERLAPCHECK = false; bool MVTX_CELL = false; bool MVTX_CLUSTER = false; + bool MVTX_SERVICE = true; int MVTX_VERBOSITY = 0; } // namespace Enable @@ -34,12 +37,26 @@ 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 + + double single_stave_service_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] + double single_stave_service_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] + double single_stave_service_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] + + const int n_service_layers = 1; //Number of service cable service_layers to generate + double service_layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] + int n_staves_service_layer[] = {48}; //Number of staves associated to each service layer + + double service_barrel_radius = 10.75; // [cm] From final design review + double service_barrel_start = 10; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) + double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTX void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); + //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::service_barrel_radius); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start)); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } @@ -66,6 +83,7 @@ double Mvtx(PHG4Reco* g4Reco, double radius, mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); radius += G4MVTX::radius_offset; + if (MVTX_SERVICE) radius += MVTXService(g4Reco, radius); return radius; } @@ -101,4 +119,120 @@ void Mvtx_Clustering() mvtxclusterizer->Verbosity(verbosity); se->registerSubsystem(mvtxclusterizer); } + +double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk +{ + return pi*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); +} + +double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area +{ + return std::sqrt( area/pi + std::pow( inner_radius, 2 ) ); +} + +void calculateMaterialBoundaries(int& service_layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs +{ + outer_copper_radius = calculateOR( G4MVTX::service_layer_start_radius[service_layer_ID], G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_copper_area ); + outer_water_radius = calculateOR( outer_copper_radius, G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_water_area ); + outer_plastic_radius = calculateOR( outer_water_radius, G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_plastic_area ); +} + +double MVTXService(PHG4Reco* g4Reco, double radius) +{ +// Note, cables are all south +// Setup service_layers + double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii + int subsystem_service_layer = 0 + std::string copper_name, water_name, plastic_name; + PHG4CylinderSubsystem* cyl; + + for (int i = 0; i < G4MVTX::n_service_layers; ++i) //Build a service_layer of copper, then water, then plastic + { + calculateMaterialBoundaries(i, copper_OR[i], water_OR[i], plastic_OR[i]); + + copper_name = "MVTX_Service_copper_service_layer_" + std::to_string(i); + water_name = "MVTX_Service_water_service_layer_" + std::to_string(i); + plastic_name = "MVTX_Service_plastic_service_layer_" + std::to_string(i); + + cyl = new PHG4CylinderSubsystem(copper_name, subsystem_service_layer); + cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", G4MVTX::service_layer_start_radius[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTX::service_barrel_length); + cyl->set_string_param("material", "G4_Cu"); + cyl->set_double_param("thickness", copper_OR[i] - G4MVTX::service_layer_start_radius[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + subsystem_service_layer += 1; + + cyl = new PHG4CylinderSubsystem(water_name, subsystem_service_layer); + cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", copper_OR[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTX::service_barrel_length); + cyl->set_string_param("material", "G4_WATER"); + cyl->set_double_param("thickness", water_OR[i] - copper_OR[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + subsystem_service_layer += 1; + + cyl = new PHG4CylinderSubsystem(plastic_name, subsystem_service_layer); + cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", water_OR[i]); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTX::service_barrel_length); + cyl->set_string_param("material", "G4_POLYETHYLENE"); + cyl->set_double_param("thickness", plastic_OR[i] - water_OR[i]); + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + subsystem_service_layer += 1; + + } + + cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_service_layer", subsystem_service_layer); + cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("radius", service_barrel_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MVTX::service_barrel_length); + cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) + cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick + cyl->SuperDetector("MVTXSERVICE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + radius = G4MVTX::service_barrel_radius; + + if (verbosity > 0) + { + cout << "=========================== G4_MVTXService.C::MVTXService() =============================" << endl; + cout << " MVTX Service Material Description:" << endl; + + cout << " Single stave copper area = " << G4MVTX::single_stave_service_copper_area << " cm^2" << endl; + cout << " Single stave water area = " << G4MVTX::single_stave_service_water_area << " cm^2" << endl; + cout << " Single stave plastic area = " << G4MVTX::single_stave_service_plastic_area << " cm^2" << endl; + + for (int j = 0; j < G4MVTX::n_service_layers; ++j) + { + cout << " service_layer " << j << " starts at " << G4MVTX::service_layer_start_radius[j] << " cm" << endl; + cout << " service_layer " << j << " services " << G4MVTX::n_staves_service_layer[j] << " staves" << endl; + } + + cout << " Service barrel radius = " << G4MVTX::service_barrel_radius << " cm" << endl; + cout << " Service barrel start = " << G4MVTX::service_barrel_start << " cm" << endl; + cout << " Service barrel length = " << G4MVTX::service_barrel_length << " cm" << endl; + cout << "=========================================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} + #endif From 7311f7a1de0c972f84cc0484acdfbdc39becd5d5 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 23 Jul 2020 23:52:30 -0400 Subject: [PATCH 0767/1222] Update to service barrel after checking event display Added a missing namespace and semicolon Moved service barrel start to +35cm. Is the z=0 not defined as the center of the MVTX? --- common/G4_Mvtx.C | 6 +++--- macros/g4simulations/G4_MvtxService.C | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index a6eca4d89..e7dd9c618 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -47,7 +47,7 @@ namespace G4MVTX int n_staves_service_layer[] = {48}; //Number of staves associated to each service layer double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = 10; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) + double service_barrel_start = -35; //[cm] Approx. double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTX @@ -142,7 +142,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) // Note, cables are all south // Setup service_layers double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii - int subsystem_service_layer = 0 + int subsystem_service_layer = 0; std::string copper_name, water_name, plastic_name; PHG4CylinderSubsystem* cyl; @@ -197,7 +197,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_service_layer", subsystem_service_layer); cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", service_barrel_radius); + cyl->set_double_param("radius", G4MVTX::service_barrel_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTX::service_barrel_length); cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) diff --git a/macros/g4simulations/G4_MvtxService.C b/macros/g4simulations/G4_MvtxService.C index 9f97b620b..4aa6ceb74 100644 --- a/macros/g4simulations/G4_MvtxService.C +++ b/macros/g4simulations/G4_MvtxService.C @@ -85,7 +85,7 @@ namespace G4MVTXSERVICE int n_staves_layer[] = {48}; //Number of staves associated to each layer double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = 10; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) + double service_barrel_start = -35; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTXSERVICE @@ -130,7 +130,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) // Note, cables are all south //Setup layers double copper_OR[G4MVTXSERVICE::n_layers], water_OR[G4MVTXSERVICE::n_layers], plastic_OR[G4MVTXSERVICE::n_layers]; //Objects for material outer radii - int subsystem_layer = 0 + int subsystem_layer = 0; std::string copper_name, water_name, plastic_name; PHG4CylinderSubsystem* cyl; @@ -185,7 +185,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_layer", subsystem_layer); cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", service_barrel_radius); + cyl->set_double_param("radius", G4MVTXSERVICE::service_barrel_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) From de01fb98bf464debe597dfb644b44e2edd3bb97c Mon Sep 17 00:00:00 2001 From: cdean-github Date: Fri, 24 Jul 2020 14:40:00 -0400 Subject: [PATCH 0768/1222] Added missing namespace Also added 3 variables that were out-of-scope for the service barrel. Simulation has been checked in local common area --- common/G4_Mvtx.C | 126 +++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index e7dd9c618..e77299706 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -28,6 +28,7 @@ namespace Enable bool MVTX_OVERLAPCHECK = false; bool MVTX_CELL = false; bool MVTX_CLUSTER = false; + bool MVTX_ABSORBER = false; bool MVTX_SERVICE = true; int MVTX_VERBOSITY = 0; @@ -60,66 +61,6 @@ void MvtxInit() BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } -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]; - if (verbosity) - { - cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; - } - radius = radius_lyr / 10.; - } - 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; - if (MVTX_SERVICE) radius += MVTXService(g4Reco, radius); - 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); - for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); - } - se->registerSubsystem(maps_hits); - return; -} - -void Mvtx_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); - 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); - // For the Mvtx layers - //================ - MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); - mvtxclusterizer->Verbosity(verbosity); - se->registerSubsystem(mvtxclusterizer); -} - double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk { return pi*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); @@ -141,6 +82,10 @@ double MVTXService(PHG4Reco* g4Reco, double radius) { // Note, cables are all south // Setup service_layers + bool AbsorberActive = Enable::ABSORBER || Enable::MVTX_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii int subsystem_service_layer = 0; std::string copper_name, water_name, plastic_name; @@ -235,4 +180,65 @@ double MVTXService(PHG4Reco* g4Reco, double radius) return radius; } +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]; + if (verbosity) + { + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + } + radius = radius_lyr / 10.; + } + 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; + if (Enable::MVTX_SERVICE) radius += MVTXService(g4Reco, radius); + 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); + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) + { + // override the default timing window for this layer - default is +/- 5000 ns + maps_hits->set_timing_window(ilayer, -5000, 5000); + } + se->registerSubsystem(maps_hits); + return; +} + +void Mvtx_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + 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); + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); +} + + #endif From 21af9f4b76460e308c176def9f53dc6a66e72b6f Mon Sep 17 00:00:00 2001 From: cdean-github Date: Mon, 27 Jul 2020 12:37:02 -0400 Subject: [PATCH 0769/1222] Fix to definition of pi There was a definition of pi already in scope from CLHEP/Units/SystemOfUnits.h:55:27 Switched pi to use M_PI as was already included --- common/G4_Mvtx.C | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index e77299706..a7a57e3e5 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -20,8 +20,6 @@ R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libmvtx.so) -const double pi = 3.14159265358979323846; - namespace Enable { bool MVTX = false; @@ -30,7 +28,7 @@ namespace Enable bool MVTX_CLUSTER = false; bool MVTX_ABSORBER = false; bool MVTX_SERVICE = true; - int MVTX_VERBOSITY = 0; + int MVTX_VERBOSITY = 1; } // namespace Enable @@ -63,12 +61,12 @@ void MvtxInit() double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk { - return pi*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); + return M_PI*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); } double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area { - return std::sqrt( area/pi + std::pow( inner_radius, 2 ) ); + return std::sqrt( area/M_PI + std::pow( inner_radius, 2 ) ); } void calculateMaterialBoundaries(int& service_layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs From d42c0bc5617b10b4ff9b2bb8e0b3f210d3b7cb43 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Jul 2020 18:40:01 -0400 Subject: [PATCH 0770/1222] get pythia6 config file from calibrations --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 39b4669a0..205bdab5a 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -146,7 +146,7 @@ int Fun4All_G4_EICDetector( // pythia6 if (Input::PYTHIA6) { - INPUTGENERATOR::Pythia6->set_config_file("phpythia6_ep.cfg"); + INPUTGENERATOR::Pythia6->set_config_file(string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6_ep.cfg"); } //-------------- From a8e975251cb9b22c8ad29e6e179303b0570a9560 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Jul 2020 18:40:41 -0400 Subject: [PATCH 0771/1222] fetch generator config files from CALIBRATIONROOT --- common/G4_Input.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 8bb57ff65..729522041 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -69,17 +69,17 @@ namespace INPUTEMBED namespace PYTHIA6 { - string config_file = "phpythia6.cfg"; + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6.cfg"; } namespace PYTHIA8 { - string config_file = "phpythia8.cfg"; + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia8.cfg"; } namespace SARTRE { - string config_file = "sartre.cfg"; + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/sartre.cfg"; } namespace PILEUP From 46bd0d5eee168648935f2e3f5cf3f165eca53555 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Jul 2020 18:47:03 -0400 Subject: [PATCH 0772/1222] remove spaces in filename (this is asking for trouble) --- common/G4_Pipe_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Pipe_EIC.C b/common/G4_Pipe_EIC.C index 95036de73..f4de43593 100644 --- a/common/G4_Pipe_EIC.C +++ b/common/G4_Pipe_EIC.C @@ -103,7 +103,7 @@ double Pipe(PHG4Reco* g4Reco, if (do_pipe_electron_forward_extension) { PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector_chamber_3-20-20.G4Import.gdml"); gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance gdml->OverlapCheck(OverlapCheck); @@ -113,7 +113,7 @@ double Pipe(PHG4Reco* g4Reco, if (do_pipe_hadron_forward_extension) { PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); + gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector_chamber_3-20-20.G4Import.gdml"); gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance gdml->OverlapCheck(OverlapCheck); From 14a801dcdd4fc5fd9d3e47b2779e3b3ffc497751 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 29 Jul 2020 10:10:05 -0400 Subject: [PATCH 0773/1222] rerun vertexing to get good vertex for acts --- macros/g4simulations/G4_Tracking.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index dd2e23b64..47d008952 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -625,6 +625,12 @@ void Tracking_Reco(int verbosity = 0) if(useActsFitting) { + // Rerun vertexing since the Hough seeding writes over the initial + // truth vertexing + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(0); + se->registerSubsystem(init_vtx); + #if __cplusplus >= 201703L PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); From e572455da232a83819ce9b50489a31271f637607 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 30 Jul 2020 13:41:11 -0400 Subject: [PATCH 0774/1222] Remove re-vertexing --- macros/g4simulations/G4_Tracking.C | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 47d008952..f0e930602 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -624,13 +624,7 @@ void Tracking_Reco(int verbosity = 0) //------------------------------------------------ if(useActsFitting) - { - // Rerun vertexing since the Hough seeding writes over the initial - // truth vertexing - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - + { #if __cplusplus >= 201703L PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); From 4bcfc9c9e80cbc8dc475ffb25150e810afdfa836 Mon Sep 17 00:00:00 2001 From: Genki Nukazuka Date: Mon, 3 Aug 2020 02:03:36 -0400 Subject: [PATCH 0775/1222] Position of INTT (distance from the beam-axis to silicon sensors) and the number of ladder in a layer were updated. Useful flag for INTT implementation was added as wel. --- macros/g4simulations/G4_Tracking.C | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 0c1179bc0..1f3348953 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -67,23 +67,22 @@ R__LOAD_LIBRARY(libPHTpcTracker.so) //============================================== ////////////// MVTX -//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_maps_layer = 0; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers +const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers /////////////// INTT +bool flag_ladder_debug = false; // false: run as usual, true: only single ladder in the innermost layer is shoen int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI}; -//int nladder[4] = {15, 15, 18, 18}; -//int nladder[4] = {1, 12, 16, 16}; // for debigging -int nladder[4] = {12, 12, 16, 16}; // new 30/05/2020 -//double sensor_radius[4] = { 8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default -double sensor_radius[4] = { 7.188, 7.732, 9.680, 10.262}; // radius of center of sensor for layer default, new 30/05/2020 + +int nladder[4] = {12, 12, 16, 16}; +// Radius of center of sensor for layer default, the subtractions of 14 um is due to the difference of the glue thickness for the sensors(14 um) and FPHX chips (50um) +// The ladder volume is defined using t_FPHXglue but not t_Siglue to contain everything, the surface of FPHX chips are placed at the planned position. So subtraction of (50-14) um is needed. +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]}; -//double offsetphi[4] = {90.0, 0.5 * 360.0 / nladder[1] , 0.0, 0.5 * 360.0 / nladder[3]}; enum enu_InttDeadMapType // Dead map options for INTT { @@ -129,7 +128,7 @@ void TrackingInit(int verbosity = 0) double Tracking(PHG4Reco* g4Reco, double radius, const int absorberactive = 0, - int verbosity = 1) + int verbosity = 0) { // create the three tracker subsystems gSystem->Load("libg4mvtx.so"); @@ -164,8 +163,14 @@ double Tracking(PHG4Reco* g4Reco, double radius, // INTT ladders //------------------- - //bool intt_overlapcheck = false; // set to true if you want to check for overlaps - bool intt_overlapcheck = true; // set to true if you want to check for overlaps + if( flag_ladder_debug == true ) + { + nladder[0] = 1; // number of ladder in the innermost layer + offsetphi[0] = 90.0; // put the first ladder in the innermost layer on the top + + } + + bool intt_overlapcheck = false; // set to true if you want to check for overlaps // instantiate the INTT subsystem and register it // We make one instance of PHG4INTTSubsystem for all four layers of tracker @@ -179,8 +184,13 @@ double Tracking(PHG4Reco* g4Reco, double radius, std::vector> vpair; // (sphxlayer, inttlayer) for (int i = 0; i < n_intt_layer; i++) - //for (int i = 0; i < 1; i++) // for debigging { + // make only the innermost layer if the flag is true + if( flag_ladder_debug == true && i >= 1 ) + { + break; + } + // 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(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; @@ -205,7 +215,6 @@ double Tracking(PHG4Reco* g4Reco, double radius, sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees } - //sitrack->set_int_param(0, "laddertype", laddertype[0]); cout << string(100, '-' ) << endl << "End of INTT set init params" << endl; // outer radius marker (translation back to cm) From 664622f6b160d34c5ccdf8e1618111f2ed4379d4 Mon Sep 17 00:00:00 2001 From: Genki Nukazuka Date: Mon, 3 Aug 2020 02:39:41 -0400 Subject: [PATCH 0776/1222] codes for myself removed --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 36 ++++++++--------------- macros/g4simulations/init_gui_vis.mac | 3 +- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index b7701a604..e8e2f7bcb 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -93,11 +93,9 @@ int Fun4All_G4_sPHENIX( // What to run //====================== - // bool do_bbc = true; - bool do_bbc = false; + bool do_bbc = true; bool do_pipe = true; - do_pipe = false; bool do_tracking = true; bool do_tracking_cell = do_tracking && true; @@ -105,28 +103,23 @@ int Fun4All_G4_sPHENIX( bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_track && true; - // bool do_pstof = false; bool do_pstof = false; - // bool do_cemc = true; - bool do_cemc = 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 = 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 && true; - // bool do_magnet = true; - bool do_magnet = false; + bool do_magnet = true; - // bool do_hcalout = true; - bool do_hcalout = false; + 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; @@ -142,14 +135,12 @@ int Fun4All_G4_sPHENIX( //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; - //bool do_global = true; - bool do_global = false; + 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_reco = false; + bool do_jet_reco = true; bool do_jet_eval = do_jet_reco && true; // HI Jet Reco for p+Au / Au+Au collisions (default is false for @@ -189,16 +180,14 @@ int Fun4All_G4_sPHENIX( // Fun4All server //--------------- - // bool display_on = false; - bool display_on = true; + bool display_on = false; if(display_on) { gROOT->LoadMacro("DisplayOn.C"); } Fun4AllServer *se = Fun4AllServer::instance(); - //se->Verbosity(0); - se->Verbosity( 9999 ); + se->Verbosity(0); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. PHRandomSeed::Verbosity(1); @@ -635,12 +624,11 @@ int Fun4All_G4_sPHENIX( if(display_on) { - //DisplayOn(); - QTGui(); + DisplayOn(); // prevent macro from finishing so can see display int i; - // cout << "***** Enter any integer to proceed" << endl; - // cin >> i; + cout << "***** Enter any integer to proceed" << endl; + cin >> i; } se->run(nEvents); diff --git a/macros/g4simulations/init_gui_vis.mac b/macros/g4simulations/init_gui_vis.mac index e27b08667..8aca21396 100644 --- a/macros/g4simulations/init_gui_vis.mac +++ b/macros/g4simulations/init_gui_vis.mac @@ -17,5 +17,4 @@ # /vis/scene/create # open graphics (opengl QT) -/vis/open OGL 1800x1200-500+500 -/vis/viewer/set/background white \ No newline at end of file +/vis/open OGL From 2f94ec6867a04eaec28d8a64247b3524f7181bce Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 3 Aug 2020 12:03:28 -0400 Subject: [PATCH 0777/1222] Add gap for black hole to determine worl size --- common/G4_World.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_World.C b/common/G4_World.C index 9eebe2b82..ca6e3cf59 100644 --- a/common/G4_World.C +++ b/common/G4_World.C @@ -22,11 +22,11 @@ void WorldInit(PHG4Reco *g4Reco) void WorldSize(PHG4Reco *g4Reco, double radius) { - double world_radius = std::max(radius, BlackHoleGeometry::max_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, -((g4Reco->GetWorldSizeZ() - 100) / 2.)); - double max_zval = std::max(BlackHoleGeometry::max_z, (g4Reco->GetWorldSizeZ() - 100) / 2.); + 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; From d53ca8e3c1d8027af15b4b67705c85a491b1f63b Mon Sep 17 00:00:00 2001 From: cdean-github Date: Mon, 3 Aug 2020 12:44:35 -0400 Subject: [PATCH 0778/1222] Minor commit to turn off MVTX verbosity (and change a cout line which referred to G4_MvtxService.C in the common area) --- common/G4_Mvtx.C | 6 +++--- macros/g4simulations/G4_MvtxService.C | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index a7a57e3e5..0fb5f8a9e 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -28,7 +28,7 @@ namespace Enable bool MVTX_CLUSTER = false; bool MVTX_ABSORBER = false; bool MVTX_SERVICE = true; - int MVTX_VERBOSITY = 1; + int MVTX_VERBOSITY = 0; } // namespace Enable @@ -154,7 +154,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) if (verbosity > 0) { - cout << "=========================== G4_MVTXService.C::MVTXService() =============================" << endl; + cout << "=========================== MVTX Service Barrel =============================" << endl; cout << " MVTX Service Material Description:" << endl; cout << " Single stave copper area = " << G4MVTX::single_stave_service_copper_area << " cm^2" << endl; @@ -170,7 +170,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) cout << " Service barrel radius = " << G4MVTX::service_barrel_radius << " cm" << endl; cout << " Service barrel start = " << G4MVTX::service_barrel_start << " cm" << endl; cout << " Service barrel length = " << G4MVTX::service_barrel_length << " cm" << endl; - cout << "=========================================================================================" << endl; + cout << "===============================================================================" << endl; } radius += no_overlapp; diff --git a/macros/g4simulations/G4_MvtxService.C b/macros/g4simulations/G4_MvtxService.C index 4aa6ceb74..c8e4b73c7 100644 --- a/macros/g4simulations/G4_MvtxService.C +++ b/macros/g4simulations/G4_MvtxService.C @@ -14,9 +14,9 @@ #include -R__LOAD_LIBRARY(libg4detectors.so) +#include -const double pi = 3.14159265358979323846; +R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { @@ -92,12 +92,12 @@ namespace G4MVTXSERVICE double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk { - return pi*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); + return M_PI*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); } double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area { - return std::sqrt( area/pi + std::pow( inner_radius, 2 ) ); + return std::sqrt( area/M_PI + std::pow( inner_radius, 2 ) ); } void calculateMaterialBoundaries(int& layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs From c02f81127bdc30e56e7aaf43ee05d3e673be136d Mon Sep 17 00:00:00 2001 From: Genki Nukazuka Date: Tue, 4 Aug 2020 01:21:42 -0400 Subject: [PATCH 0779/1222] the number of ladder in a layer and distance from the beam-axis to the silicon sensors were updated. --- common/G4_Intt.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 0d3e8f3ec..0f25336d2 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -39,9 +39,11 @@ namespace G4INTT PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI, PHG4InttDefs::SEGMENTATION_PHI}; - int nladder[4] = {15, 15, 18, 18}; - double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default + 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 From 03f680087f892fae2437547c2c0fb0cb62025bb7 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 11 Aug 2020 16:27:55 -0400 Subject: [PATCH 0780/1222] acts-ify g4tracking macro in new scheme --- common/G4_Tracking.C | 101 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 528fdeae2..a00033bc7 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -21,6 +21,15 @@ #include #include +#if __cplusplus >= 201703L +#include +#include +#include +#include +#include +#include +#endif + #include #include @@ -46,6 +55,9 @@ namespace G4TRACKING bool use_ca_seeding = false; bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead + + bool useActsFitting = false; // if true, acts KF is run with PHGenFitTrkProp + bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -81,6 +93,15 @@ void Tracking_Reco() // Tracking //------------ + if(G4TRACKING::useActsFitting) + { + #if __cplusplus >= 201703L + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + se->registerSubsystem(sl); + #endif + } + if (G4TRACKING::use_track_prop) { //-------------------------------------------------- @@ -162,25 +183,57 @@ void Tracking_Reco() // Fitting of tracks using Kalman Filter //------------------------------------------------ - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - - if (G4TRACKING::use_primary_vertex) - { - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - } - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); - + if(G4TRACKING::useActsFitting) + { + #if __cplusplus >= 201703L + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + /// Always run PHActsTracks first to take the SvtxTrack and convert it + /// to a form that Acts can process + + /// If you run PHActsTrkProp, disable PHGenFitTrkProp + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->setTimeAnalysis(true); + se->registerSubsystem(actsFit); + + PHActsVertexFitter *vtxFit = new PHActsVertexFitter(); + vtxFit->Verbosity(0); + //se->registerSubsystem(vtxFit); + + #endif + } + else + { + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + + if (G4TRACKING::use_primary_vertex) + { + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + } + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + return; } @@ -209,6 +262,16 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); + if(G4TRACKING::useActsFitting) + { + #if __cplusplus >= 201703L + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + se->registerSubsystem(actsEval); + #endif + } + + if (G4TRACKING::use_primary_vertex) { // make a second evaluator that records tracks fitted with primary vertex included From 19d044b23ca8a20fc6109098733c54dd51863c8c Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 13 Aug 2020 10:36:33 -0400 Subject: [PATCH 0781/1222] added missing header. this prevents to load the macro "standalone" or for instance to load G4_Tracking.C without loading first G4Setup_sPHENIX.C which is otherwise unnecessary when running standalone reconstruction macro. --- common/G4_Mvtx.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 0fb5f8a9e..21d024a0a 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -3,6 +3,7 @@ #include "GlobalVariables.C" +#include #include #include #include From 03a416936f16c9c725d82f9c0b5d2ff699a525fd Mon Sep 17 00:00:00 2001 From: Spencer K Griffith Date: Thu, 13 Aug 2020 16:31:51 -0400 Subject: [PATCH 0782/1222] Implemented variable parameters from calibrations file --- common/G4_CEmc_Spacal.C | 18 ++++++++++++------ macros/g4simulations/G4_CEmc_Spacal.C | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 4d8433b39..c20ca7f7a 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -368,11 +368,15 @@ void CEMC_Towers() 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_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_zero_suppression_ADC(16); // eRD1 test beam setting + 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 se->registerSubsystem(TowerDigitizer); if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) @@ -392,9 +396,11 @@ void CEMC_Towers() 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); + 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); } else diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C index 71f6c8c8e..136ff3713 100644 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ b/macros/g4simulations/G4_CEmc_Spacal.C @@ -371,11 +371,15 @@ void CEMC_Towers() 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_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_zero_suppression_ADC(16); // eRD1 test beam setting + 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 se->registerSubsystem(TowerDigitizer); if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) @@ -395,9 +399,11 @@ void CEMC_Towers() 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); + 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); } else From 6bc5ccd17cac6d24fe33219c8ad229660f31c9b5 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Thu, 20 Aug 2020 14:44:24 -0600 Subject: [PATCH 0783/1222] Use new EIC MVTX subsystem in EIC simulation --- common/G4_Mvtx_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Mvtx_EIC.C b/common/G4_Mvtx_EIC.C index dc2252c23..47407360f 100644 --- a/common/G4_Mvtx_EIC.C +++ b/common/G4_Mvtx_EIC.C @@ -4,7 +4,7 @@ #include "GlobalVariables.C" #include -#include +#include #include @@ -45,7 +45,7 @@ double Mvtx(PHG4Reco* g4Reco, double radius, // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + PHG4EICMvtxSubsystem* mvtx = new PHG4EICMvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); // H?kan Wennl?f : From 299833fae5ddca2eafb3b9086c521b06b3042056 Mon Sep 17 00:00:00 2001 From: Yasser Corrales Morales Date: Fri, 21 Aug 2020 10:38:34 -0600 Subject: [PATCH 0784/1222] Update old macros setup too ;) --- macros/g4simulations/G4_Mvtx_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C index f32b53bac..9dc920306 100644 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ b/macros/g4simulations/G4_Mvtx_EIC.C @@ -3,7 +3,7 @@ #include "GlobalVariables.C" #include -#include +#include #include @@ -44,7 +44,7 @@ double Mvtx(PHG4Reco* g4Reco, double radius, // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + PHG4EICMvtxSubsystem* mvtx = new PHG4EICMvtxSubsystem("MVTX"); mvtx->Verbosity(verbosity); // H?kan Wennl?f : From b773909c586b33b14ecee9e3ac3e7a0056973b5c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 21 Aug 2020 17:55:35 -0400 Subject: [PATCH 0785/1222] Add missign subsystems, put all G4Hit nodes behind save_g4_raw --- common/G4_DSTReader_EICDetector.C | 112 +++++++++++++++++------------- 1 file changed, 64 insertions(+), 48 deletions(-) diff --git a/common/G4_DSTReader_EICDetector.C b/common/G4_DSTReader_EICDetector.C index 3bbe926f3..a1788d3b3 100644 --- a/common/G4_DSTReader_EICDetector.C +++ b/common/G4_DSTReader_EICDetector.C @@ -5,6 +5,7 @@ #include "G4_Barrel_EIC.C" #include "G4_CEmc_EIC.C" +#include "G4_DIRC.C" #include "G4_EEMC.C" #include "G4_FEMC_EIC.C" #include "G4_FHCAL.C" @@ -14,6 +15,7 @@ #include "G4_HcalOut_ref.C" #include "G4_Magnet.C" #include "G4_Mvtx_EIC.C" +#include "G4_RICH.C" #include "G4_TPC_EIC.C" #include @@ -60,6 +62,10 @@ void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") if (G4DSTREADER::save_g4_raw) { + if (Enable::PIPE && Enable::PIPE_ABSORBER) + { + ana->AddNode("PIPE"); + } if (Enable::BARREL) { ana->AddNode("BARREL"); @@ -95,63 +101,73 @@ void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") ana->AddNode("FST_4"); ana->AddNode("FST_5"); } - } - if (Enable::CEMC) - { - ana->AddNode("CEMC"); - if (Enable::ABSORBER || Enable::CEMC_ABSORBER) + if (Enable::CEMC) { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); + ana->AddNode("CEMC"); + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) + { + ana->AddNode("ABSORBER_CEMC"); + ana->AddNode("CEMC_ELECTRONICS_0"); + } } - } - if (Enable::HCALIN) - { - ana->AddNode("HCALIN"); - if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) - ana->AddNode("ABSORBER_HCALIN"); - } + if (Enable::HCALIN) + { + ana->AddNode("HCALIN"); + if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) + { + ana->AddNode("ABSORBER_HCALIN"); + ana->AddNode("HCALIN_SPT"); + } + } - if (Enable::MAGNET) - { - if (Enable::ABSORBER || Enable::MAGNET_ABSORBER) - ana->AddNode("MAGNET"); - } + 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::HCALOUT) + { + ana->AddNode("HCALOUT"); + if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER) + ana->AddNode("ABSORBER_HCALOUT"); + } - if (Enable::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } + if (Enable::FHCAL) + { + ana->AddNode("FHCAL"); + if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) + ana->AddNode("ABSORBER_FHCAL"); + } - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } + if (Enable::FEMC) + { + ana->AddNode("FEMC"); + if (Enable::ABSORBER || Enable::FEMC_ABSORBER) + ana->AddNode("ABSORBER_FEMC"); + } - if (Enable::EEMC) - { - ana->AddNode("EEMC"); - } + if (Enable::EEMC) + { + ana->AddNode("EEMC"); + } + if (Enable::DIRC) + { + ana->AddNode("DIRC"); + } + if (Enable::RICH) + { + ana->AddNode("RICH"); + } - if (Enable::BLACKHOLE) - { - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); + 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); @@ -185,7 +201,7 @@ void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") ana->AddTower("RAW_FEMC"); ana->AddTower("CALIB_FEMC"); } - if (Enable::FEMC_TOWER) + if (Enable::EEMC_TOWER) { ana->AddTower("SIM_EEMC"); ana->AddTower("RAW_EEMC"); From 06baab37b4c76b234e7fac84d40e6d126537d45e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 12 Aug 2020 13:26:20 -0600 Subject: [PATCH 0786/1222] Added enumeration for Micromegas tiles configuration. Changed default configuration to have full z coverage and one sector --- common/G4_Micromegas.C | 58 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index b6d21ba11..496d8a34e 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -30,6 +30,14 @@ namespace Enable namespace G4MICROMEGAS { int n_micromegas_layer = 2; + enum Config + { + CONFIG_MINIMAL, + CONFIG_PHI_ONE_RING, + CONFIG_Z_ONE_SECTOR + }; + + Config CONFIG = CONFIG_Z_ONE_SECTOR; } void MicromegasInit() @@ -64,30 +72,64 @@ void Micromegas(PHG4Reco* g4Reco) void Micromegas_Cells() { - Fun4AllServer* se = Fun4AllServer::instance(); + auto se = Fun4AllServer::instance(); // micromegas auto reco = new PHG4MicromegasHitReco; reco->Verbosity(0); static constexpr double radius = 82; + static constexpr double length = 210; + static constexpr int nsectors = 12; static constexpr double tile_length = 50; static constexpr double tile_width = 25; - // 12 tiles at mid rapidity, one in front of each TPC sector - static constexpr int ntiles = 12; - MicromegasTile::List tiles; - for (int i = 0; i < ntiles; ++i) + switch( G4MICROMEGAS::CONFIG ) { - tiles.push_back({{2. * M_PI * (0.5 + i) / ntiles, 0, tile_width / radius, tile_length}}); + case G4MICROMEGAS::CONFIG_MINIMAL: + { + // one tile at mid rapidity in front of TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MINIMAL" << std::endl; + static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); + reco->set_tiles( {{{ phi0, 0, tile_width/radius, tile_length }}} ); + break; + } + + case G4MICROMEGAS::CONFIG_PHI_ONE_RING: + { + // 12 tiles at mid rapidity, one in front of each TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_PHI_ONE_RING" << std::endl; + static constexpr int ntiles = 12; + MicromegasTile::List tiles; + for (int i = 0; i < ntiles; ++i) + { + tiles.push_back({{2. * M_PI * (0.5 + i) / ntiles, 0, tile_width / radius, tile_length}}); + } + reco->set_tiles(tiles); + break; + } + + case G4MICROMEGAS::CONFIG_Z_ONE_SECTOR: + { + // 4 tiles with full z coverage in front of one TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); + static constexpr int ntiles = 4; + MicromegasTile::List tiles; + for( int i = 0; i < ntiles; ++i ) + { + tiles.push_back( {{ phi0, length*((0.5+i)/ntiles-0.5), tile_width/radius, tile_length }} ); + } + reco->set_tiles( tiles ); + break; + } } - reco->set_tiles(tiles); se->registerSubsystem(reco); } void Micromegas_Clustering() { - Fun4AllServer* se = Fun4AllServer::instance(); + auto se = Fun4AllServer::instance(); se->registerSubsystem(new PHG4MicromegasDigitizer); se->registerSubsystem(new MicromegasClusterizer); } From 670616859d73a812e4bd35277577a898e46ba09f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 31 Aug 2020 09:29:12 -0400 Subject: [PATCH 0787/1222] update g4tracking acts --- common/G4_Tracking.C | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index a00033bc7..e1a6d0f13 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -20,6 +20,7 @@ #include #include #include +#include #if __cplusplus >= 201703L #include @@ -127,6 +128,9 @@ void Tracking_Reco() init_zvtx->Verbosity(verbosity); se->registerSubsystem(init_zvtx); } + + + if (G4TRACKING::use_hough_seeding) { // find seed tracks using a subset of TPC layers @@ -138,6 +142,8 @@ void Tracking_Reco() } else if (G4TRACKING::use_ca_seeding) { + auto seeder = new PHCASeeding("PHCASeeding"); + se->registerSubsystem(seeder); } else { @@ -199,12 +205,21 @@ void Tracking_Reco() /// If you run PHActsTrkProp, disable PHGenFitTrkProp PHActsTrkProp *actsProp = new PHActsTrkProp(); actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); + actsProp->doTimeAnalysis(false); + actsProp->resetCovariance(true); + actsProp->setVolumeMaxChi2(7,60); /// MVTX + actsProp->setVolumeMaxChi2(9,60); /// INTT + actsProp->setVolumeMaxChi2(11,60); /// TPC + actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers + actsProp->setVolumeLayerMaxChi2(9, 4, 100); + actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers + actsProp->setVolumeLayerMaxChi2(11,4,200); + + se->registerSubsystem(actsProp); PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); - actsFit->setTimeAnalysis(true); - se->registerSubsystem(actsFit); + //se->registerSubsystem(actsFit); PHActsVertexFitter *vtxFit = new PHActsVertexFitter(); vtxFit->Verbosity(0); @@ -267,6 +282,7 @@ void Tracking_Eval(const std::string& outputfile) #if __cplusplus >= 201703L ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); + actsEval->setEvalCKF(true); se->registerSubsystem(actsEval); #endif } From 192b365fe35798c50935a2d8fc5459521c598c61 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 4 Sep 2020 09:12:18 -0400 Subject: [PATCH 0788/1222] fix function name --- macros/g4simulations/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index f0e930602..c779e378e 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -643,7 +643,7 @@ void Tracking_Reco(int verbosity = 0) PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); - actsFit->setTimeAnalysis(true); + actsFit->doTimeAnalysis(true); se->registerSubsystem(actsFit); #endif } From 956e661b6f54675a25f79ec25091f540ba8fb769 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 4 Sep 2020 18:09:03 -0400 Subject: [PATCH 0789/1222] Add style macro to common macros --- common/sPhenixStyle.C | 119 ++++++++++++++++++++++++++++++++++++++++++ common/sPhenixStyle.h | 51 ++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 common/sPhenixStyle.C create mode 100644 common/sPhenixStyle.h diff --git a/common/sPhenixStyle.C b/common/sPhenixStyle.C new file mode 100644 index 000000000..935f5ef76 --- /dev/null +++ b/common/sPhenixStyle.C @@ -0,0 +1,119 @@ +// +// sPHENIX Style, based on a style file from BaBar, v0.1 +// + + +#include "sPhenixStyle.h" + +#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 From 69b367e72cdac4fb239da5adfb35bf50f8009f09 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 9 Sep 2020 15:07:36 -0400 Subject: [PATCH 0790/1222] epd: update macros under common/ initialisation and registration of subsystem. --- common/G4_DSTReader.C | 6 ++++++ common/G4_EPD.C | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 common/G4_EPD.C diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C index 81e7c56b5..c9cc95647 100644 --- a/common/G4_DSTReader.C +++ b/common/G4_DSTReader.C @@ -5,6 +5,7 @@ #include "G4_BlackHole.C" #include "G4_CEmc_Spacal.C" +#include "G4_EPD.C" #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" #include "G4_Intt.C" @@ -112,6 +113,11 @@ void G4DSTreader(const string &outputFile = "G4sPHENIXCells.root") } } + if (Enable::EPD) + { + ana->AddNode("EPD"); + } + if (Enable::BLACKHOLE) { ana->AddNode("BH_1"); diff --git a/common/G4_EPD.C b/common/G4_EPD.C new file mode 100644 index 000000000..faa24e827 --- /dev/null +++ b/common/G4_EPD.C @@ -0,0 +1,24 @@ +#ifndef COMMON_G4EPD_C +#define COMMON_G4EPD_C + +#include + +#include + +R__LOAD_LIBRARY(libg4epd.so) + +namespace Enable { + bool EPD = false; +} + +void EPDInit() { } + +void EPD(PHG4Reco* g4Reco) { + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); + + epd->SuperDetector("EPD"); + + g4Reco->registerSubsystem(epd); +} + +#endif /* COMMON_G4EPD_C */ From a7ebd4910950bee3ad4cac2f935ea7a21f228275 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 9 Sep 2020 15:08:22 -0400 Subject: [PATCH 0791/1222] epd: update macros under detectors/ off by default. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 ++ detectors/sPHENIX/G4Setup_sPHENIX.C | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index d24face06..635604d4c 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -251,6 +251,8 @@ int Fun4All_G4_sPHENIX( Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; + Enable::EPD = false; + //! forward flux return plug door. Out of acceptance and off by default. //Enable::PLUGDOOR = true; Enable::PLUGDOOR_ABSORBER = true; diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index ac68c2179..fece3d8b6 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -6,6 +6,7 @@ #include "G4_BlackHole.C" #include "G4_CEmc_Spacal.C" #include "G4_CEmc_Albedo.C" +#include "G4_EPD.C" #include "G4_FEMC.C" #include "G4_HcalIn_ref.C" #include "G4_HcalOut_ref.C" @@ -92,6 +93,10 @@ void G4Init() { FEMCInit(); } + if (Enable::EPD) + { + EPDInit(); + } if (Enable::USER) { UserInit(); @@ -186,6 +191,8 @@ int G4Setup() // forward EMC if (Enable::FEMC) FEMCSetup(g4Reco); + if (Enable::EPD) EPD(g4Reco); + if (Enable::USER) { UserDetector(g4Reco); From aba512f28d39b6dd0ead2b0cd7fb6ba4e5810cc7 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 9 Sep 2020 15:09:21 -0400 Subject: [PATCH 0792/1222] epd: update macros under macros/g4simulations/ off by default. --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 9 ++++++--- macros/g4simulations/G4Setup_sPHENIX.C | 10 ++++++++++ macros/g4simulations/G4_DSTReader.C | 5 +++++ macros/g4simulations/G4_EPD.C | 22 ++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 macros/g4simulations/G4_EPD.C diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 1592f3e32..c64ed2e5c 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -133,6 +133,8 @@ int Fun4All_G4_sPHENIX( bool do_femc_cluster = do_femc_twr && true; bool do_femc_eval = do_femc_cluster && true; + bool do_epd = false; + //! forward flux return plug door. Out of acceptance and off by default. bool do_plugdoor = false; @@ -170,7 +172,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_mvtxservice); + G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_epd, do_mvtxservice); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -363,10 +365,10 @@ int Fun4All_G4_sPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservice, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_mvtxservice, magfield_rescale); + do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); #endif } @@ -598,6 +600,7 @@ int Fun4All_G4_sPHENIX( /*bool*/ do_hcalin, /*bool*/ do_magnet, /*bool*/ do_hcalout, + /*bool*/ do_epd, /*bool*/ do_cemc_twr, /*bool*/ do_hcalin_twr, /*bool*/ do_hcalout_twr); diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index a9b9be503..c7d2b2218 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -9,6 +9,7 @@ #include "G4_HcalOut_ref.C" #include "G4_PlugDoor.C" #include "G4_FEMC.C" +#include "G4_EPD.C" #include "G4_MvtxService.C" #include @@ -42,6 +43,7 @@ void G4Init(const bool do_tracking = true, const bool do_pipe = true, const bool do_plugdoor = false, const bool do_FEMC = false, + const bool do_epd = false, const bool do_mvtxservice = false ) { @@ -98,6 +100,11 @@ void G4Init(const bool do_tracking = true, gROOT->LoadMacro("G4_FEMC.C"); FEMCInit(); } + if (do_epd) + { + gROOT->LoadMacro("G4_EPD.C"); + EPDInit(); + } if (do_mvtxservice) { gROOT->LoadMacro("G4_MvtxService.C"); @@ -124,6 +131,7 @@ int G4Setup(const int absorberactive = 0, const bool do_plugdoor = false, // const bool do_plugdoor = true, const bool do_FEMC = false, + const bool do_epd = true, const bool do_mvtxservice = false, const float magfield_rescale = 1.0) { @@ -216,6 +224,8 @@ int G4Setup(const int absorberactive = 0, // forward EMC if(do_FEMC) FEMCSetup(g4Reco, absorberactive); + if (do_epd) EPDSetup(g4Reco); + //MVTX service barrel if(do_mvtxservice) radius = MVTXService(g4Reco, radius); diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C index b2eb6bb50..3ddc62b7f 100644 --- a/macros/g4simulations/G4_DSTReader.C +++ b/macros/g4simulations/G4_DSTReader.C @@ -28,6 +28,7 @@ G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// bool do_hcalin = true, // bool do_magnet = true, // bool do_hcalout = true, // + bool do_epd = true, // bool do_cemc_twr = true, // bool do_hcalin_twr = true, // bool do_hcalout_twr = true // @@ -96,6 +97,10 @@ G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("ABSORBER_HCALOUT"); } + if (do_epd) + { + ana->AddNode("EPD"); + } ana->AddNode("BH_1"); ana->AddNode("BH_FORWARD_PLUS"); diff --git a/macros/g4simulations/G4_EPD.C b/macros/g4simulations/G4_EPD.C new file mode 100644 index 000000000..824aabd6f --- /dev/null +++ b/macros/g4simulations/G4_EPD.C @@ -0,0 +1,22 @@ +#pragma once + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4epd.so) + +namespace Enable { + bool EPD = false; +} + +void EPDInit() { } + +void EPDSetup(PHG4Reco* g4Reco) { + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); + + epd->SuperDetector("EPD"); + + g4Reco->registerSubsystem(epd); +} From 3db543ede5ed0ec92c17b6c933d599c7dff52013 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 14 Sep 2020 23:33:09 -0400 Subject: [PATCH 0793/1222] add TPC endcap --- common/G4_TPC.C | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 9f7338e60..c4c06c5c2 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -28,6 +29,9 @@ namespace Enable bool TPC_OVERLAPCHECK = false; bool TPC_CELL = false; bool TPC_CLUSTER = false; + + bool TPC_ENDCAP = true; + int TPC_VERBOSITY = 0; } // namespace Enable @@ -44,8 +48,17 @@ namespace G4TPC void TPCInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 211. / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -211. / 2.); + + 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 @@ -60,6 +73,25 @@ void TPCInit() } } +//! 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) { @@ -79,6 +111,11 @@ double TPC(PHG4Reco* g4Reco, g4Reco->registerSubsystem(tpc); + if (Enable::TPC_ENDCAP) + { + TPC_Endcaps(g4Reco); + } + radius = G4TPC::tpc_outer_radius; radius += no_overlapp; From 628a351c3042a6a4137d4341d6e77e868104b91a Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 14 Sep 2020 23:38:34 -0400 Subject: [PATCH 0794/1222] improve display --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index d24face06..63584d530 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -472,10 +472,17 @@ int Fun4All_G4_sPHENIX( if (Enable::DISPLAY) { DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout <<"-------------------------------------------------"<run(1)"<ProcessLine("displaycmd()"); + + return 0; } se->skip(skip); From e96ccab6c2fdafd3e4bdc0cbbb2cd78c70f1e362 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 16 Sep 2020 15:35:38 -0400 Subject: [PATCH 0795/1222] epd: add possibility for overlap checks --- common/G4_EPD.C | 4 ++++ macros/g4simulations/G4_EPD.C | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/common/G4_EPD.C b/common/G4_EPD.C index faa24e827..2ec425f26 100644 --- a/common/G4_EPD.C +++ b/common/G4_EPD.C @@ -9,14 +9,18 @@ R__LOAD_LIBRARY(libg4epd.so) namespace Enable { bool EPD = false; + bool EPD_OVERLAPCHECK = false; } void EPDInit() { } void EPD(PHG4Reco* g4Reco) { + bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); epd->SuperDetector("EPD"); + epd->OverlapCheck(overlap_check); g4Reco->registerSubsystem(epd); } diff --git a/macros/g4simulations/G4_EPD.C b/macros/g4simulations/G4_EPD.C index 824aabd6f..083b011b8 100644 --- a/macros/g4simulations/G4_EPD.C +++ b/macros/g4simulations/G4_EPD.C @@ -9,14 +9,18 @@ R__LOAD_LIBRARY(libg4epd.so) namespace Enable { bool EPD = false; + bool EPD_OVERLAPCHECK = false; } void EPDInit() { } void EPDSetup(PHG4Reco* g4Reco) { + bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); epd->SuperDetector("EPD"); + epd->OverlapCheck(overlap_check); g4Reco->registerSubsystem(epd); } From 904cfd3ae504cac412b80c40bb8a20de2f99864d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 18 Sep 2020 09:33:00 -0400 Subject: [PATCH 0796/1222] update tracking macro to run kf --- common/G4_Tracking.C | 79 +++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e1a6d0f13..87eb94b6a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -28,6 +28,7 @@ #include #include #include +#include #include #endif @@ -58,7 +59,7 @@ namespace G4TRACKING bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead bool useActsFitting = false; // if true, acts KF is run with PHGenFitTrkProp - + bool useActsProp = useActsFitting and false; // if true, runs Acts CKF with only a seeder bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -156,18 +157,22 @@ void Tracking_Reco() tracker->enable_vertexing(false); // rave vertexing is pretty slow at large multiplicities... se->registerSubsystem(tracker); } - // 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); - } + + if(!G4TRACKING::useActsProp) + { + // 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); + } + } } else { @@ -201,30 +206,30 @@ void Tracking_Reco() /// Kalman Filter which runs track finding and track fitting /// Always run PHActsTracks first to take the SvtxTrack and convert it /// to a form that Acts can process + if(G4TRACKING::useActsProp) + { + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + actsProp->doTimeAnalysis(true); + actsProp->resetCovariance(true); + actsProp->setVolumeMaxChi2(7,60); /// MVTX + actsProp->setVolumeMaxChi2(9,60); /// INTT + actsProp->setVolumeMaxChi2(11,60); /// TPC + actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers + actsProp->setVolumeLayerMaxChi2(9, 4, 100); + actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers + actsProp->setVolumeLayerMaxChi2(11,4, 200); + + se->registerSubsystem(actsProp); + } + else + { + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->doTimeAnalysis(true); + se->registerSubsystem(actsFit); + } - /// If you run PHActsTrkProp, disable PHGenFitTrkProp - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - actsProp->doTimeAnalysis(false); - actsProp->resetCovariance(true); - actsProp->setVolumeMaxChi2(7,60); /// MVTX - actsProp->setVolumeMaxChi2(9,60); /// INTT - actsProp->setVolumeMaxChi2(11,60); /// TPC - actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers - actsProp->setVolumeLayerMaxChi2(9, 4, 100); - actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers - actsProp->setVolumeLayerMaxChi2(11,4,200); - - se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - //se->registerSubsystem(actsFit); - - PHActsVertexFitter *vtxFit = new PHActsVertexFitter(); - vtxFit->Verbosity(0); - //se->registerSubsystem(vtxFit); - #endif } else @@ -282,7 +287,7 @@ void Tracking_Eval(const std::string& outputfile) #if __cplusplus >= 201703L ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); - actsEval->setEvalCKF(true); + actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); #endif } From 21bb3b85f09928039fb75d40fd3029626e7e02e5 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 21 Sep 2020 08:47:12 -0400 Subject: [PATCH 0797/1222] run acts by default --- common/G4_Tracking.C | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 87eb94b6a..1896537f4 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -21,6 +21,8 @@ #include #include #include +#include +#include #if __cplusplus >= 201703L #include @@ -53,12 +55,11 @@ namespace G4TRACKING //===================================== int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events //default seed is PHTpcTracker - bool use_hough_seeding = false; //choose seeding algo bool use_ca_seeding = false; bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead - bool useActsFitting = false; // if true, acts KF is run with PHGenFitTrkProp + bool useActsFitting = true; // if true, acts KF is run with PHGenFitTrkProp bool useActsProp = useActsFitting and false; // if true, runs Acts CKF with only a seeder bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples @@ -80,7 +81,7 @@ void TrackingInit() } } -void Tracking_Reco() +void Tracking_Reco(const std::string outputFile) { int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); // processes the TrkrHits to make clusters, then reconstruct tracks and vertices @@ -130,18 +131,12 @@ void Tracking_Reco() se->registerSubsystem(init_zvtx); } - - - if (G4TRACKING::use_hough_seeding) - { - // find seed tracks using a subset of TPC layers - int min_layers = 4; - int nlayers_seeds = 12; - auto track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(verbosity); - se->registerSubsystem(track_seed); - } - else if (G4TRACKING::use_ca_seeding) + /// Create silicon track stubs + auto siliconSeeder = new PHSiliconTruthTrackSeeding("PHSiliconTruthTrackSeeding"); + se->registerSubsystem(siliconSeeder); + + /// Pick which TPC seeder to use + if (G4TRACKING::use_ca_seeding) { auto seeder = new PHCASeeding("PHCASeeding"); se->registerSubsystem(seeder); @@ -158,9 +153,15 @@ void Tracking_Reco() se->registerSubsystem(tracker); } - if(!G4TRACKING::useActsProp) + if(G4TRACKING::useActsFitting) + { + /// Match the silicon and TPC track stubs + auto stubMatcher = new PHSiliconTpcTrackMatching("PHSiliconTpcTrackMatching"); + se->registerSubsystem(stubMatcher); + } + else { - // Find all clusters associated with each seed track + // Use GenFit to 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); @@ -226,7 +227,7 @@ void Tracking_Reco() { PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); - actsFit->doTimeAnalysis(true); + actsFit->doTimeAnalysis(false); se->registerSubsystem(actsFit); } From 3dd4ac00b3ec5a0dfc868e60b027b33c93b3c16f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 23 Sep 2020 09:42:45 -0400 Subject: [PATCH 0798/1222] update stub matcher and acts mag field --- common/G4_Tracking.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 1896537f4..faf98b227 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -101,6 +101,8 @@ void Tracking_Reco(const std::string outputFile) #if __cplusplus >= 201703L PHActsSourceLinks *sl = new PHActsSourceLinks(); sl->Verbosity(0); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); #endif } @@ -157,6 +159,9 @@ void Tracking_Reco(const std::string outputFile) { /// Match the silicon and TPC track stubs auto stubMatcher = new PHSiliconTpcTrackMatching("PHSiliconTpcTrackMatching"); + stubMatcher->set_phi_search_window(0.02); // tune8 - optimum + stubMatcher->set_eta_search_window(0.015); // tune8 - optimum + stubMatcher->Verbosity(0); se->registerSubsystem(stubMatcher); } else From 9d2ad785fff5498735046c59829a9cb78e04811b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 23 Sep 2020 14:17:18 -0400 Subject: [PATCH 0799/1222] update display execution --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 205bdab5a..ebee19b5c 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -15,6 +15,7 @@ #include "G4_Jets.C" #include "G4_Production.C" +#include #include #include #include @@ -185,6 +186,9 @@ int Fun4All_G4_EICDetector( //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 //====================== @@ -478,8 +482,19 @@ int Fun4All_G4_EICDetector( //----------------- // Event processing //----------------- - if (nEvents < 0) + if (Enable::DISPLAY) { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout <<"-------------------------------------------------"<run(1)"<ProcessLine("displaycmd()"); + return 0; } // if we run any of the particle generators and use 0 it'll run forever From 54845dcb964f433a4591dd2cb8e0f34b83b98080 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 24 Sep 2020 16:44:28 -0400 Subject: [PATCH 0800/1222] add magnet parameters to stub matcher --- common/G4_Tracking.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index faf98b227..7f3738c05 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -162,6 +162,8 @@ void Tracking_Reco(const std::string outputFile) stubMatcher->set_phi_search_window(0.02); // tune8 - optimum stubMatcher->set_eta_search_window(0.015); // tune8 - optimum stubMatcher->Verbosity(0); + stubMatcher->set_field_dir(G4MAGNET::magfield_rescale); + stubMatcher->set_field(G4MAGNET::magfield); se->registerSubsystem(stubMatcher); } else From 855501bc449632eac35c5f14b5efc07b3f96e929 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 25 Sep 2020 09:56:49 -0400 Subject: [PATCH 0801/1222] fix tracking reco fxn call --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7f3738c05..ce82976b2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -81,7 +81,7 @@ void TrackingInit() } } -void Tracking_Reco(const std::string outputFile) +void Tracking_Reco() { int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); // processes the TrkrHits to make clusters, then reconstruct tracks and vertices From 36b03331e48fb06e253e92db846cbdab8338b9ef Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 26 Sep 2020 22:38:39 -0400 Subject: [PATCH 0802/1222] Add listfile for dst input managers (readhits and embed) --- common/G4_Input.C | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 729522041..2891051e7 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -60,11 +60,13 @@ namespace INPUTREADEIC namespace INPUTREADHITS { string filename; + string listfile; } namespace INPUTEMBED { string filename; + string listfile; } namespace PYTHIA6 @@ -221,8 +223,20 @@ void InputManagers() if (Input::EMBED) { gSystem->Load("libg4dst.so"); - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - in1->AddFile(INPUTEMBED::filename); // if one use a single input file + Fun4AllInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); + if (!INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) + { + in1->fileopen(INPUTEMBED::filename); + } + else if (!INPUTEMBED::listfile.empty()) + { + in1->AddListFile(INPUTEMBED::listfile); + } + else + { + cout << "no filename INPUTEMBED::filename or listfile INPUTEMBED::listfile given" << endl; + gSystem->Exit(1); + } in1->Repeat(); // if file(or filelist) is exhausted, start from beginning se->registerInputManager(in1); } @@ -235,7 +249,19 @@ void InputManagers() else if (Input::READHITS) { Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(INPUTREADHITS::filename); + if (!INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty()) + { + hitsin->fileopen(INPUTREADHITS::filename); + } + else if (!INPUTREADHITS::listfile.empty()) + { + hitsin->AddListFile(INPUTREADHITS::listfile); + } + else + { + cout << "no filename INPUTREADHITS::filename or listfile INPUTREADHITS::listfile given" << endl; + gSystem->Exit(1); + } hitsin->Verbosity(Input::VERBOSITY); se->registerInputManager(hitsin); } From d91ae15da6211e4c6d709bce1912905b6fc9eb32 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 28 Sep 2020 13:53:40 -0400 Subject: [PATCH 0803/1222] change pileup input manager registration so we can copy foreground input manager settings --- common/G4_Input.C | 17 +++++++++++------ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 14 +++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 2891051e7..565a4ba9c 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -105,6 +105,7 @@ namespace INPUTGENERATOR namespace INPUTMANAGER { Fun4AllHepMCInputManager *HepMCInputManager = nullptr; + Fun4AllHepMCPileupInputManager *HepMCPileupInputManager = nullptr; } void InputInit() @@ -163,6 +164,10 @@ void InputInit() { INPUTMANAGER::HepMCInputManager = new Fun4AllHepMCInputManager("HEPMCin"); } + if (Input::PILEUPRATE > 0) + { + INPUTMANAGER::HepMCPileupInputManager = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + } } void InputRegister() @@ -273,13 +278,13 @@ void InputManagers() } if (Input::PILEUPRATE > 0) { - Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); - pileup->Verbosity(Input::VERBOSITY); - pileup->AddFile(PILEUP::pileupfile); - pileup->set_collision_rate(Input::PILEUPRATE); + 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; - pileup->set_time_window(-time_window, time_window); - se->registerInputManager(pileup); + INPUTMANAGER::HepMCPileupInputManager->set_time_window(-time_window, time_window); + se->registerInputManager(INPUTMANAGER::HepMCPileupInputManager); } } #endif diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 84494150d..be608201f 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -55,6 +55,8 @@ int Fun4All_G4_sPHENIX( //=============== // 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 @@ -86,8 +88,7 @@ int Fun4All_G4_sPHENIX( // Input::UPSILON = true; Input::UPSILON_VERBOSITY = 0; -// Input::HEPMC = true; - Input::VERBOSITY = 0; + // Input::HEPMC = true; INPUTHEPMC::filename = inputFile; // Event pile up simulation with collision rate in Hz MB collisions. @@ -148,7 +149,7 @@ int Fun4All_G4_sPHENIX( if (Input::HEPMC) { - INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space, time + 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); @@ -157,6 +158,13 @@ int Fun4All_G4_sPHENIX( //! 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(2); + 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); + } } // register all input generators with Fun4All InputRegister(); From bf37687ded845f0eeb97c2581c8dab76269fb7d2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 28 Sep 2020 13:54:07 -0400 Subject: [PATCH 0804/1222] clang-format --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index be608201f..71b83482d 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -55,7 +55,7 @@ int Fun4All_G4_sPHENIX( //=============== // Input options //=============== -// verbosity setting (applies to all input managers) + // verbosity setting (applies to all input managers) Input::VERBOSITY = 0; // First enable the input generators // Either: @@ -149,10 +149,10 @@ int Fun4All_G4_sPHENIX( if (Input::HEPMC) { - 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 + 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); + 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 @@ -169,14 +169,14 @@ int Fun4All_G4_sPHENIX( // register all input generators with Fun4All InputRegister(); -// set up production relatedstuff -// Enable::PRODUCTION = true; + // set up production relatedstuff + // Enable::PRODUCTION = true; //====================== // Write the DST //====================== -// Enable::DSTOUT = true; + // Enable::DSTOUT = true; Enable::DSTOUT_COMPRESS = false; DstOut::OutputDir = outdir; DstOut::OutputFile = outputFile; @@ -223,9 +223,9 @@ int Fun4All_G4_sPHENIX( Enable::TRACKING_TRACK = true; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; -// cemc electronics + thin layer of W-epoxy to get albedo from cemc -// into the tracking, cannot run together with CEMC -// Enable::CEMCALBEDO = 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 = true; Enable::CEMC_ABSORBER = true; @@ -486,10 +486,10 @@ int Fun4All_G4_sPHENIX( gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); - cout <<"-------------------------------------------------"<run(1)"<run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; gROOT->ProcessLine("displaycmd()"); return 0; From c0aad31102c7f10ce86426d65593d6352eba5355 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 28 Sep 2020 14:01:32 -0400 Subject: [PATCH 0805/1222] add pile up input manager --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 25 +++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 5fd464b9a..d6c4ec871 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -57,6 +57,8 @@ int Fun4All_G4_fsPHENIX( //=============== // Input options //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 0; // 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 @@ -84,10 +86,12 @@ int Fun4All_G4_fsPHENIX( // Input::GUN = true; //Input::GUN_VERBOSITY = 0; - // Input::HEPMC = true; - //Input::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 //----------------- @@ -142,22 +146,29 @@ int Fun4All_G4_fsPHENIX( if (Input::HEPMC) { - INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,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 + 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); + 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(2); + 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); + } } // register all input generators with Fun4All InputRegister(); -// set up production relatedstuff -// Enable::PRODUCTION = true; + // set up production relatedstuff + // Enable::PRODUCTION = true; //====================== // Write the DST From 8c0e24afa19e5f9dd15c61fda8e0e4ca0ce36841 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 28 Sep 2020 14:17:41 -0400 Subject: [PATCH 0806/1222] Working version. --- macros/g4simulations/G4_Tracking.C | 148 +++++++++++++++++++++++------ macros/g4simulations/vis.mac | 10 +- 2 files changed, 125 insertions(+), 33 deletions(-) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 84e74bc26..d14c74368 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -37,11 +37,21 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include #include @@ -63,6 +73,11 @@ R__LOAD_LIBRARY(libPHTpcTracker.so) #include +const bool use_acts = true; +const bool use_hough_seeding = false; //choose seeding algo //default seed is PHTpcTracker +const bool use_ca_seeding = false; +const bool use_stub_matcher = true; + // Tracking simulation setup parameters and flag - leave them alone! //============================================== @@ -94,15 +109,13 @@ int n_tpc_layer_outer = 16; int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; ///////////////// Micromegas -bool enable_micromegas = false; +bool enable_micromegas = true; const int n_micromegas_layer = 2; // Tracking reconstruction setup parameters and flags //===================================== -const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events -//default seed is PHTpcTracker -const bool use_hough_seeding = false; //choose seeding algo -const bool use_ca_seeding = false; +//const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events +const int init_vertexing_min_zvtx_tracks = 5; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit @@ -110,10 +123,10 @@ const bool use_primary_vertex = false; // if true, refit tracks with primary ve // This is the setup we have been using before PHInitZVertexing was implemented - 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: -const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex +//const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex // This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event -//const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex +const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. @@ -523,6 +536,13 @@ void Tracking_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); + if(use_acts) + { + PHActsSourceLinks *srcLinks = new PHActsSourceLinks(); + srcLinks->Verbosity(0); + se->registerSubsystem(srcLinks); + } + //------------- // Tracking //------------ @@ -560,6 +580,8 @@ void Tracking_Reco(int verbosity = 0) track_seed->Verbosity(0); se->registerSubsystem(track_seed); }else if(use_ca_seeding){ + PHCASeeding *ca_seeder = new PHCASeeding(); + se->registerSubsystem(ca_seeder); }else{ 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 @@ -570,6 +592,8 @@ void Tracking_Reco(int verbosity = 0) tracker->enable_vertexing( false ); // rave vertexing is pretty slow at large multiplicities... se->registerSubsystem(tracker); } + + /* // Find all clusters associated with each seed track auto track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer, enable_micromegas ? n_micromegas_layer:0); track_prop->Verbosity(0); @@ -582,6 +606,8 @@ void Tracking_Reco(int verbosity = 0) track_prop->set_max_search_win_phi_intt(i, 0.0050); track_prop->set_min_search_win_phi_intt(i, 0.000); } + */ + } else { @@ -599,29 +625,85 @@ void Tracking_Reco(int verbosity = 0) se->registerSubsystem(pat_rec); } + if(use_acts) + { + if(use_stub_matcher) + { + // use truth information to assemble silicon clusters into track stubs + PHSiliconTruthTrackSeeding *silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + + // Match TPC track stubs from CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match ->Verbosity(0); + silicon_match->set_phi_search_window(0.02); // tune8 - optimum + silicon_match->set_eta_search_window(0.015); // tune8 - optimum + + // Match TPC track stubs from CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHMicromegasTpcTrackMatching *mm_match = new PHMicromegasTpcTrackMatching(); + mm_match ->Verbosity(0); + 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(13.0); + mm_match-> set_z_search_window_lyr2(0.2); + mm_match->set_min_tpc_layer(38); + se->registerSubsystem(mm_match); + } + else + { + // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder + PHTruthSiliconAssociation *silicon_assoc = new PHTruthSiliconAssociation(); + silicon_assoc ->Verbosity(0); + se->registerSubsystem(silicon_assoc); + } + + /// Use actsTracks or actsPropagation to prepare for ActsTrkFitter + /// actsTracks assumes some other propagation has already happened + /// whereas actstrkprop does the propagation + PHActsTracks *actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + //se->registerSubsystem(actsProp); + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + //actsFit->setTimeAnalysis(true); + //se->registerSubsystem(actsFit); + + } + //------------------------------------------------ // Fitting of tracks using Kalman Filter //------------------------------------------------ + if(!use_acts) + { + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(0); + + if (use_primary_vertex) + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + + kalman->set_vertexing_method(vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + //se->registerSubsystem(projection); - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); - - if (use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); - + } + return; } @@ -649,15 +731,23 @@ void Tracking_Reco(int verbosity = 0) //---------------- SvtxEvaluator* eval; eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); + eval->do_vertex_eval(true); 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(false); + eval->do_gpoint_eval(true); eval->do_eval_light(true); - eval->set_use_initial_vertex(g4eval_use_initial_vertex); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->set_use_initial_vertex(true); + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true eval->Verbosity(0); - se->registerSubsystem(eval); + //se->registerSubsystem(eval); + + if(use_acts) + { + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + //se->registerSubsystem(actsEval); + } if (use_primary_vertex) { diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac index 47db266aa..5f41263ee 100644 --- a/macros/g4simulations/vis.mac +++ b/macros/g4simulations/vis.mac @@ -29,11 +29,13 @@ /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 +/vis/viewer/set/viewpointThetaPhi -100 -10 +#/vis/viewer/set/viewpointThetaPhi 10 -10 +/vis/viewer/addCutawayPlane -0.5 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.5 0 +/vis/viewer/zoom 2 # # Use this open statement instead to get a HepRep version 1 file # suitable for viewing in WIRED. @@ -52,7 +54,7 @@ /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) +#(if too many tracks cause core dump => /tracking/storeTrajectory 0) # # To draw gammas only #/vis/filtering/trajectories/create/particleFilter From c7759eb43f1c26efb22a86873353056e3973d08d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 28 Sep 2020 14:27:41 -0400 Subject: [PATCH 0807/1222] put old hardcoded pileup manager vertex settings into macro --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index c64ed2e5c..d1820b06c 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -560,8 +560,10 @@ int Fun4All_G4_sPHENIX( // pile up simulation. // add random beam collisions following a collision diamond and rate from a HepMC stream Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + pileup->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); + pileup->set_vertex_distribution_mean(0, 0, 0, 0); + pileup->set_vertex_distribution_width(100e-4, 100e-4, 30, 5); se->registerInputManager(pileup); - const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); //background files for p+p pileup sim //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); From 9a2eb4963b24cca407abc1dbc9ebe60d724eb087 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 24 Sep 2020 12:46:09 -0600 Subject: [PATCH 0808/1222] Added "baseline" and "maximal" configurations. --- common/G4_Micromegas.C | 52 +++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 496d8a34e..be9702cd0 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -34,7 +34,9 @@ namespace G4MICROMEGAS { CONFIG_MINIMAL, CONFIG_PHI_ONE_RING, - CONFIG_Z_ONE_SECTOR + CONFIG_Z_ONE_SECTOR, + CONFIG_BASELINE, + CONFIG_MAXIMAL }; Config CONFIG = CONFIG_Z_ONE_SECTOR; @@ -98,12 +100,9 @@ void Micromegas_Cells() { // 12 tiles at mid rapidity, one in front of each TPC sector std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_PHI_ONE_RING" << std::endl; - static constexpr int ntiles = 12; MicromegasTile::List tiles; - for (int i = 0; i < ntiles; ++i) - { - tiles.push_back({{2. * M_PI * (0.5 + i) / ntiles, 0, tile_width / radius, tile_length}}); - } + for (int i = 0; i < nsectors; ++i) + { tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width / radius, tile_length); } reco->set_tiles(tiles); break; } @@ -112,12 +111,49 @@ void Micromegas_Cells() { // 4 tiles with full z coverage in front of one TPC sector std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + MicromegasTile::List tiles; static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); static constexpr int ntiles = 4; - MicromegasTile::List tiles; for( int i = 0; i < ntiles; ++i ) + { tiles.emplace_back( phi0, length*((0.5+i)/ntiles-0.5), tile_width/radius, tile_length ); } + reco->set_tiles( tiles ); + break; + } + + case G4MICROMEGAS::CONFIG_BASELINE: + { + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + MicromegasTile::List tiles; + + // for the first sector we put 4 tiles with full z coverage + static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); + static constexpr int ntiles_z = 4; + for( int i = 0; i < ntiles_z; ++i ) + { tiles.emplace_back( phi0, length*((0.5+i)/ntiles_z-0.5), tile_width/radius, tile_length ); } + + // for the other sectors we put two tiles on either side of the central membrane + for( int i = 1; i < nsectors; ++i ) + { + const double phi = phi0 + 2.*M_PI*i/nsectors; + tiles.emplace_back( phi, length*(1.5/4-0.5), tile_width/radius, tile_length ); + tiles.emplace_back( phi, length*(2.5/4-0.5), tile_width/radius, tile_length ); + } + reco->set_tiles( tiles ); + break; + } + + case G4MICROMEGAS::CONFIG_MAXIMAL: + { + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MAXIMAL" << std::endl; + MicromegasTile::List tiles; + + // 4 tiles with full z coverage in front of each TPC sector + static constexpr int ntiles_z = 4; + for (int iphi = 0; iphi < nsectors; ++iphi) { - tiles.push_back( {{ phi0, length*((0.5+i)/ntiles-0.5), tile_width/radius, tile_length }} ); + const double phi = 2. * M_PI * (0.5 + iphi) / nsectors; + for (int iz = 0; iz < ntiles_z; ++iz ) + { tiles.emplace_back( phi, length*((0.5+iz)/ntiles_z-0.5), tile_width/radius, tile_length ); } } reco->set_tiles( tiles ); break; From 9fcdc220a33721021816acce9d99e1fefb022461 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 2 Oct 2020 17:55:59 -0400 Subject: [PATCH 0809/1222] fix bad doxygen links, add new location of detector macros --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 42bb74679..31ce6fa8d 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ 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/macros/g4simulations/ -[jinhuang@rcas2073 g4simulations]$ # here is all the macros to run fsPHENIX and sPHENIX simulations +[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](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d5/d2c/macros_2blob_2master_2macros_2g4simulations_2Fun4All__G4__sPHENIX_8C_source.html#l00001), which is self-explanatory. It is not a black box!. You are welcome to open/edit it to work for your purpose of study. +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 @@ -63,4 +63,4 @@ Now you are able to run the whole sPHENIX simulation + reconstruction chain. Man * 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://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d1/df4/classJetEvaluator.html), [SvtxEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. +* [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. From f95aadfdbc9c130550a284fda72c7878aa4c0c7a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 2 Oct 2020 17:59:32 -0400 Subject: [PATCH 0810/1222] Revert "Fix readme" --- README.md | 8 +-- macros/QA/calorimeter/QA_Draw_Utility.C | 4 +- macros/g4simulations/Fun4All_G4_sPHENIX.C | 79 ++++------------------- 3 files changed, 17 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 31ce6fa8d..42bb74679 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ 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 +[jinhuang@rcas2073 test]$ cd macros/macros/g4simulations/ +[jinhuang@rcas2073 g4simulations]$ # here is all the macros to run fsPHENIX and sPHENIX 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. +The default sPHENIX simulation + reconstruction macro is [Fun4All_G4_sPHENIX.C](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d5/d2c/macros_2blob_2master_2macros_2g4simulations_2Fun4All__G4__sPHENIX_8C_source.html#l00001), 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 @@ -63,4 +63,4 @@ Now you are able to run the whole sPHENIX simulation + reconstruction chain. Man * 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. +* [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://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d1/df4/classJetEvaluator.html), [SvtxEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C index 1533ac1aa..8f0ab4e58 100644 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ b/macros/QA/calorimeter/QA_Draw_Utility.C @@ -156,7 +156,7 @@ double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) hnew->Draw(); // set scale - double ks_test = numeric_limits::signaling_NaN(); + double ks_test = NAN; if (href) { @@ -199,7 +199,7 @@ double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) } else { - gPad->SetTopMargin(.07); + gPad->SetTopMargin(.7); TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); legend->Draw(); } diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index 46874e9e4..d1820b06c 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -1,8 +1,4 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include #include #include #include @@ -39,7 +35,6 @@ R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libphhepmc.so) R__LOAD_LIBRARY(libPHPythia6.so) R__LOAD_LIBRARY(libPHPythia8.so) -R__LOAD_LIBRARY(libqa_modules.so) #endif using namespace std; @@ -47,8 +42,7 @@ using namespace std; int Fun4All_G4_sPHENIX( const int nEvents = 1, - const char *inputFile = "e-", - const double inputpT = 4, + 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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") { @@ -108,7 +102,7 @@ int Fun4All_G4_sPHENIX( bool do_tracking_cell = do_tracking && true; bool do_tracking_cluster = do_tracking_cell && true; bool do_tracking_track = do_tracking_cluster && true; - bool do_tracking_eval = do_tracking_track && false; + bool do_tracking_eval = do_tracking_track && true; bool do_pstof = false; @@ -116,13 +110,13 @@ int Fun4All_G4_sPHENIX( 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_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 && false; + bool do_hcalin_eval = do_hcalin_cluster && true; bool do_magnet = true; @@ -130,7 +124,7 @@ int Fun4All_G4_sPHENIX( 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_hcalout_eval = do_hcalout_cluster && true; // forward EMC bool do_femc = false; @@ -150,7 +144,7 @@ int Fun4All_G4_sPHENIX( 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 && false; + bool do_jet_eval = do_jet_reco && 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 @@ -176,7 +170,6 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4testbench.so"); gSystem->Load("libg4eval.so"); gSystem->Load("libg4intt.so"); - gSystem->Load("libqa_modules"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_epd, do_mvtxservice); @@ -197,7 +190,7 @@ int Fun4All_G4_sPHENIX( } Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(01); + se->Verbosity(0); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. PHRandomSeed::Verbosity(1); @@ -212,7 +205,7 @@ int Fun4All_G4_sPHENIX( // 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()); + //rc->set_IntFlag("RANDOMSEED", 12345); //----------------- // Event generation @@ -268,7 +261,7 @@ int Fun4All_G4_sPHENIX( { // toss low multiplicity dummy events PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles(inputFile, 1); // mu+,e+,proton,pi+,Upsilon + gen->add_particles("pi-", 1); // mu+,e+,proton,pi+,Upsilon //gen->add_particles("pi+",100); // 100 pion option if (readhepmc || do_embedding || runpythia8 || runpythia6) { @@ -281,13 +274,13 @@ int Fun4All_G4_sPHENIX( PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform); gen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - gen->set_vertex_distribution_width(0.0, 0.0, 10.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(inputpT, inputpT); + gen->set_pt_range(0.1, 20.0); gen->Embed(2); gen->Verbosity(0); @@ -615,56 +608,11 @@ int Fun4All_G4_sPHENIX( /*bool*/ do_hcalout_twr); } - // QA parts - { - - if (do_cemc) - se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC")); - if (do_hcalin) - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN")); - if (do_hcalout) - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT")); - - if (do_tracking && do_cemc && do_hcalin && do_hcalout) - { - QAG4SimulationCalorimeterSum *calo_qa = - new QAG4SimulationCalorimeterSum(); - // calo_qa->Verbosity(10); - se->registerSubsystem(calo_qa); - } - - if (do_jet_reco) - { - 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(20); - 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"); - 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"); - se->registerSubsystem(calo_jet2); - } - } - if(do_write_output) { Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); if (do_dst_compress) DstCompress(out); se->registerOutputManager(out); } - //----------------- // Event processing //----------------- @@ -691,11 +639,6 @@ int Fun4All_G4_sPHENIX( se->run(nEvents); - // QA outputs - { - QAHistManagerDef::saveQARootFile(string(outputFile) + "_qa.root"); - } - //----- // Exit //----- From ea184526e50d3fd1cf34c434993ed4f1558b8b0b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 2 Oct 2020 18:02:10 -0400 Subject: [PATCH 0811/1222] fix bad doxygen links, add new location of detector macros --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 42bb74679..31ce6fa8d 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ 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/macros/g4simulations/ -[jinhuang@rcas2073 g4simulations]$ # here is all the macros to run fsPHENIX and sPHENIX simulations +[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](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d5/d2c/macros_2blob_2master_2macros_2g4simulations_2Fun4All__G4__sPHENIX_8C_source.html#l00001), which is self-explanatory. It is not a black box!. You are welcome to open/edit it to work for your purpose of study. +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 @@ -63,4 +63,4 @@ Now you are able to run the whole sPHENIX simulation + reconstruction chain. Man * 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://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d1/df4/classJetEvaluator.html), [SvtxEvaluator](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. +* [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. From 7b6d06b319ae48f59784722a8b60d266cc457252 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Wed, 7 Oct 2020 12:29:39 -0400 Subject: [PATCH 0812/1222] Introduced CA seeding with tuning options --- macros/g4simulations/G4_Tracking.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C index 275a33700..367b62ae2 100644 --- a/macros/g4simulations/G4_Tracking.C +++ b/macros/g4simulations/G4_Tracking.C @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -601,6 +602,12 @@ void Tracking_Reco(int verbosity = 0) track_seed->Verbosity(0); se->registerSubsystem(track_seed); }else if(use_ca_seeding){ + auto ca_seed = new PHCASeeding(); + ca_seed->SetLayerRange(7,55); + ca_seed->SetSearchWindow(0.01,0.02); // (eta width, phi width) + ca_seed->SetMinHitsPerCluster(2); + ca_seed->SetMinClustersPerTrack(20); + se->registerSubsystem(ca_seed); }else{ 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 From e7664c26aa5cbcfbff157032e1578a3e249cd61d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Oct 2020 12:32:15 -0400 Subject: [PATCH 0813/1222] put back return if number of events < 0 --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index ebee19b5c..b5cb068e9 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -212,6 +212,7 @@ int Fun4All_G4_EICDetector( // mvtx/tpc tracker Enable::MVTX = true; Enable::TPC = true; +// Enable::TPC_ENDCAP = true; Enable::TRACKING = true; Enable::TRACKING_EVAL = Enable::TRACKING && true; @@ -497,6 +498,11 @@ int Fun4All_G4_EICDetector( 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 any of the particle generators and use 0 it'll run forever if (nEvents == 0 && !Input::READHITS && !Input::HEPMC && !Input::READEIC) { From b7269acd9785ff6ddb6912dde5aa6fa70d6d3453 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Oct 2020 12:33:27 -0400 Subject: [PATCH 0814/1222] Add tpc endcap --- common/G4_TPC_EIC.C | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/common/G4_TPC_EIC.C b/common/G4_TPC_EIC.C index d93822681..82bef2504 100644 --- a/common/G4_TPC_EIC.C +++ b/common/G4_TPC_EIC.C @@ -7,6 +7,7 @@ #include +#include #include #include @@ -18,11 +19,15 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libg4tpc.so) namespace Enable { bool TPC = false; -} + bool TPC_ENDCAP = false; + bool TPC_ABSORBER = false; + bool TPC_OVERLAPCHECK = false; +} // namespace Enable namespace G4TPC { @@ -48,13 +53,32 @@ namespace G4TPC } // namespace G4TPC -void TPCInit(int verbosity = 0) +void TPCInit() { // BlackHoleGeometry::max_radius set at the end of the TPC function BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length / 2.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length / 2.); } +//! 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, const int absorberactive = 0, int verbosity = 0) @@ -119,8 +143,13 @@ double TPC(PHG4Reco* g4Reco, double radius, radius += G4TPC::cage_thickness; + if (Enable::TPC_ENDCAP) + { + TPC_Endcaps(g4Reco); + } // update now that we know the outer radius BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); return radius; } + #endif From 006aa35d189f2edcbf0b399b531dae8aa03b0e77 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Oct 2020 12:36:08 -0400 Subject: [PATCH 0815/1222] check first for display before checking for number of events --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 71b83482d..ccd2f2d71 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -467,18 +467,6 @@ int Fun4All_G4_sPHENIX( //----------------- // Event processing //----------------- - 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; - } - if (Enable::DISPLAY) { DisplayOn(); @@ -495,6 +483,20 @@ int Fun4All_G4_sPHENIX( 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 + 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->skip(skip); se->run(nEvents); From d65561ce87637c7ca5558ebdc1d3e708385acbf4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Oct 2020 12:37:15 -0400 Subject: [PATCH 0816/1222] check first for display before checking for number of events --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index d6c4ec871..4f9fa7df7 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -479,6 +479,23 @@ int Fun4All_G4_fsPHENIX( //----------------- // 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; @@ -491,15 +508,6 @@ int Fun4All_G4_fsPHENIX( return 0; } - if (Enable::DISPLAY) - { - DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; - } - se->skip(skip); se->run(nEvents); From 552866d29cfc18baac872954eff078fc09e8dce9 Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Sat, 10 Oct 2020 11:36:39 -0400 Subject: [PATCH 0817/1222] Configurable parameters and additional cone sizes --- macros/g4simulations/G4_ParticleFlow.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/g4simulations/G4_ParticleFlow.C b/macros/g4simulations/G4_ParticleFlow.C index f46a1fad5..274d88b68 100644 --- a/macros/g4simulations/G4_ParticleFlow.C +++ b/macros/g4simulations/G4_ParticleFlow.C @@ -26,12 +26,17 @@ void ParticleFlow(int verbosity = 0) { // note: assumes topoCluster input already configured ParticleFlowReco *pfr = new ParticleFlowReco(); + pfr->set_energy_match_Nsigma( 1.5 ); + pfr->set_emulated_efficiency( 1.0 ); 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.5), "AntiKt_ParticleFlow_r05" ); particleflowjetreco->set_algo_node("ANTIKT"); particleflowjetreco->set_input_node("PARTICLEFLOW"); particleflowjetreco->Verbosity( verbosity ); From e3e21119fd5e2e6ec90f2c57e2e90e22909f432f Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Sat, 10 Oct 2020 11:56:48 -0400 Subject: [PATCH 0818/1222] Configurable parameters and additional cone sizes (now in common/) --- common/G4_ParticleFlow.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C index d75058495..9b35ca600 100644 --- a/common/G4_ParticleFlow.C +++ b/common/G4_ParticleFlow.C @@ -31,12 +31,17 @@ void ParticleFlow() // note: assumes topoCluster input already configured ParticleFlowReco *pfr = new ParticleFlowReco(); + pfr->set_energy_match_Nsigma( 1.5 ); + pfr->set_emulated_efficiency( 1.0 ); 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); From f3b14c2f8e3a5b6838e957345279cd25bd773ebd Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 12 Oct 2020 22:58:12 -0400 Subject: [PATCH 0819/1222] Tracking macro set up to run the Acts tracking chain by default, with options to run Genfit based tracking. Don't merge until we discuss it at the sims meeting.. --- common/G4_Tracking.C | 328 ++++++++++++++++++++++++++----------------- 1 file changed, 203 insertions(+), 125 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ce82976b2..e383438ba 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -23,6 +23,8 @@ #include #include #include +#include +#include #if __cplusplus >= 201703L #include @@ -53,24 +55,35 @@ namespace G4TRACKING { // Tracking reconstruction setup parameters and flags //===================================== - int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events - //default seed is PHTpcTracker - bool use_ca_seeding = false; - bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead + // The normal (default) Acts tracking chain is: + // PHTruthVertexing // event vertex + // PHCASeeding // TPC track seeds + // PHSiliconTruthTrackSeeding // make silicon layer track stubs + // PHSiliconTpcTrackMatching // match TPC track seeds to silicon layers track stubs + // PHMicromegasTpcTrackMatching // associate Micromagas clusters with TPC track stubs + // PHActsSourceLinks // convert TrkrClusters to Acts measurements + // PHActsTracks // convert SvtxTracks to Acts tracks + // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks + + // Possible variations - these are normally false + bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker + bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only + bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY + bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting + bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing + bool useActsProp = false; // if true, runs Acts CKF with only a seeder ***** NOT FULLY FUNCTIONAL YET + bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples - bool useActsFitting = true; // if true, acts KF is run with PHGenFitTrkProp - bool useActsProp = useActsFitting and false; // if true, runs Acts CKF with only a seeder - bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples + int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events + //default seed is PHTpcTracker // This is the setup we have been using before PHInitZVertexing was implemented - 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: - bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex - // This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event - //const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. + } // namespace G4TRACKING void TrackingInit() @@ -96,31 +109,16 @@ void Tracking_Reco() // Tracking //------------ - if(G4TRACKING::useActsFitting) - { - #if __cplusplus >= 201703L - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(0); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - #endif - } - - if (G4TRACKING::use_track_prop) - { - //-------------------------------------------------- - // Normal track seeding and propagation - //-------------------------------------------------- - - if (G4TRACKING::use_truth_vertex) + // Initial vertex finding (independent of tracking) + //================================= + if (!G4TRACKING::use_init_vertexing) { // We cheat to get the initial vertex for the full track reconstruction case PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); init_vtx->Verbosity(verbosity); se->registerSubsystem(init_vtx); } - else + else { // get the initial vertex for track fitting from the MVTX hits PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); @@ -133,78 +131,178 @@ void Tracking_Reco() se->registerSubsystem(init_zvtx); } - /// Create silicon track stubs - auto siliconSeeder = new PHSiliconTruthTrackSeeding("PHSiliconTruthTrackSeeding"); - se->registerSubsystem(siliconSeeder); - - /// Pick which TPC seeder to use - if (G4TRACKING::use_ca_seeding) + // Truth track seeding and propagation in one module + // ==================================== + if(G4TRACKING::use_truth_track_seeding) { - auto seeder = new PHCASeeding("PHCASeeding"); - se->registerSubsystem(seeder); + std::cout << "Using truth track seeding " << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); + pat_rec->Verbosity(verbosity); + se->registerSubsystem(pat_rec); } - else + + // TPC track seeding (finds all clusters in TPC for tracks) + //======================================= + if(!G4TRACKING::use_truth_track_seeding) { - 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... - se->registerSubsystem(tracker); + std::cout << "Using normal TPC track seeding " << std::endl; + + // TPC track seeding from data + if (G4TRACKING::use_PHTpcTracker_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(0); + se->registerSubsystem(tracker); + } + 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(0); + seeder->SetLayerRange(7,55); + seeder->SetSearchWindow(0.01,0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(2); + seeder->SetMinClustersPerTrack(20); + se->registerSubsystem(seeder); + } } - if(G4TRACKING::useActsFitting) - { - /// Match the silicon and TPC track stubs - auto stubMatcher = new PHSiliconTpcTrackMatching("PHSiliconTpcTrackMatching"); - stubMatcher->set_phi_search_window(0.02); // tune8 - optimum - stubMatcher->set_eta_search_window(0.015); // tune8 - optimum - stubMatcher->Verbosity(0); - stubMatcher->set_field_dir(G4MAGNET::magfield_rescale); - stubMatcher->set_field(G4MAGNET::magfield); - se->registerSubsystem(stubMatcher); - } - else - { - // Use GenFit to 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); - } - } - } - else - { - //------------------------------------------------------- - // Track finding using truth information only - //------------------------------------------------------ - - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - - // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(verbosity); - se->registerSubsystem(pat_rec); - } + // Genfit track propagation and final fitting (starts from TPC track seeds) + //================================================= + if(G4TRACKING::use_Genfit) + { + if(!G4TRACKING::use_truth_track_seeding) + { + std::cout << " Using PHGenFitTrkProp " << std::endl; + + // Association of TPC track seeds with 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); + } + } - //------------------------------------------------ - // Fitting of tracks using Kalman Filter - //------------------------------------------------ + std::cout << " Using Genfit track fitting " << std::endl; - if(G4TRACKING::useActsFitting) + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + + if (G4TRACKING::use_primary_vertex) + { + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + } + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + + // Acts tracking chain (starts from TPC track seeds) + //=================================== + if(!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) + { + std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + + // 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(0); + 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 + + // use truth information to assemble silicon clusters into track stubs for now + PHSiliconTruthTrackSeeding *silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + + // Match the TPC track stubs from Cthe A seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match ->Verbosity(0); + if(!G4TRACKING::use_PHTpcTracker_seeding) + silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding + silicon_match->set_field(G4MAGNET::magfield); + silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_phi_search_window(0.02); // tune8 - optimum + silicon_match->set_eta_search_window(0.015); // tune8 - optimum + 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(0); + // 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->print_test_windows_data(false); // normally false + se->registerSubsystem(mm_match); + } + } + + // Final fitting of tracks using Acts Kalman Filter + //================================= + if(!G4TRACKING::use_Genfit) { - #if __cplusplus >= 201703L + std::cout << " Using Acts track fitting " << std::endl; + +#if __cplusplus >= 201703L + + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent + + PHActsSourceLinks *sl = new PHActsSourceLinks(); + sl->Verbosity(0); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); + PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); @@ -212,10 +310,9 @@ void Tracking_Reco() /// Use either PHActsTrkFitter to run the ACTS /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial /// Kalman Filter which runs track finding and track fitting - /// Always run PHActsTracks first to take the SvtxTrack and convert it - /// to a form that Acts can process if(G4TRACKING::useActsProp) { + // Not fully functional yet PHActsTrkProp *actsProp = new PHActsTrkProp(); actsProp->Verbosity(0); actsProp->doTimeAnalysis(true); @@ -234,32 +331,10 @@ void Tracking_Reco() { PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); - actsFit->doTimeAnalysis(false); + actsFit->doTimeAnalysis(true); se->registerSubsystem(actsFit); } - - #endif - } - else - { - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - - if (G4TRACKING::use_primary_vertex) - { - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - } - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); +#endif } return; @@ -279,7 +354,11 @@ void Tracking_Eval(const std::string& outputfile) // Tracking evaluation //---------------- SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); + 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... @@ -290,16 +369,15 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if(G4TRACKING::useActsFitting) + if(!G4TRACKING::use_Genfit) { - #if __cplusplus >= 201703L +#if __cplusplus >= 201703L ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); - #endif +#endif } - if (G4TRACKING::use_primary_vertex) { From a5bd14456b7b1bd0899c494249134869d1266d5a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 13 Oct 2020 14:10:25 -0400 Subject: [PATCH 0820/1222] Fails during Init() with an error message if not using gcc-8. --- common/G4_Tracking.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e383438ba..dfd6c2a7d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -88,6 +88,12 @@ namespace G4TRACKING void TrackingInit() { +#if __cplusplus < 201703L + std::cout << "Cannot run tracking without gcc-8 environment. Please run:" << std::endl; + std::cout << "source /cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/bin/sphenix_setup.csh -n" << std::endl; + gSystem->Exit(1); +#endif + if (!Enable::MICROMEGAS) { G4MICROMEGAS::n_micromegas_layer = 0; From ac3dd37075d64ce20e0d09eb5a1d5e8d52845e34 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 14:43:49 -0400 Subject: [PATCH 0821/1222] Update G4_Tracking.C Setting the exit code to zero, otherwise jenkins will flag a lot of tests as failure (need to see how to get jenkins into this) --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index dfd6c2a7d..e0e4d5795 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -91,7 +91,7 @@ void TrackingInit() #if __cplusplus < 201703L std::cout << "Cannot run tracking without gcc-8 environment. Please run:" << std::endl; std::cout << "source /cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/bin/sphenix_setup.csh -n" << std::endl; - gSystem->Exit(1); + gSystem->Exit(0); #endif if (!Enable::MICROMEGAS) From deaee196ad6bc473818714b6ade42e4b99651df5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 15:05:41 -0400 Subject: [PATCH 0822/1222] use Hijing HepMC file from common area /sphenix/sim/sim01/sphnxpro/sHijing_HepMC --- common/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 565a4ba9c..6c571c394 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -86,7 +86,7 @@ namespace SARTRE namespace PILEUP { - string pileupfile = "/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"; + string pileupfile = "/sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat"; double TpcDriftVelocity = 8.0 / 1000.0; } // namespace PILEUP From 332157ad87577878af27c9804312f550d6110fb7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 17:01:08 -0400 Subject: [PATCH 0823/1222] reading hits and running g4 not supported, abort --- common/G4_Input.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_Input.C b/common/G4_Input.C index 6c571c394..74fba6dfa 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -117,6 +117,12 @@ void InputInit() 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; From f46dd759857fd87f926ba48ecf3394c074324deb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 17:01:30 -0400 Subject: [PATCH 0824/1222] use hits fril from webserver --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index ccd2f2d71..0986d3e7f 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -26,9 +26,12 @@ R__LOAD_LIBRARY(libfun4all.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 = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", + 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, From 80a2f4cfb46ca2fa48599d7a911b3e933e1bf321 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 17:03:02 -0400 Subject: [PATCH 0825/1222] use hits file from webserver --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 4f9fa7df7..dbc9812ba 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -32,7 +32,7 @@ R__LOAD_LIBRARY(libfun4all.so) int Fun4All_G4_fsPHENIX( const int nEvents = 2, - const string &inputFile = "/sphenix/sim/sim01/production/2016-07-21/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", + const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", const string &outputFile = "G4fsPHENIX.root", const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", const int skip = 0, From 7af1ed6ecbb31157787aac3caee7feba899e51ee Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 17:03:44 -0400 Subject: [PATCH 0826/1222] use hits file from webserver --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index b5cb068e9..2e65ac986 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -26,7 +26,7 @@ R__LOAD_LIBRARY(libfun4all.so) int Fun4All_G4_EICDetector( const int nEvents = 1, - const string &inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", + const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", const string &outputFile = "G4EICDetector.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, From cba0fd1b47ef1f3076c690114134d8a1976fcd49 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 13 Oct 2020 20:19:07 -0400 Subject: [PATCH 0827/1222] accidentally left hepmc input active --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index dbc9812ba..c29bfaa03 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -86,7 +86,7 @@ int Fun4All_G4_fsPHENIX( // Input::GUN = true; //Input::GUN_VERBOSITY = 0; - Input::HEPMC = true; +// Input::HEPMC = true; INPUTHEPMC::filename = inputFile; // Event pile up simulation with collision rate in Hz MB collisions. From 873fd9ffb4bb0ee9d7193a85bc255a2b9a39967a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 14 Oct 2020 09:45:37 -0400 Subject: [PATCH 0828/1222] add string gymnastics to print out correct setup script for all our implementations --- common/G4_Tracking.C | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e0e4d5795..1daad68f6 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -89,9 +89,31 @@ namespace G4TRACKING void TrackingInit() { #if __cplusplus < 201703L - std::cout << "Cannot run tracking without gcc-8 environment. Please run:" << std::endl; - std::cout << "source /cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/bin/sphenix_setup.csh -n" << std::endl; - gSystem->Exit(0); + std::cout << std::endl << "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) From 091d7a37870c758370ad32549e64f57ba7d419c5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 14 Oct 2020 09:47:06 -0400 Subject: [PATCH 0829/1222] clang-format --- common/G4_Tracking.C | 481 ++++++++++++++++++++++--------------------- 1 file changed, 241 insertions(+), 240 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 1daad68f6..09056df24 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -12,28 +12,28 @@ #include +#include #include #include #include #include #include +#include +#include +#include #include +#include #include #include -#include -#include -#include -#include -#include #if __cplusplus >= 201703L +#include #include #include -#include #include -#include +#include #include -#include +#include #endif #include @@ -67,14 +67,14 @@ namespace G4TRACKING // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks // Possible variations - these are normally false - bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker - bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only - bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY - bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing - bool useActsProp = false; // if true, runs Acts CKF with only a seeder ***** NOT FULLY FUNCTIONAL YET - bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples + bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker + bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only + bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY + bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting + bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing + bool useActsProp = false; // if true, runs Acts CKF with only a seeder ***** NOT FULLY FUNCTIONAL YET + bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events //default seed is PHTpcTracker @@ -89,20 +89,21 @@ namespace G4TRACKING void TrackingInit() { #if __cplusplus < 201703L - std::cout << std::endl << "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::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); + 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) @@ -140,231 +141,231 @@ void Tracking_Reco() // Initial vertex finding (independent of tracking) //================================= if (!G4TRACKING::use_init_vertexing) - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - } + { + // We cheat to get the initial vertex for the full track reconstruction case + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + } else - { - // get the initial vertex for track fitting from the MVTX hits - PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); - int seed_layer[7] = {0, 1, 2, 3, 4, 5, 6}; - init_zvtx->set_seeding_layer(seed_layer, 7); - // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). - init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); - init_zvtx->Verbosity(verbosity); - se->registerSubsystem(init_zvtx); - } + { + // get the initial vertex for track fitting from the MVTX hits + PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); + int seed_layer[7] = {0, 1, 2, 3, 4, 5, 6}; + init_zvtx->set_seeding_layer(seed_layer, 7); + // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. + // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). + init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); + init_zvtx->Verbosity(verbosity); + se->registerSubsystem(init_zvtx); + } - // Truth track seeding and propagation in one module - // ==================================== - if(G4TRACKING::use_truth_track_seeding) - { - std::cout << "Using truth track seeding " << std::endl; + // Truth track seeding and propagation in one module + // ==================================== + if (G4TRACKING::use_truth_track_seeding) + { + std::cout << "Using truth track seeding " << std::endl; - // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(verbosity); - se->registerSubsystem(pat_rec); - } + // For each truth particle, create a track and associate clusters with it using truth information + PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); + pat_rec->Verbosity(verbosity); + se->registerSubsystem(pat_rec); + } // TPC track seeding (finds all clusters in TPC for tracks) //======================================= - if(!G4TRACKING::use_truth_track_seeding) + if (!G4TRACKING::use_truth_track_seeding) + { + std::cout << "Using normal TPC track seeding " << std::endl; + + // TPC track seeding from data + if (G4TRACKING::use_PHTpcTracker_seeding) { - std::cout << "Using normal TPC track seeding " << std::endl; - - // TPC track seeding from data - if (G4TRACKING::use_PHTpcTracker_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(0); - se->registerSubsystem(tracker); - } - 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(0); - 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 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(0); + se->registerSubsystem(tracker); } + 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(0); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(2); + seeder->SetMinClustersPerTrack(20); + se->registerSubsystem(seeder); + } + } // Genfit track propagation and final fitting (starts from TPC track seeds) //================================================= - if(G4TRACKING::use_Genfit) + if (G4TRACKING::use_Genfit) + { + if (!G4TRACKING::use_truth_track_seeding) { - if(!G4TRACKING::use_truth_track_seeding) - { - std::cout << " Using PHGenFitTrkProp " << std::endl; - - // Association of TPC track seeds with 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; - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - - if (G4TRACKING::use_primary_vertex) - { - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - } - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); + std::cout << " Using PHGenFitTrkProp " << std::endl; + + // Association of TPC track seeds with 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; + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + + if (G4TRACKING::use_primary_vertex) + { + kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + } + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + // Acts tracking chain (starts from TPC track seeds) //=================================== - if(!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) - { - std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; - - // 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(0); - 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 - - // use truth information to assemble silicon clusters into track stubs for now - PHSiliconTruthTrackSeeding *silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); - - // Match the TPC track stubs from Cthe A seeder to silicon track stubs from PHSiliconTruthTrackSeeding - PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); - silicon_match ->Verbosity(0); - if(!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding - silicon_match->set_field(G4MAGNET::magfield); - silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_phi_search_window(0.02); // tune8 - optimum - silicon_match->set_eta_search_window(0.015); // tune8 - optimum - 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(0); - // 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->print_test_windows_data(false); // normally false - se->registerSubsystem(mm_match); - } + if (!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) + { + std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + + // 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(0); + 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 + + // use truth information to assemble silicon clusters into track stubs for now + PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + + // Match the TPC track stubs from Cthe A seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match->Verbosity(0); + if (!G4TRACKING::use_PHTpcTracker_seeding) + silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding + silicon_match->set_field(G4MAGNET::magfield); + silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_phi_search_window(0.02); // tune8 - optimum + silicon_match->set_eta_search_window(0.015); // tune8 - optimum + se->registerSubsystem(silicon_match); } - // Final fitting of tracks using Acts Kalman Filter - //================================= - if(!G4TRACKING::use_Genfit) + // Associate Micromegas clusters with the tracks + if (G4MICROMEGAS::n_micromegas_layer > 0) { - std::cout << " Using Acts track fitting " << std::endl; + 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(0); + // 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->print_test_windows_data(false); // normally false + se->registerSubsystem(mm_match); + } + } + + // Final fitting of tracks using Acts Kalman Filter + //================================= + if (!G4TRACKING::use_Genfit) + { + std::cout << " Using Acts track fitting " << std::endl; #if __cplusplus >= 201703L - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(0); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - if(G4TRACKING::useActsProp) - { - // Not fully functional yet - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - actsProp->doTimeAnalysis(true); - actsProp->resetCovariance(true); - actsProp->setVolumeMaxChi2(7,60); /// MVTX - actsProp->setVolumeMaxChi2(9,60); /// INTT - actsProp->setVolumeMaxChi2(11,60); /// TPC - actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers - actsProp->setVolumeLayerMaxChi2(9, 4, 100); - actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers - actsProp->setVolumeLayerMaxChi2(11,4, 200); - - se->registerSubsystem(actsProp); - } - else - { - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(true); - se->registerSubsystem(actsFit); - } -#endif + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent + + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(0); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); + + PHActsTracks* actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + /// Use either PHActsTrkFitter to run the ACTS + /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial + /// Kalman Filter which runs track finding and track fitting + if (G4TRACKING::useActsProp) + { + // Not fully functional yet + PHActsTrkProp* actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + actsProp->doTimeAnalysis(true); + actsProp->resetCovariance(true); + actsProp->setVolumeMaxChi2(7, 60); /// MVTX + actsProp->setVolumeMaxChi2(9, 60); /// INTT + actsProp->setVolumeMaxChi2(11, 60); /// TPC + actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers + actsProp->setVolumeLayerMaxChi2(9, 4, 100); + actsProp->setVolumeLayerMaxChi2(11, 2, 200); /// TPC first few layers + actsProp->setVolumeLayerMaxChi2(11, 4, 200); + + se->registerSubsystem(actsProp); + } + else + { + PHActsTrkFitter* actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->doTimeAnalysis(true); + se->registerSubsystem(actsFit); } - +#endif + } + return; } @@ -382,11 +383,11 @@ void Tracking_Eval(const std::string& outputfile) // 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 = 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... @@ -397,15 +398,15 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if(!G4TRACKING::use_Genfit) - { + if (!G4TRACKING::use_Genfit) + { #if __cplusplus >= 201703L - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); + ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); + actsEval->Verbosity(0); + actsEval->setEvalCKF(false); + se->registerSubsystem(actsEval); #endif - } + } if (G4TRACKING::use_primary_vertex) { From caf736d13f8c910e5ad4aeeaf26fddc7fa76f7fc Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 15 Oct 2020 14:29:10 -0400 Subject: [PATCH 0830/1222] Add lines to Run Hugo's distortion adder. --- common/G4_Tracking.C | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e0e4d5795..43340975c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -269,8 +269,10 @@ void Tracking_Reco() silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_phi_search_window(0.02); // tune8 - optimum - silicon_match->set_eta_search_window(0.015); // tune8 - optimum + // default tuned values are 0.02 and 0.015 + silicon_match->set_phi_search_window(0.10); + silicon_match->set_eta_search_window(0.15); + silicon_match->set_test_windows(true); se->registerSubsystem(silicon_match); } @@ -283,12 +285,12 @@ void Tracking_Reco() PHMicromegasTpcTrackMatching *mm_match = new PHMicromegasTpcTrackMatching(); mm_match ->Verbosity(0); // 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_lyr1(0.6); 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_z_search_window_lyr2(0.6); mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit - mm_match->print_test_windows_data(false); // normally false + mm_match->set_test_windows(true); // normally false se->registerSubsystem(mm_match); } } @@ -338,7 +340,7 @@ void Tracking_Reco() PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); actsFit->doTimeAnalysis(true); - se->registerSubsystem(actsFit); + //se->registerSubsystem(actsFit); } #endif } @@ -381,7 +383,7 @@ void Tracking_Eval(const std::string& outputfile) ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); + //se->registerSubsystem(actsEval); #endif } From ca8d2da7d5d4d1f4d72649d73dcb04ea77c646da Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 16 Oct 2020 12:58:12 -0400 Subject: [PATCH 0831/1222] update with makeactsgeometry change --- common/G4_Tracking.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e0e4d5795..0fb57922d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -27,6 +27,7 @@ #include #if __cplusplus >= 201703L +#include #include #include #include @@ -301,8 +302,14 @@ void Tracking_Reco() #if __cplusplus >= 201703L + /// Geometry must be built before any Acts modules + MakeActsGeometry *geom = new MakeActsGeometry(); + geom->Verbosity(0); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(geom); + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks *sl = new PHActsSourceLinks(); sl->Verbosity(0); sl->setMagField(G4MAGNET::magfield); From e13cba92970cf069cb2140dcb9d39e1e8c06b970 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 16 Oct 2020 15:55:33 -0400 Subject: [PATCH 0832/1222] fix weird git formatting --- common/G4_Tracking.C | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index d7b12ef71..a87278e84 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -330,47 +330,47 @@ void Tracking_Reco() geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(geom); - + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent PHActsSourceLinks *sl = new PHActsSourceLinks(); sl->Verbosity(0); sl->setMagField(G4MAGNET::magfield); sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); - + PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); - + /// Use either PHActsTrkFitter to run the ACTS /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial /// Kalman Filter which runs track finding and track fitting if(G4TRACKING::useActsProp) - { - // Not fully functional yet - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - actsProp->doTimeAnalysis(true); - actsProp->resetCovariance(true); - actsProp->setVolumeMaxChi2(7,60); /// MVTX - actsProp->setVolumeMaxChi2(9,60); /// INTT - actsProp->setVolumeMaxChi2(11,60); /// TPC - actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers - actsProp->setVolumeLayerMaxChi2(9, 4, 100); - actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers - actsProp->setVolumeLayerMaxChi2(11,4, 200); - - se->registerSubsystem(actsProp); - } - else - { - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(true); - se->registerSubsystem(actsFit); - } + { + // Not fully functional yet + PHActsTrkProp *actsProp = new PHActsTrkProp(); + actsProp->Verbosity(0); + actsProp->doTimeAnalysis(true); + actsProp->resetCovariance(true); + actsProp->setVolumeMaxChi2(7,60); /// MVTX + actsProp->setVolumeMaxChi2(9,60); /// INTT + actsProp->setVolumeMaxChi2(11,60); /// TPC + actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers + actsProp->setVolumeLayerMaxChi2(9, 4, 100); + actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers + actsProp->setVolumeLayerMaxChi2(11,4, 200); + + se->registerSubsystem(actsProp); + } + else + { + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->doTimeAnalysis(false); + se->registerSubsystem(actsFit); + } #endif - + } return; From 5d6ac83abb2420c41ec4da17a7fb63877036711d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sat, 17 Oct 2020 14:11:14 -0400 Subject: [PATCH 0833/1222] Added setup for running SC_CALIBMODE. --- common/G4_Tracking.C | 87 +++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 43340975c..84b9eb75b 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -53,6 +53,10 @@ namespace Enable namespace G4TRACKING { + // Space Charge calibration flag + bool SC_CALIBMODE = true; + double SC_COLLISIONRATE = 50e3; + // Tracking reconstruction setup parameters and flags //===================================== @@ -262,42 +266,67 @@ void Tracking_Reco() silicon_seeding->Verbosity(0); se->registerSubsystem(silicon_seeding); - // Match the TPC track stubs from Cthe A seeder to silicon track stubs from PHSiliconTruthTrackSeeding + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); silicon_match ->Verbosity(0); if(!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding + silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - // default tuned values are 0.02 and 0.015 - silicon_match->set_phi_search_window(0.10); - silicon_match->set_eta_search_window(0.15); - silicon_match->set_test_windows(true); + 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 default tuned values are 0.01 and 0.004 + silicon_match->set_phi_search_window(0.02); + silicon_match->set_eta_search_window(0.004); + } + else + { + // after distortion corrections, default tuned values are 0.01 and 0.004 + silicon_match->set_phi_search_window(0.01); + silicon_match->set_eta_search_window(0.004); + } + silicon_match->set_test_windows_printout(true); 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(0); - // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default - mm_match-> set_rphi_search_window_lyr1(0.6); - 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.6); - mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit - mm_match->set_test_windows(true); // normally false - se->registerSubsystem(mm_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(0); + 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.15); + 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.15); + 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(true); // normally false + se->registerSubsystem(mm_match); + } } - + // Final fitting of tracks using Acts Kalman Filter //================================= - if(!G4TRACKING::use_Genfit) + if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { std::cout << " Using Acts track fitting " << std::endl; @@ -340,7 +369,7 @@ void Tracking_Reco() PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); actsFit->doTimeAnalysis(true); - //se->registerSubsystem(actsFit); + se->registerSubsystem(actsFit); } #endif } @@ -377,13 +406,13 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if(!G4TRACKING::use_Genfit) + if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { #if __cplusplus >= 201703L ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); actsEval->setEvalCKF(false); - //se->registerSubsystem(actsEval); + se->registerSubsystem(actsEval); #endif } From 5f8920a124750c3eeb7b43da723100e1afd03b03 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 08:31:52 -0400 Subject: [PATCH 0834/1222] oops fix straggling conflict --- common/G4_Tracking.C | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f4cd0b120..87acfa9b3 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -458,15 +458,6 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); -<<<<<<< HEAD - if (!G4TRACKING::use_Genfit) - { -#if __cplusplus >= 201703L - ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); - actsEval->Verbosity(0); - actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); -======= if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { #if __cplusplus >= 201703L @@ -474,7 +465,6 @@ void Tracking_Eval(const std::string& outputfile) actsEval->Verbosity(0); actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); ->>>>>>> 5d6ac83abb2420c41ec4da17a7fb63877036711d #endif } From 4038f1269c041b740b4939954251a5b3bcb1521e Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 11:35:03 -0400 Subject: [PATCH 0835/1222] fix leftover from merge, remove PHActsTrkProp --- common/G4_Tracking.C | 66 +++++++++++--------------------------------- 1 file changed, 16 insertions(+), 50 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 87acfa9b3..bce696a14 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -344,35 +344,15 @@ void Tracking_Reco() 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(true); // normally false + mm_match->set_test_windows_printout(false); // normally false se->registerSubsystem(mm_match); } } - - // Final fitting of tracks using Acts Kalman Filter - //================================= - if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) - { - 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(0); - // 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->print_test_windows_data(false); // normally false - se->registerSubsystem(mm_match); - } - } - + // Final fitting of tracks using Acts Kalman Filter //================================= - if (!G4TRACKING::use_Genfit) - { + if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + { std::cout << " Using Acts track fitting " << std::endl; #if __cplusplus >= 201703L @@ -393,35 +373,21 @@ void Tracking_Reco() PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - if(G4TRACKING::useActsProp) - { - // Not fully functional yet - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - actsProp->doTimeAnalysis(true); - actsProp->resetCovariance(true); - actsProp->setVolumeMaxChi2(7,60); /// MVTX - actsProp->setVolumeMaxChi2(9,60); /// INTT - actsProp->setVolumeMaxChi2(11,60); /// TPC - actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers - actsProp->setVolumeLayerMaxChi2(9, 4, 100); - actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers - actsProp->setVolumeLayerMaxChi2(11,4, 200); - - se->registerSubsystem(actsProp); - } - else + + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(10); + 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) { - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(false); - se->registerSubsystem(actsFit); + /// run tpc residual determination with silicon+MM track fit } + #endif } From 40bc251cb802fc68ae3af8800a00350c993e0543 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 12:09:34 -0400 Subject: [PATCH 0836/1222] remove acts CKF --- common/G4_Tracking.C | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index a87278e84..0e6498abe 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -73,7 +73,6 @@ namespace G4TRACKING bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing - bool useActsProp = false; // if true, runs Acts CKF with only a seeder ***** NOT FULLY FUNCTIONAL YET bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples @@ -342,33 +341,11 @@ void Tracking_Reco() actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - if(G4TRACKING::useActsProp) - { - // Not fully functional yet - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - actsProp->doTimeAnalysis(true); - actsProp->resetCovariance(true); - actsProp->setVolumeMaxChi2(7,60); /// MVTX - actsProp->setVolumeMaxChi2(9,60); /// INTT - actsProp->setVolumeMaxChi2(11,60); /// TPC - actsProp->setVolumeLayerMaxChi2(9, 2, 100); /// INTT first few layers - actsProp->setVolumeLayerMaxChi2(9, 4, 100); - actsProp->setVolumeLayerMaxChi2(11,2, 200); /// TPC first few layers - actsProp->setVolumeLayerMaxChi2(11,4, 200); - - se->registerSubsystem(actsProp); - } - else - { - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(false); - se->registerSubsystem(actsFit); - } + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->doTimeAnalysis(false); + se->registerSubsystem(actsFit); + #endif } From bd84572d7834f1226667b5fd2a9327d267243b83 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 12:24:16 -0400 Subject: [PATCH 0837/1222] fix incorrect logic --- common/G4_Tracking.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index bce696a14..05105dc77 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -348,10 +348,10 @@ void Tracking_Reco() se->registerSubsystem(mm_match); } } - + // Final fitting of tracks using Acts Kalman Filter //================================= - if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + if (!G4TRACKING::use_Genfit) { std::cout << " Using Acts track fitting " << std::endl; @@ -373,7 +373,7 @@ void Tracking_Reco() PHActsTracks *actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); - + PHActsTrkFitter *actsFit = new PHActsTrkFitter(); actsFit->Verbosity(10); actsFit->doTimeAnalysis(false); From 50a226d443c92722a36119c27bb38e7ce197c41e Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 13:41:58 -0400 Subject: [PATCH 0838/1222] commit update --- common/G4_Tracking.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 05105dc77..f00c22a47 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -344,14 +344,14 @@ void Tracking_Reco() 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); // normally false + mm_match->set_test_windows_printout(false); // normally false se->registerSubsystem(mm_match); } } // Final fitting of tracks using Acts Kalman Filter //================================= - if (!G4TRACKING::use_Genfit) + if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { std::cout << " Using Acts track fitting " << std::endl; @@ -378,7 +378,8 @@ void Tracking_Reco() actsFit->Verbosity(10); actsFit->doTimeAnalysis(false); /// If running with distortions, fit only the silicon+MMs first - actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + //actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->fitSiliconMMs(true); se->registerSubsystem(actsFit); From 8620014ded7202e86a0f534fb27ba7d54aae65af Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 19 Oct 2020 14:30:55 -0400 Subject: [PATCH 0839/1222] update with correct tpc macro --- common/G4_TPC.C | 42 ++++++++++++++++++++++++++++-------------- common/G4_Tracking.C | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index c4c06c5c2..b14f07077 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -43,6 +43,15 @@ namespace G4TPC 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.; + + // distortions + bool ENABLE_DISTORTIONS = true; + std::string distortion_filename = "fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + unsigned int distortion_coordinates = + PHG4TpcElectronDrift::COORD_PHI| + PHG4TpcElectronDrift::COORD_R| + PHG4TpcElectronDrift::COORD_Z; + } // namespace G4TPC void TPCInit() @@ -102,24 +111,24 @@ double TPC(PHG4Reco* g4Reco, tpc->SetActive(); tpc->SuperDetector("TPC"); tpc->set_double_param("steplimits", 1); // 1cm steps - + if (AbsorberActive) - { - tpc->SetAbsorberActive(); - } + { + tpc->SetAbsorberActive(); + } tpc->OverlapCheck(OverlapCheck); - + g4Reco->registerSubsystem(tpc); - + if (Enable::TPC_ENDCAP) - { - TPC_Endcaps(g4Reco); - } - + { + TPC_Endcaps(g4Reco); + } + radius = G4TPC::tpc_outer_radius; - + radius += no_overlapp; - + return radius; } @@ -140,11 +149,16 @@ void TPC_Cells() PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); edrift->Verbosity(verbosity); + edrift->set_enable_distortions( G4TPC::ENABLE_DISTORTIONS); + if( G4TPC::ENABLE_DISTORTIONS ) + { + edrift->set_distortion_filename( G4TPC::distortion_filename ); + edrift->set_coordinates( G4TPC::distortion_coordinates ); + } + // 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->set_double_param("added_smear_trans",0.085); - //edrift->set_double_param("added_smear_long",0.105); edrift->registerPadPlane(padplane); se->registerSubsystem(edrift); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f00c22a47..76d5cec53 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -344,7 +344,7 @@ void Tracking_Reco() 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); // normally false + mm_match->set_test_windows_printout(true); // normally false se->registerSubsystem(mm_match); } } From 5c1002a7d0371f2ff87846369c9f561b81087438 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 19 Oct 2020 23:29:56 -0400 Subject: [PATCH 0840/1222] put embed flag =2 back for simple event generator --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 1 + detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 1 + detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 1 + 3 files changed, 3 insertions(+) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 2e65ac986..6aa6ddda5 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -128,6 +128,7 @@ int Fun4All_G4_EICDetector( INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-3, 3); INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); + INPUTGENERATOR::SimpleEventGenerator->Embed(2); } // Upsilons if (Input::UPSILON) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index c29bfaa03..9746135b7 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -122,6 +122,7 @@ int Fun4All_G4_fsPHENIX( INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 3); INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.5, 50.); + INPUTGENERATOR::SimpleEventGenerator->Embed(2); } // Upsilons if (Input::UPSILON) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 0986d3e7f..2b478a753 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -128,6 +128,7 @@ int Fun4All_G4_sPHENIX( INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); + INPUTGENERATOR::SimpleEventGenerator->Embed(2); } // Upsilons if (Input::UPSILON) From a02eeef1fc94ea65d278e6cb780bbec336931a4a Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Tue, 20 Oct 2020 08:52:23 -0400 Subject: [PATCH 0841/1222] Added MBD/BBC --- macros/g4simulations/Fun4All_G4_sPHENIX.C | 17 ++++---- macros/g4simulations/G4Setup_sPHENIX.C | 48 ++++++++++++----------- macros/g4simulations/G4_Bbc.C | 43 ++++++++++++++++---- macros/g4simulations/G4_DSTReader.C | 9 ++--- 4 files changed, 72 insertions(+), 45 deletions(-) diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C index d1820b06c..e24ccfbe0 100644 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ b/macros/g4simulations/Fun4All_G4_sPHENIX.C @@ -93,19 +93,16 @@ int Fun4All_G4_sPHENIX( // What to run //====================== - bool do_bbc = true; - bool do_pipe = true; bool do_mvtxservice = true; + bool do_bbc = true; + bool do_tracking = true; bool do_tracking_cell = do_tracking && true; bool do_tracking_cluster = do_tracking_cell && true; bool do_tracking_track = do_tracking_cluster && true; bool do_tracking_eval = do_tracking_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; @@ -172,7 +169,7 @@ int Fun4All_G4_sPHENIX( gSystem->Load("libg4intt.so"); // establish the geometry and reconstruction setup gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_epd, do_mvtxservice); + G4Init(do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_epd, do_mvtxservice); int absorberactive = 1; // set to 1 to make all absorbers active volumes // 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) @@ -365,10 +362,10 @@ int Fun4All_G4_sPHENIX( #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); + do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); #else G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); + do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); #endif } @@ -442,7 +439,6 @@ int Fun4All_G4_sPHENIX( gROOT->LoadMacro("G4_Global.C"); Global_Reco(); } - else if (do_global_fastsim) { gROOT->LoadMacro("G4_Global.C"); @@ -564,6 +560,7 @@ int Fun4All_G4_sPHENIX( pileup->set_vertex_distribution_mean(0, 0, 0, 0); pileup->set_vertex_distribution_width(100e-4, 100e-4, 30, 5); se->registerInputManager(pileup); + const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); //background files for p+p pileup sim //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); @@ -597,7 +594,7 @@ int Fun4All_G4_sPHENIX( G4DSTreader(outputFile, // /*int*/ absorberactive, /*bool*/ do_tracking, - /*bool*/ do_pstof, + /*bool*/ do_bbc, /*bool*/ do_cemc, /*bool*/ do_hcalin, /*bool*/ do_magnet, diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C index c7d2b2218..6e1cbe251 100644 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ b/macros/g4simulations/G4Setup_sPHENIX.C @@ -2,7 +2,7 @@ #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) #include "G4_Pipe.C" #include "G4_Tracking.C" -#include "G4_PSTOF.C" +#include "G4_Bbc.C" #include "G4_CEmc_Spacal.C" #include "G4_HcalIn_ref.C" #include "G4_Magnet.C" @@ -35,7 +35,7 @@ double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes void RunLoadTest() {} void G4Init(const bool do_tracking = true, - const bool do_pstof = true, + const bool do_bbc = true, const bool do_cemc = true, const bool do_hcalin = true, const bool do_magnet = true, @@ -61,10 +61,10 @@ void G4Init(const bool do_tracking = true, TrackingInit(); } - if (do_pstof) + if (do_bbc) { - gROOT->LoadMacro("G4_PSTOF.C"); - PSTOFInit(); + gROOT->LoadMacro("G4_Bbc.C"); + BbcInit(); } if (do_cemc) @@ -121,20 +121,19 @@ int G4Setup(const int absorberactive = 0, #else const EDecayType decayType = TPythia6Decayer::kAll, #endif - const bool do_tracking = 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 bool do_plugdoor = false, -// const bool do_plugdoor = true, - const bool do_FEMC = false, - const bool do_epd = true, + const bool do_tracking = true, + const bool do_bbc = 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_plugdoor = true, + const bool do_FEMC = false, + const bool do_epd = true, const bool do_mvtxservice = false, - const float magfield_rescale = 1.0) { - + const float magfield_rescale = 1.0) { + //--------------- // Load libraries //--------------- @@ -192,9 +191,12 @@ int G4Setup(const int absorberactive = 0, if (do_tracking) radius = Tracking(g4Reco, radius, absorberactive); //---------------------------------------- - // PSTOF - - if (do_pstof) radius = PSTOF(g4Reco, radius, absorberactive); + // BBC + if (do_bbc) + { + cout << "IN DO_BBC" << endl; + radius = Bbc(g4Reco, radius, absorberactive); + } //---------------------------------------- // CEMC @@ -234,7 +236,7 @@ int G4Setup(const int absorberactive = 0, // 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_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 @@ -300,6 +302,7 @@ void ShowerCompress(int verbosity = 0) { 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"); @@ -344,6 +347,7 @@ void DstCompress(Fun4AllDstOutputManager* out) { out->StripNode("G4CELL_CEMC"); out->StripNode("G4CELL_HCALIN"); out->StripNode("G4CELL_HCALOUT"); + out->StripNode("G4HIT_BBC"); out->StripNode("G4HIT_FEMC"); out->StripNode("G4HIT_ABSORBER_FEMC"); out->StripNode("G4CELL_FEMC"); diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C index efaccdf1c..d9c581da1 100644 --- a/macros/g4simulations/G4_Bbc.C +++ b/macros/g4simulations/G4_Bbc.C @@ -1,8 +1,8 @@ #pragma once #include - #include +#include R__LOAD_LIBRARY(libg4bbc.so) @@ -17,10 +17,32 @@ namespace G4BBC double t_smearing = 0.002; // 20ps timing resolution } -void BbcInit() {} +void BbcInit() +{ + cout << "BbcInit()" << endl; + // Nothing to Init for now +} + +double Bbc(PHG4Reco* g4Reco, + double radius, + const int absorberactive = 0, + int verbosity = 0) +{ + + gSystem->Load("libg4detectors.so"); -void Bbc_Reco(int verbosity = 0) { - + cout << "XXXX CREATING BBC" << endl; + PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); + bbc->SuperDetector( "BBC" ); + g4Reco->registerSubsystem( bbc ); + + radius = 15.; // outer shell is 15 cm + return radius; +} + + +void Bbc_Reco(int verbosity = 0) +{ //--------------- // Fun4All server @@ -28,10 +50,15 @@ void Bbc_Reco(int verbosity = 0) { Fun4AllServer *se = Fun4AllServer::instance(); - BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps - se->registerSubsystem(bbcvertex); + // disable fast sim for now + int do_bbcfast = 0; + if ( do_bbcfast ) + { + BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); + bbcvertex->set_z_smearing(G4BBC::z_smearing); + bbcvertex->set_t_smearing(G4BBC::t_smearing); + se->registerSubsystem(bbcvertex); + } return; } diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C index 3ddc62b7f..3704fcf6c 100644 --- a/macros/g4simulations/G4_DSTReader.C +++ b/macros/g4simulations/G4_DSTReader.C @@ -23,7 +23,7 @@ void G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// int absorberactive = 1, // bool do_svtx = true, // - bool do_pstof = true, // + bool do_bbc = true, // bool do_cemc = true, // bool do_hcalin = true, // bool do_magnet = true, // @@ -42,8 +42,7 @@ G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// const bool save_g4_raw = true; // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); + 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); @@ -61,9 +60,9 @@ G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// ana->AddNode("SVTX"); } - if (do_pstof) + if (do_bbc) { - ana->AddNode("PSTOF_0"); + ana->AddNode("BBC"); } if (do_cemc) From 918a5c712a37876725948d1df5f1d2ce7687632b Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 20 Oct 2020 15:01:56 -0400 Subject: [PATCH 0842/1222] update with tpc residual module --- common/G4_Tracking.C | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 76d5cec53..aabc8d38d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -35,6 +35,7 @@ #include #include #include +#include #endif #include @@ -312,7 +313,7 @@ void Tracking_Reco() silicon_match->set_phi_search_window(0.01); silicon_match->set_eta_search_window(0.004); } - silicon_match->set_test_windows_printout(true); + silicon_match->set_test_windows_printout(false); se->registerSubsystem(silicon_match); } @@ -344,14 +345,14 @@ void Tracking_Reco() 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(true); // normally false + mm_match->set_test_windows_printout(false); // normally false se->registerSubsystem(mm_match); } } // Final fitting of tracks using Acts Kalman Filter //================================= - if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + if (!G4TRACKING::use_Genfit) { std::cout << " Using Acts track fitting " << std::endl; @@ -375,17 +376,20 @@ void Tracking_Reco() se->registerSubsystem(actsTracks); PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(10); + actsFit->Verbosity(0); actsFit->doTimeAnalysis(false); /// If running with distortions, fit only the silicon+MMs first - //actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); - actsFit->fitSiliconMMs(true); + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); se->registerSubsystem(actsFit); if(G4TRACKING::SC_CALIBMODE) { /// run tpc residual determination with silicon+MM track fit + PHTpcResiduals *residuals = new PHTpcResiduals(); + residuals->Verbosity(0); + se->registerSubsystem(residuals); + } From 5b5292f591bd719f91feda8db665da6146a8151a Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Wed, 21 Oct 2020 15:41:31 -0400 Subject: [PATCH 0843/1222] Added MBD/BBC --- common/G4_Bbc.C | 22 ++++++++++++++++------ detectors/sPHENIX/G4Setup_sPHENIX.C | 12 +++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 9a390edbf..cedd32959 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -2,8 +2,9 @@ #define MACRO_G4BBC_C #include - #include +#include + R__LOAD_LIBRARY(libg4bbc.so) @@ -18,7 +19,11 @@ namespace G4BBC double t_smearing = 0.002; // 20ps timing resolution } // namespace G4BBC -void BbcInit() {} +void BbcInit() +{ + cout << "In BbcInit()" << endl; + // Nothing to Init for now +} void Bbc_Reco(int verbosity = 0) { @@ -28,10 +33,15 @@ void Bbc_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps - se->registerSubsystem(bbcvertex); + // disable fast sim for now + int do_bbcfast = 0; + if ( do_bbcfast ) + { + BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); + bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing + bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps + se->registerSubsystem(bbcvertex); + } return; } diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index fece3d8b6..94e9602d9 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -3,6 +3,7 @@ #include "GlobalVariables.C" +#include "G4_Bbc.C" #include "G4_BlackHole.C" #include "G4_CEmc_Spacal.C" #include "G4_CEmc_Albedo.C" @@ -14,7 +15,6 @@ #include "G4_Magnet.C" #include "G4_Micromegas.C" #include "G4_Mvtx.C" -#include "G4_PSTOF.C" #include "G4_Pipe.C" #include "G4_PlugDoor.C" #include "G4_TPC.C" @@ -51,9 +51,9 @@ void G4Init() if (Enable::TPC) TPCInit(); if (Enable::MICROMEGAS) MicromegasInit(); - if (Enable::PSTOF) + if (Enable::BBC) { - PSTOFInit(); + BbcInit(); } if (Enable::CEMCALBEDO) @@ -159,9 +159,9 @@ int G4Setup() if (Enable::MICROMEGAS) Micromegas(g4Reco); //---------------------------------------- - // PSTOF + // BBC - if (Enable::PSTOF) radius = PSTOF(g4Reco, radius); + if (Enable::BBC) radius = Bbc(g4Reco, radius); //---------------------------------------- // CEMC (it is checked above that not both of them are set @@ -236,6 +236,7 @@ void ShowerCompress(int verbosity = 0) 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"); @@ -278,6 +279,7 @@ void DstCompress(Fun4AllDstOutputManager *out) 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"); From 81be3bcab4b1ad768ed8de122076be8cd6d89e25 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 21 Oct 2020 18:01:49 -0400 Subject: [PATCH 0844/1222] common: extend beam pipe beyond central region --- common/G4_Pipe.C | 71 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 8effed77f..76514f04d 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -3,6 +3,7 @@ #include "GlobalVariables.C" +#include #include #include @@ -25,14 +26,19 @@ namespace G4PIPE 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 + double al_pipe_length = 171.44; // extension beyond +/- 40 cm + + double al_pipe_cone_length = 8.56; + + double al_pipe_ext_radius = 2.5005; + double al_pipe_ext_length = 60.0; // extension beyond conical part } // namespace G4PIPE void PipeInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length)); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length)); } double Pipe(PHG4Reco* g4Reco, double radius) @@ -121,7 +127,62 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - radius = G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness; + PHG4ConeSubsystem* cone = nullptr; + + G4double cone_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + 0.5 * G4PIPE::al_pipe_cone_length; + G4double ext_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + 0.5 * G4PIPE::al_pipe_ext_length + no_overlapp; + + /* north aluminum pipe (conical part) */ + cone = new PHG4ConeSubsystem("N_AL_PIPE_CONE", 6); + cone->SetR1(G4PIPE::al_pipe_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cone->SetR2(G4PIPE::al_pipe_ext_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); + cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); + cone->SetPlaceZ(cone_position + no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north aluminum pipe (extension) */ + cyl = new PHG4CylinderSubsystem("N_AL_PIPE_EXT", 7); + cyl->set_double_param("place_z", ext_position + no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_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); + + /* south aluminum pipe (conical part) */ + cone = new PHG4ConeSubsystem("S_AL_PIPE_CONE", 8); + cone->SetR1(G4PIPE::al_pipe_ext_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); + cone->SetR2(G4PIPE::al_pipe_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); + cone->SetPlaceZ(-cone_position - no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south aluminum pipe (extension) */ + cyl = new PHG4CylinderSubsystem("S_AL_PIPE_EXT", 9); + cyl->set_double_param("place_z", -ext_position - no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_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); + + radius = G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness; if (verbosity > 0) { From d211284c7d531f0312c9b5b27277e88341a06c7b Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 21 Oct 2020 18:35:59 -0400 Subject: [PATCH 0845/1222] common: add volumes for vacuum within beam pipe --- common/G4_Pipe.C | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 76514f04d..8f54ae4a0 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -182,6 +182,56 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); + /* north aluminum pipe (conical part) [vacuum] */ + cone = new PHG4ConeSubsystem("VAC_N_AL_PIPE_CONE", 10); + cone->SetR1(0., G4PIPE::al_pipe_radius); + cone->SetR2(0., G4PIPE::al_pipe_ext_radius); + cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); + cone->SetPlaceZ(cone_position + no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north aluminum pipe (extension) [vacuum] */ + cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE_EXT", 11); + cyl->set_double_param("place_z", ext_position + no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south aluminum pipe (conical part) [vacuum] */ + cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", 12); + cone->SetR1(0., G4PIPE::al_pipe_ext_radius); + cone->SetR2(0., G4PIPE::al_pipe_radius); + cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); + cone->SetPlaceZ(-cone_position - no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south aluminum pipe (extension) [vacuum] */ + cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE_EXT", 13); + cyl->set_double_param("place_z", -ext_position - no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + radius = G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness; if (verbosity > 0) From 75c3f59336836ca21817184a2cd3c44b83783324 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 16:20:17 -0400 Subject: [PATCH 0846/1222] change #include from quotes to <> --- common/G4_Aerogel.C | 2 +- common/G4_Barrel_EIC.C | 2 +- common/G4_BlackHole.C | 2 +- common/G4_CEmc_Albedo.C | 2 +- common/G4_CEmc_EIC.C | 2 +- common/G4_CEmc_Spacal.C | 2 +- common/G4_CaloTrigger.C | 2 +- common/G4_DIRC.C | 2 +- common/G4_DSTReader.C | 22 ++++++++++----------- common/G4_DSTReader_EICDetector.C | 32 +++++++++++++++---------------- common/G4_DSTReader_fsPHENIX.C | 24 +++++++++++------------ common/G4_EEMC.C | 2 +- common/G4_FEMC.C | 2 +- common/G4_FEMC_EIC.C | 2 +- common/G4_FGEM_fsPHENIX.C | 6 +++--- common/G4_FHCAL.C | 2 +- common/G4_FST_EIC.C | 2 +- common/G4_GEM_EIC.C | 2 +- common/G4_HcalIn_ref.C | 2 +- common/G4_HcalOut_ref.C | 2 +- common/G4_Input.C | 2 +- common/G4_Intt.C | 4 ++-- common/G4_Jets.C | 2 +- common/G4_Magnet.C | 2 +- common/G4_Micromegas.C | 8 ++++---- common/G4_Mvtx.C | 2 +- common/G4_Mvtx_EIC.C | 2 +- common/G4_ParticleFlow.C | 2 +- common/G4_Pipe.C | 2 +- common/G4_Pipe_EIC.C | 2 +- common/G4_Piston.C | 4 ++-- common/G4_PlugDoor.C | 2 +- common/G4_PlugDoor_EIC.C | 2 +- common/G4_PlugDoor_fsPHENIX.C | 2 +- common/G4_Production.C | 2 +- common/G4_RICH.C | 2 +- common/G4_TPC.C | 6 +++--- common/G4_TPC_EIC.C | 4 ++-- common/G4_TopoClusterReco.C | 2 +- common/G4_Tracking.C | 10 +++++----- common/G4_Tracking_EIC.C | 16 ++++++++-------- common/G4_World.C | 2 +- common/sPhenixStyle.C | 2 +- 43 files changed, 100 insertions(+), 100 deletions(-) diff --git a/common/G4_Aerogel.C b/common/G4_Aerogel.C index cdde4cbf8..fef33af08 100644 --- a/common/G4_Aerogel.C +++ b/common/G4_Aerogel.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4AEROGEL_C #define MACRO_G4AEROGEL_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index 75c96f0f7..9ef1b019e 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4BARRELEIC_C #define MACRO_G4BARRELEIC_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_BlackHole.C b/common/G4_BlackHole.C index b6cfca88b..c03bb0140 100644 --- a/common/G4_BlackHole.C +++ b/common/G4_BlackHole.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4BLACKHOLE_C #define MACRO_G4BLACKHOLE_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_CEmc_Albedo.C b/common/G4_CEmc_Albedo.C index 3d5b3ab91..bd067be75 100644 --- a/common/G4_CEmc_Albedo.C +++ b/common/G4_CEmc_Albedo.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4CEMCALBEDO_C #define MACRO_G4CEMCALBEDO_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_CEmc_EIC.C b/common/G4_CEmc_EIC.C index 193e48e7d..e1f6cb386 100644 --- a/common/G4_CEmc_EIC.C +++ b/common/G4_CEmc_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4CEMCEIC_C #define MACRO_G4CEMCEIC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index c20ca7f7a..879425557 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4CEMCSPACAL_C #define MACRO_G4CEMCSPACAL_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_CaloTrigger.C b/common/G4_CaloTrigger.C index c22613ccc..0f8d85d4e 100644 --- a/common/G4_CaloTrigger.C +++ b/common/G4_CaloTrigger.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4CALOTRIGGER_C #define MACRO_G4CALOTRIGGER_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_DIRC.C b/common/G4_DIRC.C index 4ab87fe64..65cc51152 100644 --- a/common/G4_DIRC.C +++ b/common/G4_DIRC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4DIRC_C #define MACRO_G4DIRC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C index c9cc95647..b518a033f 100644 --- a/common/G4_DSTReader.C +++ b/common/G4_DSTReader.C @@ -1,17 +1,17 @@ #ifndef MACRO_G4DSTREADER_C #define MACRO_G4DSTREADER_C -#include "GlobalVariables.C" - -#include "G4_BlackHole.C" -#include "G4_CEmc_Spacal.C" -#include "G4_EPD.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Intt.C" -#include "G4_Magnet.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/common/G4_DSTReader_EICDetector.C b/common/G4_DSTReader_EICDetector.C index a1788d3b3..4525f18a4 100644 --- a/common/G4_DSTReader_EICDetector.C +++ b/common/G4_DSTReader_EICDetector.C @@ -1,22 +1,22 @@ #ifndef MACRO_G4DSTREADEREICDETECTOR_C #define MACRO_G4DSTREADEREICDETECTOR_C -#include "GlobalVariables.C" - -#include "G4_Barrel_EIC.C" -#include "G4_CEmc_EIC.C" -#include "G4_DIRC.C" -#include "G4_EEMC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_FST_EIC.C" -#include "G4_GEM_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" -#include "G4_Mvtx_EIC.C" -#include "G4_RICH.C" -#include "G4_TPC_EIC.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/common/G4_DSTReader_fsPHENIX.C b/common/G4_DSTReader_fsPHENIX.C index 38bd6ffe4..0c06bccc8 100644 --- a/common/G4_DSTReader_fsPHENIX.C +++ b/common/G4_DSTReader_fsPHENIX.C @@ -1,18 +1,18 @@ #ifndef MACRO_G4DSTREADERFSPHENIX_C #define MACRO_G4DSTREADERFSPHENIX_C -#include "GlobalVariables.C" - -#include "G4_CEmc_Spacal.C" -#include "G4_FEMC.C" -#include "G4_FGEM_fsPHENIX.C" -#include "G4_FHCAL.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Intt.C" -#include "G4_Magnet.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index 4a92ebbe6..6b8b72de7 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4EEMC_C #define MACRO_G4EEMC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C index ed94f9ef7..20e162cd5 100644 --- a/common/G4_FEMC.C +++ b/common/G4_FEMC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4FEMC_C #define MACRO_G4FEMC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index da2ce7be3..dbdd29162 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4FEMCEIC_C #define MACRO_G4FEMCEIC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C index d208dcbab..c1d7b6b4c 100644 --- a/common/G4_FGEM_fsPHENIX.C +++ b/common/G4_FGEM_fsPHENIX.C @@ -1,10 +1,10 @@ #ifndef MACRO_G4FGEMFSPHENIX_C #define MACRO_G4FGEMFSPHENIX_C -#include "GlobalVariables.C" +#include -#include "G4_FEMC.C" -#include "G4_FHCAL.C" +#include +#include #include diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index 8e7f9157d..dfef894f9 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4FHCAL_C #define MACRO_G4FHCAL_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index 9436d905e..4b152bf26 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4FSTEIC_C #define MACRO_G4FSTEIC_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C index f58936e0c..0acc4d7a7 100644 --- a/common/G4_GEM_EIC.C +++ b/common/G4_GEM_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4GEMEIC_C #define MACRO_G4GEMEIC_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index d62777b6a..1c42d01da 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -2,7 +2,7 @@ #ifndef MACRO_G4HCALINREF_C #define MACRO_G4HCALINREF_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 96a597591..a69196a2f 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4HCALOUTREF_C #define MACRO_G4HCALOUTREF_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_Input.C b/common/G4_Input.C index 74fba6dfa..51d95f18b 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4INPUT_C #define MACRO_G4INPUT_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 0f25336d2..15add9fd0 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -1,9 +1,9 @@ #ifndef MACRO_G4INTT_C #define MACRO_G4INTT_C -#include "GlobalVariables.C" +#include -#include "G4_Mvtx.C" +#include #include #include diff --git a/common/G4_Jets.C b/common/G4_Jets.C index f90337512..5fea1f720 100644 --- a/common/G4_Jets.C +++ b/common/G4_Jets.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4JETS_C #define MACRO_G4JETS_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 385d47426..7ca53a95a 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4MAGNET_C #define MACRO_G4MAGNET_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index be9702cd0..c79408dd9 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -1,11 +1,11 @@ #ifndef MACRO_G4MICROMEGAS_C #define MACRO_G4MICROMEGAS_C -#include "GlobalVariables.C" +#include -#include "G4_Intt.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" +#include +#include +#include #include #include diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 21d024a0a..f726191e1 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4MVTX_C #define MACRO_G4MVTX_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_Mvtx_EIC.C b/common/G4_Mvtx_EIC.C index 47407360f..f48201707 100644 --- a/common/G4_Mvtx_EIC.C +++ b/common/G4_Mvtx_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4MVTXEIC_C #define MACRO_G4MVTXEIC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C index 9b35ca600..c3b22f683 100644 --- a/common/G4_ParticleFlow.C +++ b/common/G4_ParticleFlow.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PARTICLEFLOW_C #define MACRO_G4PARTICLEFLOW_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 8f54ae4a0..f85908ab5 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PIPE_C #define MACRO_G4PIPE_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_Pipe_EIC.C b/common/G4_Pipe_EIC.C index f4de43593..f828a9973 100644 --- a/common/G4_Pipe_EIC.C +++ b/common/G4_Pipe_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PIPEEIC_C #define MACRO_G4PIPEEIC_C -#include "GlobalVariables.C" +#include #include #include diff --git a/common/G4_Piston.C b/common/G4_Piston.C index 459fc01c1..fa1afd322 100644 --- a/common/G4_Piston.C +++ b/common/G4_Piston.C @@ -1,9 +1,9 @@ #ifndef MACRO_G4PISTON_C #define MACRO_G4PISTON_C -#include "GlobalVariables.C" +#include -#include "G4_Pipe.C" +#include #include #include diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C index 8463b25cf..d45cbf928 100644 --- a/common/G4_PlugDoor.C +++ b/common/G4_PlugDoor.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PLUGDOOR_C #define MACRO_G4PLUGDOOR_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_PlugDoor_EIC.C b/common/G4_PlugDoor_EIC.C index c3e68dcbe..98b626b89 100644 --- a/common/G4_PlugDoor_EIC.C +++ b/common/G4_PlugDoor_EIC.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PLUGDOOREIC_C #define MACRO_G4PLUGDOOREIC_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_PlugDoor_fsPHENIX.C b/common/G4_PlugDoor_fsPHENIX.C index 571706815..da4940960 100644 --- a/common/G4_PlugDoor_fsPHENIX.C +++ b/common/G4_PlugDoor_fsPHENIX.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PLUGDOORFSPHENIX_C #define MACRO_G4PLUGDOORFSPHENIX_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Production.C b/common/G4_Production.C index 4993c4cc0..85e7801a7 100644 --- a/common/G4_Production.C +++ b/common/G4_Production.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4PRODUCTION_C #define MACRO_G4PRODUCTION_C -#include "GlobalVariables.C" +#include namespace Enable { diff --git a/common/G4_RICH.C b/common/G4_RICH.C index acc1b68b2..172f83bee 100644 --- a/common/G4_RICH.C +++ b/common/G4_RICH.C @@ -8,7 +8,7 @@ #ifndef MACRO_G4RICH_C #define MACRO_G4RICH_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_TPC.C b/common/G4_TPC.C index c4c06c5c2..139e5d588 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -1,10 +1,10 @@ #ifndef MACRO_G4TPC_C #define MACRO_G4TPC_C -#include "GlobalVariables.C" +#include -#include "G4_Intt.C" -#include "G4_Mvtx.C" +#include +#include #include #include diff --git a/common/G4_TPC_EIC.C b/common/G4_TPC_EIC.C index 82bef2504..2346fd582 100644 --- a/common/G4_TPC_EIC.C +++ b/common/G4_TPC_EIC.C @@ -1,9 +1,9 @@ #ifndef MACRO_G4TPCEIC_C #define MACRO_G4TPCEIC_C -#include "GlobalVariables.C" +#include -#include "G4_Mvtx_EIC.C" +#include #include diff --git a/common/G4_TopoClusterReco.C b/common/G4_TopoClusterReco.C index 3b4374179..293911e9a 100644 --- a/common/G4_TopoClusterReco.C +++ b/common/G4_TopoClusterReco.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4TOPOCLUSTERRECO_C #define MACRO_G4TOPOCLUSTERRECO_C -#include "GlobalVariables.C" +#include #include diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0e6498abe..cba893969 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -1,12 +1,12 @@ #ifndef MACRO_G4TRACKING_C #define MACRO_G4TRACKING_C -#include "GlobalVariables.C" +#include -#include "G4_Intt.C" -#include "G4_Micromegas.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" +#include +#include +#include +#include #include diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index 2310fda88..4bd32a52b 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -1,14 +1,14 @@ #ifndef MACRO_G4TRACKINGEIC_C #define MACRO_G4TRACKINGEIC_C -#include "GlobalVariables.C" - -#include "G4_CEmc_EIC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_GEM_EIC.C" -#include "G4_Mvtx_EIC.C" -#include "G4_TPC_EIC.C" +#include + +#include +#include +#include +#include +#include +#include #include diff --git a/common/G4_World.C b/common/G4_World.C index ca6e3cf59..0180bd3f4 100644 --- a/common/G4_World.C +++ b/common/G4_World.C @@ -1,7 +1,7 @@ #ifndef MACRO_G4WORLD_C #define MACRO_G4WORLD_C -#include "GlobalVariables.C" +#include #include diff --git a/common/sPhenixStyle.C b/common/sPhenixStyle.C index 935f5ef76..cb4c9cc56 100644 --- a/common/sPhenixStyle.C +++ b/common/sPhenixStyle.C @@ -3,7 +3,7 @@ // -#include "sPhenixStyle.h" +#include #include #include From 77bbb16ab6e46fada27fb12cf564885e48b4dc1f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 16:35:45 -0400 Subject: [PATCH 0847/1222] move magfield_rescale and magfield to from G4_Magnet.C to GlobalVariables.C --- common/G4_Magnet.C | 3 --- common/GlobalVariables.C | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 7ca53a95a..61059f5a6 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -22,9 +22,6 @@ namespace G4MAGNET double magnet_outer_cryostat_wall_radius = 174.5; double magnet_outer_cryostat_wall_thickness = 2.5; double magnet_length = 379.; - double magfield_rescale = 1; - string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); - } // namespace G4MAGNET void MagnetInit() diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 9513df2ce..d5306cadf 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -52,4 +52,10 @@ namespace TRACKING { string TrackNodeName = "SvtxTrackMap"; } + +namespace G4MAGNET +{ + double magfield_rescale = 1; + string magfield= string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); +} #endif From f08d9ecba02939573e6bd8294a1a457342db2e2d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 18:53:27 -0400 Subject: [PATCH 0848/1222] Add capability for multiple single particle generators --- common/G4_Input.C | 58 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 51d95f18b..e8a270fc3 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -35,14 +35,17 @@ namespace Input { bool GUN = false; int GUN_VERBOSITY = 0; + int GUN_NUMBER = 1; bool READHITS = false; bool PYTHIA6 = false; bool PYTHIA8 = false; bool SARTRE = false; bool SIMPLE = false; int SIMPLE_VERBOSITY = 0; + int SIMPLE_NUMBER = 1; bool UPSILON = false; int UPSILON_VERBOSITY = 0; + int UPSILON_NUMBER = 1; double PILEUPRATE = 0.; int VERBOSITY = 0; } // namespace Input @@ -93,9 +96,9 @@ namespace PILEUP // collection of pointers to particle generators we can grab in the Fun4All macro namespace INPUTGENERATOR { - PHG4ParticleGeneratorVectorMeson *VectorMesonGenerator = nullptr; - PHG4SimpleEventGenerator *SimpleEventGenerator = nullptr; - PHG4ParticleGun *Gun = nullptr; + std::vector VectorMesonGenerator; + std::vector SimpleEventGenerator; + std::vector Gun; PHPythia6 *Pythia6 = nullptr; PHPythia8 *Pythia8 = nullptr; PHSartre *Sartre = nullptr; @@ -155,15 +158,33 @@ void InputInit() if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator = new PHG4SimpleEventGenerator(); + for (int i=0; iEmbed(2); + INPUTGENERATOR::SimpleEventGenerator.push_back(simple); + } } if (Input::GUN) { - INPUTGENERATOR::Gun = new PHG4ParticleGun(); + for (int i=0; iEmbed(2); + INPUTGENERATOR::Gun.push_back(gun); + } } if (Input::UPSILON) { - INPUTGENERATOR::VectorMesonGenerator = new PHG4ParticleGeneratorVectorMeson(); + for (int i=0; iEmbed(2); + INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); + } } // input managers for which we might need to set options if (Input::HEPMC) @@ -194,23 +215,32 @@ void InputRegister() } if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator->Verbosity(Input::SIMPLE_VERBOSITY); - se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator); + for (size_t icnt = 0; icnt < INPUTGENERATOR::SimpleEventGenerator.size(); ++icnt) + { + INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(Input::SIMPLE_VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator[icnt]); + } } if (Input::UPSILON) { + for (size_t icnt = 0; icnt < INPUTGENERATOR::VectorMesonGenerator.size(); ++icnt) + { if (Input::HEPMC || Input::SIMPLE) { - INPUTGENERATOR::VectorMesonGenerator->set_reuse_existing_vertex(true); + INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true); + } + INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(Input::UPSILON_VERBOSITY); + INPUTGENERATOR::VectorMesonGenerator[icnt]->Embed(2); + se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); } - INPUTGENERATOR::VectorMesonGenerator->Verbosity(Input::UPSILON_VERBOSITY); - INPUTGENERATOR::VectorMesonGenerator->Embed(2); - se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator); } if (Input::GUN) { - INPUTGENERATOR::Gun->Verbosity(Input::GUN_VERBOSITY); - se->registerSubsystem(INPUTGENERATOR::Gun); + for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt) + { + INPUTGENERATOR::Gun[icnt]->Verbosity(Input::GUN_VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::Gun[icnt]); + } } if (Input::READEIC) { From 9bd2644715b4f3fb8214dfc2256a23faf5ac5ea3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 18:55:07 -0400 Subject: [PATCH 0849/1222] clang-format --- common/G4_Tracking.C | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index cba893969..ca07b3317 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -27,8 +27,8 @@ #include #if __cplusplus >= 201703L -#include #include +#include #include #include #include @@ -324,30 +324,29 @@ void Tracking_Reco() #if __cplusplus >= 201703L /// Geometry must be built before any Acts modules - MakeActsGeometry *geom = new MakeActsGeometry(); + MakeActsGeometry* geom = new MakeActsGeometry(); geom->Verbosity(0); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(geom); - + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks *sl = new PHActsSourceLinks(); + PHActsSourceLinks* sl = new PHActsSourceLinks(); sl->Verbosity(0); sl->setMagField(G4MAGNET::magfield); sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); - - PHActsTracks *actsTracks = new PHActsTracks(); + + PHActsTracks* actsTracks = new PHActsTracks(); actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); + + PHActsTrkFitter* actsFit = new PHActsTrkFitter(); actsFit->Verbosity(0); actsFit->doTimeAnalysis(false); se->registerSubsystem(actsFit); - -#endif - + +#endif } return; From 4ca66a656df4a8f1d209af9b8e2080e8c72bbe0a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 20:47:31 -0400 Subject: [PATCH 0850/1222] use <> for include, use index for single particle generator settings --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 77 ++++++++++++++------------ detectors/sPHENIX/G4Setup_sPHENIX.C | 38 ++++++------- 2 files changed, 62 insertions(+), 53 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 2b478a753..30669412b 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -1,21 +1,21 @@ #ifndef MACRO_FUN4ALLG4SPHENIX_C #define MACRO_FUN4ALLG4SPHENIX_C -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_sPHENIX.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader.C" -#include "G4_Global.C" -#include "G4_HIJetReco.C" -#include "G4_Input.C" -#include "G4_Jets.C" -#include "G4_ParticleFlow.C" -#include "G4_Production.C" -#include "G4_TopoClusterReco.C" -#include "G4_Tracking.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -78,18 +78,21 @@ int Fun4All_G4_sPHENIX( INPUTEMBED::filename = embed_input_file; Input::SIMPLE = true; - //Input::SIMPLE_VERBOSITY = 1; + // Input::SIMPLE_NUMBER = 2; // if you need 2 of them + // Input::SIMPLE_VERBOSITY = 1; // Input::PYTHIA6 = true; // Input::PYTHIA8 = true; // Input::GUN = true; - //Input::GUN_VERBOSITY = 1; + // Input::GUN_NUMBER = 3; // if you need 3 of them + // Input::GUN_VERBOSITY = 1; // Upsilon generator // Input::UPSILON = true; - Input::UPSILON_VERBOSITY = 0; + // Input::UPSILON_NUMBER = 3; // if you need 3 of them + // Input::UPSILON_VERBOSITY = 0; // Input::HEPMC = true; INPUTHEPMC::filename = inputFile; @@ -109,41 +112,47 @@ int Fun4All_G4_sPHENIX( // 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) { - INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); if (Input::HEPMC || Input::EMBED) { - INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); - INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + 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->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } - INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 1); - INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); - INPUTGENERATOR::SimpleEventGenerator->Embed(2); + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); + INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // 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->add_decay_particles("e", 0); - INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); - INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + 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->set_upsilon_1s(); + INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); } // 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->AddParticle("pi-", 0, 1, 0); - INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0); } //-------------- diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index fece3d8b6..b5b319f1f 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -1,25 +1,25 @@ #ifndef MACRO_G4SETUPSPHENIX_C #define MACRO_G4SETUPSPHENIX_C -#include "GlobalVariables.C" - -#include "G4_BlackHole.C" -#include "G4_CEmc_Spacal.C" -#include "G4_CEmc_Albedo.C" -#include "G4_EPD.C" -#include "G4_FEMC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Intt.C" -#include "G4_Magnet.C" -#include "G4_Micromegas.C" -#include "G4_Mvtx.C" -#include "G4_PSTOF.C" -#include "G4_Pipe.C" -#include "G4_PlugDoor.C" -#include "G4_TPC.C" -#include "G4_User.C" -#include "G4_World.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include From 7ed6104768cbc9c618287089e16b4d10d088f43d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 22:43:29 -0400 Subject: [PATCH 0851/1222] use <> for include, use index for single particle generator settings --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 67 +++++++++++++----------- detectors/fsPHENIX/G4Setup_fsPHENIX.C | 36 ++++++------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 9746135b7..511d74205 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -1,18 +1,18 @@ #ifndef MACRO_FUN4ALLG4FSPHENIX_C #define MACRO_FUN4ALLG4FSPHENIX_C -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_fsPHENIX.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_fsPHENIX.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_Input.C" -#include "G4_Jets.C" -#include "G4_Production.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -77,14 +77,21 @@ int Fun4All_G4_fsPHENIX( INPUTEMBED::filename = embed_input_file; Input::SIMPLE = true; - //Input::SIMPLE_VERBOSITY = 1; + // Input::SIMPLE_NUMBER = 2; // if you need 2 of them + // Input::SIMPLE_VERBOSITY = 1; // Input::PYTHIA6 = true; // Input::PYTHIA8 = true; // Input::GUN = true; - //Input::GUN_VERBOSITY = 0; + // Input::GUN_NUMBER = 3; // if you need 3 of them + // Input::GUN_VERBOSITY = 1; + + // Upsilon generator + // Input::UPSILON = true; + // Input::UPSILON_NUMBER = 3; // if you need 3 of them + // Input::UPSILON_VERBOSITY = 0; // Input::HEPMC = true; INPUTHEPMC::filename = inputFile; @@ -105,39 +112,39 @@ int Fun4All_G4_fsPHENIX( // Simple Input generator: if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); if (Input::HEPMC || Input::EMBED) { - INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); - INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + 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->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } - INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-1, 3); - INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.5, 50.); - INPUTGENERATOR::SimpleEventGenerator->Embed(2); + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 3); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.5, 50.); + INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // Upsilons if (Input::UPSILON) { - INPUTGENERATOR::VectorMesonGenerator->add_decay_particles("mu", 0); - INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); - INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("mu", 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->set_upsilon_1s(); + INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); } // particle gun if (Input::GUN) { - INPUTGENERATOR::Gun->AddParticle("pi-", 0, 1, 0); - INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0); } //-------------- diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C index ec8d67933..db4218782 100644 --- a/detectors/fsPHENIX/G4Setup_fsPHENIX.C +++ b/detectors/fsPHENIX/G4Setup_fsPHENIX.C @@ -1,24 +1,24 @@ #ifndef MACRO_G4SETUPFSPHENIX_C #define MACRO_G4SETUPFSPHENIX_C -#include "GlobalVariables.C" - -#include "G4_BlackHole.C" -#include "G4_CEmc_Spacal.C" -#include "G4_FEMC.C" -#include "G4_FGEM_fsPHENIX.C" -#include "G4_FHCAL.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" -#include "G4_Mvtx.C" -#include "G4_Pipe.C" -#include "G4_Piston.C" -#include "G4_PlugDoor_fsPHENIX.C" -#include "G4_TPC.C" -#include "G4_Tracking.C" -#include "G4_User.C" -#include "G4_World.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include From 2e355844643acb43e882bade8596215266cc0827 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Oct 2020 23:39:41 -0400 Subject: [PATCH 0852/1222] use <> for include, use index for single particle generator settings --- .../EICDetector/Fun4All_G4_EICDetector.C | 74 ++++++++++--------- detectors/EICDetector/G4Setup_EICDetector.C | 48 ++++++------ 2 files changed, 65 insertions(+), 57 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 6aa6ddda5..d70167443 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -1,19 +1,19 @@ #ifndef MACRO_FUN4ALLG4EICDETECTOR_C #define MACRO_FUN4ALLG4EICDETECTOR_C -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_EICDetector.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_EICDetector.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_HIJetReco.C" -#include "G4_Input.C" -#include "G4_Jets.C" -#include "G4_Production.C" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -78,15 +78,18 @@ int Fun4All_G4_EICDetector( // Simple multi particle generator in eta/phi/pt ranges Input::SIMPLE = true; + // Input::SIMPLE_NUMBER = 2; // if you need 2 of them // Input::SIMPLE_VERBOSITY = 1; // Particle gun (same particles in always the same direction) - // Input::GUN = true; - Input::GUN_VERBOSITY = 0; + // Input::GUN = true; + // Input::GUN_NUMBER = 3; // if you need 3 of them + // Input::GUN_VERBOSITY = 0; // Upsilon generator - //Input::UPSILON = true; - Input::UPSILON_VERBOSITY = 0; + // Input::UPSILON = true; + // Input::UPSILON_NUMBER = 3; // if you need 3 of them + // Input::UPSILON_VERBOSITY = 0; // And/Or read generated particles from file @@ -109,41 +112,46 @@ int Fun4All_G4_EICDetector( // 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) { - INPUTGENERATOR::SimpleEventGenerator->add_particles("pi-", 5); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); if (Input::HEPMC || Input::EMBED) { - INPUTGENERATOR::SimpleEventGenerator->set_reuse_existing_vertex(true); - INPUTGENERATOR::SimpleEventGenerator->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + 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->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform, PHG4SimpleEventGenerator::Uniform); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_mean(0., 0., 0.); - INPUTGENERATOR::SimpleEventGenerator->set_vertex_distribution_width(0., 0., 5.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } - INPUTGENERATOR::SimpleEventGenerator->set_eta_range(-3, 3); - INPUTGENERATOR::SimpleEventGenerator->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator->set_pt_range(0.1, 20.); - INPUTGENERATOR::SimpleEventGenerator->Embed(2); + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-3, 3); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); } // 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->add_decay_particles("mu", 0); - INPUTGENERATOR::VectorMesonGenerator->set_rapidity_range(-1, 1); - INPUTGENERATOR::VectorMesonGenerator->set_pt_range(0., 10.); + INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("mu", 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->set_upsilon_1s(); + INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); } // 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->AddParticle("pi-", 0, 1, 0); - INPUTGENERATOR::Gun->set_vtx(0, 0, 0); + INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0); } // pythia6 if (Input::PYTHIA6) diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 743181d0d..043b7204b 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -1,30 +1,30 @@ #ifndef MACRO_G4SETUPEICDETECTOR_C #define MACRO_G4SETUPEICDETECTOR_C -#include "GlobalVariables.C" - -#include "G4_Aerogel.C" -#include "G4_Barrel_EIC.C" -#include "G4_BlackHole.C" -#include "G4_CEmc_EIC.C" -#include "G4_DIRC.C" -#include "G4_EEMC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_FST_EIC.C" -#include "G4_GEM_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Input.C" -#include "G4_Magnet.C" -#include "G4_Mvtx_EIC.C" -#include "G4_Pipe_EIC.C" -#include "G4_PlugDoor_EIC.C" -#include "G4_RICH.C" -#include "G4_TPC_EIC.C" -#include "G4_Tracking_EIC.C" -#include "G4_User.C" -#include "G4_World.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 From 9e5ecd498ca87c72dfd69c92b552f6d6b0e15b79 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 08:18:53 -0400 Subject: [PATCH 0853/1222] clang-format --- common/G4_CEmc_Spacal.C | 20 +-- common/G4_EPD.C | 10 +- common/G4_Input.C | 28 ++-- common/G4_Intt.C | 2 +- common/G4_Micromegas.C | 122 ++++++++++-------- common/G4_Mvtx.C | 66 +++++----- common/G4_Mvtx_EIC.C | 2 +- common/G4_ParticleFlow.C | 4 +- common/G4_Pipe.C | 2 +- common/G4_World.C | 6 +- common/GlobalVariables.C | 4 +- common/sPhenixStyle.C | 64 +++++---- .../EICDetector/Fun4All_G4_EICDetector.C | 26 ++-- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 14 +- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 19 ++- detectors/sPHENIX/G4Setup_sPHENIX.C | 2 +- 16 files changed, 200 insertions(+), 191 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 879425557..6b8b2c071 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -368,13 +368,13 @@ void CEMC_Towers() TowerDigitizer->Detector("CEMC"); TowerDigitizer->Verbosity(verbosity); TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - 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_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->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 se->registerSubsystem(TowerDigitizer); @@ -397,10 +397,10 @@ void CEMC_Towers() 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); + 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); } else diff --git a/common/G4_EPD.C b/common/G4_EPD.C index 2ec425f26..9f031c173 100644 --- a/common/G4_EPD.C +++ b/common/G4_EPD.C @@ -7,14 +7,16 @@ R__LOAD_LIBRARY(libg4epd.so) -namespace Enable { +namespace Enable +{ bool EPD = false; bool EPD_OVERLAPCHECK = false; -} +} // namespace Enable -void EPDInit() { } +void EPDInit() {} -void EPD(PHG4Reco* g4Reco) { +void EPD(PHG4Reco* g4Reco) +{ bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); diff --git a/common/G4_Input.C b/common/G4_Input.C index e8a270fc3..412f3c59f 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -64,13 +64,13 @@ namespace INPUTREADHITS { string filename; string listfile; -} +} // namespace INPUTREADHITS namespace INPUTEMBED { string filename; string listfile; -} +} // namespace INPUTEMBED namespace PYTHIA6 { @@ -109,7 +109,7 @@ namespace INPUTMANAGER { Fun4AllHepMCInputManager *HepMCInputManager = nullptr; Fun4AllHepMCPileupInputManager *HepMCPileupInputManager = nullptr; -} +} // namespace INPUTMANAGER void InputInit() { @@ -158,7 +158,7 @@ void InputInit() if (Input::SIMPLE) { - for (int i=0; iset_reuse_existing_vertex(true); - } - INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(Input::UPSILON_VERBOSITY); - INPUTGENERATOR::VectorMesonGenerator[icnt]->Embed(2); - se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); + if (Input::HEPMC || Input::SIMPLE) + { + INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true); + } + INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(Input::UPSILON_VERBOSITY); + INPUTGENERATOR::VectorMesonGenerator[icnt]->Embed(2); + se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); } } if (Input::GUN) @@ -278,7 +278,7 @@ void InputManagers() cout << "no filename INPUTEMBED::filename or listfile INPUTEMBED::listfile given" << endl; gSystem->Exit(1); } - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning + in1->Repeat(); // if file(or filelist) is exhausted, start from beginning se->registerInputManager(in1); } if (Input::HEPMC) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 15add9fd0..287b153c6 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -40,7 +40,7 @@ namespace G4INTT 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 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]}; diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index c79408dd9..03f7a52fd 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -40,7 +40,7 @@ namespace G4MICROMEGAS }; Config CONFIG = CONFIG_Z_ONE_SECTOR; -} +} // namespace G4MICROMEGAS void MicromegasInit() { @@ -85,79 +85,87 @@ void Micromegas_Cells() static constexpr double tile_length = 50; static constexpr double tile_width = 25; - switch( G4MICROMEGAS::CONFIG ) + switch (G4MICROMEGAS::CONFIG) + { + case G4MICROMEGAS::CONFIG_MINIMAL: + { + // one tile at mid rapidity in front of TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MINIMAL" << std::endl; + static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); + reco->set_tiles({{{phi0, 0, tile_width / radius, tile_length}}}); + break; + } + + case G4MICROMEGAS::CONFIG_PHI_ONE_RING: { - case G4MICROMEGAS::CONFIG_MINIMAL: + // 12 tiles at mid rapidity, one in front of each TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_PHI_ONE_RING" << std::endl; + MicromegasTile::List tiles; + for (int i = 0; i < nsectors; ++i) { - // one tile at mid rapidity in front of TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MINIMAL" << std::endl; - static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); - reco->set_tiles( {{{ phi0, 0, tile_width/radius, tile_length }}} ); - break; + tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width / radius, tile_length); } + reco->set_tiles(tiles); + break; + } - case G4MICROMEGAS::CONFIG_PHI_ONE_RING: + case G4MICROMEGAS::CONFIG_Z_ONE_SECTOR: + { + // 4 tiles with full z coverage in front of one TPC sector + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + MicromegasTile::List tiles; + static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); + static constexpr int ntiles = 4; + for (int i = 0; i < ntiles; ++i) { - // 12 tiles at mid rapidity, one in front of each TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_PHI_ONE_RING" << std::endl; - MicromegasTile::List tiles; - for (int i = 0; i < nsectors; ++i) - { tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width / radius, tile_length); } - reco->set_tiles(tiles); - break; + tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles - 0.5), tile_width / radius, tile_length); } + reco->set_tiles(tiles); + break; + } + + case G4MICROMEGAS::CONFIG_BASELINE: + { + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + MicromegasTile::List tiles; - case G4MICROMEGAS::CONFIG_Z_ONE_SECTOR: + // for the first sector we put 4 tiles with full z coverage + static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); + static constexpr int ntiles_z = 4; + for (int i = 0; i < ntiles_z; ++i) { - // 4 tiles with full z coverage in front of one TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; - MicromegasTile::List tiles; - static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); - static constexpr int ntiles = 4; - for( int i = 0; i < ntiles; ++i ) - { tiles.emplace_back( phi0, length*((0.5+i)/ntiles-0.5), tile_width/radius, tile_length ); } - reco->set_tiles( tiles ); - break; + tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles_z - 0.5), tile_width / radius, tile_length); } - case G4MICROMEGAS::CONFIG_BASELINE: + // for the other sectors we put two tiles on either side of the central membrane + for (int i = 1; i < nsectors; ++i) { - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; - MicromegasTile::List tiles; - - // for the first sector we put 4 tiles with full z coverage - static constexpr double phi0 = M_PI*(0.5 + 1./nsectors); - static constexpr int ntiles_z = 4; - for( int i = 0; i < ntiles_z; ++i ) - { tiles.emplace_back( phi0, length*((0.5+i)/ntiles_z-0.5), tile_width/radius, tile_length ); } - - // for the other sectors we put two tiles on either side of the central membrane - for( int i = 1; i < nsectors; ++i ) - { - const double phi = phi0 + 2.*M_PI*i/nsectors; - tiles.emplace_back( phi, length*(1.5/4-0.5), tile_width/radius, tile_length ); - tiles.emplace_back( phi, length*(2.5/4-0.5), tile_width/radius, tile_length ); - } - reco->set_tiles( tiles ); - break; + const double phi = phi0 + 2. * M_PI * i / nsectors; + tiles.emplace_back(phi, length * (1.5 / 4 - 0.5), tile_width / radius, tile_length); + tiles.emplace_back(phi, length * (2.5 / 4 - 0.5), tile_width / radius, tile_length); } + reco->set_tiles(tiles); + break; + } - case G4MICROMEGAS::CONFIG_MAXIMAL: - { - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MAXIMAL" << std::endl; - MicromegasTile::List tiles; + case G4MICROMEGAS::CONFIG_MAXIMAL: + { + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MAXIMAL" << std::endl; + MicromegasTile::List tiles; - // 4 tiles with full z coverage in front of each TPC sector - static constexpr int ntiles_z = 4; - for (int iphi = 0; iphi < nsectors; ++iphi) + // 4 tiles with full z coverage in front of each TPC sector + static constexpr int ntiles_z = 4; + for (int iphi = 0; iphi < nsectors; ++iphi) + { + const double phi = 2. * M_PI * (0.5 + iphi) / nsectors; + for (int iz = 0; iz < ntiles_z; ++iz) { - const double phi = 2. * M_PI * (0.5 + iphi) / nsectors; - for (int iz = 0; iz < ntiles_z; ++iz ) - { tiles.emplace_back( phi, length*((0.5+iz)/ntiles_z-0.5), tile_width/radius, tile_length ); } + tiles.emplace_back(phi, length * ((0.5 + iz) / ntiles_z - 0.5), tile_width / radius, tile_length); } - reco->set_tiles( tiles ); - break; } + reco->set_tiles(tiles); + break; + } } se->registerSubsystem(reco); diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index f726191e1..3faae5343 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -38,17 +38,17 @@ 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 - double single_stave_service_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] - double single_stave_service_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] - double single_stave_service_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] + double single_stave_service_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] + double single_stave_service_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] + double single_stave_service_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] - const int n_service_layers = 1; //Number of service cable service_layers to generate - double service_layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] - int n_staves_service_layer[] = {48}; //Number of staves associated to each service layer + const int n_service_layers = 1; //Number of service cable service_layers to generate + double service_layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] + int n_staves_service_layer[] = {48}; //Number of staves associated to each service layer - double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = -35; //[cm] Approx. - double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) + double service_barrel_radius = 10.75; // [cm] From final design review + double service_barrel_start = -35; //[cm] Approx. + double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTX void MvtxInit() @@ -56,50 +56,50 @@ void MvtxInit() //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::service_barrel_radius); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start)); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start)); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); } -double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk +double calculateArea(double inner_radius, double outer_radius) //Calculate the area of a disk { - return M_PI*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); + return M_PI * (std::pow(outer_radius, 2) - std::pow(inner_radius, 2)); } -double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area +double calculateOR(double inner_radius, double area) //Calculate the outer radius of a disk, knowing the inner radius and the area { - return std::sqrt( area/M_PI + std::pow( inner_radius, 2 ) ); + return std::sqrt(area / M_PI + std::pow(inner_radius, 2)); } -void calculateMaterialBoundaries(int& service_layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs +void calculateMaterialBoundaries(int& service_layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs { - outer_copper_radius = calculateOR( G4MVTX::service_layer_start_radius[service_layer_ID], G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_copper_area ); - outer_water_radius = calculateOR( outer_copper_radius, G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_water_area ); - outer_plastic_radius = calculateOR( outer_water_radius, G4MVTX::n_staves_service_layer[service_layer_ID]*G4MVTX::single_stave_service_plastic_area ); + outer_copper_radius = calculateOR(G4MVTX::service_layer_start_radius[service_layer_ID], G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_copper_area); + outer_water_radius = calculateOR(outer_copper_radius, G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_water_area); + outer_plastic_radius = calculateOR(outer_water_radius, G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_plastic_area); } double MVTXService(PHG4Reco* g4Reco, double radius) { -// Note, cables are all south -// Setup service_layers + // Note, cables are all south + // Setup service_layers bool AbsorberActive = Enable::ABSORBER || Enable::MVTX_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); - double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii + double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii int subsystem_service_layer = 0; std::string copper_name, water_name, plastic_name; PHG4CylinderSubsystem* cyl; - for (int i = 0; i < G4MVTX::n_service_layers; ++i) //Build a service_layer of copper, then water, then plastic + for (int i = 0; i < G4MVTX::n_service_layers; ++i) //Build a service_layer of copper, then water, then plastic { calculateMaterialBoundaries(i, copper_OR[i], water_OR[i], plastic_OR[i]); - copper_name = "MVTX_Service_copper_service_layer_" + std::to_string(i); - water_name = "MVTX_Service_water_service_layer_" + std::to_string(i); + copper_name = "MVTX_Service_copper_service_layer_" + std::to_string(i); + water_name = "MVTX_Service_water_service_layer_" + std::to_string(i); plastic_name = "MVTX_Service_plastic_service_layer_" + std::to_string(i); cyl = new PHG4CylinderSubsystem(copper_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", G4MVTX::service_layer_start_radius[i]); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTX::service_barrel_length); @@ -112,7 +112,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) subsystem_service_layer += 1; cyl = new PHG4CylinderSubsystem(water_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", copper_OR[i]); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTX::service_barrel_length); @@ -125,7 +125,7 @@ double MVTXService(PHG4Reco* g4Reco, double radius) subsystem_service_layer += 1; cyl = new PHG4CylinderSubsystem(plastic_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", water_OR[i]); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTX::service_barrel_length); @@ -136,16 +136,15 @@ double MVTXService(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); subsystem_service_layer += 1; - } cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_service_layer", subsystem_service_layer); - cyl->set_double_param("place_z", -1*(G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); + cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); cyl->set_double_param("radius", G4MVTX::service_barrel_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4MVTX::service_barrel_length); - cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) - cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick + cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) + cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick cyl->SuperDetector("MVTXSERVICE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); @@ -164,8 +163,8 @@ double MVTXService(PHG4Reco* g4Reco, double radius) for (int j = 0; j < G4MVTX::n_service_layers; ++j) { - cout << " service_layer " << j << " starts at " << G4MVTX::service_layer_start_radius[j] << " cm" << endl; - cout << " service_layer " << j << " services " << G4MVTX::n_staves_service_layer[j] << " staves" << endl; + cout << " service_layer " << j << " starts at " << G4MVTX::service_layer_start_radius[j] << " cm" << endl; + cout << " service_layer " << j << " services " << G4MVTX::n_staves_service_layer[j] << " staves" << endl; } cout << " Service barrel radius = " << G4MVTX::service_barrel_radius << " cm" << endl; @@ -239,5 +238,4 @@ void Mvtx_Clustering() se->registerSubsystem(mvtxclusterizer); } - #endif diff --git a/common/G4_Mvtx_EIC.C b/common/G4_Mvtx_EIC.C index f48201707..2ecff30ba 100644 --- a/common/G4_Mvtx_EIC.C +++ b/common/G4_Mvtx_EIC.C @@ -3,8 +3,8 @@ #include -#include #include +#include #include diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C index c3b22f683..01aed3357 100644 --- a/common/G4_ParticleFlow.C +++ b/common/G4_ParticleFlow.C @@ -31,8 +31,8 @@ void ParticleFlow() // note: assumes topoCluster input already configured ParticleFlowReco *pfr = new ParticleFlowReco(); - pfr->set_energy_match_Nsigma( 1.5 ); - pfr->set_emulated_efficiency( 1.0 ); + pfr->set_energy_match_Nsigma(1.5); + pfr->set_emulated_efficiency(1.0); pfr->Verbosity(verbosity); se->registerSubsystem(pfr); diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index f85908ab5..3b2c68fce 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -31,7 +31,7 @@ namespace G4PIPE double al_pipe_cone_length = 8.56; double al_pipe_ext_radius = 2.5005; - double al_pipe_ext_length = 60.0; // extension beyond conical part + double al_pipe_ext_length = 60.0; // extension beyond conical part } // namespace G4PIPE void PipeInit() diff --git a/common/G4_World.C b/common/G4_World.C index 0180bd3f4..ceeafdca7 100644 --- a/common/G4_World.C +++ b/common/G4_World.C @@ -22,11 +22,11 @@ void WorldInit(PHG4Reco *g4Reco) void WorldSize(PHG4Reco *g4Reco, double radius) { - double world_radius = std::max((BlackHoleGeometry::max_radius+BlackHoleGeometry::gap), 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 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; diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index d5306cadf..f6b5aaa9f 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -56,6 +56,6 @@ namespace TRACKING namespace G4MAGNET { double magfield_rescale = 1; - string magfield= string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); -} + string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); +} // namespace G4MAGNET #endif diff --git a/common/sPhenixStyle.C b/common/sPhenixStyle.C index cb4c9cc56..f958e92cc 100644 --- a/common/sPhenixStyle.C +++ b/common/sPhenixStyle.C @@ -2,29 +2,28 @@ // sPHENIX Style, based on a style file from BaBar, v0.1 // - #include -#include #include +#include #include -void SetsPhenixStyle () +void SetsPhenixStyle() { static TStyle* sphenixStyle = 0; - std::cout << "sPhenixStyle: Applying nominal settings." << std::endl ; - if ( sphenixStyle==0 ) sphenixStyle = sPhenixStyle(); + std::cout << "sPhenixStyle: Applying nominal settings." << std::endl; + if (sphenixStyle == 0) sphenixStyle = sPhenixStyle(); gROOT->SetStyle("sPHENIX"); gROOT->ForceStyle(); } -TStyle* sPhenixStyle() +TStyle* sPhenixStyle() { - TStyle *sphenixStyle = new TStyle("sPHENIX","sPHENIX style"); + TStyle* sphenixStyle = new TStyle("sPHENIX", "sPHENIX style"); // use plain black on white colors - Int_t icol=0; // WHITE + Int_t icol = 0; // WHITE sphenixStyle->SetFrameBorderMode(icol); sphenixStyle->SetFrameFillColor(icol); sphenixStyle->SetCanvasBorderMode(icol); @@ -35,7 +34,7 @@ TStyle* sPhenixStyle() //sphenixStyle->SetFillColor(icol); // don't use: white fill color for *all* objects // set the paper & margin sizes - sphenixStyle->SetPaperSize(20,26); + sphenixStyle->SetPaperSize(20, 26); // set margin sizes sphenixStyle->SetPadTopMargin(0.05); @@ -49,32 +48,32 @@ TStyle* sPhenixStyle() // use large fonts //Int_t font=72; // Helvetica italics - Int_t font=42; // Helvetica - Double_t tsize=0.05; + 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"); + 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 + sphenixStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes - // get rid of X error bars + // get rid of X error bars //sphenixStyle->SetErrorX(0.001); // get rid of error bar caps sphenixStyle->SetEndErrorSize(0.); @@ -95,8 +94,7 @@ TStyle* sPhenixStyle() sphenixStyle->SetLegendFillColor(0); sphenixStyle->SetLegendFont(font); - -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) std::cout << "sPhenixStyle: ROOT6 mode" << std::endl; sphenixStyle->SetLegendTextSize(tsize); sphenixStyle->SetPalette(kBird); @@ -104,16 +102,14 @@ TStyle* sPhenixStyle() 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}; + 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/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index d70167443..cc1d42a91 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -125,8 +125,8 @@ int Fun4All_G4_EICDetector( else { INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } @@ -166,10 +166,10 @@ int Fun4All_G4_EICDetector( if (Input::HEPMC) { - INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4,100e-4,30,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 + INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 30, 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); + 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 @@ -180,8 +180,8 @@ int Fun4All_G4_EICDetector( // register all input generators with Fun4All InputRegister(); -// set up production relatedstuff -// Enable::PRODUCTION = true; + // set up production relatedstuff + // Enable::PRODUCTION = true; //====================== // Write the DST @@ -221,7 +221,7 @@ int Fun4All_G4_EICDetector( // mvtx/tpc tracker Enable::MVTX = true; Enable::TPC = true; -// Enable::TPC_ENDCAP = true; + // Enable::TPC_ENDCAP = true; Enable::TRACKING = true; Enable::TRACKING_EVAL = Enable::TRACKING && true; @@ -499,15 +499,15 @@ int Fun4All_G4_EICDetector( gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); - cout <<"-------------------------------------------------"<run(1)"<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 we use a negative number of events we go back to the command line here if (nEvents < 0) { return 0; diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 511d74205..9b7e064b8 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -93,7 +93,7 @@ int Fun4All_G4_fsPHENIX( // Input::UPSILON_NUMBER = 3; // if you need 3 of them // Input::UPSILON_VERBOSITY = 0; -// Input::HEPMC = true; + // Input::HEPMC = true; INPUTHEPMC::filename = inputFile; // Event pile up simulation with collision rate in Hz MB collisions. @@ -110,6 +110,8 @@ int Fun4All_G4_fsPHENIX( // 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) { INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); @@ -121,8 +123,8 @@ int Fun4All_G4_fsPHENIX( else { INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } @@ -132,6 +134,8 @@ int Fun4All_G4_fsPHENIX( INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // 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("mu", 0); @@ -141,6 +145,8 @@ int Fun4All_G4_fsPHENIX( INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); } // 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); @@ -503,7 +509,7 @@ int Fun4All_G4_fsPHENIX( return 0; } -// if we use a negative number of events we go back to the command line here + // if we use a negative number of events we go back to the command line here if (nEvents < 0) { return 0; diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 30669412b..f7f9edf0d 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -112,8 +112,8 @@ int Fun4All_G4_sPHENIX( // 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 you run more than one of these Input::SIMPLE_NUMBER > 1 + // add the settings for other with [1], next with [2]... if (Input::SIMPLE) { INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); @@ -125,8 +125,8 @@ int Fun4All_G4_sPHENIX( else { INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); + PHG4SimpleEventGenerator::Uniform, + PHG4SimpleEventGenerator::Uniform); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); } @@ -136,8 +136,8 @@ int Fun4All_G4_sPHENIX( INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // Upsilons -// if you run more than one of these Input::UPSILON_NUMBER > 1 -// add the settings for other with [1], next with [2]... + // 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); @@ -147,8 +147,8 @@ int Fun4All_G4_sPHENIX( INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); } // 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 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); @@ -496,7 +496,7 @@ int Fun4All_G4_sPHENIX( return 0; } -// if we use a negative number of events we go back to the command line here + // if we use a negative number of events we go back to the command line here if (nEvents < 0) { return 0; @@ -509,7 +509,6 @@ int Fun4All_G4_sPHENIX( return 0; } - se->skip(skip); se->run(nEvents); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index b5b319f1f..f0a9ff154 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -4,8 +4,8 @@ #include #include -#include #include +#include #include #include #include From 23ebf859e702294a35a6680a21d4fba7a8bcc8bb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 09:22:28 -0400 Subject: [PATCH 0854/1222] initialize magnet in MagnetInit() not in G4MAGNET namespace --- common/G4_Magnet.C | 8 ++++++++ common/GlobalVariables.C | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 61059f5a6..a9812f1b7 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -26,6 +26,14 @@ namespace G4MAGNET void MagnetInit() { + if (!isfinite(G4MAGNET::magfield_rescale)) + { + G4MAGNET::magfield_rescale = 1.; + } + if (G4MAGNET::magfield.empty()) + { + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + } 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.); diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index f6b5aaa9f..7f8584375 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -55,7 +55,10 @@ namespace TRACKING namespace G4MAGNET { - double magfield_rescale = 1; - string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + // 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; + string magfield; } // namespace G4MAGNET #endif From a8d199d0b648094d6577394de9e1bff4cdb5800b Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Fri, 23 Oct 2020 11:47:26 -0400 Subject: [PATCH 0855/1222] Added MBD/BBC --- common/G4_Bbc.C | 37 +++++++++++++++++++++++++++++-------- common/G4_DSTReader.C | 4 ++-- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index cedd32959..163fe8209 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -1,9 +1,9 @@ -#ifndef MACRO_G4BBC_C -#define MACRO_G4BBC_C +#ifndef COMMON_G4BBC_C +#define COMMON_G4BBC_C #include #include -#include +#include "g4detectors/PHG4BbcSubsystem.h" R__LOAD_LIBRARY(libg4bbc.so) @@ -11,6 +11,7 @@ R__LOAD_LIBRARY(libg4bbc.so) namespace Enable { bool BBC = false; + bool BBCFAKE = false; } namespace G4BBC @@ -21,10 +22,31 @@ namespace G4BBC void BbcInit() { - cout << "In BbcInit()" << endl; - // Nothing to Init for now + //cout << "In BbcInit()" << endl; + + // Set boundary of tracked particles to include BBC (values in cm) + 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, 15.0); + +} + + +double Bbc(PHG4Reco* g4Reco, double radius) +{ + //cout << "XXXX CREATING BBC" << endl; + + gSystem->Load("libg4detectors.so"); + + PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); + bbc->SuperDetector( "BBC" ); + g4Reco->registerSubsystem( bbc ); + + radius = 15.; // outer shell is 15 cm + return radius; } + void Bbc_Reco(int verbosity = 0) { //--------------- @@ -33,9 +55,8 @@ void Bbc_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - // disable fast sim for now - int do_bbcfast = 0; - if ( do_bbcfast ) + //if ( Enable::BBCFAKE == true ) + if ( Enable::BBC == true ) { BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); bbcvertex->set_z_smearing(G4BBC::z_smearing); // 6 mm, temporarily perfect for TPC initial vertexing diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C index c9cc95647..b3a686f31 100644 --- a/common/G4_DSTReader.C +++ b/common/G4_DSTReader.C @@ -71,9 +71,9 @@ void G4DSTreader(const string &outputFile = "G4sPHENIXCells.root") ana->AddNode("TPC"); } - if (Enable::PSTOF) + if (Enable::BBC) { - ana->AddNode("PSTOF_0"); + ana->AddNode("BBC"); } if (Enable::CEMC) From 4a96f1be187692d4d2ea7ae32a385a50921c227f Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Fri, 23 Oct 2020 12:31:56 -0400 Subject: [PATCH 0856/1222] Added MBD/BBC --- common/G4_Bbc.C | 35 ++++++++++++++++---------- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 7 +++--- detectors/sPHENIX/G4Setup_sPHENIX.C | 1 + 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 163fe8209..07f7c4139 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -16,8 +16,8 @@ namespace Enable namespace G4BBC { - double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC - double t_smearing = 0.002; // 20ps timing resolution + 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() @@ -25,9 +25,12 @@ void BbcInit() //cout << "In BbcInit()" << endl; // Set boundary of tracked particles to include BBC (values in cm) - 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, 15.0); + if ( Enable::BBC == true ) + { + 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, 15.0); + } } @@ -38,11 +41,15 @@ double Bbc(PHG4Reco* g4Reco, double radius) gSystem->Load("libg4detectors.so"); - PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); - bbc->SuperDetector( "BBC" ); - g4Reco->registerSubsystem( bbc ); + if ( Enable::BBC == true ) + { + PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); + bbc->SuperDetector( "BBC" ); + g4Reco->registerSubsystem( bbc ); + + radius = 15.; // outer shell is 15 cm + } - radius = 15.; // outer shell is 15 cm return radius; } @@ -55,12 +62,14 @@ void Bbc_Reco(int verbosity = 0) Fun4AllServer* se = Fun4AllServer::instance(); - //if ( Enable::BBCFAKE == true ) - if ( Enable::BBC == true ) + // If BBC is enabled, it overrides the BBCFAKE + if ( Enable::BBCFAKE == true && Enable::BBC == false ) { + 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); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(G4BBC::t_smearing); // 20 ps + bbcvertex->set_z_smearing(G4BBC::z_smearing); + bbcvertex->set_t_smearing(G4BBC::t_smearing); se->registerSubsystem(bbcvertex); } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 2b478a753..cdc7ecb1d 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -199,13 +199,12 @@ int Fun4All_G4_sPHENIX( // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; - Enable::BBC = true; + Enable::BBC = false; + Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation Enable::PIPE = true; Enable::PIPE_ABSORBER = true; - //Enable::PSTOF = true; - // central tracking Enable::MVTX = true; Enable::MVTX_CELL = Enable::MVTX && true; @@ -329,7 +328,7 @@ int Fun4All_G4_sPHENIX( // BBC Reco //--------- - if (Enable::BBC) + if (Enable::BBC || Enable::BBCFAKE) { BbcInit(); Bbc_Reco(); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 94e9602d9..7ce41aac5 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -40,6 +40,7 @@ R__LOAD_LIBRARY(libg4detectors.so) void G4Init() { + cout << "IN NEW INIT" << endl; // load detector/material macros and execute Init() function if (Enable::PIPE) From de066e66e0e50ef0ab3a7574a9b4cdfc3bcbe32f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 13:07:47 -0400 Subject: [PATCH 0857/1222] Add UserAnalysisInit() function for user modules --- common/G4_User.C | 18 +++++++++++++++++- detectors/EICDetector/Fun4All_G4_EICDetector.C | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/common/G4_User.C b/common/G4_User.C index 95a3bd7c5..bf5d193c0 100644 --- a/common/G4_User.C +++ b/common/G4_User.C @@ -3,15 +3,23 @@ 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; } -void UserInit(int verbosity = 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 @@ -22,8 +30,16 @@ void UserInit(int verbosity = 0) //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() +{ + return; +} + #endif diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index cc1d42a91..01a39bb02 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -308,6 +309,7 @@ int Fun4All_G4_EICDetector( //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits //BlackHoleGeometry::visible = true; + //Enable::USER = true; //--------------- // World Settings //--------------- @@ -467,6 +469,10 @@ int Fun4All_G4_EICDetector( if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); + if (Enable::USER) + { + UserAnalysisInit(); + } //-------------- // Set up Input Managers //-------------- From 85d836b00e6348736c7a3c96f2bf9c76897b41d0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 13:14:31 -0400 Subject: [PATCH 0858/1222] Add UserAnalysisInit() function for user modules --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 7 +++---- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 6 ++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 01a39bb02..df77d7ce0 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -310,6 +310,7 @@ int Fun4All_G4_EICDetector( //BlackHoleGeometry::visible = true; //Enable::USER = true; + //--------------- // World Settings //--------------- @@ -469,10 +470,8 @@ int Fun4All_G4_EICDetector( if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); - if (Enable::USER) - { - UserAnalysisInit(); - } + if (Enable::USER) UserAnalysisInit(); + //-------------- // Set up Input Managers //-------------- diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 9b7e064b8..ab15efff7 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -298,6 +299,9 @@ int Fun4All_G4_fsPHENIX( //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits // BlackHoleGeometry::visible = true; + // run user provided code (from local G4_User.C) + //Enable::USER = true; + //--------------- // World Settings //--------------- @@ -468,6 +472,8 @@ int Fun4All_G4_fsPHENIX( if (Enable::DSTREADER) G4DSTreader_fsPHENIX(outputroot + "_DSTReader.root"); + if (Enable::USER) UserAnalysisInit(); + //-------------- // Set up Input Managers //-------------- diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index f7f9edf0d..a89bd5b7e 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -301,6 +302,9 @@ int Fun4All_G4_sPHENIX( //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits //BlackHoleGeometry::visible = true; + // run user provided code (from local G4_User.C) + //Enable::USER = true; + //--------------- // World Settings //--------------- @@ -459,6 +463,8 @@ int Fun4All_G4_sPHENIX( if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); + if (Enable::USER) UserAnalysisInit(); + //-------------- // Set up Input Managers //-------------- From 0d5ea2555b536305dfeed5b9a8812a8703164671 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 14:36:23 -0400 Subject: [PATCH 0859/1222] remove printout --- detectors/sPHENIX/G4Setup_sPHENIX.C | 1 - 1 file changed, 1 deletion(-) diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 8bf56a386..2e612619b 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -41,7 +41,6 @@ R__LOAD_LIBRARY(libg4detectors.so) void G4Init() { - cout << "IN NEW INIT" << endl; // load detector/material macros and execute Init() function if (Enable::PIPE) From bc7fbbe8b047a22702fa0ffa5235e672da28a0f5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 15:17:06 -0400 Subject: [PATCH 0860/1222] Add new Bbc subsystem --- common/G4_Bbc.C | 63 +++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 07f7c4139..ded770aa0 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -1,74 +1,75 @@ -#ifndef COMMON_G4BBC_C -#define COMMON_G4BBC_C +#ifndef MACRO_G4BBC_C +#define MACRO_G4BBC_C + +#include #include + #include -#include "g4detectors/PHG4BbcSubsystem.h" R__LOAD_LIBRARY(libg4bbc.so) +R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { bool BBC = false; bool BBCFAKE = false; -} + 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 + 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() { - //cout << "In BbcInit()" << endl; - + 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 == true ) + 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, 15.0); } - } - -double Bbc(PHG4Reco* g4Reco, double radius) +void Bbc(PHG4Reco* g4Reco) { - //cout << "XXXX CREATING BBC" << endl; - - gSystem->Load("libg4detectors.so"); - - if ( Enable::BBC == true ) + if (Enable::BBC) { - PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); - bbc->SuperDetector( "BBC" ); - g4Reco->registerSubsystem( bbc ); - - radius = 15.; // outer shell is 15 cm + PHG4BbcSubsystem* bbc = new PHG4BbcSubsystem("BBC"); + bbc->SuperDetector("BBC"); + g4Reco->registerSubsystem(bbc); } - - return radius; + return; } - -void Bbc_Reco(int verbosity = 0) +void Bbc_Reco() { + int verbosity = std::max(Enable::VERBOSITY, Enable::BBC_VERBOSITY); + //--------------- // Fun4All server //--------------- Fun4AllServer* se = Fun4AllServer::instance(); - // If BBC is enabled, it overrides the BBCFAKE - if ( Enable::BBCFAKE == true && Enable::BBC == false ) + if (Enable::BBCFAKE) { - cout << "BBCFAKE: Using smeared vtx and t0 resolutions of " - << G4BBC::z_smearing << " cm and " << G4BBC::t_smearing*1000 << " ps" << endl; + 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_z_smearing(G4BBC::z_smearing); bbcvertex->set_t_smearing(G4BBC::t_smearing); se->registerSubsystem(bbcvertex); } From 33ac32f829f75dfff3d9396cfd43c7ace4683d38 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 15:17:50 -0400 Subject: [PATCH 0861/1222] Add new bbc detector --- .../EICDetector/Fun4All_G4_EICDetector.C | 15 +--- detectors/EICDetector/G4Setup_EICDetector.C | 8 ++ detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 15 +--- detectors/fsPHENIX/G4Setup_fsPHENIX.C | 90 +++++-------------- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 13 +-- detectors/sPHENIX/G4Setup_sPHENIX.C | 12 +-- 6 files changed, 45 insertions(+), 108 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index df77d7ce0..dc5e23afe 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -207,7 +207,8 @@ int Fun4All_G4_EICDetector( // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; - Enable::BBC = true; + // Enable::BBC = true; + Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation // whether to simulate the Be section of the beam pipe Enable::PIPE = true; @@ -346,20 +347,12 @@ int Fun4All_G4_EICDetector( G4Setup(); } - //--------- - // BBC Reco - //--------- - - if (Enable::BBC) - { - BbcInit(); - Bbc_Reco(); - } - //------------------ // Detector Division //------------------ + if (Enable::BBC || Enable::BBCFAKE) Bbc_Reco(); + if (Enable::CEMC_CELL) CEMC_Cells(); if (Enable::HCALIN_CELL) HCALInner_Cells(); diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 043b7204b..1fde0c6fe 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -98,6 +99,8 @@ void G4Init() TrackingInit(); } + if (Enable::BBC) BbcInit(); + if (Enable::CEMC) { CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations @@ -236,6 +239,11 @@ int G4Setup() radius = TPC(g4Reco, radius); } + //---------------------------------------- + // BBC + + if (Enable::BBC) Bbc(g4Reco); + //---------------------------------------- // CEMC // diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index ab15efff7..cf65714e5 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -208,7 +208,8 @@ int Fun4All_G4_fsPHENIX( // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; - Enable::BBC = true; + // Enable::BBC = true; + Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation Enable::PIPE = true; Enable::PIPE_ABSORBER = true; @@ -335,20 +336,12 @@ int Fun4All_G4_fsPHENIX( G4Setup(); } - //--------- - // BBC Reco, just smeared vertex - //--------- - - if (Enable::BBC) - { - BbcInit(); - Bbc_Reco(); - } - //------------------ // 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(); diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C index db4218782..f75510e85 100644 --- a/detectors/fsPHENIX/G4Setup_fsPHENIX.C +++ b/detectors/fsPHENIX/G4Setup_fsPHENIX.C @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -41,73 +42,22 @@ void G4Init() { // 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::CEMC) - { - CEmcInit(); - } - - if (Enable::HCALIN) - { - HCalInnerInit(); - } - - if (Enable::MAGNET) - { - MagnetInit(); - } - if (Enable::HCALOUT) - { - HCalOuterInit(); - } - - if (Enable::FGEM) - { - FGEM_Init(); - } - - if (Enable::FEMC) - { - FEMCInit(); - } - - if (Enable::FHCAL) - { - FHCALInit(); - } - if (Enable::PISTON) - { - PistonInit(); - } - - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - if (Enable::USER) - { - UserInit(); - } - - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } + if (Enable::PIPE) PipeInit(); + if (Enable::MVTX) MvtxInit(); + if (Enable::INTT) InttInit(); + if (Enable::TPC) TPCInit(); + if (Enable::BBC) BbcInit(); + if (Enable::CEMC) CEmcInit(); + if (Enable::HCALIN) HCalInnerInit(); + if (Enable::MAGNET) MagnetInit(); + if (Enable::HCALOUT) HCalOuterInit(); + if (Enable::FGEM) FGEM_Init(); + if (Enable::FEMC) FEMCInit(); + if (Enable::FHCAL) FHCALInit(); + if (Enable::PISTON) PistonInit(); + if (Enable::PLUGDOOR) PlugDoorInit(); + if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); } int G4Setup() @@ -168,6 +118,12 @@ int G4Setup() { radius = TPC(g4Reco, radius); } + + //---------------------------------------- + // BBC + + if (Enable::BBC) Bbc(g4Reco); + //---------------------------------------- // CEMC // diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 9b51a0f8d..feff569ea 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -209,7 +209,7 @@ int Fun4All_G4_sPHENIX( // Enable::OVERLAPCHECK = true; // Enable::VERBOSITY = 1; - Enable::BBC = false; + // Enable::BBC = true; Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation Enable::PIPE = true; @@ -337,19 +337,12 @@ int Fun4All_G4_sPHENIX( G4Setup(); } - //--------- - // BBC Reco - //--------- - - if (Enable::BBC || Enable::BBCFAKE) - { - BbcInit(); - Bbc_Reco(); - } //------------------ // 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(); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 2e612619b..3bcde9df0 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -43,19 +43,13 @@ void G4Init() { // load detector/material macros and execute Init() function - if (Enable::PIPE) - { - PipeInit(); - } + 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::BBC) BbcInit(); if (Enable::CEMCALBEDO) { @@ -162,7 +156,7 @@ int G4Setup() //---------------------------------------- // BBC - if (Enable::BBC) radius = Bbc(g4Reco, radius); + if (Enable::BBC) Bbc(g4Reco); //---------------------------------------- // CEMC (it is checked above that not both of them are set From 39d5b54c8286200b1b9bed8292e0ffd4087a4414 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 23 Oct 2020 17:02:37 -0400 Subject: [PATCH 0862/1222] add Fun4AllServer instance, make it load standalone --- common/G4_User.C | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/G4_User.C b/common/G4_User.C index bf5d193c0..2bf718d04 100644 --- a/common/G4_User.C +++ b/common/G4_User.C @@ -1,6 +1,12 @@ #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 @@ -39,6 +45,8 @@ void UserDetector(PHG4Reco *g4Reco) // Any analysis goes here (registering your module with Fun4All) void UserAnalysisInit() { + Fun4AllServer* se = Fun4AllServer::instance(); + return; } From 7197563ac6f706cd76ed6212b25c93cbd5f72e3b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 24 Oct 2020 10:28:07 -0400 Subject: [PATCH 0863/1222] initialize magnetic field even if magnet is disabled --- common/G4_Magnet.C | 7 ++++++- detectors/sPHENIX/G4Setup_sPHENIX.C | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index a9812f1b7..970cdc301 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -24,7 +24,7 @@ namespace G4MAGNET double magnet_length = 379.; } // namespace G4MAGNET -void MagnetInit() +void MagnetFieldInit() { if (!isfinite(G4MAGNET::magfield_rescale)) { @@ -34,6 +34,11 @@ void MagnetInit() { G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.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.); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 3bcde9df0..a98c69db4 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -75,6 +75,8 @@ void G4Init() { MagnetInit(); } +// We want the field - even if the magnet volume is disabled + MagnetFieldInit(); if (Enable::HCALOUT) { HCalOuterInit(); From de92da4b85cbe757f64b21a8e73cbe11337b10e8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 24 Oct 2020 10:51:22 -0400 Subject: [PATCH 0864/1222] initialize magnetic field even if magnet is disabled, cleanup --- detectors/EICDetector/G4Setup_EICDetector.C | 255 ++++---------------- detectors/fsPHENIX/G4Setup_fsPHENIX.C | 2 + detectors/sPHENIX/G4Setup_sPHENIX.C | 114 ++------- 3 files changed, 68 insertions(+), 303 deletions(-) diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 1fde0c6fe..b5d6e239e 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -60,104 +60,29 @@ void G4Init() } // load detector/material macros and execute Init() function - if (Enable::PIPE) - { - PipeInit(); - } - - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - - if (Enable::EGEM) - { - EGEM_Init(); - } - if (Enable::FGEM) - { - FGEM_Init(); - } - if (Enable::FST) - { - FST_Init(); - } - if (Enable::BARREL) - { - BarrelInit(); - } - if (Enable::MVTX) - { - MvtxInit(); - } - if (Enable::TPC) - { - TPCInit(); - } - if (Enable::TRACKING) - { - TrackingInit(); - } - + if (Enable::PIPE) PipeInit(); + if (Enable::PLUGDOOR) PlugDoorInit(); + if (Enable::EGEM) EGEM_Init(); + if (Enable::FGEM) FGEM_Init(); + if (Enable::FST) FST_Init(); + if (Enable::BARREL) BarrelInit(); + if (Enable::MVTX) MvtxInit(); + if (Enable::TPC) TPCInit(); + if (Enable::TRACKING) TrackingInit(); if (Enable::BBC) BbcInit(); - - if (Enable::CEMC) - { - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (Enable::HCALIN) - { - HCalInnerInit(1); - } - - if (Enable::MAGNET) - { - MagnetInit(); - } - if (Enable::HCALOUT) - { - HCalOuterInit(); - } - - if (Enable::FEMC) - { - FEMCInit(); - } - - if (Enable::FHCAL) - { - FHCALInit(); - } - - if (Enable::EEMC) - { - EEMCInit(); - } - - if (Enable::DIRC) - { - DIRCInit(); - } - - if (Enable::RICH) - { - RICHInit(); - } - - if (Enable::AEROGEL) - { - AerogelInit(); - } - if (Enable::USER) - { - UserInit(); - } - - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } + if (Enable::CEMC) CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations + if (Enable::HCALIN) HCalInnerInit(1); + if (Enable::MAGNET) MagnetInit(); + MagnetFieldInit(); // We want the field - even if the magnet volume is disabled + if (Enable::HCALOUT) HCalOuterInit(); + if (Enable::FEMC) FEMCInit(); + if (Enable::FHCAL) FHCALInit(); + if (Enable::EEMC) EEMCInit(); + if (Enable::DIRC) DIRCInit(); + if (Enable::RICH) RICHInit(); + if (Enable::AEROGEL) AerogelInit(); + if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); } int G4Setup() @@ -203,132 +128,42 @@ int G4Setup() } 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.; - //---------------------------------------- - // PIPE - if (Enable::PIPE) - { - radius = Pipe(g4Reco, radius); - } - //---------------------------------------- - - if (Enable::EGEM) - { - EGEMSetup(g4Reco); - } - - if (Enable::FGEM) - { - FGEMSetup(g4Reco); - } - if (Enable::FST) - { - FSTSetup(g4Reco); - } - if (Enable::BARREL) - { - Barrel(g4Reco, radius); - } - if (Enable::MVTX) - { - radius = Mvtx(g4Reco, radius); - } - if (Enable::TPC) - { - radius = TPC(g4Reco, radius); - } - - //---------------------------------------- - // BBC - + if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::EGEM) EGEMSetup(g4Reco); + if (Enable::FGEM) FGEMSetup(g4Reco); + if (Enable::FST) FSTSetup(g4Reco); + if (Enable::BARREL) Barrel(g4Reco, radius); + if (Enable::MVTX) radius = Mvtx(g4Reco, radius); + if (Enable::TPC) radius = TPC(g4Reco, radius); if (Enable::BBC) Bbc(g4Reco); - - //---------------------------------------- - // CEMC - // - if (Enable::CEMC) - { - radius = CEmc(g4Reco, radius); - } - - //---------------------------------------- - // HCALIN - - if (Enable::HCALIN) - { - radius = HCalInner(g4Reco, radius, 4); - } - //---------------------------------------- - // MAGNET - - if (Enable::MAGNET) - { - radius = Magnet(g4Reco, radius); - } - //---------------------------------------- - // HCALOUT - - if (Enable::HCALOUT) - { - radius = HCalOuter(g4Reco, radius, 4); - } - //---------------------------------------- - // FEMC - - if (Enable::FEMC) - { - FEMCSetup(g4Reco); - } - - //---------------------------------------- - // FHCAL - - if (Enable::FHCAL) - { - FHCALSetup(g4Reco); - } - //---------------------------------------- - // EEMC - - if (Enable::EEMC) - { - EEMCSetup(g4Reco); - } + if (Enable::CEMC) radius = CEmc(g4Reco, radius); + 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::FEMC) FEMCSetup(g4Reco); + if (Enable::FHCAL) FHCALSetup(g4Reco); + if (Enable::EEMC) EEMCSetup(g4Reco); //---------------------------------------- // PID - if (Enable::DIRC) - { - DIRCSetup(g4Reco); - } + if (Enable::DIRC) DIRCSetup(g4Reco); + if (Enable::RICH) RICHSetup(g4Reco); + if (Enable::AEROGEL) AerogelSetup(g4Reco); - if (Enable::RICH) - { - RICHSetup(g4Reco); - } - - if (Enable::AEROGEL) - { - AerogelSetup(g4Reco); - } //---------------------------------------- // sPHENIX forward flux return door - if (Enable::PLUGDOOR) - { - PlugDoor(g4Reco); - } - if (Enable::USER) - { - UserDetector(g4Reco); + if (Enable::PLUGDOOR) PlugDoor(g4Reco); + + if (Enable::USER) UserDetector(g4Reco); } //---------------------------------------- // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions - if (Enable::BLACKHOLE) - { - BlackHole(g4Reco, radius); - } + if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C index f75510e85..99e8fc298 100644 --- a/detectors/fsPHENIX/G4Setup_fsPHENIX.C +++ b/detectors/fsPHENIX/G4Setup_fsPHENIX.C @@ -50,6 +50,8 @@ void G4Init() if (Enable::CEMC) CEmcInit(); if (Enable::HCALIN) HCalInnerInit(); if (Enable::MAGNET) MagnetInit(); +// We want the field - even if the magnet volume is disabled + MagnetFieldInit(); if (Enable::HCALOUT) HCalOuterInit(); if (Enable::FGEM) FGEM_Init(); if (Enable::FEMC) FEMCInit(); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index a98c69db4..08873a185 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -41,6 +41,12 @@ 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(); @@ -48,61 +54,18 @@ void G4Init() if (Enable::INTT) InttInit(); if (Enable::TPC) TPCInit(); if (Enable::MICROMEGAS) MicromegasInit(); - if (Enable::BBC) BbcInit(); - - if (Enable::CEMCALBEDO) - { - CEmcAlbedoInit(); - } - - if (Enable::CEMC) - { - if (Enable::CEMCALBEDO) - { - cout << "Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously" << endl; - gSystem->Exit(1); - } - CEmcInit(); // make it 2*2*2*3*3 so we can try other combinations - } - - if (Enable::HCALIN) - { - HCalInnerInit(); - } - - if (Enable::MAGNET) - { - MagnetInit(); - } -// We want the field - even if the magnet volume is disabled - MagnetFieldInit(); - if (Enable::HCALOUT) - { - HCalOuterInit(); - } - - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - if (Enable::FEMC) - { - FEMCInit(); - } - if (Enable::EPD) - { - EPDInit(); - } - if (Enable::USER) - { - UserInit(); - } - - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } + 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::FEMC) FEMCInit(); + if (Enable::EPD) EPDInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); + if (Enable::USER) UserInit(); } int G4Setup() @@ -142,66 +105,31 @@ int G4Setup() } 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.; - //---------------------------------------- - // PIPE if (Enable::PIPE) radius = Pipe(g4Reco, radius); - - //---------------------------------------- - // TRACKING 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); - - //---------------------------------------- - // BBC - if (Enable::BBC) Bbc(g4Reco); - - //---------------------------------------- - // CEMC (it is checked above that not both of them are set if (Enable::CEMCALBEDO) CEmcAlbedo(g4Reco); - if (Enable::CEMC) radius = CEmc(g4Reco, radius, 8); - - //---------------------------------------- - // HCALIN - if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4); - - //---------------------------------------- - // MAGNET - if (Enable::MAGNET) radius = Magnet(g4Reco, radius); - - //---------------------------------------- - // HCALOUT - if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); - - //---------------------------------------- - // sPHENIX forward flux return door if (Enable::PLUGDOOR) PlugDoor(g4Reco); - - // forward EMC if (Enable::FEMC) FEMCSetup(g4Reco); - if (Enable::EPD) EPD(g4Reco); + if (Enable::USER) UserDetector(g4Reco); - if (Enable::USER) - { - UserDetector(g4Reco); - } //---------------------------------------- // BLACKHOLE - if (Enable::BLACKHOLE) - { - BlackHole(g4Reco, radius); - } + if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); g4Reco->registerSubsystem(truth); From eaa983e60ea189f23d5c12d7903f7296ddbb7f8e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 24 Oct 2020 11:04:15 -0400 Subject: [PATCH 0865/1222] black hole needs to be initialized last --- detectors/sPHENIX/G4Setup_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 08873a185..654690cff 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -64,8 +64,8 @@ void G4Init() if (Enable::PLUGDOOR) PlugDoorInit(); if (Enable::FEMC) FEMCInit(); if (Enable::EPD) EPDInit(); - if (Enable::BLACKHOLE) BlackHoleInit(); if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); } int G4Setup() From 9bd7ef564744bc47819e426135fd51589cadbe3b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 24 Oct 2020 13:43:46 -0400 Subject: [PATCH 0866/1222] use unique embedding id across generators --- common/G4_Input.C | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 412f3c59f..b824e8cc7 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -125,7 +125,7 @@ void InputInit() cout << "Reading Hits and running G4 simultanously is not supported" << endl; gSystem->Exit(1); } - + int embedid = 1; // need to be uniq across generators, start with 1 if (Input::PYTHIA6 && Input::PYTHIA8) { cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; @@ -162,7 +162,8 @@ void InputInit() { std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); - simple->Embed(2); + simple->Embed(embedid); + embedid++; INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } } @@ -172,7 +173,8 @@ void InputInit() { std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); - gun->Embed(2); + gun->Embed(embedid); + embedid++; INPUTGENERATOR::Gun.push_back(gun); } } @@ -182,7 +184,8 @@ void InputInit() { std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); - upsilon->Embed(2); + upsilon->Embed(embedid); + embedid++; INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } From 9a0987918eb271e3e96f95457566992fa132e203 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 24 Oct 2020 14:04:50 -0400 Subject: [PATCH 0867/1222] set unique embedding id in G4_Input --- common/G4_Input.C | 14 +++++++------- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 3 +-- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index b824e8cc7..b78f63913 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -48,6 +48,7 @@ namespace Input int UPSILON_NUMBER = 1; double PILEUPRATE = 0.; int VERBOSITY = 0; + int EmbedId = 1; } // namespace Input namespace INPUTHEPMC @@ -125,7 +126,6 @@ void InputInit() cout << "Reading Hits and running G4 simultanously is not supported" << endl; gSystem->Exit(1); } - int embedid = 1; // need to be uniq across generators, start with 1 if (Input::PYTHIA6 && Input::PYTHIA8) { cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; @@ -162,8 +162,8 @@ void InputInit() { std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); - simple->Embed(embedid); - embedid++; + simple->Embed(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } } @@ -173,8 +173,8 @@ void InputInit() { std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); - gun->Embed(embedid); - embedid++; + gun->Embed(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::Gun.push_back(gun); } } @@ -184,8 +184,8 @@ void InputInit() { std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); - upsilon->Embed(embedid); - embedid++; + upsilon->Embed(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index cf65714e5..cba9b166f 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -132,7 +132,6 @@ int Fun4All_G4_fsPHENIX( INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 3); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.5, 50.); - INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // Upsilons // if you run more than one of these Input::UPSILON_NUMBER > 1 @@ -169,7 +168,7 @@ int Fun4All_G4_fsPHENIX( //! 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(2); + //INPUTMANAGER::HepMCInputManager->set_embedding_id(Input::EmbedID); if (Input::PILEUPRATE > 0) { // Copy vertex settings from foreground hepmc input diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index feff569ea..dab0c442a 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -134,7 +134,6 @@ int Fun4All_G4_sPHENIX( INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); - INPUTGENERATOR::SimpleEventGenerator[0]->Embed(2); } // Upsilons // if you run more than one of these Input::UPSILON_NUMBER > 1 @@ -171,7 +170,7 @@ int Fun4All_G4_sPHENIX( //! 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(2); + //INPUTMANAGER::HepMCInputManager->set_embedding_id(Input::EmbedID); if (Input::PILEUPRATE > 0) { // Copy vertex settings from foreground hepmc input From 059dbc8df997ab1077977471eebf83c4e576b557 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 25 Oct 2020 01:18:20 -0400 Subject: [PATCH 0868/1222] Update G4Setup_EICDetector.C Remove leftover } --- detectors/EICDetector/G4Setup_EICDetector.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index b5d6e239e..3cc9fccc1 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -160,7 +160,7 @@ int G4Setup() if (Enable::PLUGDOOR) PlugDoor(g4Reco); if (Enable::USER) UserDetector(g4Reco); - } + //---------------------------------------- // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); From 2f4c2dda8e1eda4784e1bca684c28ee50ad48308 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 26 Oct 2020 22:03:48 -0400 Subject: [PATCH 0869/1222] fix overlap with forward black hole (need to deal with the adding of no_overlap, there is a small air gap in the beam pipe vacuum) --- common/G4_Pipe.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 3b2c68fce..4de9f4eec 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -37,8 +37,8 @@ namespace G4PIPE void PipeInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length)); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length +no_overlapp ); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length) - no_overlapp); } double Pipe(PHG4Reco* g4Reco, double radius) From 0bcc08a89848a957a02e6f3b2b49f08ef517e007 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 26 Oct 2020 22:13:13 -0400 Subject: [PATCH 0870/1222] Add simple particle generator, DZero generator and iongun --- common/G4_Input.C | 137 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 24 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index b78f63913..9a00d030e 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -8,7 +8,10 @@ #include #include +#include +#include #include +#include #include #include #include @@ -33,20 +36,38 @@ R__LOAD_LIBRARY(libPHSartre.so) namespace Input { - bool GUN = false; - int GUN_VERBOSITY = 0; - int GUN_NUMBER = 1; - bool READHITS = false; +// Real Event generators bool PYTHIA6 = false; bool PYTHIA8 = false; bool SARTRE = false; + +// Single/multiple particle generators + bool DZERO = false; + int DZERO_NUMBER = 1; + int DZERO_VERBOSITY = 1; + + bool GUN = false; + int GUN_NUMBER = 1; + int GUN_VERBOSITY = 0; + + bool IONGUN = false; + int IONGUN_NUMBER = 1; + int IONGUN_VERBOSITY = 0; + + bool PGEN = false; + int PGEN_NUMBER = 1; + int PGEN_VERBOSITY = 0; + bool SIMPLE = false; - int SIMPLE_VERBOSITY = 0; int SIMPLE_NUMBER = 1; + int SIMPLE_VERBOSITY = 0; + bool UPSILON = false; - int UPSILON_VERBOSITY = 0; int UPSILON_NUMBER = 1; + int UPSILON_VERBOSITY = 0; + double PILEUPRATE = 0.; + bool READHITS = false; int VERBOSITY = 0; int EmbedId = 1; } // namespace Input @@ -97,6 +118,9 @@ 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; @@ -132,6 +156,8 @@ void InputInit() gSystem->Exit(1); } +// done with consistency checks, create generators in no specific order + Fun4AllServer *se = Fun4AllServer::instance(); if (Input::PYTHIA6) { @@ -155,16 +181,16 @@ void InputInit() INPUTGENERATOR::SartreTrigger->SetEtaHighLow(1.0, -1.1); // central arm INPUTGENERATOR::SartreTrigger->PrintConfig(); } - - if (Input::SIMPLE) +// single particle generators + if (Input::DZERO) { - for (int i = 0; i < Input::SIMPLE_NUMBER; ++i) + for (int i = 0; i < Input::DZERO_NUMBER; ++i) { - std::string name = "EVTGENERATOR_" + std::to_string(i); - PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); - simple->Embed(Input::EmbedId); + std::string name = "DZERO_" + std::to_string(i); + PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); + dzero->Embed(Input::EmbedId); Input::EmbedId++; - INPUTGENERATOR::SimpleEventGenerator.push_back(simple); + INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } } if (Input::GUN) @@ -178,6 +204,39 @@ void InputInit() 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::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::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::EmbedId++; + INPUTGENERATOR::SimpleEventGenerator.push_back(simple); + } + } if (Input::UPSILON) { for (int i = 0; i < Input::UPSILON_NUMBER; ++i) @@ -189,6 +248,7 @@ void InputInit() INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } + // input managers for which we might need to set options if (Input::HEPMC) { @@ -216,11 +276,48 @@ void InputRegister() 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(Input::SIMPLE_VERBOSITY); + INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(verbosity); se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator[icnt]); } } @@ -228,23 +325,15 @@ void InputRegister() { 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(Input::UPSILON_VERBOSITY); - INPUTGENERATOR::VectorMesonGenerator[icnt]->Embed(2); + INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(verbosity); se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); } } - if (Input::GUN) - { - for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt) - { - INPUTGENERATOR::Gun[icnt]->Verbosity(Input::GUN_VERBOSITY); - se->registerSubsystem(INPUTGENERATOR::Gun[icnt]); - } - } if (Input::READEIC) { ReadEICFiles *eicr = new ReadEICFiles(); From 3be12732a084f5123d33d06706d70ae30baf11cd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 26 Oct 2020 22:17:15 -0400 Subject: [PATCH 0871/1222] set default dzero verbosity to zero --- common/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 9a00d030e..39d59436d 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -44,7 +44,7 @@ namespace Input // Single/multiple particle generators bool DZERO = false; int DZERO_NUMBER = 1; - int DZERO_VERBOSITY = 1; + int DZERO_VERBOSITY = 0; bool GUN = false; int GUN_NUMBER = 1; From 75c431582dca625d9bb836006d74525e4797c1ef Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 27 Oct 2020 12:28:53 -0400 Subject: [PATCH 0872/1222] re-enable full cemc reco --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index dab0c442a..190967be4 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -242,7 +242,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC = true; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; - Enable::CEMC_TOWER = Enable::CEMC_CELL && false; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; From 266d4376cb597dab8ef5e0dbe67d7852ce09aaba Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 28 Oct 2020 16:53:06 -0400 Subject: [PATCH 0873/1222] Adds the flags to turn on distortions and still do silicon and Micromegas matching to the TPC seed tracks. --- common/G4_TPC.C | 15 +++ common/G4_Tracking.C | 247 +++++++++++++++++++++++++------------------ 2 files changed, 159 insertions(+), 103 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 139e5d588..305ce64cf 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -43,6 +43,15 @@ namespace G4TPC 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.; + + // distortions + bool ENABLE_DISTORTIONS = false; + std::string distortion_filename = "fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + unsigned int distortion_coordinates = + PHG4TpcElectronDrift::COORD_PHI| + PHG4TpcElectronDrift::COORD_R| + PHG4TpcElectronDrift::COORD_Z; + } // namespace G4TPC void TPCInit() @@ -140,6 +149,12 @@ void TPC_Cells() PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); edrift->Verbosity(verbosity); + edrift->set_enable_distortions( G4TPC::ENABLE_DISTORTIONS); + if( G4TPC::ENABLE_DISTORTIONS ) + { + edrift->set_distortion_filename( G4TPC::distortion_filename ); + edrift->set_coordinates( G4TPC::distortion_coordinates ); + } // 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 diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ca07b3317..80d1ee5c0 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -54,6 +54,10 @@ 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 + // Tracking reconstruction setup parameters and flags //===================================== @@ -67,13 +71,14 @@ namespace G4TRACKING // PHActsTracks // convert SvtxTracks to Acts tracks // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks + bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + // Possible variations - these are normally false bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing - bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events @@ -121,6 +126,14 @@ void TrackingInit() { G4MICROMEGAS::n_micromegas_layer = 0; } + + // SC_CALIBMODE makes no sense if distortions are not present + G4TRACKING::SC_CALIBMODE = G4TPC::ENABLE_DISTORTIONS && G4TRACKING::SC_CALIBMODE; + + // Genfit does final vertexing, Acts does not + if(G4TRACKING::use_Genfit) + G4TRACKING::g4eval_use_initial_vertex = false; + } void Tracking_Reco() @@ -144,7 +157,7 @@ void Tracking_Reco() { // We cheat to get the initial vertex for the full track reconstruction case PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); + init_vtx->Verbosity(0); se->registerSubsystem(init_vtx); } else @@ -256,99 +269,127 @@ void Tracking_Reco() projection->Verbosity(verbosity); se->registerSubsystem(projection); } - + // Acts tracking chain (starts from TPC track seeds) //=================================== if (!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) - { - std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; - - // 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(0); - se->registerSubsystem(silicon_assoc); + std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + + // 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(0); + 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 + + // use truth information to assemble silicon clusters into track stubs for now + PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match ->Verbosity(0); + if(!G4TRACKING::use_PHTpcTracker_seeding) + silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding + 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.02); + silicon_match->set_eta_search_window(0.004); + } + 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(0); + 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 - { - 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 - - // use truth information to assemble silicon clusters into track stubs for now - PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); - - // Match the TPC track stubs from Cthe A seeder to silicon track stubs from PHSiliconTruthTrackSeeding - PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); - silicon_match->Verbosity(0); - if (!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // defaults to PHTpcTracker seeding, use true for PHCASeeding - silicon_match->set_field(G4MAGNET::magfield); - silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_phi_search_window(0.02); // tune8 - optimum - silicon_match->set_eta_search_window(0.015); // tune8 - optimum - 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(0); - // 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->print_test_windows_data(false); // normally false - se->registerSubsystem(mm_match); - } - } - + // Final fitting of tracks using Acts Kalman Filter //================================= - if (!G4TRACKING::use_Genfit) - { - std::cout << " Using Acts track fitting " << std::endl; - + if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + { + std::cout << " Using Acts track fitting " << std::endl; + #if __cplusplus >= 201703L - /// Geometry must be built before any Acts modules - MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(0); - geom->setMagField(G4MAGNET::magfield); - geom->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(geom); - - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(0); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - - PHActsTracks* actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - PHActsTrkFitter* actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(false); - se->registerSubsystem(actsFit); - + /// Geometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->Verbosity(0); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(geom); + + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(0); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); + + PHActsTracks* actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + PHActsTrkFitter* actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + actsFit->doTimeAnalysis(false); + se->registerSubsystem(actsFit); + #endif - } - + } + return; } @@ -381,8 +422,8 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if (!G4TRACKING::use_Genfit) - { + if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + { #if __cplusplus >= 201703L ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); actsEval->Verbosity(0); @@ -391,21 +432,21 @@ void Tracking_Eval(const std::string& outputfile) #endif } - if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - 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(verbosity); - se->registerSubsystem(evalp); - } - + if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); + 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(verbosity); + se->registerSubsystem(evalp); + } + return; } #endif From 08244a83c9123b0bd92b0b151f6c6d1c7a903f94 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 2 Nov 2020 15:36:37 -0500 Subject: [PATCH 0874/1222] add flag for evaluator, remove SCD check --- common/G4_Tracking.C | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 73b783b6c..028c9519e 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -81,7 +81,7 @@ namespace G4TRACKING bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples - + bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events //default seed is PHTpcTracker @@ -360,7 +360,7 @@ void Tracking_Reco() // Final fitting of tracks using Acts Kalman Filter //================================= - if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + if(!G4TRACKING::use_Genfit) { std::cout << " Using Acts track fitting " << std::endl; @@ -437,10 +437,13 @@ void Tracking_Eval(const std::string& outputfile) if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { #if __cplusplus >= 201703L - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); + if(use_acts_evaluator) + { + ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); + actsEval->Verbosity(0); + actsEval->setEvalCKF(false); + se->registerSubsystem(actsEval); + } #endif } From 8961c2a13356e9d8f6ae61cb9d2caf46e38a7d0f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 2 Nov 2020 15:47:38 -0500 Subject: [PATCH 0875/1222] fix namespace --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 028c9519e..b9df004c5 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -437,7 +437,7 @@ void Tracking_Eval(const std::string& outputfile) if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { #if __cplusplus >= 201703L - if(use_acts_evaluator) + if(G4TRACKING::use_acts_evaluator) { ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); actsEval->Verbosity(0); From e2471c74f8e514131e4a034e3cb85a8b30d8bf34 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 2 Nov 2020 21:05:23 -0500 Subject: [PATCH 0876/1222] PHGenFitTrackProjection was inside the Genfit tracking section, so when Acts tracking was run, the associations to the calorimeters were not made. Moved it to the end of Tracking_reco() so that it will be run for either Genfit or Acts tracking. --- common/G4_Tracking.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 73b783b6c..d8fe9b60c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -263,12 +263,6 @@ void Tracking_Reco() se->registerSubsystem(kalman); - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); } // Acts tracking chain (starts from TPC track seeds) @@ -401,6 +395,13 @@ void Tracking_Reco() } #endif } + + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); return; } From 02fe022e5f4c1397f3a8c6f43ea92d41325b16f9 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 3 Nov 2020 12:30:22 -0700 Subject: [PATCH 0877/1222] default to Baseline Micromegas configuration --- common/G4_Micromegas.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 03f7a52fd..53f30851e 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -39,7 +39,7 @@ namespace G4MICROMEGAS CONFIG_MAXIMAL }; - Config CONFIG = CONFIG_Z_ONE_SECTOR; + Config CONFIG = CONFIG_BASELINE; } // namespace G4MICROMEGAS void MicromegasInit() From 66b101e7636ea6b733a20123c3a99761c37a3116 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 7 Oct 2020 14:11:19 -0400 Subject: [PATCH 0878/1222] added 7cm z offset to central membrane for baseline micromegas configuration --- common/G4_Micromegas.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 53f30851e..6c63c8904 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -126,7 +126,7 @@ void Micromegas_Cells() case G4MICROMEGAS::CONFIG_BASELINE: { - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; + std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_BASELINE" << std::endl; MicromegasTile::List tiles; // for the first sector we put 4 tiles with full z coverage @@ -138,11 +138,12 @@ void Micromegas_Cells() } // for the other sectors we put two tiles on either side of the central membrane + static constexpr double zoffset = 7; for (int i = 1; i < nsectors; ++i) { - const double phi = phi0 + 2. * M_PI * i / nsectors; - tiles.emplace_back(phi, length * (1.5 / 4 - 0.5), tile_width / radius, tile_length); - tiles.emplace_back(phi, length * (2.5 / 4 - 0.5), tile_width / radius, tile_length); + const double phi = phi0 + 2.*M_PI*i/nsectors; + tiles.emplace_back( phi, length*(1.5/4-0.5) - zoffset, tile_width/radius, tile_length ); + tiles.emplace_back( phi, length*(2.5/4-0.5) + zoffset, tile_width/radius, tile_length ); } reco->set_tiles(tiles); break; From ee7523aa757c1031e78cb41689552e49bf75a431 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 5 Nov 2020 11:26:19 -0500 Subject: [PATCH 0879/1222] added TpcSpaceChargeCorrection module and relevant flags it is disabled by default. --- common/G4_TPC.C | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 18aa00aec..b272c25fc 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -16,6 +16,7 @@ #include #include +#include #include @@ -52,6 +53,14 @@ namespace G4TPC PHG4TpcElectronDrift::COORD_R| PHG4TpcElectronDrift::COORD_Z; + // distortion corrections + bool ENABLE_CORRECTIONS = false; + std::string correction_filename = "fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + unsigned int correction_coordinates = + TpcSpaceChargeCorrection::COORD_PHI| + TpcSpaceChargeCorrection::COORD_R| + TpcSpaceChargeCorrection::COORD_Z; + } // namespace G4TPC void TPCInit() @@ -195,8 +204,18 @@ void TPC_Clustering() // For the Tpc //========== - TpcClusterizer* tpcclusterizer = new TpcClusterizer(); + auto tpcclusterizer = new TpcClusterizer; tpcclusterizer->Verbosity(verbosity); se->registerSubsystem(tpcclusterizer); + + // space charge correction + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto tpcSpaceChargeCorrection = new TpcSpaceChargeCorrection; + tpcSpaceChargeCorrection->set_distortion_filename( G4TPC::correction_filename ); + tpcSpaceChargeCorrection->set_coordinates( G4TPC::correction_coordinates ); + se->registerSubsystem(tpcSpaceChargeCorrection); + } + } #endif From dd8dac6597a63b1692b89f0b91f1c51a515c123e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 5 Nov 2020 11:45:27 -0500 Subject: [PATCH 0880/1222] Automatically disable spacecharge distortion if not running GenFit --- common/G4_Tracking.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index cc4dac748..2259afcd8 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -135,6 +135,12 @@ void TrackingInit() if(G4TRACKING::use_Genfit) G4TRACKING::g4eval_use_initial_vertex = false; + // 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; + } } void Tracking_Reco() From 6c09419e341875f6c37487b97077254ad90c839c Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 5 Nov 2020 12:07:45 -0500 Subject: [PATCH 0881/1222] added missing include --- common/G4_Bbc.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index ded770aa0..f0082fa26 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -4,6 +4,7 @@ #include #include +#include #include From a6af95861be38c815bbb2686548faf6db1df9885 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 6 Nov 2020 14:57:25 -0500 Subject: [PATCH 0882/1222] add acts track projection --- common/G4_Tracking.C | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2259afcd8..ae2b095ae 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -36,6 +36,7 @@ #include #include #include +#include #endif #include @@ -269,6 +270,13 @@ void Tracking_Reco() se->registerSubsystem(kalman); + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } // Acts tracking chain (starts from TPC track seeds) @@ -367,47 +375,44 @@ void Tracking_Reco() #if __cplusplus >= 201703L /// Geometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(0); + geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(geom); /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(0); + sl->Verbosity(verbosity); sl->setMagField(G4MAGNET::magfield); sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); PHActsTracks* actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); + actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); PHActsTrkFitter* actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); + 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 PHTpcResiduals *residuals = new PHTpcResiduals(); - residuals->Verbosity(0); + residuals->Verbosity(verbosity); se->registerSubsystem(residuals); - } + + PHActsTrackProjection* actsProj = new PHActsTrackProjection(); + actsProj->Verbosity(verbosity); + se->registerSubsystem(actsProj); #endif } - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); + return; } From 65a2909b17d918f05fe7d98da81583f08ec8a1cc Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Sat, 7 Nov 2020 09:22:13 -0700 Subject: [PATCH 0883/1222] look for default distortion maps in $CALIBRATION_MAIN --- common/G4_TPC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index b272c25fc..859bb8b83 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -47,7 +47,7 @@ namespace G4TPC // distortions bool ENABLE_DISTORTIONS = false; - std::string distortion_filename = "fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + auto distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; unsigned int distortion_coordinates = PHG4TpcElectronDrift::COORD_PHI| PHG4TpcElectronDrift::COORD_R| @@ -55,7 +55,7 @@ namespace G4TPC // distortion corrections bool ENABLE_CORRECTIONS = false; - std::string correction_filename = "fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + auto correction_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; unsigned int correction_coordinates = TpcSpaceChargeCorrection::COORD_PHI| TpcSpaceChargeCorrection::COORD_R| From 64c901f9fac6830fcca34214168a39e5552cfde9 Mon Sep 17 00:00:00 2001 From: Joe Osborn <53052717+osbornjd@users.noreply.github.com> Date: Mon, 9 Nov 2020 09:13:52 -0500 Subject: [PATCH 0884/1222] Revert "Add Acts track-to-calo projection" --- common/G4_Tracking.C | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ae2b095ae..2259afcd8 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -36,7 +36,6 @@ #include #include #include -#include #endif #include @@ -270,13 +269,6 @@ void Tracking_Reco() se->registerSubsystem(kalman); - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); - } // Acts tracking chain (starts from TPC track seeds) @@ -375,44 +367,47 @@ void Tracking_Reco() #if __cplusplus >= 201703L /// Geometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(verbosity); + geom->Verbosity(0); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(geom); /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(verbosity); + sl->Verbosity(0); sl->setMagField(G4MAGNET::magfield); sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); PHActsTracks* actsTracks = new PHActsTracks(); - actsTracks->Verbosity(verbosity); + actsTracks->Verbosity(0); se->registerSubsystem(actsTracks); PHActsTrkFitter* actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(verbosity); + actsFit->Verbosity(0); 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 PHTpcResiduals *residuals = new PHTpcResiduals(); - residuals->Verbosity(verbosity); + residuals->Verbosity(0); se->registerSubsystem(residuals); - } - PHActsTrackProjection* actsProj = new PHActsTrackProjection(); - actsProj->Verbosity(verbosity); - se->registerSubsystem(actsProj); + } #endif } - + //------------------ + // Track Projections + //------------------ + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + projection->Verbosity(verbosity); + se->registerSubsystem(projection); return; } From 4bf23283b6bfd14990f05ec4dab0cbf0db2cd9a5 Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 9 Nov 2020 13:58:56 -0500 Subject: [PATCH 0885/1222] update LANL FST and barrel tracker setup --- macros/g4simulations/G4_Barrel_EIC.C | 82 +++++++++++++++----------- macros/g4simulations/G4_FST_EIC.C | 22 ++++--- macros/g4simulations/G4_Tracking_EIC.C | 45 ++++++++------ 3 files changed, 87 insertions(+), 62 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 42e256951..fc9399fb2 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -31,61 +31,71 @@ double Barrel(PHG4Reco* g4Reco, double radius) const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; //--------------------------------- - //build barrel detector + //build barrel1 detector //--------------------------------- - const int nLayer = 5; + const int nLayer1 = 3; //barrel 1 + const int nLayer2 = 2; //barrel 2 + int nLayer[2]={nLayer1,nLayer2}; + const int nSubLayer = 7; const float um = 0.0001; //convert um to cm - double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm - double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm + double r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 + {16, 22.0}}; //barrel 2 + + double halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 + {25,25}}; //barrel 2 string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", "Support1", "Support_Gap", "Support2"}; string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {285 * um, 15 * um, 20 * um, 100 * um, + double thickness[nSubLayer] = {35 * um, 15 * um, 20 * um, 100 * um, 50 * um, 1, 50 * um}; int k = 0; //layer id. Must be unique. double max_bh_radius = 0.; - PHG4CylinderSubsystem* cyl; - for (int i = 0; i < nLayer; i++) - { - //if (i>2) continue; - for (int j = 0; j < nSubLayer; j++) - { - cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); - if (j == 0) - { - cyl->set_double_param("radius", r[i]); - } - else - { - cyl->set_double_param("radius", r[i] + thickness[j - 1]); - } - cyl->set_double_param("length", 2.0 * halfLength[i]); - cyl->set_string_param("material", material[j]); - cyl->set_double_param("thickness", thickness[j]); - max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); - cyl->SuperDetector("BARREL"); - if (j == 0) - { - cyl->SetActive(); //only the Silicon Sensor is active - } - else + PHG4CylinderSubsystem* cyl[2]; + for (int n = 0; n < 2; n++) { //barrel1, barrel2 + for (int i = 0; i < nLayer[n]; i++) { - if (AbsorberActive) cyl->SetActive(); + if (n==1) thickness[0]=85*um; + + for (int j = 0; j < nSubLayer; j++) + { + //cyl[n] = new PHG4CylinderSubsystem("Barrel"+ n +"_" + + layerName[j], k); + cyl[n] = new PHG4CylinderSubsystem(Form("Barrel%d_%s",n,layerName[j].c_str()), k); + if (j == 0) + { + cyl[n]->set_double_param("radius", r[n][i]); + } + else + { + cyl[n]->set_double_param("radius", r[n][i] + thickness[j - 1]); + } + cyl[n]->set_double_param("length", 2.0 * halfLength[n][i]); + cyl[n]->set_string_param("material", material[j]); + cyl[n]->set_double_param("thickness", thickness[j]); + max_bh_radius = std::max(max_bh_radius, (r[n][i] + thickness[j - 1] + thickness[j])); + cyl[n]->SuperDetector(Form("BARREL%d",n)); + if (j == 0) + { + cyl[n]->SetActive(); //only the Silicon Sensor is active + } + else + { + if (AbsorberActive) cyl[n]->SetActive(); + } + g4Reco->registerSubsystem(cyl[n]); + k++; + } } - g4Reco->registerSubsystem(cyl); - k++; - } } // update now that we know the outer radius BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[1][0]); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[0][0]); return max_bh_radius; } //---------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C index 15e363f6d..96c4c3e15 100644 --- a/macros/g4simulations/G4_FST_EIC.C +++ b/macros/g4simulations/G4_FST_EIC.C @@ -11,7 +11,7 @@ R__LOAD_LIBRARY(libg4detectors.so) int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax); + double Rmax,double tSilicon); //-----------------------------------------------------------------------------------// namespace Enable { @@ -26,17 +26,21 @@ void FST_Init() //-----------------------------------------------------------------------------------// void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); - //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35*um); + make_LANL_FST_station("FST_2", g4Reco, 90, 5.2, 43, 35*um); + make_LANL_FST_station("FST_3", g4Reco, 115, 6, 44, 85*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 85*um); + make_LANL_FST_station("FST_5", g4Reco, 300, 15, 45, 85*um); } //-----------------------------------------------------------------------------------// int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax) + double zpos, double Rmin, double Rmax,double tSilicon) //silicon thickness { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " @@ -80,7 +84,7 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index 5d63476b4..45c5829bc 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -58,13 +58,12 @@ void Tracking_Reco() // kalman->Smearing(false); if (G4TRACKING::DISPLACED_VERTEX) { - // do not use truth vertex in the track fitting, - // which would lead to worse momentum resolution for prompt tracks - // but this allows displaced track analysis including DCA and vertex finding + //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex kalman->set_use_vertex_in_fitting(false); - kalman->set_vertex_xy_resolution(0);// do not smear the vertex used in the built-in DCA calculation - kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation - kalman->enable_vertexing(true); // enable vertex finding and fitting + kalman->set_vertex_xy_resolution(0); + kalman->set_vertex_z_resolution(0); + kalman->enable_vertexing(true); + kalman->set_vertex_min_ndf(1); } else { @@ -82,12 +81,19 @@ void Tracking_Reco() //------------------------- if (Enable::BARREL) { - kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, + kalman->add_phg4hits("G4HIT_BARREL0", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, + 5e-4, // const float radres, *ignored in cylindrical detector* + 20e-4/sqrt(12), // const float phires, + 20e-4/sqrt(12), // const float lonres, + 0.95, // const float eff, + 0); // const float noise + kalman->add_phg4hits("G4HIT_BARREL1", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + 36.4e-4/sqrt(12), // const float phires, + 36.4e-4/sqrt(12), // const float lonres, + 0.95, // const float eff, 0); // const float noise } //------------------------- @@ -150,7 +156,8 @@ void Tracking_Reco() { kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, + 100e-4, // const float radres, + //100. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -160,16 +167,20 @@ void Tracking_Reco() //------------------------- // FST //------------------------- + float pitch=20e-4; if (Enable::FST) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { + if (i>=3) pitch=36.4e-4; + else pitch=20e-4; + kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, + pitch/sqrt(12), // const float radres, + pitch/sqrt(12), // const float phires, + 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* + 0.95, // const float eff, 0); // const float noise } } From c5c68c09291245981301e66bd6f67e67b11a5bdf Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 9 Nov 2020 14:45:23 -0500 Subject: [PATCH 0886/1222] update LANL FST and barrel tracker --- macros/g4simulations/G4_Barrel_EIC.C | 82 +++++++++++++++----------- macros/g4simulations/G4_FST_EIC.C | 22 ++++--- macros/g4simulations/G4_Tracking_EIC.C | 41 ++++++++----- 3 files changed, 86 insertions(+), 59 deletions(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index 42e256951..fc9399fb2 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -31,61 +31,71 @@ double Barrel(PHG4Reco* g4Reco, double radius) const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; //--------------------------------- - //build barrel detector + //build barrel1 detector //--------------------------------- - const int nLayer = 5; + const int nLayer1 = 3; //barrel 1 + const int nLayer2 = 2; //barrel 2 + int nLayer[2]={nLayer1,nLayer2}; + const int nSubLayer = 7; const float um = 0.0001; //convert um to cm - double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm - double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm + double r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 + {16, 22.0}}; //barrel 2 + + double halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 + {25,25}}; //barrel 2 string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", "Support1", "Support_Gap", "Support2"}; string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {285 * um, 15 * um, 20 * um, 100 * um, + double thickness[nSubLayer] = {35 * um, 15 * um, 20 * um, 100 * um, 50 * um, 1, 50 * um}; int k = 0; //layer id. Must be unique. double max_bh_radius = 0.; - PHG4CylinderSubsystem* cyl; - for (int i = 0; i < nLayer; i++) - { - //if (i>2) continue; - for (int j = 0; j < nSubLayer; j++) - { - cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); - if (j == 0) - { - cyl->set_double_param("radius", r[i]); - } - else - { - cyl->set_double_param("radius", r[i] + thickness[j - 1]); - } - cyl->set_double_param("length", 2.0 * halfLength[i]); - cyl->set_string_param("material", material[j]); - cyl->set_double_param("thickness", thickness[j]); - max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); - cyl->SuperDetector("BARREL"); - if (j == 0) - { - cyl->SetActive(); //only the Silicon Sensor is active - } - else + PHG4CylinderSubsystem* cyl[2]; + for (int n = 0; n < 2; n++) { //barrel1, barrel2 + for (int i = 0; i < nLayer[n]; i++) { - if (AbsorberActive) cyl->SetActive(); + if (n==1) thickness[0]=85*um; + + for (int j = 0; j < nSubLayer; j++) + { + //cyl[n] = new PHG4CylinderSubsystem("Barrel"+ n +"_" + + layerName[j], k); + cyl[n] = new PHG4CylinderSubsystem(Form("Barrel%d_%s",n,layerName[j].c_str()), k); + if (j == 0) + { + cyl[n]->set_double_param("radius", r[n][i]); + } + else + { + cyl[n]->set_double_param("radius", r[n][i] + thickness[j - 1]); + } + cyl[n]->set_double_param("length", 2.0 * halfLength[n][i]); + cyl[n]->set_string_param("material", material[j]); + cyl[n]->set_double_param("thickness", thickness[j]); + max_bh_radius = std::max(max_bh_radius, (r[n][i] + thickness[j - 1] + thickness[j])); + cyl[n]->SuperDetector(Form("BARREL%d",n)); + if (j == 0) + { + cyl[n]->SetActive(); //only the Silicon Sensor is active + } + else + { + if (AbsorberActive) cyl[n]->SetActive(); + } + g4Reco->registerSubsystem(cyl[n]); + k++; + } } - g4Reco->registerSubsystem(cyl); - k++; - } } // update now that we know the outer radius BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[1][0]); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[0][0]); return max_bh_radius; } //---------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C index 15e363f6d..96c4c3e15 100644 --- a/macros/g4simulations/G4_FST_EIC.C +++ b/macros/g4simulations/G4_FST_EIC.C @@ -11,7 +11,7 @@ R__LOAD_LIBRARY(libg4detectors.so) int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax); + double Rmax,double tSilicon); //-----------------------------------------------------------------------------------// namespace Enable { @@ -26,17 +26,21 @@ void FST_Init() //-----------------------------------------------------------------------------------// void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); - //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35*um); + make_LANL_FST_station("FST_2", g4Reco, 90, 5.2, 43, 35*um); + make_LANL_FST_station("FST_3", g4Reco, 115, 6, 44, 85*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 85*um); + make_LANL_FST_station("FST_5", g4Reco, 300, 15, 45, 85*um); } //-----------------------------------------------------------------------------------// int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax) + double zpos, double Rmin, double Rmax,double tSilicon) //silicon thickness { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " @@ -80,7 +84,7 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C index adebe691e..45c5829bc 100644 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ b/macros/g4simulations/G4_Tracking_EIC.C @@ -59,10 +59,11 @@ void Tracking_Reco() if (G4TRACKING::DISPLACED_VERTEX) { //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(1); - kalman->set_vertex_z_resolution(1); + kalman->set_use_vertex_in_fitting(false); + kalman->set_vertex_xy_resolution(0); + kalman->set_vertex_z_resolution(0); kalman->enable_vertexing(true); + kalman->set_vertex_min_ndf(1); } else { @@ -80,12 +81,19 @@ void Tracking_Reco() //------------------------- if (Enable::BARREL) { - kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, + kalman->add_phg4hits("G4HIT_BARREL0", // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + 20e-4/sqrt(12), // const float phires, + 20e-4/sqrt(12), // const float lonres, + 0.95, // const float eff, + 0); // const float noise + kalman->add_phg4hits("G4HIT_BARREL1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, + 5e-4, // const float radres, *ignored in cylindrical detector* + 36.4e-4/sqrt(12), // const float phires, + 36.4e-4/sqrt(12), // const float lonres, + 0.95, // const float eff, 0); // const float noise } //------------------------- @@ -148,7 +156,8 @@ void Tracking_Reco() { kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, + 100e-4, // const float radres, + //100. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -158,16 +167,20 @@ void Tracking_Reco() //------------------------- // FST //------------------------- + float pitch=20e-4; if (Enable::FST) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { + if (i>=3) pitch=36.4e-4; + else pitch=20e-4; + kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, - 1, // const float eff, + pitch/sqrt(12), // const float radres, + pitch/sqrt(12), // const float phires, + 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* + 0.95, // const float eff, 0); // const float noise } } From 8133379327981987154c6879d5694914f240a992 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 12 Nov 2020 20:59:31 -0500 Subject: [PATCH 0887/1222] base QA macro --- common/QA.C | 42 ++++++++++++++++++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 16 ++++++++++ 2 files changed, 58 insertions(+) create mode 100644 common/QA.C diff --git a/common/QA.C b/common/QA.C new file mode 100644 index 000000000..5b4a2f8d9 --- /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 = true; + 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_EndRun(const std::string& qaOutputFileName) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + QAHistManagerDef::saveQARootFile(qaOutputFileName); + return; +} + +#endif diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 190967be4..5ce0a3a38 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -300,6 +301,9 @@ int Fun4All_G4_sPHENIX( //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits //BlackHoleGeometry::visible = true; + // disable QA which otherwise run by default + //Enable::QA = false; + // run user provided code (from local G4_User.C) //Enable::USER = true; @@ -456,6 +460,12 @@ int Fun4All_G4_sPHENIX( if (Enable::USER) UserAnalysisInit(); + //---------------------- + // Standard QAs + //---------------------- + + if (Enable::TRACKING_TRACK and Enable::QA) QA_G4CaloTracking(); + //-------------- // Set up Input Managers //-------------- @@ -509,6 +519,12 @@ int Fun4All_G4_sPHENIX( se->skip(skip); se->run(nEvents); + //----- + // QA output + //----- + + if (Enable::QA) QA_EndRun(outputroot + "_qa.root"); + //----- // Exit //----- From 161a76f843b4a2ed6b1ed7fce9c3a629cac29a8d Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 12 Nov 2020 21:11:11 -0500 Subject: [PATCH 0888/1222] calorimeter QAs --- common/G4_CEmc_Spacal.C | 17 +++++++++++++++++ common/G4_HcalIn_ref.C | 17 +++++++++++++++++ common/G4_HcalOut_ref.C | 17 +++++++++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 12 +++++++++++- 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 6b8b2c071..6c3248455 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -2,6 +2,7 @@ #define MACRO_G4CEMCSPACAL_C #include +#include #include #include @@ -21,6 +22,7 @@ #include #include #include +#include #include @@ -34,6 +36,7 @@ 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 { @@ -44,6 +47,7 @@ namespace Enable bool CEMC_TOWER = false; bool CEMC_CLUSTER = false; bool CEMC_EVAL = false; + bool CEMC_QA = false; int CEMC_VERBOSITY = 0; } // namespace Enable @@ -471,4 +475,17 @@ void CEMC_Eval(const std::string &outputfile) 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_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 1c42d01da..547b074c0 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -3,6 +3,7 @@ #define MACRO_G4HCALINREF_C #include +#include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include @@ -25,6 +27,7 @@ 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); @@ -37,6 +40,7 @@ namespace Enable bool HCALIN_TOWER = false; bool HCALIN_CLUSTER = false; bool HCALIN_EVAL = false; + bool HCALIN_QA = false; int HCALIN_VERBOSITY = 0; } // namespace Enable @@ -298,4 +302,17 @@ void HCALInner_Eval(const std::string &outputfile) 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 index a69196a2f..d5254f226 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -2,6 +2,7 @@ #define MACRO_G4HCALOUTREF_C #include +#include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include @@ -23,6 +25,7 @@ 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 { @@ -33,6 +36,7 @@ namespace Enable bool HCALOUT_TOWER = false; bool HCALOUT_CLUSTER = false; bool HCALOUT_EVAL = false; + bool HCALOUT_QA = false; int HCALOUT_VERBOSITY = 0; } // namespace Enable @@ -224,4 +228,17 @@ void HCALOuter_Eval(const std::string &outputfile) 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/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 5ce0a3a38..80dbd9253 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -246,6 +246,7 @@ int Fun4All_G4_sPHENIX( 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 && true; Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; @@ -253,6 +254,7 @@ int Fun4All_G4_sPHENIX( 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 && true; Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; @@ -263,6 +265,7 @@ int Fun4All_G4_sPHENIX( 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 && true; // forward EMC //Enable::FEMC = true; @@ -464,7 +467,14 @@ int Fun4All_G4_sPHENIX( // Standard QAs //---------------------- - if (Enable::TRACKING_TRACK and Enable::QA) QA_G4CaloTracking(); + + if (Enable::CEMC_QA and Enable::QA) CEMC_Eval(outputroot + "_g4cemc_eval.root"); + + if (Enable::HCALIN_QA and Enable::QA) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); + + if (Enable::HCALOUT_QA and Enable::QA) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); + + if (Enable::TRACKING_TRACK and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA and Enable::QA) QA_G4CaloTracking(); //-------------- // Set up Input Managers From ba46ec58d14f7b1b48098fccbd6f35dbbb9830b0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 13 Nov 2020 11:14:59 -0500 Subject: [PATCH 0889/1222] replace G4double by double --- common/G4_Pipe.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 4de9f4eec..75e7f8b00 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -129,8 +129,8 @@ double Pipe(PHG4Reco* g4Reco, double radius) PHG4ConeSubsystem* cone = nullptr; - G4double cone_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + 0.5 * G4PIPE::al_pipe_cone_length; - G4double ext_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + 0.5 * G4PIPE::al_pipe_ext_length + no_overlapp; + double cone_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + 0.5 * G4PIPE::al_pipe_cone_length; + double ext_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + 0.5 * G4PIPE::al_pipe_ext_length + no_overlapp; /* north aluminum pipe (conical part) */ cone = new PHG4ConeSubsystem("N_AL_PIPE_CONE", 6); From ed0cce33261efa43b3930eb2ecb166948d4e2354 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 13 Nov 2020 11:19:58 -0500 Subject: [PATCH 0890/1222] Jet QA --- common/G4_Jets.C | 40 ++++++++++++++++++++++++++++++++++++++++ common/QA.C | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/common/G4_Jets.C b/common/G4_Jets.C index 5fea1f720..f4640f615 100644 --- a/common/G4_Jets.C +++ b/common/G4_Jets.C @@ -2,6 +2,7 @@ #define MACRO_G4JETS_C #include +#include #include #include @@ -11,16 +12,19 @@ #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 @@ -114,4 +118,40 @@ void Jet_Eval(const std::string &outfilename = "g4jets_eval.root") 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/QA.C b/common/QA.C index 5b4a2f8d9..cadb321c5 100644 --- a/common/QA.C +++ b/common/QA.C @@ -12,7 +12,7 @@ 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 = true; + bool QA = false; int QA_VERBOSITY = 0; } // namespace Enable From a44433a3cc6b55430046c06153a543c7ad9d1a1c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 14 Nov 2020 22:15:16 -0500 Subject: [PATCH 0891/1222] Add tracker QA --- common/G4_Intt.C | 16 ++ common/G4_Mvtx.C | 14 ++ common/G4_TPC.C | 17 +++ common/G4_Tracking.C | 339 ++++++++++++++++++++++++------------------- 4 files changed, 235 insertions(+), 151 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 287b153c6..c96b87a92 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -2,6 +2,7 @@ #define MACRO_G4INTT_C #include +#include #include @@ -13,6 +14,7 @@ #include #include +#include #include @@ -21,6 +23,7 @@ R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libqa_modules.so) namespace Enable { @@ -28,6 +31,7 @@ namespace Enable bool INTT_OVERLAPCHECK = false; bool INTT_CELL = false; bool INTT_CLUSTER = false; + bool INTT_QA = false; int INTT_VERBOSITY = 0; } // namespace Enable @@ -186,4 +190,16 @@ void Intt_Clustering() } 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_Mvtx.C b/common/G4_Mvtx.C index 3faae5343..37ac24b69 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -2,6 +2,7 @@ #define MACRO_G4MVTX_C #include +#include #include #include @@ -12,6 +13,7 @@ #include #include +#include #include @@ -20,6 +22,7 @@ R__LOAD_LIBRARY(libg4mvtx.so) R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libqa_modules.so) namespace Enable { @@ -27,6 +30,7 @@ namespace Enable bool MVTX_OVERLAPCHECK = false; bool MVTX_CELL = false; bool MVTX_CLUSTER = false; + bool MVTX_QA = false; bool MVTX_ABSORBER = false; bool MVTX_SERVICE = true; int MVTX_VERBOSITY = 0; @@ -238,4 +242,14 @@ void Mvtx_Clustering() 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_TPC.C b/common/G4_TPC.C index 859bb8b83..7f8adbbaa 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -2,6 +2,7 @@ #define MACRO_G4TPC_C #include +#include #include #include @@ -17,11 +18,13 @@ #include #include +#include #include R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libqa_modules.so) namespace Enable { @@ -30,6 +33,7 @@ namespace Enable bool TPC_OVERLAPCHECK = false; bool TPC_CELL = false; bool TPC_CLUSTER = false; + bool TPC_QA = false; bool TPC_ENDCAP = true; @@ -218,4 +222,17 @@ void TPC_Clustering() } } + + +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_Tracking.C b/common/G4_Tracking.C index 2259afcd8..2f73fd90d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -2,6 +2,7 @@ #define MACRO_G4TRACKING_C #include +#include #include #include @@ -42,23 +43,29 @@ #include +#include +#include +#include + R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libtrack_reco.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() + 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 - + // Tracking reconstruction setup parameters and flags //===================================== @@ -132,11 +139,11 @@ void TrackingInit() G4TRACKING::SC_CALIBMODE = G4TPC::ENABLE_DISTORTIONS && G4TRACKING::SC_CALIBMODE; // Genfit does final vertexing, Acts does not - if(G4TRACKING::use_Genfit) - G4TRACKING::g4eval_use_initial_vertex = false; + if (G4TRACKING::use_Genfit) + G4TRACKING::g4eval_use_initial_vertex = false; // For now the TpcSpaceChargeCorrection module only works with the GenFit tracking chain - if(G4TPC::ENABLE_CORRECTIONS && !G4TRACKING::use_Genfit) + 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; @@ -268,139 +275,136 @@ void Tracking_Reco() kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); - } - + // Acts tracking chain (starts from TPC track seeds) //=================================== if (!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) + { + std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + + // 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(0); + 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 + + // use truth information to assemble silicon clusters into track stubs for now + PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); + silicon_match->Verbosity(0); + if (!G4TRACKING::use_PHTpcTracker_seeding) + silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding + 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.02); + silicon_match->set_eta_search_window(0.004); + } + 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 normal Acts matching chain for silicon and MM's " << std::endl; - - // 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(0); - se->registerSubsystem(silicon_assoc); - } + 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(0); + 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 - { - 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 - - // use truth information to assemble silicon clusters into track stubs for now - PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); - - // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding - PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); - silicon_match ->Verbosity(0); - if(!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding - 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.02); - silicon_match->set_eta_search_window(0.004); - } - 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(0); - 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); - } + { + // 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 //================================= - if(!G4TRACKING::use_Genfit) - { - std::cout << " Using Acts track fitting " << std::endl; - + if (!G4TRACKING::use_Genfit) + { + std::cout << " Using Acts track fitting " << std::endl; + #if __cplusplus >= 201703L - /// Geometry must be built before any Acts modules - MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(0); - geom->setMagField(G4MAGNET::magfield); - geom->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(geom); - - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(0); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - - PHActsTracks* actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - PHActsTrkFitter* actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - 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 - PHTpcResiduals *residuals = new PHTpcResiduals(); - residuals->Verbosity(0); - se->registerSubsystem(residuals); - - } -#endif + /// Geometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->Verbosity(0); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(geom); + + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(0); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); + + PHActsTracks* actsTracks = new PHActsTracks(); + actsTracks->Verbosity(0); + se->registerSubsystem(actsTracks); + + PHActsTrkFitter* actsFit = new PHActsTrkFitter(); + actsFit->Verbosity(0); + 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 + PHTpcResiduals* residuals = new PHTpcResiduals(); + residuals->Verbosity(0); + se->registerSubsystem(residuals); } +#endif + } //------------------ // Track Projections @@ -408,7 +412,7 @@ void Tracking_Reco() PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); - + return; } @@ -441,34 +445,67 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if(!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) + if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) { #if __cplusplus >= 201703L - if(G4TRACKING::use_acts_evaluator) - { - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); - } + if (G4TRACKING::use_acts_evaluator) + { + ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); + actsEval->Verbosity(0); + actsEval->setEvalCKF(false); + se->registerSubsystem(actsEval); + } #endif } - if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - 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(verbosity); - se->registerSubsystem(evalp); - } - + if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); + 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(verbosity); + se->registerSubsystem(evalp); + } + 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 (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int i = 0; i < Input::UPSILON_NUMBER; ++i) + { + qa->addEmbeddingID(Input::UPSILON_FirstEmbedId + i); + } + se->registerSubsystem(qa); + } +} + #endif From 71f753000e58c610ab8c24ead24b87fe0b886761 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 14 Nov 2020 22:15:44 -0500 Subject: [PATCH 0892/1222] drive QA --- common/G4_Input.C | 49 ++++++++++++++++++++------ common/QA.C | 2 +- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 44 ++++++++++++++--------- 3 files changed, 66 insertions(+), 29 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 39d59436d..9eeaa751e 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -9,9 +9,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -36,27 +36,36 @@ R__LOAD_LIBRARY(libPHSartre.so) namespace Input { -// Real Event generators + // 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 + // Single/multiple particle generators bool DZERO = false; int DZERO_NUMBER = 1; int DZERO_VERBOSITY = 0; + int DZERO_FirstEmbedId = 0; bool GUN = false; int GUN_NUMBER = 1; int GUN_VERBOSITY = 0; + int GUN_FirstEmbedId = 0; bool IONGUN = false; int IONGUN_NUMBER = 1; int IONGUN_VERBOSITY = 0; + int IONGUN_FirstEmbedId = 0; bool PGEN = false; int PGEN_NUMBER = 1; int PGEN_VERBOSITY = 0; + int PGEN_FirstEmbedId = 0; bool SIMPLE = false; int SIMPLE_NUMBER = 1; @@ -65,6 +74,7 @@ namespace Input bool UPSILON = false; int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; + int UPSILON_FirstEmbedId = 0; double PILEUPRATE = 0.; bool READHITS = false; @@ -156,19 +166,27 @@ void InputInit() gSystem->Exit(1); } -// done with consistency checks, create generators in no specific order + // 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) { @@ -180,8 +198,12 @@ void InputInit() //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 + // single particle generators if (Input::DZERO) { for (int i = 0; i < Input::DZERO_NUMBER; ++i) @@ -189,6 +211,7 @@ void InputInit() std::string name = "DZERO_" + std::to_string(i); PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); dzero->Embed(Input::EmbedId); + if (i == 0) Input::DZERO_FirstEmbedId = Input::EmbedId; Input::EmbedId++; INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } @@ -200,6 +223,7 @@ void InputInit() std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); gun->Embed(Input::EmbedId); + if (i == 0) Input::GUN_FirstEmbedId = Input::EmbedId; Input::EmbedId++; INPUTGENERATOR::Gun.push_back(gun); } @@ -211,6 +235,7 @@ void InputInit() std::string name = "IONGUN_" + std::to_string(i); PHG4IonGun *iongun = new PHG4IonGun(name); iongun->Embed(Input::EmbedId); + if (i == 0) Input::IONGUN_FirstEmbedId = Input::EmbedId; Input::EmbedId++; INPUTGENERATOR::IonGun.push_back(iongun); } @@ -233,6 +258,7 @@ void InputInit() std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); simple->Embed(Input::EmbedId); + if (i == 0) Input::PGEN_FirstEmbedId = Input::EmbedId; Input::EmbedId++; INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } @@ -244,6 +270,7 @@ void InputInit() std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); upsilon->Embed(Input::EmbedId); + if (i == 0) Input::UPSILON_FirstEmbedId = Input::EmbedId; Input::EmbedId++; INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } @@ -278,7 +305,7 @@ void InputRegister() } if (Input::DZERO) { - int verbosity = max(Input::DZERO_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::DZERO_VERBOSITY, Input::VERBOSITY); for (size_t icnt = 0; icnt < INPUTGENERATOR::DZeroMesonGenerator.size(); ++icnt) { INPUTGENERATOR::DZeroMesonGenerator[icnt]->Verbosity(verbosity); @@ -287,7 +314,7 @@ void InputRegister() } if (Input::GUN) { - int verbosity = max(Input::GUN_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::GUN_VERBOSITY, Input::VERBOSITY); for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt) { INPUTGENERATOR::Gun[icnt]->Verbosity(verbosity); @@ -296,7 +323,7 @@ void InputRegister() } if (Input::IONGUN) { - int verbosity = max(Input::IONGUN_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::IONGUN_VERBOSITY, Input::VERBOSITY); for (size_t icnt = 0; icnt < INPUTGENERATOR::IonGun.size(); ++icnt) { INPUTGENERATOR::IonGun[icnt]->Verbosity(verbosity); @@ -305,7 +332,7 @@ void InputRegister() } if (Input::PGEN) { - int verbosity = max(Input::PGEN_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::PGEN_VERBOSITY, Input::VERBOSITY); for (size_t icnt = 0; icnt < INPUTGENERATOR::ParticleGenerator.size(); ++icnt) { INPUTGENERATOR::ParticleGenerator[icnt]->Verbosity(verbosity); @@ -314,7 +341,7 @@ void InputRegister() } if (Input::SIMPLE) { - int verbosity = max(Input::SIMPLE_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::SIMPLE_VERBOSITY, Input::VERBOSITY); for (size_t icnt = 0; icnt < INPUTGENERATOR::SimpleEventGenerator.size(); ++icnt) { INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(verbosity); @@ -325,7 +352,7 @@ void InputRegister() { for (size_t icnt = 0; icnt < INPUTGENERATOR::VectorMesonGenerator.size(); ++icnt) { - int verbosity = max(Input::UPSILON_VERBOSITY,Input::VERBOSITY); + int verbosity = max(Input::UPSILON_VERBOSITY, Input::VERBOSITY); if (Input::HEPMC || Input::SIMPLE) { INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true); diff --git a/common/QA.C b/common/QA.C index cadb321c5..594a4ca5f 100644 --- a/common/QA.C +++ b/common/QA.C @@ -32,7 +32,7 @@ void QA_G4CaloTracking() } // run this after se->run() to output QA histogram file for all QA modules -void QA_EndRun(const std::string& qaOutputFileName) +void QA_Output(const std::string& qaOutputFileName) { Fun4AllServer* se = Fun4AllServer::instance(); QAHistManagerDef::saveQARootFile(qaOutputFileName); diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 80dbd9253..e850179cc 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include #include @@ -40,10 +40,10 @@ int Fun4All_G4_sPHENIX( const string &outdir = ".") { Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); + se->Verbosity(1); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. - PHRandomSeed::Verbosity(1); + PHRandomSeed::Verbosity(0); // just if we set some flags somewhere in this macro recoConsts *rc = recoConsts::instance(); @@ -204,13 +204,17 @@ int Fun4All_G4_sPHENIX( //====================== // 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::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation + Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation Enable::PIPE = true; Enable::PIPE_ABSORBER = true; @@ -219,15 +223,18 @@ int Fun4All_G4_sPHENIX( Enable::MVTX = true; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; + Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + Enable::INTT_QA = Enable::INTT_CLUSTER and 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 and Enable::QA && true; //Enable::MICROMEGAS = true; Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; @@ -235,6 +242,7 @@ int Fun4All_G4_sPHENIX( Enable::TRACKING_TRACK = true; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; + Enable::TRACKING_QA = Enable::TRACKING_TRACK and Enable::QA && true; // cemc electronics + thin layer of W-epoxy to get albedo from cemc // into the tracking, cannot run together with CEMC @@ -246,7 +254,7 @@ int Fun4All_G4_sPHENIX( 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 && true; + Enable::CEMC_QA = Enable::CEMC_CLUSTER and Enable::QA && true; Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; @@ -254,7 +262,7 @@ int Fun4All_G4_sPHENIX( 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 && true; + Enable::HCALIN_QA = Enable::HCALIN_CLUSTER and Enable::QA && true; Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; @@ -265,7 +273,7 @@ int Fun4All_G4_sPHENIX( 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 && true; + Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER and Enable::QA && true; // forward EMC //Enable::FEMC = true; @@ -273,7 +281,7 @@ int Fun4All_G4_sPHENIX( Enable::FEMC_CELL = Enable::FEMC && true; Enable::FEMC_TOWER = Enable::FEMC_CELL && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; + Enable::FEMC_EVAL = Enable::FEMC_CLUSTER and Enable::QA && true; Enable::EPD = false; @@ -288,6 +296,7 @@ int Fun4All_G4_sPHENIX( Enable::JETS = true; Enable::JETS_EVAL = Enable::JETS && true; + Enable::JETS_QA = Enable::JETS and 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 @@ -304,9 +313,6 @@ int Fun4All_G4_sPHENIX( //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits //BlackHoleGeometry::visible = true; - // disable QA which otherwise run by default - //Enable::QA = false; - // run user provided code (from local G4_User.C) //Enable::USER = true; @@ -467,14 +473,18 @@ int Fun4All_G4_sPHENIX( // Standard QAs //---------------------- + if (Enable::CEMC_QA) CEMC_QA(); + if (Enable::HCALIN_QA) HCALInner_QA(); + if (Enable::HCALOUT_QA) HCALOuter_QA(); - if (Enable::CEMC_QA and Enable::QA) CEMC_Eval(outputroot + "_g4cemc_eval.root"); - - if (Enable::HCALIN_QA and Enable::QA) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); + if (Enable::JETS_QA) Jet_QA(); - if (Enable::HCALOUT_QA and Enable::QA) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); + if (Enable::MVTX_QA) Mvtx_QA(); + if (Enable::INTT_QA) Intt_QA(); + if (Enable::TPC_QA) TPC_QA(); + if (Enable::TRACKING_QA) Tracking_QA(); - if (Enable::TRACKING_TRACK and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA and Enable::QA) QA_G4CaloTracking(); + if (Enable::TRACKING_QA and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA) QA_G4CaloTracking(); //-------------- // Set up Input Managers @@ -533,7 +543,7 @@ int Fun4All_G4_sPHENIX( // QA output //----- - if (Enable::QA) QA_EndRun(outputroot + "_qa.root"); + if (Enable::QA) QA_Output(outputroot + "_qa.root"); //----- // Exit From 3eabbda0570f1549f25325021e08a9a4029fc5c3 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 17 Nov 2020 16:27:20 -0500 Subject: [PATCH 0893/1222] add acts vertex finder --- common/G4_Tracking.C | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2259afcd8..df189fe12 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -81,6 +81,7 @@ namespace G4TRACKING bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples + bool use_acts_vertexing = true; // Turn to true for acts final vertexing tool bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events //default seed is PHTpcTracker @@ -399,6 +400,15 @@ void Tracking_Reco() se->registerSubsystem(residuals); } + + if(G4TRACKING::use_acts_vertexing) + { + PHActsVertexFinder *vtxer = new PHActsVertexFinder(); + vtxer->Verbosity(0); + se->registerSubsystem(vtxer); + } + + #endif } From 2c7c2781e0c2989ffbca1f18f4aedaf9e1fc375b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 17 Nov 2020 21:57:59 -0500 Subject: [PATCH 0894/1222] add vertex refit --- common/G4_Tracking.C | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2f73fd90d..9530db47f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -87,6 +87,7 @@ namespace G4TRACKING bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing + bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events @@ -406,6 +407,18 @@ void Tracking_Reco() #endif } + // 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(0); + se->registerSubsystem(rave); + } + //------------------ // Track Projections //------------------ @@ -496,6 +509,18 @@ void Tracking_QA() 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); + + } + if (Input::UPSILON) { QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); From eb333f7d0deaafdf6e88cca9060f3303a5460cdc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 17 Nov 2020 22:16:38 -0500 Subject: [PATCH 0895/1222] Add flow, fermi and listfile for hepmc input mgr --- common/G4_Input.C | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 39d59436d..2ca80d6a7 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -16,6 +16,10 @@ #include #include +#include + +#include +#include #include #include @@ -75,6 +79,11 @@ namespace Input namespace INPUTHEPMC { string filename; + string listfile; + bool FLOW = false; + int FLOW_VERBOSITY = 0; + bool FERMIMOTION = false; + } namespace INPUTREADEIC @@ -172,6 +181,7 @@ void InputInit() } 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 @@ -347,6 +357,20 @@ void InputRegister() // read-in HepMC events to Geant4 if there is any HepMCNodeReader *hr = new HepMCNodeReader(); se->registerSubsystem(hr); + if (Input::HEPMC) + { + 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); + } + } } } @@ -377,7 +401,19 @@ void InputManagers() { INPUTMANAGER::HepMCInputManager->Verbosity(Input::VERBOSITY); se->registerInputManager(INPUTMANAGER::HepMCInputManager); - se->fileopen(INPUTMANAGER::HepMCInputManager->Name(), INPUTHEPMC::filename); + 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) { From 5dd540aa056b24bee0de9ebe9cb60f9b4f929ae4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 17 Nov 2020 22:21:26 -0500 Subject: [PATCH 0896/1222] prevent flow afterburner and pileup to run simultaneously --- common/G4_Input.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 2ca80d6a7..37d2dae64 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -164,7 +164,11 @@ void InputInit() 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(); From 4d9e9315d85c8f72185bdfed95972783bdd58f40 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 18 Nov 2020 11:27:19 -0500 Subject: [PATCH 0897/1222] change acts modules to verbosity --- common/G4_Tracking.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index df189fe12..e0384cf67 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -368,24 +368,24 @@ void Tracking_Reco() #if __cplusplus >= 201703L /// Geometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(0); + geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(geom); /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(0); + sl->Verbosity(verbosity); sl->setMagField(G4MAGNET::magfield); sl->setMagFieldRescale(G4MAGNET::magfield_rescale); se->registerSubsystem(sl); PHActsTracks* actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); + actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); PHActsTrkFitter* actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); + actsFit->Verbosity(verbosity); actsFit->doTimeAnalysis(false); /// If running with distortions, fit only the silicon+MMs first actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); @@ -396,7 +396,7 @@ void Tracking_Reco() { /// run tpc residual determination with silicon+MM track fit PHTpcResiduals *residuals = new PHTpcResiduals(); - residuals->Verbosity(0); + residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } @@ -404,7 +404,7 @@ void Tracking_Reco() if(G4TRACKING::use_acts_vertexing) { PHActsVertexFinder *vtxer = new PHActsVertexFinder(); - vtxer->Verbosity(0); + vtxer->Verbosity(verbosity); se->registerSubsystem(vtxer); } From 02973713de14c458fbf594bf5f3d510c8b74ba90 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 18 Nov 2020 11:32:10 -0500 Subject: [PATCH 0898/1222] remove flag --- common/G4_Tracking.C | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e0384cf67..39498c5ad 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -81,7 +81,6 @@ namespace G4TRACKING bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples - bool use_acts_vertexing = true; // Turn to true for acts final vertexing tool bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events //default seed is PHTpcTracker @@ -398,15 +397,12 @@ void Tracking_Reco() PHTpcResiduals *residuals = new PHTpcResiduals(); residuals->Verbosity(verbosity); se->registerSubsystem(residuals); - - } - - if(G4TRACKING::use_acts_vertexing) - { - PHActsVertexFinder *vtxer = new PHActsVertexFinder(); - vtxer->Verbosity(verbosity); - se->registerSubsystem(vtxer); } + + PHActsVertexFinder *vtxer = new PHActsVertexFinder(); + vtxer->Verbosity(verbosity); + se->registerSubsystem(vtxer); + #endif From 3fadd4d62b2032bf7a485353987cb2090e661a58 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 18 Nov 2020 15:24:40 -0500 Subject: [PATCH 0899/1222] add missing header --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9530db47f..8b6b64c9a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include From 6ec03aa4755b7717415426ca6522b447cdbf6032 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 18 Nov 2020 20:03:13 -0500 Subject: [PATCH 0900/1222] fix verbosity --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index e850179cc..57bb79b13 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -40,10 +40,10 @@ int Fun4All_G4_sPHENIX( const string &outdir = ".") { Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(1); + se->Verbosity(0); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. - PHRandomSeed::Verbosity(0); + PHRandomSeed::Verbosity(1); // just if we set some flags somewhere in this macro recoConsts *rc = recoConsts::instance(); From c194a61d1540405fd40e2e8630ec9c27e3b1c7f6 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 18 Nov 2020 20:28:47 -0500 Subject: [PATCH 0901/1222] use explicit collection of embedding IDs per Chris' suggestion --- common/G4_Input.C | 23 +++++++++++++---------- common/G4_Tracking.C | 13 +++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 9eeaa751e..8c035bfe9 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -28,6 +28,8 @@ #include #include +#include + R__LOAD_LIBRARY(libfun4all.so) R__LOAD_LIBRARY(libg4testbench.so) R__LOAD_LIBRARY(libPHPythia6.so) @@ -50,22 +52,22 @@ namespace Input bool DZERO = false; int DZERO_NUMBER = 1; int DZERO_VERBOSITY = 0; - int DZERO_FirstEmbedId = 0; + std::set DZERO_EmbedIds; bool GUN = false; int GUN_NUMBER = 1; int GUN_VERBOSITY = 0; - int GUN_FirstEmbedId = 0; + std::set GUN_EmbedIds = 0; bool IONGUN = false; int IONGUN_NUMBER = 1; int IONGUN_VERBOSITY = 0; - int IONGUN_FirstEmbedId = 0; + std::set IONGUN_EmbedIds = 0; bool PGEN = false; int PGEN_NUMBER = 1; int PGEN_VERBOSITY = 0; - int PGEN_FirstEmbedId = 0; + std::set PGEN_EmbedIds = 0; bool SIMPLE = false; int SIMPLE_NUMBER = 1; @@ -74,7 +76,7 @@ namespace Input bool UPSILON = false; int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; - int UPSILON_FirstEmbedId = 0; + std::set UPSILON_EmbedIds = 0; double PILEUPRATE = 0.; bool READHITS = false; @@ -211,7 +213,7 @@ void InputInit() std::string name = "DZERO_" + std::to_string(i); PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); dzero->Embed(Input::EmbedId); - if (i == 0) Input::DZERO_FirstEmbedId = Input::EmbedId; + Input::DZERO_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } @@ -223,7 +225,7 @@ void InputInit() std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); gun->Embed(Input::EmbedId); - if (i == 0) Input::GUN_FirstEmbedId = Input::EmbedId; + Input::GUN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; INPUTGENERATOR::Gun.push_back(gun); } @@ -235,7 +237,7 @@ void InputInit() std::string name = "IONGUN_" + std::to_string(i); PHG4IonGun *iongun = new PHG4IonGun(name); iongun->Embed(Input::EmbedId); - if (i == 0) Input::IONGUN_FirstEmbedId = Input::EmbedId; + Input::IONGUN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; INPUTGENERATOR::IonGun.push_back(iongun); } @@ -247,6 +249,7 @@ void InputInit() 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); } @@ -258,7 +261,7 @@ void InputInit() std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); simple->Embed(Input::EmbedId); - if (i == 0) Input::PGEN_FirstEmbedId = Input::EmbedId; + Input::PGEN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } @@ -270,7 +273,7 @@ void InputInit() std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); upsilon->Embed(Input::EmbedId); - if (i == 0) Input::UPSILON_FirstEmbedId = Input::EmbedId; + Input::UPSILON_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 8b6b64c9a..1443e77c7 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -17,10 +17,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -413,10 +413,10 @@ void Tracking_Reco() if (G4TRACKING::use_rave_vertexing) { PHRaveVertexing* rave = new PHRaveVertexing(); -// rave->set_vertexing_method("kalman-smoothing:1"); + // rave->set_vertexing_method("kalman-smoothing:1"); rave->set_over_write_svtxvertexmap(false); rave->set_svtxvertexmaprefit_node_name("SvtxVertexMapRave"); -// rave->Verbosity(0); + // rave->Verbosity(0); se->registerSubsystem(rave); } @@ -510,25 +510,22 @@ void Tracking_QA() 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); - } if (Input::UPSILON) { QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); - for (int i = 0; i < Input::UPSILON_NUMBER; ++i) + for (int id : Input::UPSILON_EmbedIds) { - qa->addEmbeddingID(Input::UPSILON_FirstEmbedId + i); + qa->addEmbeddingID(id); } se->registerSubsystem(qa); } From 94c99f94f677373a192795e8a32eae0460041f70 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 18 Nov 2020 20:50:10 -0500 Subject: [PATCH 0902/1222] fix typo --- common/G4_Input.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 8c035bfe9..3e358362f 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -57,17 +57,17 @@ namespace Input bool GUN = false; int GUN_NUMBER = 1; int GUN_VERBOSITY = 0; - std::set GUN_EmbedIds = 0; + std::set GUN_EmbedIds; bool IONGUN = false; int IONGUN_NUMBER = 1; int IONGUN_VERBOSITY = 0; - std::set IONGUN_EmbedIds = 0; + std::set IONGUN_EmbedIds; bool PGEN = false; int PGEN_NUMBER = 1; int PGEN_VERBOSITY = 0; - std::set PGEN_EmbedIds = 0; + std::set PGEN_EmbedIds; bool SIMPLE = false; int SIMPLE_NUMBER = 1; @@ -76,7 +76,7 @@ namespace Input bool UPSILON = false; int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; - std::set UPSILON_EmbedIds = 0; + std::set UPSILON_EmbedIds; double PILEUPRATE = 0.; bool READHITS = false; From 6aaa15775b9e3d4d858179aca9ba47b793df0cdb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 19 Nov 2020 16:39:03 -0500 Subject: [PATCH 0903/1222] flow and fermi afterburner need to run before HepMCNodeReader --- common/G4_Input.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 30a71272c..ce920630a 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -388,11 +388,10 @@ void InputRegister() // put them onto the G4 particle stack if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::READEIC) { - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); 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(); @@ -405,6 +404,9 @@ void InputRegister() se->registerSubsystem(fermi); } } + // copy HepMC records into G4 + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); } } From 9a048d841354665297388ee88131fb1c1d6e387e Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 19 Nov 2020 20:25:22 -0500 Subject: [PATCH 0904/1222] fix fsPHENIX loading order of G4_Tracking --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 1 + detectors/fsPHENIX/G4Setup_fsPHENIX.C | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index cba9b166f..5e5c661fa 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C index 99e8fc298..79c32f6a7 100644 --- a/detectors/fsPHENIX/G4Setup_fsPHENIX.C +++ b/detectors/fsPHENIX/G4Setup_fsPHENIX.C @@ -17,7 +17,6 @@ #include #include #include -#include #include #include From 4274c32df5b0c91953d94c1bd4d31c6ae510ab7b Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 19 Nov 2020 20:42:16 -0500 Subject: [PATCH 0905/1222] As Chris suggested, moving Upsilon to GlobalVariables.C and resolving potential future dependency problems with these two variables --- common/G4_Input.C | 4 ++-- common/GlobalVariables.C | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 30a71272c..4744824d6 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -76,10 +76,10 @@ namespace Input int SIMPLE_NUMBER = 1; int SIMPLE_VERBOSITY = 0; - bool UPSILON = false; +// bool UPSILON = false; // moved to GlobalVariables.C, as used in downstream vairables int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; - std::set UPSILON_EmbedIds; +// std::set UPSILON_EmbedIds; // moved to GlobalVariables.C, as used in downstream vairables double PILEUPRATE = 0.; bool READHITS = false; diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 7f8584375..0a5b1efff 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -2,6 +2,7 @@ #define MACRO_GLOBALVARIABLES_C #include +#include double no_overlapp = 0.0001; @@ -12,6 +13,9 @@ namespace Input bool HEPMC = false; bool EMBED = false; bool READEIC = false; + + bool UPSILON = false; + std::set UPSILON_EmbedIds; } // namespace Input namespace DstOut From 4ab26373495e1e3000a6bb71922a7dd54dd2490d Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 25 Nov 2020 12:07:35 -0500 Subject: [PATCH 0906/1222] updated flags to handle new distortions from Henry --- common/G4_TPC.C | 37 ++++++++++++++++++++++++------------- common/G4_Tracking.C | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 7f8adbbaa..120bea780 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -50,12 +51,16 @@ namespace G4TPC double tpc_outer_radius = 77. + 2.; // distortions - bool ENABLE_DISTORTIONS = false; - auto distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; - unsigned int distortion_coordinates = - PHG4TpcElectronDrift::COORD_PHI| - PHG4TpcElectronDrift::COORD_R| - PHG4TpcElectronDrift::COORD_Z; + bool ENABLE_STATIC_DISTORTIONS = false; + auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + + bool ENABLE_TIME_ORDERED_DISTORTIONS = false; + std::string time_ordered_distortion_filename = "/gpfs/mnt/gpfs02/sphenix/user/klest/TimeOrderedDistortions.root"; + +// unsigned int distortion_coordinates = +// PHG4TpcElectronDrift::COORD_PHI| +// PHG4TpcElectronDrift::COORD_R| +// PHG4TpcElectronDrift::COORD_Z; // distortion corrections bool ENABLE_CORRECTIONS = false; @@ -162,13 +167,19 @@ void TPC_Cells() PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); edrift->Detector("TPC"); edrift->Verbosity(verbosity); - edrift->set_enable_distortions( G4TPC::ENABLE_DISTORTIONS); - if( G4TPC::ENABLE_DISTORTIONS ) - { - edrift->set_distortion_filename( G4TPC::distortion_filename ); - edrift->set_coordinates( G4TPC::distortion_coordinates ); - } - + 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 ); + } + // 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 diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 619dea55e..7771aefe1 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -138,7 +138,7 @@ void TrackingInit() } // SC_CALIBMODE makes no sense if distortions are not present - G4TRACKING::SC_CALIBMODE = G4TPC::ENABLE_DISTORTIONS && G4TRACKING::SC_CALIBMODE; + G4TRACKING::SC_CALIBMODE = (G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) && G4TRACKING::SC_CALIBMODE; // Genfit does final vertexing, Acts does not if (G4TRACKING::use_Genfit) From 0ada46a39d8274a1af09ac3c763f82b7517b6d92 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 25 Nov 2020 17:42:59 -0500 Subject: [PATCH 0907/1222] enable forward black holes separately --- common/G4_BlackHole.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/G4_BlackHole.C b/common/G4_BlackHole.C index c03bb0140..12bc26c2f 100644 --- a/common/G4_BlackHole.C +++ b/common/G4_BlackHole.C @@ -12,6 +12,7 @@ namespace Enable { bool BLACKHOLE = false; bool BLACKHOLE_SAVEHITS = true; + bool BLACKHOLE_FORWARD_SAVEHITS = true; } // namespace Enable void BlackHoleInit() {} @@ -65,7 +66,7 @@ void BlackHole(PHG4Reco *g4Reco, double radius) blackhole->set_color(1, 0, 0, 0.7); } blackhole->BlackHole(); - if (Enable::BLACKHOLE_SAVEHITS) + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) { blackhole->SetActive(); // see what leaks out } @@ -86,7 +87,7 @@ void BlackHole(PHG4Reco *g4Reco, double radius) blackhole->set_color(1, 0, 0, 0.7); } blackhole->BlackHole(); - if (Enable::BLACKHOLE_SAVEHITS) + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) { blackhole->SetActive(); // always see what leaks out } From c06a8fe7c7a6dae1e530402c1f26e33e1fe5561f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 27 Nov 2020 00:46:28 -0500 Subject: [PATCH 0908/1222] load libFermimotionAfterburner.so in G4_Input.C --- common/G4_Input.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Input.C b/common/G4_Input.C index 28e124620..de9ad24ce 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -38,6 +38,7 @@ 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 { From df95465e26016802e10900446f91a7cb88119ae5 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 2 Dec 2020 10:32:26 -0500 Subject: [PATCH 0909/1222] macro for testing silicon seeding --- common/G4_Tracking.C | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 619dea55e..437f37482 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -306,6 +307,23 @@ void Tracking_Reco() PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); silicon_seeding->Verbosity(0); se->registerSubsystem(silicon_seeding); + /// qGeometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->Verbosity(verbosity); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(geom); + + /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(verbosity); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); + + PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); + silicon_Seeding->Verbosity(10); + se->registerSubsystem(silicon_Seeding); // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); @@ -373,19 +391,7 @@ void Tracking_Reco() std::cout << " Using Acts track fitting " << std::endl; #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); - se->registerSubsystem(geom); - - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(verbosity); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); + PHActsTracks* actsTracks = new PHActsTracks(); actsTracks->Verbosity(verbosity); From 4fd8788f3b9977d2926ad45ce326f4231cfe0ac9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 2 Dec 2020 15:00:04 -0500 Subject: [PATCH 0910/1222] eemc has now more of a standard interface --- common/G4_EEMC.C | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index 6b8b72de7..7d0dc2a81 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -25,6 +25,7 @@ R__LOAD_LIBRARY(libg4eval.so) namespace Enable { bool EEMC = false; + bool EEMC_ABSORBER = false; bool EEMC_CELL = false; bool EEMC_TOWER = false; bool EEMC_CLUSTER = false; @@ -42,17 +43,33 @@ namespace G4EEMC void EEMCInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt + if (G4EEMC::use_projective_geometry) + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 81.); + } +else + { + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); + } + // from towerMap_EEMC_v006.txt BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); } void EEMCSetup(PHG4Reco *g4Reco) { + bool AbsorberActive = Enable::ABSORBER || Enable::EEMC_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::EEMC_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); /** Use dedicated EEMC module */ PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); - + eemc->SuperDetector("EEMC"); + eemc->SetActive(); + if (AbsorberActive) + { + eemc->SetAbsorberActive(); + } + /* path to central copy of calibrations repositry */ ostringstream mapping_eemc; @@ -75,9 +92,6 @@ void EEMCSetup(PHG4Reco *g4Reco) eemc->OverlapCheck(OverlapCheck); - // SetAbsorberActive method not implemented - // if (AbsorberActive) eemc->SetAbsorberActive(); - /* register Ecal module */ g4Reco->registerSubsystem(eemc); } From 55e7ed94f809497f05282c2e7574f465538d51f3 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 2 Dec 2020 15:00:28 -0500 Subject: [PATCH 0911/1222] clang-format --- common/G4_EEMC.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index 7d0dc2a81..ff9b735e6 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -45,11 +45,11 @@ void EEMCInit() { if (G4EEMC::use_projective_geometry) { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 81.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 81.); } -else + else { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); } // from towerMap_EEMC_v006.txt BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); @@ -69,7 +69,7 @@ void EEMCSetup(PHG4Reco *g4Reco) { eemc->SetAbsorberActive(); } - + /* path to central copy of calibrations repositry */ ostringstream mapping_eemc; From 6df6f75ca54c274d5f540788d72d72ed7c08a7fe Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 2 Dec 2020 20:17:08 -0700 Subject: [PATCH 0912/1222] removed unused and now obsolete headers --- common/G4_Barrel_EIC.C | 2 -- common/G4_TPC_EIC.C | 1 - 2 files changed, 3 deletions(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index 9ef1b019e..e25078a4a 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -5,8 +5,6 @@ #include -#include - #include #include diff --git a/common/G4_TPC_EIC.C b/common/G4_TPC_EIC.C index 2346fd582..c4d0a54fd 100644 --- a/common/G4_TPC_EIC.C +++ b/common/G4_TPC_EIC.C @@ -8,7 +8,6 @@ #include #include -#include #include From 12b05e07fd09ef8e14b5a807963a68c4d581a4c2 Mon Sep 17 00:00:00 2001 From: pingwong Date: Thu, 3 Dec 2020 17:21:31 -0500 Subject: [PATCH 0913/1222] updated FST design --- macros/g4simulations/G4_Barrel_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/g4simulations/G4_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C index fc9399fb2..0df58b843 100644 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ b/macros/g4simulations/G4_Barrel_EIC.C @@ -4,7 +4,7 @@ #include -#include +//#include #include From 5e07012022c5a189d36993ff99d9d892f0a4095e Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 8 Dec 2020 10:12:04 -0500 Subject: [PATCH 0914/1222] update macro with silicon seeder --- common/G4_Tracking.C | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 45d7d6a23..1c92b84a0 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -306,8 +307,9 @@ void Tracking_Reco() // use truth information to assemble silicon clusters into track stubs for now PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); - /// qGeometry must be built before any Acts modules + //se->registerSubsystem(silicon_seeding); + + /// qGeometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); @@ -322,9 +324,14 @@ void Tracking_Reco() se->registerSubsystem(sl); PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); - silicon_Seeding->Verbosity(10); + silicon_Seeding->Verbosity(0); se->registerSubsystem(silicon_Seeding); + PHActsInitialVertexFinder *initFinder = new + PHActsInitialVertexFinder(); + initFinder->Verbosity(0); + se->registerSubsystem(initFinder); + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); silicon_match->Verbosity(0); From 236f0ecc4858aa898debb4519921a41f3d2ea684 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 8 Dec 2020 20:39:53 -0500 Subject: [PATCH 0915/1222] remove content of unused cell reco, use string param for map file --- common/G4_EEMC.C | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index ff9b735e6..4968ba0bb 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -70,19 +70,23 @@ void EEMCSetup(PHG4Reco *g4Reco) eemc->SetAbsorberActive(); } - /* path to central copy of calibrations repositry */ + /* path to central copy of calibrations repository */ ostringstream mapping_eemc; /* Use non-projective geometry */ if (!G4EEMC::use_projective_geometry) { mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - eemc->SetTowerMappingFile(mapping_eemc.str()); + eemc->set_string_param("mappingtower", mapping_eemc.str()); } /* use projective geometry */ else { + cout << "The projective version has serious problems with overlaps" << endl; + cout << "Do Not Use!" << endl; + cout << "If you insist, copy G4_EEMC.C locally and comment out this exit" << endl; + gSystem->Exit(1); ostringstream mapping_eemc_4x4construct; mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; @@ -98,15 +102,6 @@ void EEMCSetup(PHG4Reco *g4Reco) void EEMC_Cells() { - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); - hc->Detector("EEMC"); - se->registerSubsystem(hc); - - return; } void EEMC_Towers() From 34e054d9fe697d99f166023dd751dba218e9d63a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 8 Dec 2020 20:41:13 -0500 Subject: [PATCH 0916/1222] remove unused eemc cell reco --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index dc5e23afe..7e9fecad7 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -279,8 +279,7 @@ int Fun4All_G4_EICDetector( // EICDetector geometry - 'electron' direction Enable::EEMC = true; - Enable::EEMC_CELL = Enable::EEMC && true; - Enable::EEMC_TOWER = Enable::EEMC_CELL && true; + Enable::EEMC_TOWER = Enable::EEMC && true; Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; @@ -363,8 +362,6 @@ int Fun4All_G4_EICDetector( if (Enable::FHCAL_CELL) FHCAL_Cells(); - if (Enable::EEMC_CELL) EEMC_Cells(); - //----------------------------- // CEMC towering and clustering //----------------------------- From 0022ad0418d1f4d1b367abc10be43bec1e903f35 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 16 Dec 2020 11:46:30 -0500 Subject: [PATCH 0917/1222] update tracking macro with flag for acts silicon seeder --- common/G4_Tracking.C | 90 ++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 1c92b84a0..aaa6fa888 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -89,7 +89,8 @@ namespace G4TRACKING bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing + bool use_acts_init_vertexing = false; // if true runs acts silicon seeding+initial vertexing + bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple @@ -169,16 +170,41 @@ void Tracking_Reco() // Tracking //------------ - // Initial vertex finding (independent of tracking) + if(!G4TRACKING::use_Genfit) + { +#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); + se->registerSubsystem(geom); + + /// Always run PHActsSourceLinks first, to convert TrkrClusters + /// to the Acts equivalent + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(verbosity); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); +#endif + } + + // Initial vertex finding //================================= - if (!G4TRACKING::use_init_vertexing) - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - } - else + if(G4TRACKING::use_acts_init_vertexing && !G4TRACKING::use_Genfit) + { + #if __cplusplus >= 201703L + PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); + silicon_Seeding->Verbosity(verbosity); + se->registerSubsystem(silicon_Seeding); + + PHActsInitialVertexFinder *initFinder = new PHActsInitialVertexFinder(); + initFinder->Verbosity(verbosity); + se->registerSubsystem(initFinder); + #endif + } + else if (G4TRACKING::use_phinit_vertexing) { // get the initial vertex for track fitting from the MVTX hits PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); @@ -190,6 +216,15 @@ void Tracking_Reco() init_zvtx->Verbosity(verbosity); se->registerSubsystem(init_zvtx); } + else + { + // We cheat to get the initial vertex for the full track reconstruction case + std::cout << "JOE TRUTH VERTEXING"<Verbosity(verbosity); + se->registerSubsystem(init_vtx); + + } // Truth track seeding and propagation in one module // ==================================== @@ -294,7 +329,7 @@ void Tracking_Reco() // 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(0); + silicon_assoc->Verbosity(verbosity); se->registerSubsystem(silicon_assoc); } else @@ -305,32 +340,13 @@ void Tracking_Reco() // start with a complete TPC track seed from one of the CA seeders // use truth information to assemble silicon clusters into track stubs for now - PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - //se->registerSubsystem(silicon_seeding); - - /// qGeometry must be built before any Acts modules - MakeActsGeometry* geom = new MakeActsGeometry(); - geom->Verbosity(verbosity); - geom->setMagField(G4MAGNET::magfield); - geom->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(geom); - - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(verbosity); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - - PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); - silicon_Seeding->Verbosity(0); - se->registerSubsystem(silicon_Seeding); - - PHActsInitialVertexFinder *initFinder = new - PHActsInitialVertexFinder(); - initFinder->Verbosity(0); - se->registerSubsystem(initFinder); + if(!G4TRACKING::use_acts_init_vertexing) + { + PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(0); + se->registerSubsystem(silicon_seeding); + std::cout << "JOE SILICON TRUTH TRACK SEEDING"< Date: Mon, 21 Dec 2020 13:01:24 -0500 Subject: [PATCH 0918/1222] add template clusterizer as default --- common/G4_EEMC.C | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index 4968ba0bb..eadb5317a 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -39,6 +40,16 @@ namespace G4EEMC int use_projective_geometry = 0; double Gdz = 18. + 0.0001; double Gz0 = -170.; + enum enu_Eemc_clusterizer + { + kEemcGraphClusterizer, + kEemcTemplateClusterizer + }; + //default template clusterizer, as developed by Sasha Bazilevsky + enu_Eemc_clusterizer Eemc_clusterizer = kEemcTemplateClusterizer; + // graph clusterizer + //enu_Eemc_clusterizer Eemc_clusterizer = kEemcGraphClusterizer; + } // namespace G4EEMC void EEMCInit() @@ -156,11 +167,27 @@ void EEMC_Clusters() Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcTemplateClusterizer) + { +RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("EEMCRawClusterBuilderTemplate"); + ClusterBuilder->Detector("EEMC"); ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); + } + else if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcGraphClusterizer) + { +RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "EEMC_Clusters - unknown clusterizer setting " << G4EEMC::Eemc_clusterizer << endl; + gSystem->Exit(1); + } return; } From f34b98ccd26a323c67c29ed61b7769f7a06af91e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:03:31 -0500 Subject: [PATCH 0919/1222] remove obsolete FEMC_Cells() code, leave function empty --- common/G4_FEMC_EIC.C | 8 -------- 1 file changed, 8 deletions(-) diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index dbdd29162..529f224b1 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -85,14 +85,6 @@ void FEMCSetup(PHG4Reco *g4Reco) void FEMC_Cells() { - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - return; } From a9ca95ecedc0361c00037dee503b4aed0b9ed75d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:03:44 -0500 Subject: [PATCH 0920/1222] remove obsolete FEMC_Cells() code, leave function empty --- common/G4_FEMC.C | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C index 20e162cd5..5311458bd 100644 --- a/common/G4_FEMC.C +++ b/common/G4_FEMC.C @@ -89,12 +89,6 @@ void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) void FEMC_Cells() { - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - return; } From 0c42b33b07f5d24165ef58a47be44d58fb905220 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:22:22 -0500 Subject: [PATCH 0921/1222] remove obsolete FHCAL_Cells() code, leave function empty, make template clusterer default --- common/G4_FHCAL.C | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index dfef894f9..33dc341ae 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -41,6 +42,15 @@ namespace G4FHCAL double Gz0 = 400.; double Gdz = 100.; double outer_radius = 262.; + enum enu_FHcal_clusterizer + { + kFHcalGraphClusterizer, + kFHcalTemplateClusterizer + }; + //template clusterizer, as developed by Sasha Bazilevsky + enu_FHcal_clusterizer FHcal_clusterizer = kFHcalTemplateClusterizer; + // graph clusterizer + //enu_FHcal_clusterizer FHcal_clusterizer = kFHcalGraphClusterizer; } // namespace G4FHCAL void FHCALInit() @@ -76,12 +86,6 @@ void FHCALSetup(PHG4Reco *g4Reco) void FHCAL_Cells(int verbosity = 0) { - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); - hc->Detector("FHCAL"); - se->registerSubsystem(hc); - return; } @@ -94,7 +98,6 @@ void FHCAL_Towers() ostringstream mapping_fhcal; mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; - //mapping_fhcal << "towerMap_FHCAL_latest.txt"; RawTowerBuilderByHitIndex *tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); tower_FHCAL->Detector("FHCAL"); @@ -148,11 +151,28 @@ void FHCAL_Clusters() int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); + if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) + { +RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("FHCALRawClusterBuilderTemplate"); + ClusterBuilder->Detector("FHCAL"); + ClusterBuilder->SetPlanarGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); + } + else if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) + { RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); ClusterBuilder->Detector("FHCAL"); ClusterBuilder->Verbosity(verbosity); ClusterBuilder->set_threshold_energy(0.100); se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "FHCAL_Clusters - unknown clusterizer setting " << G4FHCAL::FHcal_clusterizer << endl; + gSystem->Exit(1); + } return; } From eb7cf8e90202405f61623e12723f18f14128236b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:22:59 -0500 Subject: [PATCH 0922/1222] Add coment about SetCylindricalGeometry() calling order --- common/G4_HcalIn_ref.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 547b074c0..f678452d0 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -272,7 +272,7 @@ void HCALInner_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->SetCylindricalGeometry(); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } From bca0dc6be27ecc4d723b2b51d0d6991fcde79334 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:23:11 -0500 Subject: [PATCH 0923/1222] Add coment about SetCylindricalGeometry() calling order --- common/G4_HcalOut_ref.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index d5254f226..b7cb54cf7 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -196,7 +196,7 @@ void HCALOuter_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->SetCylindricalGeometry(); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } From 42510b554b5570ec3edb3248d743f7f68b664938 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:23:53 -0500 Subject: [PATCH 0924/1222] clang-format --- common/G4_EEMC.C | 16 ++++++++-------- common/G4_FHCAL.C | 22 +++++++++++----------- common/G4_HcalIn_ref.C | 2 +- common/G4_HcalOut_ref.C | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index eadb5317a..cb3bfd8a0 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -169,19 +169,19 @@ void EEMC_Clusters() if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcTemplateClusterizer) { -RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("EEMCRawClusterBuilderTemplate"); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EEMCRawClusterBuilderTemplate"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); } else if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcGraphClusterizer) { -RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); } else { diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index 33dc341ae..bea6f32b2 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -153,20 +153,20 @@ void FHCAL_Clusters() if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) { -RawClusterBuilderTemplate* ClusterBuilder = new RawClusterBuilderTemplate("FHCALRawClusterBuilderTemplate"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->SetPlanarGeometry(); // has to be called after Detector() - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem(ClusterBuilder); + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("FHCALRawClusterBuilderTemplate"); + ClusterBuilder->Detector("FHCAL"); + ClusterBuilder->SetPlanarGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); } else if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem(ClusterBuilder); + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); + ClusterBuilder->Detector("FHCAL"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); } else { diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index f678452d0..9d6cec245 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -272,7 +272,7 @@ void HCALInner_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index b7cb54cf7..77108b938 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -196,7 +196,7 @@ void HCALOuter_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } From 00c7946c5040d5bce0d4338b7ff3a34ae1cc6653 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:25:32 -0500 Subject: [PATCH 0925/1222] remove obsolete Femc Cell reco --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 57bb79b13..a50e4cf92 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -278,8 +278,7 @@ int Fun4All_G4_sPHENIX( // forward EMC //Enable::FEMC = true; Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_TOWER = Enable::FEMC && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER and Enable::QA && true; @@ -366,8 +365,6 @@ int Fun4All_G4_sPHENIX( if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (Enable::FEMC_CELL) FEMC_Cells(); - //----------------------------- // CEMC towering and clustering //----------------------------- From 8fc6027c38ddb50f93afdd5d543da1add963e855 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:26:48 -0500 Subject: [PATCH 0926/1222] remove obsolete Femc and fhcal Cell reco --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 5e5c661fa..d607c0298 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -276,14 +276,12 @@ int Fun4All_G4_fsPHENIX( Enable::FEMC = true; Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_TOWER = Enable::FEMC && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FHCAL = true; Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_CELL = Enable::FHCAL && true; - Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_TOWER = Enable::FHCAL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; @@ -352,9 +350,6 @@ int Fun4All_G4_fsPHENIX( if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (Enable::FEMC_CELL) FEMC_Cells(); - if (Enable::FHCAL_CELL) FHCAL_Cells(); - //----------------------------- // CEMC towering and clustering //----------------------------- From 62a648350efd15c2141fd7e0c16813e41bc1d9d6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 21 Dec 2020 13:27:43 -0500 Subject: [PATCH 0927/1222] remove obsolete Femc and fhcal Cell reco --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 7e9fecad7..c423474ab 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -265,15 +265,13 @@ int Fun4All_G4_EICDetector( Enable::FEMC = true; // Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_TOWER = Enable::FEMC && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; Enable::FHCAL = true; // Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_CELL = Enable::FHCAL && true; - Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_TOWER = Enable::FHCAL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; @@ -358,10 +356,6 @@ int Fun4All_G4_EICDetector( if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (Enable::FEMC_CELL) FEMC_Cells(); - - if (Enable::FHCAL_CELL) FHCAL_Cells(); - //----------------------------- // CEMC towering and clustering //----------------------------- From 2b8100d2e1d7ff8aac1f80d9896c0b0722aa5c5a Mon Sep 17 00:00:00 2001 From: cdean-github Date: Wed, 23 Dec 2020 12:25:54 -0500 Subject: [PATCH 0928/1222] KFParticle macro added This PR adds the KFParticle macro to perform Upsilon, D0 and Lc reco The three reconstructions were tested and work without crashing although the Lc generator is still a work in progress. This will appear in a later PR to core software. There are some base cuts which are realistic but might be tight for code testing so they can be loosened (or set to effectively no cut). The nTuple output is disabled by default while the DST output is enabled. Truth matching is also disabled by default, only enable it if you know there are truth variables. KFParticle will exit your run rather than skip the event if this is the case --- common/G4_KFParticle.C | 166 +++++++++++++++++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 26 +++- 2 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 common/G4_KFParticle.C diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C new file mode 100644 index 000000000..206b77e1a --- /dev/null +++ b/common/G4_KFParticle.C @@ -0,0 +1,166 @@ +#ifndef MACRO_G4KFPARTICLE_C +#define MACRO_G4KFPARTICLE_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libkfparticle_sphenix.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 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 KFParticleInit() {} //I guess this line isnt needed + +void KFParticle_Upsilon_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "Upsilon"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(2); + daughterList[0] = make_pair("electron", +1); + daughterList[1] = make_pair("electron", -1); + kfparticle->getChargeConjugate(false); + kfparticle->setDaughters(daughterList); + 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->setMotherName(motherName); + kfparticle->setMinimumMass(7); + kfparticle->setMaximumMass(11); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +void KFParticle_D0_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "D0"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(2); + daughterList[0] = make_pair("kaon", -1); + daughterList[1] = make_pair("pion", +1); + kfparticle->getChargeConjugate(true); + kfparticle->setDaughters(daughterList); + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMotherName(motherName); + kfparticle->setMinimumMass(1.750); + kfparticle->setMaximumMass(1.950); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +void KFParticle_Lambdac_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "Lambdac"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(3); + daughterList[0] = make_pair("proton", +1); + daughterList[1] = make_pair("kaon", -1); + daughterList[2] = make_pair("pion", +1); + kfparticle->getChargeConjugate(true); + kfparticle->setDaughters(daughterList); + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMotherName(motherName); + kfparticle->setMinimumMass(2.150); + kfparticle->setMaximumMass(2.400); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +#endif diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index a50e4cf92..1ac0bde83 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -91,10 +92,16 @@ int Fun4All_G4_sPHENIX( // 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 = true; - // Input::UPSILON_NUMBER = 3; // if you need 3 of them - // Input::UPSILON_VERBOSITY = 0; + //Input::UPSILON = true; + //Input::UPSILON_NUMBER = 3; // if you need 3 of them + //Input::UPSILON_VERBOSITY = 0; // Input::HEPMC = true; INPUTHEPMC::filename = inputFile; @@ -190,7 +197,7 @@ int Fun4All_G4_sPHENIX( // Write the DST //====================== - // Enable::DSTOUT = true; + //Enable::DSTOUT = true; Enable::DSTOUT_COMPRESS = false; DstOut::OutputDir = outdir; DstOut::OutputFile = outputFile; @@ -466,6 +473,17 @@ int Fun4All_G4_sPHENIX( if (Enable::USER) UserAnalysisInit(); + //====================== + // Run KFParticle on evt + //====================== + Enable::KFPARTICLE = false; + Enable::KFPARTICLE_VERBOSITY = 0; + //Enable::KFPARTICLE_TRUTH_MATCH = true; + //Enable::KFPARTICLE_SAVE_NTUPLE = true; + if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); + //if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco(); + //---------------------- // Standard QAs //---------------------- From 7cd655d1a95321dc5ceac00482d7c883bf5d7118 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Wed, 23 Dec 2020 13:35:48 -0500 Subject: [PATCH 0929/1222] Small changes to Fun4All_G4_sPHENIX.C I moved a couple of lines around and changed some default arguments then commented them out for consistency with the macro's style --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 1ac0bde83..ff2045c29 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -296,7 +296,11 @@ int Fun4All_G4_sPHENIX( Enable::PLUGDOOR_ABSORBER = true; Enable::GLOBAL_RECO = true; - // Enable::GLOBAL_FASTSIM = 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; @@ -476,10 +480,6 @@ int Fun4All_G4_sPHENIX( //====================== // Run KFParticle on evt //====================== - Enable::KFPARTICLE = false; - Enable::KFPARTICLE_VERBOSITY = 0; - //Enable::KFPARTICLE_TRUTH_MATCH = true; - //Enable::KFPARTICLE_SAVE_NTUPLE = true; if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); //if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco(); From b107ab682d849c468b5bb51086a57f47ec7d583e Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 23 Dec 2020 21:37:52 -0500 Subject: [PATCH 0930/1222] Move ShowerCompress() to afer evaluator and QA calls --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index ff2045c29..ee1628c81 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -399,8 +399,6 @@ int Fun4All_G4_sPHENIX( if (Enable::FEMC_TOWER) FEMC_Towers(); if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - if (Enable::DSTOUT_COMPRESS) ShowerCompress(); - //-------------- // SVTX tracking //-------------- @@ -516,7 +514,11 @@ int Fun4All_G4_sPHENIX( { string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); - if (Enable::DSTOUT_COMPRESS) DstCompress(out); + if (Enable::DSTOUT_COMPRESS) + { + ShowerCompress(); + DstCompress(out); + } se->registerOutputManager(out); } //----------------- From cd162957fc84fb2c129563da4d7ad6a836defa1e Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 24 Dec 2020 18:06:49 -0500 Subject: [PATCH 0931/1222] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 31ce6fa8d..60156a27e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ 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.racf.bnl.gov/jenkins-sphenix/buildStatus/icon?job=sPHENIX/sPHENIX_CoreSoftware_MasterBranch)](https://web.racf.bnl.gov/jenkins-sphenix/job/sPHENIX/job/sPHENIX_CoreSoftware_MasterBranch/) +[![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/) [![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) From 0c6692376c9920588290121ed0174ddeda102e22 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 5 Jan 2021 19:46:08 -0500 Subject: [PATCH 0932/1222] ditch obsolete g4simulation directory --- macros/g4simulations/DisplayOn.C | 62 -- macros/g4simulations/Fun4All_G4_EICDetector.C | 427 --------- macros/g4simulations/Fun4All_G4_fsPHENIX.C | 418 --------- macros/g4simulations/Fun4All_G4_sPHENIX.C | 654 -------------- macros/g4simulations/G4Setup_EICDetector.C | 425 --------- macros/g4simulations/G4Setup_fsPHENIX.C | 335 ------- macros/g4simulations/G4Setup_sPHENIX.C | 356 -------- macros/g4simulations/G4_Aerogel.C | 52 -- macros/g4simulations/G4_Barrel_EIC.C | 101 --- macros/g4simulations/G4_Bbc.C | 64 -- macros/g4simulations/G4_BlackHole.C | 85 -- macros/g4simulations/G4_CEmc_EIC.C | 316 ------- macros/g4simulations/G4_CEmc_Spacal.C | 476 ---------- macros/g4simulations/G4_CaloTrigger.C | 32 - macros/g4simulations/G4_DIRC.C | 101 --- macros/g4simulations/G4_DSTReader.C | 144 --- .../g4simulations/G4_DSTReader_EICDetector.C | 208 ----- macros/g4simulations/G4_DSTReader_fsPHENIX.C | 189 ---- macros/g4simulations/G4_EEMC.C | 168 ---- macros/g4simulations/G4_EPD.C | 26 - macros/g4simulations/G4_FEMC.C | 261 ------ macros/g4simulations/G4_FEMC_EIC.C | 268 ------ macros/g4simulations/G4_FGEM_fsPHENIX.C | 352 -------- macros/g4simulations/G4_FHCAL.C | 167 ---- macros/g4simulations/G4_FST_EIC.C | 98 -- macros/g4simulations/G4_FwdJets.C | 80 -- macros/g4simulations/G4_GEM_EIC.C | 220 ----- macros/g4simulations/G4_Global.C | 58 -- macros/g4simulations/G4_HIJetReco.C | 135 --- macros/g4simulations/G4_HcalIn_ref.C | 302 ------- macros/g4simulations/G4_HcalOut_ref.C | 226 ----- macros/g4simulations/G4_Input.C | 181 ---- macros/g4simulations/G4_Input_Gun.C | 58 -- macros/g4simulations/G4_Input_Simple.C | 148 ---- macros/g4simulations/G4_Input_Upsilon.C | 93 -- macros/g4simulations/G4_Intt.C | 185 ---- macros/g4simulations/G4_Jets.C | 115 --- macros/g4simulations/G4_Magnet.C | 106 --- macros/g4simulations/G4_Mvtx.C | 102 --- macros/g4simulations/G4_MvtxService.C | 225 ----- macros/g4simulations/G4_Mvtx_EIC.C | 87 -- macros/g4simulations/G4_PSTOF.C | 37 - macros/g4simulations/G4_ParticleFlow.C | 47 - macros/g4simulations/G4_Pipe.C | 141 --- macros/g4simulations/G4_Pipe_EIC.C | 123 --- macros/g4simulations/G4_Piston.C | 124 --- macros/g4simulations/G4_PlugDoor.C | 50 -- macros/g4simulations/G4_PlugDoor_EIC.C | 58 -- macros/g4simulations/G4_PlugDoor_fsPHENIX.C | 67 -- macros/g4simulations/G4_RICH.C | 62 -- ...adders+intt_ladders+tpc_KalmanPatRec_EIC.C | 369 -------- macros/g4simulations/G4_TPC.C | 149 ---- macros/g4simulations/G4_TPC_EIC.C | 124 --- macros/g4simulations/G4_TopoClusterReco.C | 69 -- macros/g4simulations/G4_Tracking.C | 836 ------------------ macros/g4simulations/G4_Tracking_EIC.C | 235 ----- macros/g4simulations/G4_Tracking_fsPHENIX.C | 209 ----- macros/g4simulations/G4_User.C | 27 - macros/g4simulations/G4_World.C | 32 - macros/g4simulations/GlobalVariables.C | 49 - .../g4simulations/ReadClustersRunTracking.C | 165 ---- macros/g4simulations/flowAfterburner.xml | 20 - macros/g4simulations/init_gui_vis.mac | 20 - macros/g4simulations/phpythia6.cfg | 17 - macros/g4simulations/phpythia8.cfg | 28 - macros/g4simulations/sartre.cfg | 113 --- macros/g4simulations/vis.mac | 84 -- 67 files changed, 11361 deletions(-) delete mode 100644 macros/g4simulations/DisplayOn.C delete mode 100644 macros/g4simulations/Fun4All_G4_EICDetector.C delete mode 100644 macros/g4simulations/Fun4All_G4_fsPHENIX.C delete mode 100644 macros/g4simulations/Fun4All_G4_sPHENIX.C delete mode 100644 macros/g4simulations/G4Setup_EICDetector.C delete mode 100644 macros/g4simulations/G4Setup_fsPHENIX.C delete mode 100644 macros/g4simulations/G4Setup_sPHENIX.C delete mode 100644 macros/g4simulations/G4_Aerogel.C delete mode 100644 macros/g4simulations/G4_Barrel_EIC.C delete mode 100644 macros/g4simulations/G4_Bbc.C delete mode 100644 macros/g4simulations/G4_BlackHole.C delete mode 100644 macros/g4simulations/G4_CEmc_EIC.C delete mode 100644 macros/g4simulations/G4_CEmc_Spacal.C delete mode 100644 macros/g4simulations/G4_CaloTrigger.C delete mode 100644 macros/g4simulations/G4_DIRC.C delete mode 100644 macros/g4simulations/G4_DSTReader.C delete mode 100644 macros/g4simulations/G4_DSTReader_EICDetector.C delete mode 100644 macros/g4simulations/G4_DSTReader_fsPHENIX.C delete mode 100644 macros/g4simulations/G4_EEMC.C delete mode 100644 macros/g4simulations/G4_EPD.C delete mode 100644 macros/g4simulations/G4_FEMC.C delete mode 100644 macros/g4simulations/G4_FEMC_EIC.C delete mode 100644 macros/g4simulations/G4_FGEM_fsPHENIX.C delete mode 100644 macros/g4simulations/G4_FHCAL.C delete mode 100644 macros/g4simulations/G4_FST_EIC.C delete mode 100644 macros/g4simulations/G4_FwdJets.C delete mode 100644 macros/g4simulations/G4_GEM_EIC.C delete mode 100644 macros/g4simulations/G4_Global.C delete mode 100644 macros/g4simulations/G4_HIJetReco.C delete mode 100644 macros/g4simulations/G4_HcalIn_ref.C delete mode 100644 macros/g4simulations/G4_HcalOut_ref.C delete mode 100644 macros/g4simulations/G4_Input.C delete mode 100644 macros/g4simulations/G4_Input_Gun.C delete mode 100644 macros/g4simulations/G4_Input_Simple.C delete mode 100644 macros/g4simulations/G4_Input_Upsilon.C delete mode 100644 macros/g4simulations/G4_Intt.C delete mode 100644 macros/g4simulations/G4_Jets.C delete mode 100644 macros/g4simulations/G4_Magnet.C delete mode 100644 macros/g4simulations/G4_Mvtx.C delete mode 100644 macros/g4simulations/G4_MvtxService.C delete mode 100644 macros/g4simulations/G4_Mvtx_EIC.C delete mode 100644 macros/g4simulations/G4_PSTOF.C delete mode 100644 macros/g4simulations/G4_ParticleFlow.C delete mode 100644 macros/g4simulations/G4_Pipe.C delete mode 100644 macros/g4simulations/G4_Pipe_EIC.C delete mode 100644 macros/g4simulations/G4_Piston.C delete mode 100644 macros/g4simulations/G4_PlugDoor.C delete mode 100644 macros/g4simulations/G4_PlugDoor_EIC.C delete mode 100644 macros/g4simulations/G4_PlugDoor_fsPHENIX.C delete mode 100644 macros/g4simulations/G4_RICH.C delete mode 100644 macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C delete mode 100644 macros/g4simulations/G4_TPC.C delete mode 100644 macros/g4simulations/G4_TPC_EIC.C delete mode 100644 macros/g4simulations/G4_TopoClusterReco.C delete mode 100644 macros/g4simulations/G4_Tracking.C delete mode 100644 macros/g4simulations/G4_Tracking_EIC.C delete mode 100644 macros/g4simulations/G4_Tracking_fsPHENIX.C delete mode 100644 macros/g4simulations/G4_User.C delete mode 100644 macros/g4simulations/G4_World.C delete mode 100644 macros/g4simulations/GlobalVariables.C delete mode 100644 macros/g4simulations/ReadClustersRunTracking.C delete mode 100644 macros/g4simulations/flowAfterburner.xml delete mode 100644 macros/g4simulations/init_gui_vis.mac delete mode 100644 macros/g4simulations/phpythia6.cfg delete mode 100644 macros/g4simulations/phpythia8.cfg delete mode 100644 macros/g4simulations/sartre.cfg delete mode 100644 macros/g4simulations/vis.mac diff --git a/macros/g4simulations/DisplayOn.C b/macros/g4simulations/DisplayOn.C deleted file mode 100644 index 72b69734e..000000000 --- a/macros/g4simulations/DisplayOn.C +++ /dev/null @@ -1,62 +0,0 @@ -#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 -// 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.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; -} -// 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/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C deleted file mode 100644 index 8c63e4c77..000000000 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ /dev/null @@ -1,427 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_EICDetector.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_EICDetector.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_HIJetReco.C" -#include "G4_Input.C" -#include "G4_Jets.C" - -#include -#include -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) - -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 string &outputFile = "G4EICDetector.root") -{ - //--------------- - // Fun4All server - //--------------- - Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(01); // 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 initial seed - // which will produce identical results so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //=============== - // 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 - // - //Input::READHITS = true; - INPUTREADHITS::filename = inputFile; - - // Or: - // Use one or more particle generators - // It is run if Input:: is set to true - // all other options only play a role if it is active - - // Use Pythia 8 - // Input::PYTHIA8 = true; - - // Use Pythia 6 - // Input::PYTHIA6 = true; - // PYTHIA6::config_file = "phpythia6_ep.cfg"; - - // Use Sartre - // Input::SARTRE = true; - - // Simple multi particle generator in eta/phi/pt ranges - Input::SIMPLE = true; - Input::SIMPLE_VERBOSITY = 0; - INPUTSIMPLE::AddParticle("pi-", 5); - INPUTSIMPLE::set_eta_range(-3, 3); - INPUTSIMPLE::set_phi_range(-M_PI, M_PI); - INPUTSIMPLE::set_pt_range(0.1, 20.); - // or if you want to set the momentum, not pt range - // INPUTSIMPLE::set_p_range(0.1, 20.); - INPUTSIMPLE::set_vtx_mean(0., 0., 0.); - INPUTSIMPLE::set_vtx_width(0., 0., 5.); - - // Particle gun (same particles in always the same direction) - // Input::GUN = true; - Input::GUN_VERBOSITY = 0; - INPUTGUN::AddParticle("anti_proton", 10, 0, 0.01); - INPUTGUN::AddParticle("geantino", 1.7776, -0.4335, 0.); - //INPUTGUN::set_vtx(0,0,0); - - // Upsilon generator - //Input::UPSILON = true; - Input::UPSILON_VERBOSITY = 0; - INPUTUPSILON::AddDecayParticles("e+", "e-", 0); - - // And/Or read generated particles from file - - // eic-smear output - // Input::READEIC = true; - INPUTREADEIC::filename = inputFile; - - // HepMC2 files - // Input::HEPMC = true; - Input::VERBOSITY = 0; - INPUTHEPMC::filename = inputFile; - - //----------------- - // Initialize the selected Input/Event generation - //----------------- - InputInit(); - - //====================== - // Write the DST - //====================== - -// Enable::DSTOUT = true; - Enable::DSTOUT_COMPRESS = false; // Compress DST files - //Option to convert DST to human command readable TTree for quick poke around the outputs - //Enable::DSTREADER = true; - - //====================== - // What to run - //====================== - // Global options (enabled for all subsystems - if implemented) - // Enable::ABSORBER = true; - // Enable::OVERLAPCHECK = true; - // Enable::VERBOSITY = 1; - - Enable::BBC = true; - - // whether to simulate the Be section of the beam pipe - Enable::PIPE = true; - // EIC beam pipe extension beyond the Be-section: - //G4PIPE::use_forward_pipes = true; - - Enable::EGEM = true; - Enable::FGEM = true; - // barrel tracker - Enable::BARREL = false; - Enable::FST = false; - // mvtx/tpc tracker - Enable::MVTX = true; - Enable::TPC = true; - - Enable::TRACKING = true; - Enable::TRACKING_EVAL = Enable::TRACKING && true; - G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - // projections to calorimeters - G4TRACKING::PROJECTION_CEMC = false; - G4TRACKING::PROJECTION_FEMC = false; - G4TRACKING::PROJECTION_FHCAL = false; - - Enable::CEMC = true; - // 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::HCALIN = true; - // 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::MAGNET = true; - - Enable::HCALOUT = true; - // 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; - - // EICDetector geometry - barrel - Enable::DIRC = true; - - // EICDetector geometry - 'hadron' direction - Enable::RICH = true; - Enable::AEROGEL = true; - - Enable::FEMC = true; - // Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; - Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; - - Enable::FHCAL = true; - // Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_CELL = Enable::FHCAL && true; - Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; - Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; - Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; - - // EICDetector geometry - 'electron' direction - Enable::EEMC = true; - Enable::EEMC_CELL = Enable::EEMC && true; - Enable::EEMC_TOWER = Enable::EEMC_CELL && true; - Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; - Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; - - Enable::PLUGDOOR = true; - - // Other options - Enable::GLOBAL_RECO = true; - Enable::GLOBAL_FASTSIM = true; - - Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; - - // Select only one jet reconstruction- they currently use the same - // output collections on the node tree! - Enable::JETS = true; - Enable::JETS_EVAL = Enable::JETS && true; - - Enable::FWDJETS = true; - Enable::FWDJETS_EVAL = Enable::FWDJETS && 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) - Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; - - // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - BlackHoleGeometry::visible = false; - - // establish the geometry and reconstruction setup - G4Init(); - - //--------------- - // 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.4 / 1.5; // 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; - - //----------------- - // Event generation - //----------------- - - // 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 (!Input::READHITS) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(); - } - - //--------- - // BBC Reco - //--------- - - if (Enable::BBC) - { - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (Enable::CEMC_CELL) CEMC_Cells(); - - if (Enable::HCALIN_CELL) HCALInner_Cells(); - - if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - - if (Enable::FEMC_CELL) FEMC_Cells(); - - if (Enable::FHCAL_CELL) FHCAL_Cells(); - - if (Enable::EEMC_CELL) EEMC_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(); - - //----------------------------- - // e, h direction Calorimeter towering and clustering - //----------------------------- - - if (Enable::FEMC_TOWER) FEMC_Towers(); - if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - - if (Enable::FHCAL_TOWER) FHCAL_Towers(); - if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - - if (Enable::EEMC_TOWER) EEMC_Towers(); - if (Enable::EEMC_CLUSTER) EEMC_Clusters(); - - if (Enable::DSTOUT_COMPRESS) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (Enable::TRACKING) Tracking_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - 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::FWDJETS) Jet_FwdReco(); - - 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::DSTREADER) G4DSTreader_EICDetector(outputroot + "_DSTReader.root"); - - //---------------------- - // Simulation evaluation - //---------------------- - if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4tracking_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::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); - - if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); - - if (Enable::EEMC_EVAL) EEMC_Eval(outputroot + "_g4eemc_eval.root"); - - if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); - - if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); - - //-------------- - // Set up Input Managers - //-------------- - - InputManagers(); - - //-------------- - // Set up Output Manager - //-------------- - if (Enable::DSTOUT) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (Enable::DSTOUT_COMPRESS) DstCompress(out); - se->registerOutputManager(out); - } - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return 0; - } - // if we run any of the particle generators and use 0 it'll run forever - if (nEvents == 0 && !Input::READHITS && !Input::HEPMC && !Input::READEIC) - { - 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(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 0; -} diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C deleted file mode 100644 index ed85ad8be..000000000 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ /dev/null @@ -1,418 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "DisplayOn.C" -#include "G4Setup_fsPHENIX.C" -#include "G4_Bbc.C" -#include "G4_CaloTrigger.C" -#include "G4_DSTReader_fsPHENIX.C" -#include "G4_FwdJets.C" -#include "G4_Global.C" -#include "G4_Input.C" -#include "G4_Jets.C" - -#include -#include -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) - -// If using the default embedding file results in a error, try -// TFile *f1 = TFile::Open("http://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") -// if it returns a certificate error, something like -// Error in : can not open file with davix: Failure (Neon): Server certificate verification failed: bad certificate chain after 3 attempts (6) -// add the line -// Davix.GSI.CACheck: n -// to your .rootrc - -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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") -{ - //--------------- - // 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 initial seed - // which will produce identical results so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //=============== - // 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 - Input::READHITS = false; - INPUTREADHITS::filename = 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 = embed_input_file; - - Input::SIMPLE = true; - //Input::SIMPLE_VERBOSITY = 1; - INPUTSIMPLE::AddParticle("pi-", 5); - // INPUTSIMPLE::AddParticle("e-",0); - // INPUTSIMPLE::AddParticle("pi-",10); - INPUTSIMPLE::set_eta_range(-1, 3); - INPUTSIMPLE::set_phi_range(-M_PI, M_PI); - INPUTSIMPLE::set_pt_range(0.5, 50.); - INPUTSIMPLE::set_vtx_mean(0., 0., 0.); - INPUTSIMPLE::set_vtx_width(0., 0., 5.); - - // Input::PYTHIA6 = true; - - // Input::PYTHIA8 = true; - - // Input::GUN = true; - //Input::GUN_VERBOSITY = 0; - INPUTGUN::AddParticle("pi-", 0, 1, 0); - //INPUTGUN::set_vtx(0,0,0); - - // Input::HEPMC = true; - Input::VERBOSITY = 0; - INPUTHEPMC::filename = inputFile; - - //----------------- - // Initialize the selected Input/Event generation - //----------------- - InputInit(); - - //====================== - // Write the DST - //====================== - - Enable::DSTOUT = true; - Enable::DSTOUT_COMPRESS = false; - - //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::BBC = true; - - Enable::PIPE = true; - Enable::PIPE_ABSORBER = true; - // Enable::PIPE_OVERLAPCHECK = false; - - // central tracking - Enable::MVTX = true; - Enable::MVTX_CELL = Enable::MVTX && true; - Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; - - Enable::INTT = true; - Enable::INTT_CELL = Enable::INTT && true; - Enable::INTT_CLUSTER = Enable::INTT_CELL && true; - - Enable::TPC = true; - // Enable::TPC_ABSORBER = true; - Enable::TPC_CELL = Enable::TPC && true; - Enable::TPC_CLUSTER = Enable::TPC_CELL && true; - - Enable::TRACKING_TRACK = Enable::TPC_CELL && Enable::INTT_CELL && Enable::MVTX_CELL && true; - Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; - - // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = true; - // 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::HCALIN = true; - // 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::MAGNET = true; - // Enable::MAGNET_ABSORBER = true; - - Enable::HCALOUT = true; - // 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::GLOBAL_RECO = true; - Enable::GLOBAL_FASTSIM = true; - - Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && true; - - Enable::JETS = true; - Enable::JETS_EVAL = Enable::JETS && true; - - Enable::FWDJETS = true; - Enable::FWDJETS_EVAL = Enable::FWDJETS && true; - - // fsPHENIX geometry - - Enable::FGEM = true; - Enable::FGEM_TRACK = Enable::FGEM && Enable::MVTX && true; - Enable::FGEM_EVAL = Enable::FGEM_TRACK && true; - - Enable::FEMC = true; - Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; - Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - - Enable::FHCAL = true; - Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_CELL = Enable::FHCAL && true; - Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; - Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; - Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; - - // Enable::PISTON = true; - Enable::PISTON_ABSORBER = true; - Enable::PISTON_OVERLAPCHECK = false; - - Enable::PLUGDOOR = true; - // Enable::PLUGDOOR_ABSORBER = true; - Enable::PLUGDOOR_OVERLAPCHECK = false; - - // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - // BlackHoleGeometry::visible = true; - - //--------------- - // 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.4 / 1.5; // 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(); - - if (!Input::READHITS) - { - //--------------------- - // Set up G4 only if we do not read hits - //--------------------- - G4Setup(); - } - - //--------- - // BBC Reco, just smeared vertex - //--------- - - if (Enable::BBC) - { - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (Enable::MVTX_CELL) Mvtx_Cells(); - if (Enable::INTT_CELL) Intt_Cells(); - if (Enable::TPC_CELL) TPC_Cells(); - - if (Enable::CEMC_CELL) CEMC_Cells(); - - if (Enable::HCALIN_CELL) HCALInner_Cells(); - - if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - - if (Enable::FEMC_CELL) FEMC_Cells(); - if (Enable::FHCAL_CELL) FHCAL_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 (Enable::FEMC_TOWER) FEMC_Towers(); - if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - - if (Enable::FHCAL_TOWER) FHCAL_Towers(); - if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - - 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::TRACKING_TRACK) Tracking_Reco(); - - //-------------- - // FGEM tracking - //-------------- - - if (Enable::FGEM_TRACK) FGEM_FastSim_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - 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::FWDJETS) Jet_FwdReco(); - - //---------------------- - // Simulation evaluation - //---------------------- - - if (Enable::TRACKING_EVAL) Tracking_Eval("g4tracking_eval.root"); - - if (Enable::CEMC_EVAL) CEMC_Eval("g4cemc_eval.root"); - - if (Enable::HCALIN_EVAL) HCALInner_Eval("g4hcalin_eval.root"); - - if (Enable::HCALOUT_EVAL) HCALOuter_Eval("g4hcalout_eval.root"); - - if (Enable::FHCAL_EVAL) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); - - if (Enable::JETS_EVAL) Jet_Eval("g4jet_eval.root"); - - if (Enable::FWDJETS_EVAL) Jet_FwdEval("g4fwdjet_eval.root"); - - if (Enable::FGEM_EVAL) FGEM_FastSim_Eval("g4tracking_fgem_eval.root"); - - if (Enable::DSTREADER) G4DSTreader_fsPHENIX(outputFile); - - //-------------- - // Set up Input Managers - //-------------- - - InputManagers(); - - //-------------- - // Set up Output Managers - //-------------- - - if (Enable::DSTOUT) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (Enable::DSTOUT_COMPRESS) DstCompress(out); - se->registerOutputManager(out); - } - - //----------------- - // Event processing - //----------------- - 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; - } - - if (Enable::DISPLAY) - { - DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 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 e24ccfbe0..000000000 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ /dev/null @@ -1,654 +0,0 @@ -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "G4Setup_sPHENIX.C" -#include "G4_Bbc.C" -#include "G4_Global.C" -#include "G4_CaloTrigger.C" -#include "G4_Jets.C" -#include "G4_HIJetReco.C" -#include "G4_TopoClusterReco.C" -#include "G4_ParticleFlow.C" -#include "G4_DSTReader.C" -#include "DisplayOn.C" -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libphhepmc.so) -R__LOAD_LIBRARY(libPHPythia6.so) -R__LOAD_LIBRARY(libPHPythia8.so) -#endif - -using namespace std; - - -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 = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") -{ - - //=============== - // 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; - const int num_upsilons_per_event = 1; // can set more than 1 upsilon per event, each has a unique embed flag - // Event pile up simulation with collision rate in Hz MB collisions. - // Note please follow up the macro to verify the settings for beam parameters - const double pileup_collision_rate = 0; // 100e3 for 100kHz nominal AuAu collision rate. - const bool do_write_output = false; - // To write cluster files set do_write_output = true and set - // do_tracking = true, do_tracking_cell = true, do_tracking_cluster = true and - // leave the tracking for later do_tracking_track = false, do_tracking_eval = false - - //====================== - // What to run - //====================== - - bool do_pipe = true; - bool do_mvtxservice = true; - - bool do_bbc = true; - - bool do_tracking = true; - bool do_tracking_cell = do_tracking && true; - bool do_tracking_cluster = do_tracking_cell && true; - bool do_tracking_track = do_tracking_cluster && true; - bool do_tracking_eval = do_tracking_track && true; - 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; - - // forward EMC - bool do_femc = false; - 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_epd = false; - - //! forward flux return plug door. Out of acceptance and off by default. - bool do_plugdoor = false; - - 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 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) - bool do_HIjetreco = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - // 3-D topoCluster reconstruction, potentially in all calorimeter layers - bool do_topoCluster = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - // particle flow jet reconstruction - needs topoClusters! - bool do_particle_flow = false && do_topoCluster; - - 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("libg4eval.so"); - gSystem->Load("libg4intt.so"); - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, do_plugdoor, do_femc, do_epd, do_mvtxservice); - - int absorberactive = 1; // set to 1 to make all absorbers active volumes - // 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) - const string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database - const float magfield_rescale = -1.4 / 1.5; // scale the map to a 1.4 T field - - //--------------- - // Fun4All server - //--------------- - - bool display_on = false; - if(display_on) - { - gROOT->LoadMacro("DisplayOn.C"); - } - - 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", 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." << endl; - exit(1); - } - } - else - { - // running Geant4 stage. First load event generators. - - if (readhepmc) - { - // place holder. Additional action is performed in later stage at the input manager level - } - - if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8 *pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia8 - if (readhepmc) - pythia8->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 - // pythia8->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available - se->registerSubsystem(pythia8); - } - - if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); // example configure files : https://github.com/sPHENIX-Collaboration/coresoftware/tree/master/generators/PHPythia6 - if (readhepmc) - pythia6->set_reuse_vertex(0); // reuse vertex of subevent with embedding ID of 0 - // pythia6->set_vertex_distribution_width(0,0,10,0); // additional vertex smearing if needed, more vertex options available - se->registerSubsystem(pythia6); - } - - // 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 || do_embedding || runpythia8 || runpythia6) - { - 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, 20.0); - gen->Embed(2); - 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 - - for(int iups = 0; iups < num_upsilons_per_event;iups++) - { - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+", "e-", 0); // i = decay id - // event vertex - if (readhepmc || do_embedding || particles || runpythia8 || runpythia6) - { - vgen->set_reuse_existing_vertex(true); - } - - // 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(3); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - } - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - G4Setup(absorberactive, magfield, EDecayType::kAll, - do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); -#else - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_tracking, do_bbc, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe,do_plugdoor, do_femc, do_epd, do_mvtxservice, magfield_rescale); -#endif - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - //------------------ - // Detector Division - //------------------ - - if (do_tracking_cell) Tracking_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(); - - //----------------------------- - // 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 enabled, do topoClustering early, upstream of any possible jet reconstruction - if (do_topoCluster) - { - gROOT->LoadMacro("G4_TopoClusterReco.C"); - TopoClusterReco(); - } - - if (do_femc_twr) FEMC_Towers(); - if (do_femc_cluster) FEMC_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_tracking_cluster) Tracking_Clus(); - - if (do_tracking_track) Tracking_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_particle_flow) { - gROOT->LoadMacro("G4_ParticleFlow.C"); - ParticleFlow(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_tracking_eval) Tracking_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_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - // 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); - } - - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - in1->AddFile(embed_input_file); // if one use a single input file -// in1->AddListFile(embed_input_file); // Recommended: if one use a text list of many input files - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning - se->registerInputManager(in1); - } - - if (readhepmc) - { - //meta-lib for DST objects used in simulation outputs - gSystem->Load("libg4dst.so"); - - Fun4AllHepMCInputManager *in = new Fun4AllHepMCInputManager("HepMCInput_1"); - se->registerInputManager(in); - se->fileopen(in->Name().c_str(), inputFile); - //in->set_vertex_distribution_width(100e-4,100e-4,30,0);//optional collision smear in space, time - //in->set_vertex_distribution_mean(0,0,1,0);//optional collision central position shift in space, time - // //optional choice of vertex distribution function in space, time - //in->set_vertex_distribution_function(PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Gaus,PHHepMCGenHelper::Uniform,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 - //in->set_embedding_id(2); - } - 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 (pileup_collision_rate > 0) - { - // pile up simulation. - // add random beam collisions following a collision diamond and rate from a HepMC stream - Fun4AllHepMCPileupInputManager *pileup = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); - pileup->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); - pileup->set_vertex_distribution_mean(0, 0, 0, 0); - pileup->set_vertex_distribution_width(100e-4, 100e-4, 30, 5); - se->registerInputManager(pileup); - - const string pileupfile("/sphenix/sim/sim01/sHijing/sHijing_0-12fm.dat"); - //background files for p+p pileup sim - //const string pileupfile("/gpfs/mnt/gpfs04/sphenix/user/shlim/04.InnerTrackerTaskForce/01.PythiaGen/list_pythia8_mb.dat"); - pileup->AddFile(pileupfile); // HepMC events used in pile up collisions. You can add multiple files, and the file list will be reused. - //pileup->set_vertex_distribution_width(100e-4,100e-4,30,5);//override collision smear in space time - //pileup->set_vertex_distribution_mean(0,0,0,0);//override collision central position shift in space time - pileup->set_collision_rate(pileup_collision_rate); - - double time_window_minus = -35000; - double time_window_plus = 35000; - - if (do_tracking) - { - // This gets the default drift velocity only! - PHG4TpcElectronDrift *dr = (PHG4TpcElectronDrift *)se->getSubsysReco("PHG4TpcElectronDrift"); - assert(dr); - double TpcDriftVelocity = dr->get_double_param("drift_velocity"); - time_window_minus = -105.5 / TpcDriftVelocity; // ns - time_window_plus = 105.5 / TpcDriftVelocity; // ns; - } - pileup->set_time_window(time_window_minus, time_window_plus); // override timing window in ns - cout << "Collision pileup enabled using file " << pileupfile << " with collision rate " << pileup_collision_rate - << " and time window " << time_window_minus << " to " << time_window_plus << endl; - } - - 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_tracking, - /*bool*/ do_bbc, - /*bool*/ do_cemc, - /*bool*/ do_hcalin, - /*bool*/ do_magnet, - /*bool*/ do_hcalout, - /*bool*/ do_epd, - /*bool*/ do_cemc_twr, - /*bool*/ do_hcalin_twr, - /*bool*/ do_hcalout_twr); - } - - if(do_write_output) { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - if (do_dst_compress) DstCompress(out); - se->registerOutputManager(out); - } - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return 0; - } - // 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 0; - } - - if(display_on) - { - DisplayOn(); - // prevent macro from finishing so can see display - int i; - cout << "***** Enter any integer to proceed" << endl; - cin >> i; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - return 0; -} - - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunFFALoadTest() {} diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C deleted file mode 100644 index a64fc86a2..000000000 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ /dev/null @@ -1,425 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Aerogel.C" -#include "G4_Barrel_EIC.C" -#include "G4_BlackHole.C" -#include "G4_CEmc_EIC.C" -#include "G4_DIRC.C" -#include "G4_EEMC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_FST_EIC.C" -#include "G4_GEM_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Input.C" -#include "G4_Magnet.C" -#include "G4_Mvtx_EIC.C" -#include "G4_Pipe_EIC.C" -#include "G4_PlugDoor_EIC.C" -#include "G4_RICH.C" -#include "G4_TPC_EIC.C" -#include "G4_Tracking_EIC.C" -#include "G4_User.C" -#include "G4_World.C" - -#include - -#include - -#include -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4decayer.so) -R__LOAD_LIBRARY(libg4detectors.so) - -void G4Init() -{ -// First some check for subsystems which do not go together - - if (Enable::TPC && Enable::FST) - { - cout << "TPC and FST cannot be enabled together" << endl; - gSystem->Exit(1); - } - else if ((Enable::TPC || Enable::MVTX) && Enable::BARREL) - { - cout << "TPC/MVTX and BARREL cannot be enabled together" << endl; - gSystem->Exit(1); - } - - // load detector/material macros and execute Init() function - if (Enable::PIPE) - { - PipeInit(); - } - - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - - if (Enable::EGEM) - { - EGEM_Init(); - } - if (Enable::FGEM) - { - FGEM_Init(); - } - if (Enable::FST) - { - FST_Init(); - } - if (Enable::BARREL) - { - BarrelInit(); - } - if (Enable::MVTX) - { - MvtxInit(); - } - if (Enable::TPC) - { - TPCInit(); - } - if (Enable::TRACKING) - { - TrackingInit(); - } - - if (Enable::CEMC) - { - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (Enable::HCALIN) - { - HCalInnerInit(1); - } - - if (Enable::MAGNET) - { - MagnetInit(); - } - if (Enable::HCALOUT) - { - HCalOuterInit(); - } - - if (Enable::FEMC) - { - FEMCInit(); - } - - if (Enable::FHCAL) - { - FHCALInit(); - } - - if (Enable::EEMC) - { - EEMCInit(); - } - - if (Enable::DIRC) - { - DIRCInit(); - } - - if (Enable::RICH) - { - RICHInit(); - } - - if (Enable::AEROGEL) - { - AerogelInit(); - } - if (Enable::USER) - { - UserInit(); - } - - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } -} - -int G4Setup() -{ - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco *g4Reco = new PHG4Reco(); - - WorldInit(g4Reco); - - 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 (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("sPHENIX.root") != string::npos) - { - 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); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (Enable::PIPE) - { - radius = Pipe(g4Reco, radius); - } - //---------------------------------------- - - if (Enable::EGEM) - { - EGEMSetup(g4Reco); - } - - if (Enable::FGEM) - { - FGEMSetup(g4Reco); - } - if (Enable::FST) - { - FSTSetup(g4Reco); - } - if (Enable::BARREL) - { - Barrel(g4Reco, radius); - } - if (Enable::MVTX) - { - radius = Mvtx(g4Reco, radius); - } - if (Enable::TPC) - { - radius = TPC(g4Reco, radius); - } - - //---------------------------------------- - // CEMC - // - if (Enable::CEMC) - { - radius = CEmc(g4Reco, radius); - } - - //---------------------------------------- - // HCALIN - - if (Enable::HCALIN) - { - radius = HCalInner(g4Reco, radius, 4); - } - //---------------------------------------- - // MAGNET - - if (Enable::MAGNET) - { - radius = Magnet(g4Reco, radius, 0); - } - //---------------------------------------- - // HCALOUT - - if (Enable::HCALOUT) - { - radius = HCalOuter(g4Reco, radius, 4); - } - //---------------------------------------- - // FEMC - - if (Enable::FEMC) - { - FEMCSetup(g4Reco); - } - - //---------------------------------------- - // FHCAL - - if (Enable::FHCAL) - { - FHCALSetup(g4Reco); - } - //---------------------------------------- - // EEMC - - if (Enable::EEMC) - { - EEMCSetup(g4Reco); - } - - //---------------------------------------- - // PID - - if (Enable::DIRC) - { - DIRCSetup(g4Reco); - } - - if (Enable::RICH) - { - RICHSetup(g4Reco); - } - - if (Enable::AEROGEL) - { - AerogelSetup(g4Reco); - } - //---------------------------------------- - // sPHENIX forward flux return door - if (Enable::PLUGDOOR) - { - PlugDoor(g4Reco); - } - if (Enable::USER) - { - UserDetector(g4Reco); - } - //---------------------------------------- - // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions - 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() -{ - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_FIELDCAGE"); - 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 5d04f5a17..000000000 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ /dev/null @@ -1,335 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_BlackHole.C" -#include "G4_CEmc_Spacal.C" -#include "G4_FEMC.C" -#include "G4_FGEM_fsPHENIX.C" -#include "G4_FHCAL.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" -#include "G4_Mvtx.C" -#include "G4_Pipe.C" -#include "G4_Piston.C" -#include "G4_PlugDoor_fsPHENIX.C" -#include "G4_TPC.C" -#include "G4_Tracking_fsPHENIX.C" -#include "G4_User.C" -#include "G4_World.C" - -#include - -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4decayer.so) -R__LOAD_LIBRARY(libg4detectors.so) - -void ShowerCompress(int verbosity = 0); -void DstCompress(Fun4AllDstOutputManager *out); - -void RunLoadTest() {} - -void G4Init() -{ - // 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::CEMC) - { - CEmcInit(); - } - - if (Enable::HCALIN) - { - HCalInnerInit(); - } - - if (Enable::MAGNET) - { - MagnetInit(); - } - if (Enable::HCALOUT) - { - HCalOuterInit(); - } - - if (Enable::FGEM) - { - FGEM_Init(); - } - - if (Enable::FEMC) - { - FEMCInit(); - } - - if (Enable::FHCAL) - { - FHCALInit(); - } - if (Enable::PISTON) - { - PistonInit(); - } - - if (Enable::PLUGDOOR) - { - PlugDoorInit(); - } - if (Enable::USER) - { - UserInit(); - } - - if (Enable::BLACKHOLE) - { - BlackHoleInit(); - } -} - -int G4Setup() -{ - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco *g4Reco = new PHG4Reco(); - g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST - WorldInit(g4Reco); - g4Reco->set_rapidity_coverage(1.1); // according to drawings - 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("sPHENIX.root") != string::npos) - { - 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); - - double radius = 0.; - - //---------------------------------------- - // PIPE - 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); - } - //---------------------------------------- - // CEMC - // - if (Enable::CEMC) - { - radius = CEmc(g4Reco, radius, 8); - } - - //---------------------------------------- - // HCALIN - - if (Enable::HCALIN) - { - radius = HCalInner(g4Reco, radius, 4); - } - - //---------------------------------------- - // MAGNET - - if (Enable::MAGNET) - { - radius = Magnet(g4Reco, radius, 0); - } - - //---------------------------------------- - // HCALOUT - - if (Enable::HCALOUT) - { - radius = HCalOuter(g4Reco, radius, 4); - } - - //---------------------------------------- - // Forward tracking - - if (Enable::FGEM) - { - FGEMSetup(g4Reco); - } - - //---------------------------------------- - // FEMC - - if (Enable::FEMC) - { - FEMCSetup(g4Reco); - } - //---------------------------------------- - // FHCAL - - if (Enable::FHCAL) - { - FHCALSetup(g4Reco); - } - if (Enable::PISTON) - { - Piston(g4Reco); - } - - if (Enable::PLUGDOOR) - { - PlugDoor(g4Reco); - } - - if (Enable::USER) - { - UserDetector(g4Reco); - } - - 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->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"); - } -} diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C deleted file mode 100644 index 6e1cbe251..000000000 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ /dev/null @@ -1,356 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "G4_Pipe.C" -#include "G4_Tracking.C" -#include "G4_Bbc.C" -#include "G4_CEmc_Spacal.C" -#include "G4_HcalIn_ref.C" -#include "G4_Magnet.C" -#include "G4_HcalOut_ref.C" -#include "G4_PlugDoor.C" -#include "G4_FEMC.C" -#include "G4_EPD.C" -#include "G4_MvtxService.C" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -class SubsysReco; -R__LOAD_LIBRARY(libg4decayer.so) -R__LOAD_LIBRARY(libg4detectors.so) -#else -bool overlapcheck = false; // set to true if you want to check for overlaps -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -#endif - -// This function is only used to test if we can load this as root6 macro -// without running into unresolved libraries and include files -void RunLoadTest() {} - -void G4Init(const bool do_tracking = true, - const bool do_bbc = 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_plugdoor = false, - const bool do_FEMC = false, - const bool do_epd = false, - const bool do_mvtxservice = false - ) - { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_tracking) - { - gROOT->LoadMacro("G4_Tracking.C"); - TrackingInit(); - } - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - } - - 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_pipe) - { - gROOT->LoadMacro("G4_PlugDoor.C"); - PlugDoorInit(); - } - if (do_FEMC) - { - gROOT->LoadMacro("G4_FEMC.C"); - FEMCInit(); - } - if (do_epd) - { - gROOT->LoadMacro("G4_EPD.C"); - EPDInit(); - } - if (do_mvtxservice) - { - gROOT->LoadMacro("G4_MvtxService.C"); - MVTXServiceInit(); - } - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - const EDecayType decayType = EDecayType::kAll, -#else - const EDecayType decayType = TPythia6Decayer::kAll, -#endif - const bool do_tracking = true, - const bool do_bbc = 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_plugdoor = true, - const bool do_FEMC = false, - const bool do_epd = true, - const bool do_mvtxservice = false, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - - 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 ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) - if (decayType != EDecayType::kAll) -#else - if (decayType != TPythia6Decayer::kAll) -#endif - { - 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, PHFieldConfig::Field3DCartesian); - } else { - g4Reco->set_field_map(field, PHFieldConfig::kField2D); - } - } 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); - - //---------------------------------------- - // TRACKING - if (do_tracking) radius = Tracking(g4Reco, radius, absorberactive); - - //---------------------------------------- - // BBC - if (do_bbc) - { - cout << "IN DO_BBC" << endl; - radius = Bbc(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); - - //---------------------------------------- - // sPHENIX forward flux return door - if (do_plugdoor) PlugDoor(g4Reco, absorberactive); - - // forward EMC - if(do_FEMC) FEMCSetup(g4Reco, absorberactive); - - if (do_epd) EPDSetup(g4Reco); - - //MVTX service barrel - if(do_mvtxservice) radius = MVTXService(g4Reco, radius); - - //---------------------------------------- - // 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 ); - return 0; -} - -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->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"); - compress->AddHitContainer("G4HIT_FEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); - compress->AddCellContainer("G4CELL_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); - compress->AddHitContainer("G4HIT_MVTXSERVICE"); - 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_BBC"); - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4CELL_FEMC"); - out->StripNode("G4HIT_MVTXSERVICE"); - } -} diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C deleted file mode 100644 index 767828ead..000000000 --- a/macros/g4simulations/G4_Aerogel.C +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -/*! - * \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 $ - */ - -namespace Enable -{ - bool AEROGEL = false; -} - -void AerogelInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 164.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 287.); -} - -void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.242) -{ - PHG4SectorSubsystem* 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.85)); - 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 = 18.; // 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_Barrel_EIC.C b/macros/g4simulations/G4_Barrel_EIC.C deleted file mode 100644 index 0df58b843..000000000 --- a/macros/g4simulations/G4_Barrel_EIC.C +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -//#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) -//---------------------------------------------------------------------// -namespace Enable -{ - bool BARREL = false; - bool BARREL_ABSORBER = false; -} // namespace Enable -//---------------------------------------------------------------------// -void BarrelInit() -{ -} -//---------------------------------------------------------------------// -double Barrel(PHG4Reco* g4Reco, double radius) -{ - const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; - - //--------------------------------- - //build barrel1 detector - //--------------------------------- - const int nLayer1 = 3; //barrel 1 - const int nLayer2 = 2; //barrel 2 - int nLayer[2]={nLayer1,nLayer2}; - - const int nSubLayer = 7; - const float um = 0.0001; //convert um to cm - - double r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 - {16, 22.0}}; //barrel 2 - - double halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 - {25,25}}; //barrel 2 - - string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", - "Support1", "Support_Gap", "Support2"}; - string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", - "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {35 * um, 15 * um, 20 * um, 100 * um, - 50 * um, 1, 50 * um}; - - int k = 0; //layer id. Must be unique. - double max_bh_radius = 0.; - PHG4CylinderSubsystem* cyl[2]; - for (int n = 0; n < 2; n++) { //barrel1, barrel2 - for (int i = 0; i < nLayer[n]; i++) - { - if (n==1) thickness[0]=85*um; - - for (int j = 0; j < nSubLayer; j++) - { - //cyl[n] = new PHG4CylinderSubsystem("Barrel"+ n +"_" + + layerName[j], k); - cyl[n] = new PHG4CylinderSubsystem(Form("Barrel%d_%s",n,layerName[j].c_str()), k); - if (j == 0) - { - cyl[n]->set_double_param("radius", r[n][i]); - } - else - { - cyl[n]->set_double_param("radius", r[n][i] + thickness[j - 1]); - } - cyl[n]->set_double_param("length", 2.0 * halfLength[n][i]); - cyl[n]->set_string_param("material", material[j]); - cyl[n]->set_double_param("thickness", thickness[j]); - max_bh_radius = std::max(max_bh_radius, (r[n][i] + thickness[j - 1] + thickness[j])); - cyl[n]->SuperDetector(Form("BARREL%d",n)); - if (j == 0) - { - cyl[n]->SetActive(); //only the Silicon Sensor is active - } - else - { - if (AbsorberActive) cyl[n]->SetActive(); - } - g4Reco->registerSubsystem(cyl[n]); - k++; - } - } - } - - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[1][0]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[0][0]); - return max_bh_radius; -} -//---------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C deleted file mode 100644 index d9c581da1..000000000 --- a/macros/g4simulations/G4_Bbc.C +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include -#include - -R__LOAD_LIBRARY(libg4bbc.so) - -namespace Enable -{ - bool BBC = false; -} - -namespace G4BBC -{ - double z_smearing = 0.; // should be 6mm, temporary to 0 for TPC - double t_smearing = 0.002; // 20ps timing resolution -} - -void BbcInit() -{ - cout << "BbcInit()" << endl; - // Nothing to Init for now -} - -double Bbc(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - - gSystem->Load("libg4detectors.so"); - - cout << "XXXX CREATING BBC" << endl; - PHG4BbcSubsystem *bbc = new PHG4BbcSubsystem( "BBC" ); - bbc->SuperDetector( "BBC" ); - g4Reco->registerSubsystem( bbc ); - - radius = 15.; // outer shell is 15 cm - return radius; -} - - -void Bbc_Reco(int verbosity = 0) -{ - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - // disable fast sim for now - int do_bbcfast = 0; - if ( do_bbcfast ) - { - BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(G4BBC::z_smearing); - bbcvertex->set_t_smearing(G4BBC::t_smearing); - se->registerSubsystem(bbcvertex); - } - - return; -} diff --git a/macros/g4simulations/G4_BlackHole.C b/macros/g4simulations/G4_BlackHole.C deleted file mode 100644 index cbf64b26e..000000000 --- a/macros/g4simulations/G4_BlackHole.C +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool BLACKHOLE = false; -} - -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(); - blackhole->SetActive(); // always 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(); - blackhole->SetActive(); // always 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(); - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(true); - g4Reco->registerSubsystem(blackhole); - return; -} diff --git a/macros/g4simulations/G4_CEmc_EIC.C b/macros/g4simulations/G4_CEmc_EIC.C deleted file mode 100644 index 78db65cb4..000000000 --- a/macros/g4simulations/G4_CEmc_EIC.C +++ /dev/null @@ -1,316 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 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; - int CEMC_VERBOSITY = 0; -} - -namespace G4CEMC -{ - double cemcdepth = 9; - // tungs to scint width ratio of ~10:1 - // corresponds to approx 2% sampling fraction - - // 18 radiation lengths for 40 layers - double scint_width = 0.05; - double tungs_width = 0.245; - double electronics_width = 0.5; - - int min_cemc_layer = 1; - int max_cemc_layer = 41; - - double topradius = 106.8; // cm - double bottomradius = 95; // cm - double negrapidity = -1.5; - double posrapidity = 1.24; - // this is default set to -1.5 95) - { - cout << "inconsistency, radius: " << radius - << " larger than allowed inner radius for CEMC = 95 cm" << endl; - gSystem->Exit(-1); - } - - radius = 95; - - PHG4CylinderSubsystem *cemc; - - // determine the length of the calorimeter - // can adjust length coverage by just adjusting these values - // rapidity coverage will be determined by z shift of EMCAl - // as indicated in the loop below - - // eta = -ln(tan(theta/2)) - double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::posrapidity)); - double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::negrapidity)); - // get the angle between the beam pipe and negative pseudorapidity axis - theta2 = M_PI - theta2; - - double z1 = G4CEMC::topradius / TMath::Tan(theta1); - double z2 = G4CEMC::topradius / TMath::Tan(theta2); - - double z3 = G4CEMC::bottomradius / TMath::Tan(theta1); - double z4 = G4CEMC::bottomradius / TMath::Tan(theta2); - - // this is the top layer length - double totaltoplength = z1 + z2; - // this is the bottom layer length - double totalbottomlength = z3 + z4; - - //Added by Barak, 12/12/19 - double ztemp = 0; - double layer_shift = 0; - - double height = 0; - for (int thislayer = G4CEMC::min_cemc_layer; thislayer <= G4CEMC::max_cemc_layer; - thislayer++) - { - // the length for a particular layer is determined from the bottom length - double thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); - - cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); - cemc->set_double_param("radius", radius); - cemc->set_string_param("material", "Spacal_W_Epoxy"); - cemc->set_double_param("thickness", G4CEMC::tungs_width); - cemc->set_double_param("length", thislength); - cemc->set_int_param("lengthviarapidity", 0); - - // starts centered around IP - // shift backwards 30 cm for total 370 cm length to cover -1.5set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - ztemp = radius / TMath::Tan(theta2); - layer_shift = -1. * (ztemp - (thislength / 2.)); - cemc->set_double_param("place_z", layer_shift); - - cemc->SuperDetector("ABSORBER_CEMC"); - if (AbsorberActive) cemc->SetActive(); - cemc->OverlapCheck(OverlapCheck); - - g4Reco->registerSubsystem(cemc); - - radius += G4CEMC::tungs_width; - radius += no_overlapp; - - height += G4CEMC::tungs_width; - height += no_overlapp; //Added by Barak, 12/13/19 - - //Added by Barak, 12/13/19 - thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); - - cemc = new PHG4CylinderSubsystem("CEMC", thislayer); - cemc->set_double_param("radius", radius); - cemc->set_string_param("material", "PMMA"); - cemc->set_double_param("thickness", G4CEMC::scint_width); - cemc->set_int_param("lightyield", 1); - cemc->set_int_param("lengthviarapidity", 0); - cemc->set_double_param("length", thislength); - - // shift back -30 cm to cover -1.4set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - cemc->set_double_param("place_z", layer_shift); - - cemc->SuperDetector("CEMC"); - - cemc->SetActive(); - cemc->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cemc); - - radius += G4CEMC::scint_width; - radius += no_overlapp; - - height += G4CEMC::scint_width; - height += no_overlapp; //Added by Barak, 12/13/19 - } - - PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cemc_cyl->set_double_param("radius", radius); - cemc_cyl->set_string_param("material", "G4_TEFLON"); - cemc_cyl->set_double_param("thickness", G4CEMC::electronics_width); - - double l1 = (radius + 0.5) / TMath::Tan(theta1); - double l2 = (radius + 0.5) / TMath::Tan(theta2); - cemc_cyl->set_int_param("lengthviarapidity", 0); - cemc_cyl->set_double_param("length", l1 + l2); - // shift back -30 cm to cover -1.4set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - layer_shift = -1. * ((l2 - l1) / 2.); - cemc_cyl->set_double_param("place_z", layer_shift); - - if (AbsorberActive) cemc_cyl->SetActive(); - cemc_cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cemc_cyl); - // update black hole settings since we have the values here - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + G4CEMC::electronics_width); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2) / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift - (l1 + l2) / 2.); - - return radius; -} - -void CEMC_Cells() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - double radius = 95; - for (int i = G4CEMC::min_cemc_layer; i <= G4CEMC::max_cemc_layer; i++) - { - //Added by Barak, 12/13/19 - radius += (G4CEMC::tungs_width + no_overlapp); - if (i > 1) radius += (G4CEMC::scint_width + no_overlapp); - - cemc_cells->cellsize(i, 2. * M_PI / 256. * radius, 2. * M_PI / 256. * radius); - } - se->registerSubsystem(cemc_cells); - - return; -} - -void CEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - CemcTowerBuilder->Detector("CEMC"); - CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); - CemcTowerBuilder->Verbosity(verbosity); - se->registerSubsystem(CemcTowerBuilder); - - const double photoelectron_per_GeV = 500; // 500 photon per total GeV deposition - // just set a 4% sampling fraction - already tuned by tungs/scint width ratio - double sampling_fraction = 4e-02; - RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); - CemcTowerDigitizer->Detector("CEMC"); - CemcTowerDigitizer->Verbosity(verbosity); - CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - CemcTowerDigitizer->set_pedstal_central_ADC(0); - CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error - CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting - se->registerSubsystem(CemcTowerDigitizer); - - RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - CemcTowerCalibration->Detector("CEMC"); - CemcTowerCalibration->Verbosity(verbosity); - CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); - CemcTowerCalibration->set_pedstal_ADC(0); - - se->registerSubsystem(CemcTowerCalibration); - - return; -} - -void CEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) - { - RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - - cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - cemc_clusterbuilder->LoadProfile(femc_prof); - se->registerSubsystem(cemc_clusterbuilder); - } - else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) - { - RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - se->registerSubsystem(cemc_clusterbuilder); - } - else - { - cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; - exit(1); - } - 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.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - return; -} diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C deleted file mode 100644 index 136ff3713..000000000 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ /dev/null @@ -1,476 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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, const int absorberactive = 0); -double -CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0); - -R__LOAD_LIBRARY(libcalo_reco.so) -R__LOAD_LIBRARY(libg4calo.so) -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.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; - int CEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4CEMC -{ - 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; - - 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, - const int absorberactive = 0) -{ - if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ - crossings, /*const int*/ absorberactive); - } - else if (G4CEMC::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 #" - << 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, const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER || absorberactive; - 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, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER || absorberactive; - 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; - - 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_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 * TMath::Pi() / 256. * radius, 2 * TMath::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 - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - 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 - se->registerSubsystem(TowerDigitizer); - - if (G4CEMC::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 (G4CEMC::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/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); - } - else - { - cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; - gSystem->Exit(-1); - return; - } - - 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; -} diff --git a/macros/g4simulations/G4_CaloTrigger.C b/macros/g4simulations/G4_CaloTrigger.C deleted file mode 100644 index 8e183621f..000000000 --- a/macros/g4simulations/G4_CaloTrigger.C +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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; -} diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C deleted file mode 100644 index 3846bd993..000000000 --- a/macros/g4simulations/G4_DIRC.C +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -/*! - * \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 $ - */ - -namespace Enable -{ - bool DIRC = false; -} - -namespace G4DIRC -{ - double radiator_R = 83.65; - double length = 400; - double z_shift = -75; //115 - double z_start = z_shift + length / 2.; - double z_end = z_shift - length / 2.; - double outer_skin_radius = 89.25; -} // namespace G4DIRC - -void DIRCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4DIRC::outer_skin_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4DIRC::z_start); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4DIRC::z_end); -} - -//! 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) -{ - PHG4SectorSubsystem *dirc; - dirc = new PHG4SectorSubsystem("DIRC"); - dirc->get_geometry().set_normal_polar_angle(M_PI / 2); - dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::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_double_param("length", G4DIRC::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", G4DIRC::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", G4DIRC::outer_skin_radius - 0.076); - cyl->set_double_param("length", G4DIRC::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", G4DIRC::z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cyl); - - // Done - return G4DIRC::outer_skin_radius; -} diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C deleted file mode 100644 index 3704fcf6c..000000000 --- a/macros/g4simulations/G4_DSTReader.C +++ /dev/null @@ -1,144 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -R__LOAD_LIBRARY(libg4eval.so) -#endif - -////////////////////////////////////////////////////////////////// -/*! - \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 G4DSTreaderInit() {} - -void -G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_bbc = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_epd = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = 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_bbc) - { - ana->AddNode("BBC"); - } - - 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_epd) - { - ana->AddNode("EPD"); - } - - 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 8d4f47cfe..000000000 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ /dev/null @@ -1,208 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Barrel_EIC.C" -#include "G4_CEmc_EIC.C" -#include "G4_EEMC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_FST_EIC.C" -#include "G4_GEM_EIC.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" -#include "G4_Mvtx_EIC.C" -#include "G4_TPC_EIC.C" - -#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 G4DSTreader_EICDetectorInit() {} -void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") -{ - //! debug output on screen? - 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::BARREL) - { - ana->AddNode("BARREL"); - } - if (Enable::MVTX) - { - ana->AddNode("MVTX"); - } - if (Enable::TPC) - { - ana->AddNode("TPC"); - } - - if (Enable::EGEM) - { - ana->AddNode("EGEM_0"); - ana->AddNode("EGEM_1"); - ana->AddNode("EGEM_2"); - ana->AddNode("EGEM_3"); - } - if (Enable::FGEM) - { - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - if (Enable::FST) - { - ana->AddNode("FST_0"); - ana->AddNode("FST_1"); - ana->AddNode("FST_2"); - ana->AddNode("FST_3"); - ana->AddNode("FST_4"); - ana->AddNode("FST_5"); - } - } - - 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::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } - - if (Enable::EEMC) - { - ana->AddNode("EEMC"); - } - - 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"); - } - if (Enable::FHCAL_TOWER) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (Enable::FEMC_TOWER) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - if (Enable::FEMC_TOWER) - { - 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 829bd465e..000000000 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ /dev/null @@ -1,189 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Intt.C" -#include "G4_Mvtx.C" -#include "G4_TPC.C" -#include "G4_CEmc_Spacal.C" -#include "G4_HcalIn_ref.C" -#include "G4_HcalOut_ref.C" -#include "G4_Magnet.C" -#include "G4_FHCAL.C" -#include "G4_FEMC.C" -#include "G4_FGEM_fsPHENIX.C" - - -#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 G4DSTREADER -{ - bool save_g4_raw = true; - double tower_zero_supp = 1.e-6; -} - - - - -void G4DSTreader_fsPHENIXInit() {} - -void -G4DSTreader_fsPHENIX( const string &outputFile = "G4sPHENIXCells.root") -{ - - //! debug output on screen? - int verbosity = max(Enable::VERBOSITY,Enable::DSTREADER_VERBOSITY); - - // 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); - - 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::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::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } - - if (Enable::FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - 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"); - } - if (Enable::FHCAL_TOWER) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (Enable::FEMC_TOWER) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - - // Jets disabled for now -// if (Enable::JETS) -// { -// -// 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 d37cf7da5..000000000 --- a/macros/g4simulations/G4_EEMC.C +++ /dev/null @@ -1,168 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 EEMC = false; - bool EEMC_CELL = false; - bool EEMC_TOWER = false; - bool EEMC_CLUSTER = false; - bool EEMC_EVAL = false; - bool EEMC_OVERLAPCHECK = false; - int EEMC_VERBOSITY = 0; -} - -namespace G4EEMC -{ - int use_projective_geometry = 0; - double Gdz = 18. + 0.0001; - double Gz0 = -170.; -} // namespace G4EEMC - -void EEMCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); // from towerMap_EEMC_v006.txt - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); -} - -void EEMCSetup(PHG4Reco *g4Reco) -{ - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::EEMC_OVERLAPCHECK; - - /** Use dedicated EEMC module */ - PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); - - /* path to central copy of calibrations repositry */ - ostringstream mapping_eemc; - - /* Use non-projective geometry */ - if (!G4EEMC::use_projective_geometry) - { - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - eemc->SetTowerMappingFile(mapping_eemc.str()); - } - - /* use projective geometry */ - else - { - ostringstream mapping_eemc_4x4construct; - - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; - mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; - eemc->SetProjectiveGeometry(mapping_eemc.str(), mapping_eemc_4x4construct.str()); - } - - eemc->OverlapCheck(OverlapCheck); - - // SetAbsorberActive method not implemented - // if (AbsorberActive) eemc->SetAbsorberActive(); - - /* register Ecal module */ - g4Reco->registerSubsystem(eemc); -} - -void EEMC_Cells() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); - hc->Detector("EEMC"); - se->registerSubsystem(hc); - - return; -} - -void EEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_eemc; - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.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 = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); - - return; -} - -void EEMC_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - 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_EPD.C b/macros/g4simulations/G4_EPD.C deleted file mode 100644 index 083b011b8..000000000 --- a/macros/g4simulations/G4_EPD.C +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4epd.so) - -namespace Enable { - bool EPD = false; - bool EPD_OVERLAPCHECK = false; -} - -void EPDInit() { } - -void EPDSetup(PHG4Reco* g4Reco) { - bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; - - PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); - - epd->SuperDetector("EPD"); - epd->OverlapCheck(overlap_check); - - g4Reco->registerSubsystem(epd); -} diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C deleted file mode 100644 index cbf9ed4fe..000000000 --- a/macros/g4simulations/G4_FEMC.C +++ /dev/null @@ -1,261 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 FEMC = false; - bool FEMC_ABSORBER = false; - bool FEMC_CELL = false; - bool FEMC_TOWER = false; - bool FEMC_CLUSTER = false; - int FEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4FEMC -{ - // from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt - double Gz0 = 305.; - double Gdz = 40.; - double outer_radius = 180.; - string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - enum enu_Femc_clusterizer - { - kFemcGraphClusterizer, - kFemcTemplateClusterizer - }; - - //template clusterizer, as developed by Sasha Bazilevsky - enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; - // graph clusterizer - //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; -} // namespace G4FEMC - -void FEMCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); -} - -void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive>0); - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); - mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - - // cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile(mapping_femc.str()); - femc->OverlapCheck(overlapcheck); - femc->SetActive(); - femc->SuperDetector("FEMC"); - if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); - - g4Reco->registerSubsystem(femc); -} - -void FEMC_Cells() -{ - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void FEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - - 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 ); - - // E864 towers (three types for three sizes) - RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); - TowerDigitizer3->Detector("FEMC"); - TowerDigitizer3->TowerType(3); - TowerDigitizer3->Verbosity(verbosity); - TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer3); - - RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); - TowerDigitizer4->Detector("FEMC"); - TowerDigitizer4->TowerType(4); - TowerDigitizer4->Verbosity(verbosity); - TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer4); - - RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); - TowerDigitizer5->Detector("FEMC"); - TowerDigitizer5->TowerType(5); - TowerDigitizer5->Verbosity(verbosity); - TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer5); - - RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); - TowerDigitizer6->Detector("FEMC"); - TowerDigitizer6->TowerType(6); - TowerDigitizer6->Verbosity(verbosity); - TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer6); - - // 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 ); - - // E864 towers (three types for three sizes) - RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); - TowerCalibration3->Detector("FEMC"); - TowerCalibration3->TowerType(3); - TowerCalibration3->Verbosity(verbosity); - TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration3->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration3->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration3); - - RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); - TowerCalibration4->Detector("FEMC"); - TowerCalibration4->TowerType(4); - TowerCalibration4->Verbosity(verbosity); - TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration4->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration4->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration4); - - RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); - TowerCalibration5->Detector("FEMC"); - TowerCalibration5->TowerType(5); - TowerCalibration5->Verbosity(verbosity); - TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration5->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration5->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration5); - - RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); - TowerCalibration6->Detector("FEMC"); - TowerCalibration6->TowerType(6); - TowerCalibration6->Verbosity(verbosity); - TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration6->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration6->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration6); -} - -void FEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; - exit(1); - } - - return; -} - -void FEMC_Eval(std::string outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY,Enable::FEMC_VERBOSITY); - 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 e471c2618..000000000 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ /dev/null @@ -1,268 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 FEMC = false; - bool FEMC_ABSORBER = false; - bool FEMC_CELL = false; - bool FEMC_TOWER = false; - bool FEMC_CLUSTER = false; - bool FEMC_EVAL = false; - bool FEMC_OVERLAPCHECK = false; - int FEMC_VERBOSITY = 0; -} - -namespace G4FEMC -{ - // from ForwardEcal/mapping/towerMap_FEMC_v007.txt - const double Gz0 = 310.; - const double Gdz = 36.5; - const double outer_radius = 182.655; - enum enu_Femc_clusterizer - { - kFemcGraphClusterizer, - kFemcTemplateClusterizer - }; - //template clusterizer, as developed by Sasha Bazilevsky - enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; - // graph clusterizer - //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; -} // namespace G4FEMC - -void FEMCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); -} - -void FEMCSetup(PHG4Reco *g4Reco) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // femc->SetEICDetector(); - - // fsPHENIX ECAL - // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - - cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile(mapping_femc.str()); - femc->OverlapCheck(OverlapCheck); - femc->SetActive(); - femc->SuperDetector("FEMC"); - if (AbsorberActive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem(femc); -} - -void FEMC_Cells() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void FEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // // fsPHENIX ECAL - // mapping_femc << getenv("CALIBRATIONROOT") << - // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.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); - - // // E864 towers (three types for three sizes) - // RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); - // TowerDigitizer3->Detector("FEMC"); - // TowerDigitizer3->TowerType(3); - // TowerDigitizer3->Verbosity(verbosity); - // TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer3 ); - // - // RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); - // TowerDigitizer4->Detector("FEMC"); - // TowerDigitizer4->TowerType(4); - // TowerDigitizer4->Verbosity(verbosity); - // TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer4 ); - // - // RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); - // TowerDigitizer5->Detector("FEMC"); - // TowerDigitizer5->TowerType(5); - // TowerDigitizer5->Verbosity(verbosity); - // TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer5 ); - // - // RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); - // TowerDigitizer6->Detector("FEMC"); - // TowerDigitizer6->TowerType(6); - // TowerDigitizer6->Verbosity(verbosity); - // TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer6 ); - - // 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); - - // // E864 towers (three types for three sizes) - // RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); - // TowerCalibration3->Detector("FEMC"); - // TowerCalibration3->TowerType(3); - // TowerCalibration3->Verbosity(verbosity); - // TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration3->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration3 ); - // - // RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); - // TowerCalibration4->Detector("FEMC"); - // TowerCalibration4->TowerType(4); - // TowerCalibration4->Verbosity(verbosity); - // TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration4->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration4 ); - // - // RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); - // TowerCalibration5->Detector("FEMC"); - // TowerCalibration5->TowerType(5); - // TowerCalibration5->Verbosity(verbosity); - // TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration5->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration5 ); - // - // RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); - // TowerCalibration6->Detector("FEMC"); - // TowerCalibration6->TowerType(6); - // TowerCalibration6->Verbosity(verbosity); - // TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration6->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration6 ); -} - -void FEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; - exit(1); - } - - return; -} - -void FEMC_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - 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 dcee2d1b1..000000000 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ /dev/null @@ -1,352 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_FEMC.C" -#include "G4_FHCAL.C" - -#include - -#include - -#include -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) - -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8); -void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); - -namespace Enable -{ - bool FGEM = false; - bool FGEM_OVERLAPCHECK = false; - bool FGEM_TRACK = false; - bool FGEM_EVAL = false; - int FGEM_VERBOSITY = 0; -} - -void FGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); - TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks -} - -void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // -) -{ - const double tilt = .1; - - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; - - 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); - - 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); - - 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); - - 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; - - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; - - 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); - - 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); - return 0; -} - -void FGEM_FastSim_Reco() -{ -int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(verbosity); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name(TRACKING::TrackNodeName); - - // MAPS in MVTX detector - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM0, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM1, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // TPC - kalman->add_phg4hits( - "G4HIT_TPC", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM4, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // Saved track states (projections) - - if (Enable::FEMC) - { - kalman->add_state_name("FEMC"); - } - if (Enable::FHCAL) - { - kalman->add_state_name("FHCAL"); - } - se->registerSubsystem(kalman); -} - -void FGEM_FastSim_Eval(const std::string &outputfile) -{ -int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); - fast_sim_eval->set_filename(outputfile); - se->registerSubsystem(fast_sim_eval); - - return; -} diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C deleted file mode 100644 index 00564379a..000000000 --- a/macros/g4simulations/G4_FHCAL.C +++ /dev/null @@ -1,167 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 FHCAL = false; - bool FHCAL_ABSORBER = false; - bool FHCAL_CELL = false; - bool FHCAL_TOWER = false; - bool FHCAL_CLUSTER = false; - bool FHCAL_EVAL = false; - int FHCAL_VERBOSITY = 0; -} - -namespace G4FHCAL -{ - // from ForwardHcal/mapping/towerMap_FHCAL_v005.txt - double Gz0 = 400.; - double Gdz = 100.; - double outer_radius = 262.; -} // namespace G4FHCAL - -void FHCALInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); -} - -void FHCAL_Cells(int verbosity = 0) -{ - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); - hc->Detector("FHCAL"); - se->registerSubsystem(hc); - - return; -} - -void FHCALSetup(PHG4Reco *g4Reco) -{ - const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; - 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_v005.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 = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_v005.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 = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - 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(const std::string &outputfile) -{ -int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - 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_FST_EIC.C b/macros/g4simulations/G4_FST_EIC.C deleted file mode 100644 index 96c4c3e15..000000000 --- a/macros/g4simulations/G4_FST_EIC.C +++ /dev/null @@ -1,98 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax,double tSilicon); -//-----------------------------------------------------------------------------------// -namespace Enable -{ - static bool FST = false; -} -//-----------------------------------------------------------------------------------// -void FST_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); -} -//-----------------------------------------------------------------------------------// -void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) -{ - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - - //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35*um); - make_LANL_FST_station("FST_2", g4Reco, 90, 5.2, 43, 35*um); - make_LANL_FST_station("FST_3", g4Reco, 115, 6, 44, 85*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 85*um); - make_LANL_FST_station("FST_5", g4Reco, 300, 15, 45, 85*um); -} -//-----------------------------------------------------------------------------------// -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax,double tSilicon) //silicon thickness -{ - // cout - // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " - // << name << endl; - - // always facing the interaction point - double polar_angle = 0; - if (zpos < 0) - { - zpos = -zpos; - polar_angle = M_PI; - } - - double min_polar_angle = atan2(Rmin, zpos); - double max_polar_angle = atan2(Rmax, zpos); - - if (max_polar_angle < min_polar_angle) - { - double t = max_polar_angle; - max_polar_angle = min_polar_angle; - min_polar_angle = t; - } - - PHG4SectorSubsystem *fst; - fst = new PHG4SectorSubsystem(name); - - fst->SuperDetector(name); - - fst->get_geometry().set_normal_polar_angle(polar_angle); - fst->get_geometry().set_normal_start(zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - fst->get_geometry().set_min_polar_angle(min_polar_angle); - fst->get_geometry().set_max_polar_angle(max_polar_angle); - fst->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_N_Sector(1); - fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(overlapcheck); - - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - // build up layers - - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); - fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); - - g4Reco->registerSubsystem(fst); - return 0; -} -//-----------------------------------------------------------------------------------// diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C deleted file mode 100644 index b454b935a..000000000 --- a/macros/g4simulations/G4_FwdJets.C +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4jets.so) -R__LOAD_LIBRARY(libg4eval.so) - -namespace Enable -{ - bool FWDJETS = false; - bool FWDJETS_EVAL = false; - int FWDJETS_VERBOSITY = 0; -} - -void Jet_FwdRecoInit() {} - -void Jet_FwdReco() -{ -int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); - - 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(const std::string &outfilename = "g4fwdjets_eval.root") -{ -int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); - 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_GEM_EIC.C b/macros/g4simulations/G4_GEM_EIC.C deleted file mode 100644 index e62053acd..000000000 --- a/macros/g4simulations/G4_GEM_EIC.C +++ /dev/null @@ -1,220 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); -void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); - -namespace Enable -{ - bool EGEM = false; - bool FGEM = false; -} // namespace Enable - -void EGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); - // extends only to -z - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -160.); -} - -void FGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); -} - -void EGEMSetup(PHG4Reco *g4Reco) -{ - /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be - * drawn in event display but will NOT register any hits. - * - * Geometric constraints: - * TPC length = 211 cm --> from z = -105.5 to z = +105.5 - */ - float thickness = 3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); -} - -void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // - const double min_eta = 1.245 // -) -{ - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - etamax = 2; - etamin = min_eta; - zpos = 134.0; - - gem = new PHG4SectorSubsystem(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(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(Enable::OVERLAPCHECK); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_3"; - etamax = 2; - etamin = min_eta; - zpos = 157.0; - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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(etamax)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - 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(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(Enable::OVERLAPCHECK); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_4"; - etamax = 3.5; - etamin = min_eta; - zpos = 271.0; - gem = new PHG4SectorSubsystem(name); - - 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(Enable::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(Enable::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 = 0.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++) - { - ostringstream 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 = M_PI; - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name); - - 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(Enable::OVERLAPCHECK); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - return 0; -} diff --git a/macros/g4simulations/G4_Global.C b/macros/g4simulations/G4_Global.C deleted file mode 100644 index ceb05fee1..000000000 --- a/macros/g4simulations/G4_Global.C +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include -#include - -#include - -R__LOAD_LIBRARY(libg4vertex.so) - -namespace Enable -{ - bool GLOBAL_RECO = false; - bool GLOBAL_FASTSIM = false; -} - -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 -} - -void GlobalInit() {} - -void Global_Reco(int verbosity = 0) { - - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - GlobalVertexReco* gblvertex = new GlobalVertexReco(); - se->registerSubsystem(gblvertex); - - return; -} - -void Global_FastSim(int verbosity = 0) { - - - //--------------- - // 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; -} diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C deleted file mode 100644 index c5511dcd4..000000000 --- a/macros/g4simulations/G4_HIJetReco.C +++ /dev/null @@ -1,135 +0,0 @@ -#pragma once - -#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 HIJetRecoInit() {} - -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; -} diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C deleted file mode 100644 index 950ea3e5a..000000000 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ /dev/null @@ -1,302 +0,0 @@ -//Inner HCal reconstruction macro -#pragma once - -#include "GlobalVariables.C" - -#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) - -void HCalInner_SupportRing(PHG4Reco *g4Reco, - const int absorberactive = 0); - -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; - 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; - - 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, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER || absorberactive; - 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, 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) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER || absorberactive; - - 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); - 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"); - 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 (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_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(); - 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; -} diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C deleted file mode 100644 index e42700978..000000000 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ /dev/null @@ -1,226 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 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; - int HCALOUT_VERBOSITY = 0; -} // namespace Enable - -namespace G4HCALOUT -{ - double outer_radius = 264.71; - double size_z = 304.91 * 2; - 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, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER || absorberactive; - 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); - 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"); - 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); - 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(); - 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; -} diff --git a/macros/g4simulations/G4_Input.C b/macros/g4simulations/G4_Input.C deleted file mode 100644 index a998bfb42..000000000 --- a/macros/g4simulations/G4_Input.C +++ /dev/null @@ -1,181 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Input_Gun.C" -#include "G4_Input_Simple.C" -#include "G4_Input_Upsilon.C" - -#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) - -namespace Input -{ - bool READHITS = false; - bool PYTHIA6 = false; - bool PYTHIA8 = false; - bool SARTRE = false; - int VERBOSITY = 0; -} // namespace Input - -namespace INPUTHEPMC -{ - string filename; -} - -namespace INPUTREADEIC -{ - string filename; -} - -namespace INPUTREADHITS -{ - string filename; -} - -namespace INPUTEMBED -{ - string filename; -} - -namespace PYTHIA6 -{ - string config_file = "phpythia6.cfg"; -} - -namespace PYTHIA8 -{ - string config_file = "phpythia8.cfg"; -} - -namespace SARTRE -{ - string config_file = "sartre.cfg"; -} - -void InputInit() -{ - // 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::PYTHIA6 && Input::PYTHIA8) - { - cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; - gSystem->Exit(1); - } - - Fun4AllServer *se = Fun4AllServer::instance(); - if (Input::PYTHIA6) - { - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file(PYTHIA6::config_file); - se->registerSubsystem(pythia6); - } - if (Input::PYTHIA8) - { - PHPythia8 *pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file(PYTHIA8::config_file); - se->registerSubsystem(pythia8); - } - if (Input::SARTRE) - { - PHSartre *mysartre = new PHSartre(); - mysartre->set_config_file(SARTRE::config_file); - // 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); - } - - if (Input::SIMPLE) - { - InputSimpleInit(); - } - if (Input::GUN) - { - InputGunInit(); - } - if (Input::UPSILON) - { - InputUpsilonInit(); - } - - if (Input::READEIC) - { - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(INPUTREADEIC::filename); - se->registerSubsystem(eicr); - } - - // 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::READEIC) - { - // read-in HepMC events to Geant4 if there is any - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } -} - -void InputManagers() -{ - Fun4AllServer *se = Fun4AllServer::instance(); - if (Input::EMBED) - { - gSystem->Load("libg4dst.so"); - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - in1->AddFile(INPUTEMBED::filename); // if one use a single input file - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning - se->registerInputManager(in1); - } - if (Input::HEPMC) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager("HEPMCin"); - in->Verbosity(Input::VERBOSITY); - se->registerInputManager(in); - se->fileopen(in->Name(), INPUTHEPMC::filename); - } - else if (Input::READHITS) - { - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(INPUTREADHITS::filename); - hitsin->Verbosity(Input::VERBOSITY); - se->registerInputManager(hitsin); - } - else - { - Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); - in->Verbosity(Input::VERBOSITY); - se->registerInputManager(in); - } -} diff --git a/macros/g4simulations/G4_Input_Gun.C b/macros/g4simulations/G4_Input_Gun.C deleted file mode 100644 index 43b289685..000000000 --- a/macros/g4simulations/G4_Input_Gun.C +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Input.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) - -namespace Input -{ - bool GUN = false; - bool GUN_VERBOSITY = 0; -} // namespace Input - -namespace INPUTGUN -{ - double vx = 0.; - double vy = 0.; - double vz = 0.; - deque> particles; - void AddParticle(const string &name, const double px, const double py, const double pz); - void set_vtx(double x, double y, double z) - { - vx = x; - vy = y; - vz = z; - } -} // namespace INPUTGUN - -void INPUTGUN::AddParticle(const string &name, const double px, const double py, const double pz) -{ - particles.push_back(make_tuple(name, px, py, pz)); -} - -void InputGunInit() -{ - if (INPUTGUN::particles.empty()) - { - cout << "Input::GUN: particle map is empty use for e.g. 1 pi- with px=0, py=1GeV/c, pz=0" << endl; - cout << "INPUTGUN::AddParticle(\"pi-\",0,1,0);" << endl; - gSystem->Exit(-1); - } - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4ParticleGun *gun = new PHG4ParticleGun(); - for (auto iter = INPUTGUN::particles.begin(); iter != INPUTGUN::particles.end(); ++iter) - { - gun->AddParticle(get<0>(*iter), get<1>(*iter), get<2>(*iter), get<3>(*iter)); - } - gun->Verbosity(Input::GUN_VERBOSITY); - se->registerSubsystem(gun); -} diff --git a/macros/g4simulations/G4_Input_Simple.C b/macros/g4simulations/G4_Input_Simple.C deleted file mode 100644 index beb44e9dd..000000000 --- a/macros/g4simulations/G4_Input_Simple.C +++ /dev/null @@ -1,148 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Input.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) - -namespace Input -{ - bool SIMPLE = false; - int SIMPLE_VERBOSITY = 0; -} // namespace Input - -namespace INPUTSIMPLE -{ - double vxmean = 0.; - double vymean = 0.; - double vzmean = 0.; - double vxwidth = 0.; - double vywidth = 0.; - double vzwidth = 5.; - double etamin = -1.; - double etamax = 3.; - double phimin = -1. * M_PI; - double phimax = 1. * M_PI; - double ptmin = 0.5; - double ptmax = 50.; - double pmin = NAN; - double pmax = NAN; - map particles; - void AddParticle(const string &name, const unsigned int num); - void set_p_range(double d1, double d2); - void set_pt_range(double d1, double d2); - - void set_eta_range(double d1, double d2) - { - etamin = d1; - etamax = d2; - } - - void set_phi_range(double d1, double d2) - { - phimin = d1; - phimax = d2; - } - - void set_vtx_mean(double vx, double vy, double vz) - { - vxmean = vx; - vymean = vy; - vzmean = vz; - } - void set_vtx_width(double vx, double vy, double vz) - { - vxwidth = vx; - vywidth = vy; - vzwidth = vz; - } -} // namespace INPUTSIMPLE - -void INPUTSIMPLE::AddParticle(const string &name, const unsigned int num) -{ - if (num == 0) - { - cout << "INPUTSIMPLE::AddParticle(\"" << name << "\"," << num - << "): number of " << name << " has to be > 0" << endl; - return; - } - auto iter = particles.find(name); - if (iter != particles.end()) - { - iter->second += num; - } - else - { - particles.insert(make_pair(name, num)); - } -} - -void INPUTSIMPLE::set_p_range(double d1, double d2) -{ - pmin = d1; - pmax = d2; - ptmin = NAN; - ptmax = NAN; -} - -void INPUTSIMPLE::set_pt_range(double d1, double d2) -{ - pmin = NAN; - pmax = NAN; - ptmin = d1; - ptmax = d2; -} - -void InputSimpleInit() -{ - if (INPUTSIMPLE::particles.empty()) - { - cout << "Input::SIMPLE: particle map is empty use for e.g. 5 pi-" << endl; - cout << "INPUTSIMPLE::particles[\"pi-\"] = 5;" << endl; - gSystem->Exit(-1); - } - Fun4AllServer *se = Fun4AllServer::instance(); - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - for (map::const_iterator iter = INPUTSIMPLE::particles.begin(); - iter != INPUTSIMPLE::particles.end(); ++iter) - { - gen->add_particles(iter->first, iter->second); - } - if (Input::HEPMC || Input::EMBED) - { - 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(INPUTSIMPLE::vxmean, INPUTSIMPLE::vymean, INPUTSIMPLE::vzmean); - gen->set_vertex_distribution_width(INPUTSIMPLE::vxwidth, INPUTSIMPLE::vywidth, INPUTSIMPLE::vzwidth); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(INPUTSIMPLE::etamin, INPUTSIMPLE::etamax); - gen->set_phi_range(INPUTSIMPLE::phimin, INPUTSIMPLE::phimax); - if (isfinite(INPUTSIMPLE::ptmin) && isfinite(INPUTSIMPLE::ptmax)) - { - gen->set_pt_range(INPUTSIMPLE::ptmin, INPUTSIMPLE::ptmax); - } - else if (isfinite(INPUTSIMPLE::pmin) && isfinite(INPUTSIMPLE::pmax)) - { - gen->set_p_range(INPUTSIMPLE::pmin, INPUTSIMPLE::pmax); - } - gen->Embed(1); - gen->Verbosity(Input::SIMPLE_VERBOSITY); - se->registerSubsystem(gen); -} diff --git a/macros/g4simulations/G4_Input_Upsilon.C b/macros/g4simulations/G4_Input_Upsilon.C deleted file mode 100644 index 2bf887b12..000000000 --- a/macros/g4simulations/G4_Input_Upsilon.C +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Input.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) - -namespace Input -{ - bool UPSILON = false; - bool UPSILON_VERBOSITY = 0; -} // namespace Input - -namespace INPUTUPSILON -{ - int istate = 1; - double etamin = -1.; - double etamax = 1.; - double ptmin = 0.; - double ptmax = 10.; - deque> particles; - void AddDecayParticles(const string &name1, const string &name2, const int decay_id); - void set_rapidity_range(double min, double max) - { - etamin = min; - etamax = max; - } - void set_pt_range(double min, double max) - { - ptmin = min; - ptmax = max; - } -} // namespace INPUTUPSILON - -void INPUTUPSILON::AddDecayParticles(const string &name1, const string &name2, const int decay_id) -{ - particles.push_back(make_tuple(name1, name2, decay_id)); -} - -void InputUpsilonInit() -{ - if (INPUTUPSILON::particles.empty()) - { - cout << "Input::UPSILON: particle map is empty use for e.g. e+/e-" << endl; - cout << "INPUTUPSILON::AddDecayParticle(\"e+\", \"e-\", 0);" << endl; - gSystem->Exit(-1); - } - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - for (auto iter = INPUTUPSILON::particles.begin(); iter != INPUTUPSILON::particles.end(); ++iter) - { - vgen->add_decay_particles(get<0>(*iter), get<1>(*iter), get<2>(*iter)); - } - // event vertex - if (Input::HEPMC || Input::SIMPLE) - { - vgen->set_reuse_existing_vertex(true); - } - - vgen->set_rapidity_range(INPUTUPSILON::etamin, INPUTUPSILON::etamax); - vgen->set_pt_range(INPUTUPSILON::ptmin, INPUTUPSILON::ptmax); - - if (INPUTUPSILON::istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (INPUTUPSILON::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(Input::UPSILON_VERBOSITY); - vgen->Embed(2); - se->registerSubsystem(vgen); -} diff --git a/macros/g4simulations/G4_Intt.C b/macros/g4simulations/G4_Intt.C deleted file mode 100644 index 292291994..000000000 --- a/macros/g4simulations/G4_Intt.C +++ /dev/null @@ -1,185 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Mvtx.C" - -#include -#include -#include -#include - -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4intt.so) -R__LOAD_LIBRARY(libintt.so) - -namespace Enable -{ - bool INTT = false; - bool INTT_OVERLAPCHECK = false; - bool INTT_CELL = false; - bool INTT_CLUSTER = 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] = {15, 15, 18, 18}; - double sensor_radius[4] = {8.987, 9.545, 10.835, 11.361}; // radius of center of sensor for layer default - 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 - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - }; - enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here - -} // namespace G4INTT - -void InttInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 16.85 + 0.6); // rail radius + rail outer radius - 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); - 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(); - // new storage containers - PHG4InttHitReco* reco = new PHG4InttHitReco(); - // The timing windows are hard-coded in the INTT ladder model, they can be overridden here - //reco->set_double_param("tmax",80.0); - //reco->set_double_param("tmin",-20.0); - reco->Verbosity(verbosity); - se->registerSubsystem(reco); - return; -} - -void Intt_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); - // Intt - //===== - // 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); - for (int i = 0; i < G4INTT::n_intt_layer; i++) - { - digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); - 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); -} diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C deleted file mode 100644 index c167dd9e6..000000000 --- a/macros/g4simulations/G4_Jets.C +++ /dev/null @@ -1,115 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include -#include -#include -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4jets.so) -R__LOAD_LIBRARY(libg4eval.so) - -namespace Enable -{ - bool JETS = false; - bool JETS_EVAL = false; - int JETS_VERBOSITY = 0; -} - -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; -} diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C deleted file mode 100644 index b05e49683..000000000 --- a/macros/g4simulations/G4_Magnet.C +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool MAGNET = false; - bool MAGNET_ABSORBER = false; - bool MAGNET_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4MAGNET -{ - double magnet_outer_cryostat_wall_radius = 174.5; - double magnet_outer_cryostat_wall_thickness = 2.5; - double magnet_length = 379.; - double magfield_rescale = 1; - string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); - -} // namespace G4MAGNET - -void MagnetInit() -{ - 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, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER || absorberactive; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MAGNET_OVERLAPCHECK; - - 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; -} diff --git a/macros/g4simulations/G4_Mvtx.C b/macros/g4simulations/G4_Mvtx.C deleted file mode 100644 index ce2a18bee..000000000 --- a/macros/g4simulations/G4_Mvtx.C +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include -#include -#include - -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libmvtx.so) - -namespace Enable -{ - bool MVTX = false; - bool MVTX_OVERLAPCHECK = false; - bool MVTX_CELL = false; - bool MVTX_CLUSTER = 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 - -void MvtxInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); -} - -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]; - if (verbosity) - { - cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; - } - radius = radius_lyr / 10.; - } - 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); - for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); - } - se->registerSubsystem(maps_hits); - return; -} - -void Mvtx_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); - 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); - // For the Mvtx layers - //================ - MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); - mvtxclusterizer->Verbosity(verbosity); - se->registerSubsystem(mvtxclusterizer); -} diff --git a/macros/g4simulations/G4_MvtxService.C b/macros/g4simulations/G4_MvtxService.C deleted file mode 100644 index c8e4b73c7..000000000 --- a/macros/g4simulations/G4_MvtxService.C +++ /dev/null @@ -1,225 +0,0 @@ -/******************************/ -/* MVTX Service Barrel */ -/* Cameron Dean */ -/* cdean@lanl.gov */ -/* 07/17/2020 */ -/******************************/ - -#ifndef MACRO_G4MVTXSERVICE_C -#define MACRO_G4MVTXSERVICE_C - -#include "GlobalVariables.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool MVTXSERVICE = false; - bool MVTXSERVICE_ABSORBER = false; - bool MVTXSERVICE_OVERLAPCHECK = false; - int MVTXSERVICE_VERBOSITY = 0; -} // namespace Enable - -namespace G4MVTXSERVICE -{ - /* - * These are the parameters for all cables/wires/tubes for the MVTX service barrel - * Uncomment and use these when it is time to make a more detailed service barrel model - * DEFAULT G4 UNITS ARE CM, GEV AND NS - - double signal_wire_copper_area = 0.0102; //[mm^2] Cross sectional area of copper for one signal wire - double signal_wire_plastic_area = 0.0407; //[mm^2] Cross sectional area of plastic for one signal wire - int n_signal_wires_per_stave = 12; //Number of signal wires for each stave - - double digital_power_OR = 1.175; //Digital power parameters, [OR/IR] is the [outer/inner] radius of the cable sheath - double digital_power_IR = 0.775; - double digital_power_copper_area = calculateArea( 0, digital_power_IR ); - double digital_power_plastic_area = calculateArea( digital_power_IR, digital_power_OR ); - int n_digital_power = 2; - - double analogue_power_OR = 0.775; //Analogue power parameters - double analogue_power_IR = 0.375; - double analogue_power_copper_area = calculateArea( 0, analogue_power_IR ); - double analogue_power_plastic_area = calculateArea( analogue_power_IR, analogue_power_OR ); - int n_analogue_power = 2; - - double ground_power_OR = 0.725; //Ground power parameters - double ground_power_IR = 0.325; - double ground_power_copper_area = calculateArea( 0, ground_power_IR ); - double ground_power_plastic_area = calculateArea( ground_power_IR, ground_power_OR ); - int n_ground_power = 6; - - double power_cable_sheath_OR = 4.3; //The power cables are enclosed within their own plastic sheath - double power_cable_sheath_IR = 3.3; - double power_cable_sheath_area = calculateArea( power_cable_sheath_IR, power_cable_sheath_OR ); - - double power_cable_copper_area = n_digital_power*digital_power_copper_area - + n_analogue_power*analogue_power_copper_area - + n_ground_power*ground_power_copper_area; //[mm^2] Cross sectional area of copper for one power cable - double power_cable_plastic_area = power_cable_sheath_area - + n_digital_power*digital_power_plastic_area - + n_analogue_power*analogue_power_plastic_area - + n_ground_power*ground_power_plastic_area; //[mm^2] Cross sectional area of plastic for one power cable - double power_cable_air_area = 27.2; //[mm^2] Free space in each power cable - int n_power_cabless_per_stave = 1; //Number of power cables for each stave - - double cooling_tube_OR = 0.794; //Outer radius of cooling tube - double cooling_tube_IR = 0.397; //Inner radius of cooling tube - double cooling_tube_water_area = calculateArea( 0, cooling_tube_IR); //[mm^2] Cross sectional area of water for one cooling tube - double cooling_tube_plastic_area = calculateArea( cooling_tube_IR, cooling_tube_OR); //[mm^2] Cross sectional area of plastic for one cooling tube - int n_cooling_tubes_per_stave = 2; //Number of cooling tubes for each stave - - */ - double single_stave_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] - double single_stave_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] - double single_stave_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] - - const int n_layers = 1; //Number of service cable layers to generate - double layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] - int n_staves_layer[] = {48}; //Number of staves associated to each layer - - double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = -35; //[cm] Approx (Straight barrel length (419mm) - 0.5*stave active length (270mm/2)) - double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) -} // namespace G4MVTXSERVICE - - -double calculateArea( double inner_radius, double outer_radius ) //Calculate the area of a disk -{ - return M_PI*( std::pow( outer_radius, 2 ) - std::pow( inner_radius, 2) ); -} - -double calculateOR( double inner_radius, double area ) //Calculate the outer radius of a disk, knowing the inner radius and the area -{ - return std::sqrt( area/M_PI + std::pow( inner_radius, 2 ) ); -} - -void calculateMaterialBoundaries(int& layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs -{ - outer_copper_radius = calculateOR( G4MVTXSERVICE::layer_start_radius[layer_ID], G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_copper_area ); - outer_water_radius = calculateOR( outer_copper_radius, G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_water_area ); - outer_plastic_radius = calculateOR( outer_water_radius, G4MVTXSERVICE::n_staves_layer[layer_ID]*G4MVTXSERVICE::single_stave_plastic_area ); -} - -void MVTXServiceInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTXSERVICE::service_barrel_radius); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start)); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, -G4MVTXSERVICE::service_barrel_start); -} - -double MVTXService(PHG4Reco* g4Reco, double radius) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::MVTXSERVICE_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MVTXSERVICE_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::MVTXSERVICE_VERBOSITY); -/* - if (radius > G4MVTXSERVICE::service_barrel_radius) - { - std::cout << "inconsistency: radius: " << radius - << " larger than service barrel radius: " << G4MVTXSERVICE::service_barrel_radius << std::endl; - gSystem->Exit(-1); - } -*/ - // Note, cables are all south - //Setup layers - double copper_OR[G4MVTXSERVICE::n_layers], water_OR[G4MVTXSERVICE::n_layers], plastic_OR[G4MVTXSERVICE::n_layers]; //Objects for material outer radii - int subsystem_layer = 0; - std::string copper_name, water_name, plastic_name; - PHG4CylinderSubsystem* cyl; - - for (int i = 0; i < G4MVTXSERVICE::n_layers; ++i) //Build a layer of copper, then water, then plastic - { - calculateMaterialBoundaries(i, copper_OR[i], water_OR[i], plastic_OR[i]); - - copper_name = "MVTX_Service_copper_layer_" + std::to_string(i); - water_name = "MVTX_Service_water_layer_" + std::to_string(i); - plastic_name = "MVTX_Service_plastic_layer_" + std::to_string(i); - - cyl = new PHG4CylinderSubsystem(copper_name, subsystem_layer); - cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", G4MVTXSERVICE::layer_start_radius[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); - cyl->set_string_param("material", "G4_Cu"); - cyl->set_double_param("thickness", copper_OR[i] - G4MVTXSERVICE::layer_start_radius[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_layer += 1; - - cyl = new PHG4CylinderSubsystem(water_name, subsystem_layer); - cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", copper_OR[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); - cyl->set_string_param("material", "G4_WATER"); - cyl->set_double_param("thickness", water_OR[i] - copper_OR[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_layer += 1; - - cyl = new PHG4CylinderSubsystem(plastic_name, subsystem_layer); - cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", water_OR[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); - cyl->set_string_param("material", "G4_POLYETHYLENE"); - cyl->set_double_param("thickness", plastic_OR[i] - water_OR[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_layer += 1; - - } - - cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_layer", subsystem_layer); - cyl->set_double_param("place_z", -1*(G4MVTXSERVICE::service_barrel_length + G4MVTXSERVICE::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", G4MVTXSERVICE::service_barrel_radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTXSERVICE::service_barrel_length); - cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) - cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - - radius = G4MVTXSERVICE::service_barrel_radius; - - if (verbosity > 0) - { - cout << "=========================== G4_MVTXService.C::MVTXService() =============================" << endl; - cout << " MVTX Service Material Description:" << endl; - - cout << " Single stave copper area = " << G4MVTXSERVICE::single_stave_copper_area << " cm^2" << endl; - cout << " Single stave water area = " << G4MVTXSERVICE::single_stave_water_area << " cm^2" << endl; - cout << " Single stave plastic area = " << G4MVTXSERVICE::single_stave_plastic_area << " cm^2" << endl; - - for (int j = 0; j < G4MVTXSERVICE::n_layers; ++j) - { - cout << " Layer " << j << " starts at " << G4MVTXSERVICE::layer_start_radius[j] << " cm" << endl; - cout << " Layer " << j << " services " << G4MVTXSERVICE::n_staves_layer[j] << " staves" << endl; - } - - cout << " Service barrel radius = " << G4MVTXSERVICE::service_barrel_radius << " cm" << endl; - cout << " Service barrel start = " << G4MVTXSERVICE::service_barrel_start << " cm" << endl; - cout << " Service barrel length = " << G4MVTXSERVICE::service_barrel_length << " cm" << endl; - cout << "=========================================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} -#endif diff --git a/macros/g4simulations/G4_Mvtx_EIC.C b/macros/g4simulations/G4_Mvtx_EIC.C deleted file mode 100644 index 9dc920306..000000000 --- a/macros/g4simulations/G4_Mvtx_EIC.C +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4mvtx.so) - -namespace Enable -{ - bool MVTX = false; - bool MVTX_OVERLAPCHECK = 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 - vector N_staves = {18, 24, 30}; - vector nom_radius = {36.4, 48.1, 59.8}; -} // namespace G4MVTX - -void MvtxInit(int verbosity = 0) -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10. + 0.7); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); -} - -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); - - // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - - PHG4EICMvtxSubsystem* mvtx = new PHG4EICMvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - // H?kan Wennl?f : - // Without time-stamping layer: - // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves - // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 - // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 - // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 - // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - - // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30}; - // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; - if (G4MVTX::N_staves.size() < G4MVTX::n_maps_layer) - { - cout << "vector N_staves too small: " << G4MVTX::N_staves.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; - gSystem->Exit(1); - } - if (G4MVTX::nom_radius.size() < G4MVTX::n_maps_layer) - { - cout << "vector nom_radius too small: " << G4MVTX::nom_radius.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; - gSystem->Exit(1); - } - for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) - { - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", G4MVTX::N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", G4MVTX::nom_radius[ilyr]); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); - mvtx->set_double_param(ilyr, "phi0", 0); - } - - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm -} diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C deleted file mode 100644 index 1a5416a56..000000000 --- a/macros/g4simulations/G4_PSTOF.C +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif -// $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, 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_ParticleFlow.C b/macros/g4simulations/G4_ParticleFlow.C deleted file mode 100644 index 274d88b68..000000000 --- a/macros/g4simulations/G4_ParticleFlow.C +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4jets.so) -R__LOAD_LIBRARY(libparticleflow.so) -#endif - -void ParticleFlow(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4jets.so"); - gSystem->Load("libparticleflow.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - // note: assumes topoCluster input already configured - ParticleFlowReco *pfr = new ParticleFlowReco(); - pfr->set_energy_match_Nsigma( 1.5 ); - pfr->set_emulated_efficiency( 1.0 ); - 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.5), "AntiKt_ParticleFlow_r05" ); - particleflowjetreco->set_algo_node("ANTIKT"); - particleflowjetreco->set_input_node("PARTICLEFLOW"); - particleflowjetreco->Verbosity( verbosity ); - se->registerSubsystem( particleflowjetreco ); - - return; - -} diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C deleted file mode 100644 index 5ae0470a1..000000000 --- a/macros/g4simulations/G4_Pipe.C +++ /dev/null @@ -1,141 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#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 -{ - 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 -} // namespace G4PIPE - -void PipeInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length)); -} - -double Pipe(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER || absorberactive; - 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); - } - - // 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", 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", 1); - cyl->set_double_param("radius", G4PIPE::be_pipe_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 - cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); - cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + no_overlapp); - cyl->set_double_param("radius", 0.0); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::al_pipe_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", 3); - cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + 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_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 aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); - cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - no_overlapp); - cyl->set_double_param("radius", 0.0); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::al_pipe_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", 5); - cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - 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_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); - - radius = G4PIPE::al_pipe_radius + G4PIPE::al_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; -} diff --git a/macros/g4simulations/G4_Pipe_EIC.C b/macros/g4simulations/G4_Pipe_EIC.C deleted file mode 100644 index c50d8797c..000000000 --- a/macros/g4simulations/G4_Pipe_EIC.C +++ /dev/null @@ -1,123 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -// This creates the Enable Flag to be used in the main steering macro -namespace Enable -{ - bool PIPE = false; - bool PIPE_ABSORBER = false; - bool PIPE_OVERLAPCHECK = false; - int PIPE_VERBOSITY = 0; -} - -namespace G4PIPE -{ - // Central pipe dimension - // Extracted via mechanical model: Detector chamber 3-20-20 - // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. - // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - double be_pipe_radius = 3.1000; - double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - double be_pipe_length_plus = 66.8; // +z beam pipe extend. - double be_pipe_length_neg = -79.8; // -z beam pipe extend. - bool use_forward_pipes = false; -} // namespace G4PIPE - -void PipeInit() -{ - if (G4PIPE::use_forward_pipes) - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 23.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 450.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -463.); - } - else - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); - } -} - -//! construct beam pipe -double Pipe(PHG4Reco* g4Reco, - double radius) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); - // process pipe extentions? - const bool do_pipe_hadron_forward_extension = G4PIPE::use_forward_pipes && true; - const bool do_pipe_electron_forward_extension = G4PIPE::use_forward_pipes && true; - - const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length - const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); - - if (radius > G4PIPE::be_pipe_radius) - { - cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; - gSystem->Exit(-1); - } - - // 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_double_param("place_z", be_pipe_center); - cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); - cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(OverlapCheck); - if (AbsorberActive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", G4PIPE::be_pipe_radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", be_pipe_length); - cyl->set_double_param("place_z", be_pipe_center); - cyl->set_string_param("material", "G4_Be"); - cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); - cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(OverlapCheck); - if (AbsorberActive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius = G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness; - - radius += no_overlapp; - - if (do_pipe_electron_forward_extension) - { - PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(gdml); - } - - if (do_pipe_hadron_forward_extension) - { - PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector chamber 3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(gdml); - } - - return radius; -} diff --git a/macros/g4simulations/G4_Piston.C b/macros/g4simulations/G4_Piston.C deleted file mode 100644 index 06e73a091..000000000 --- a/macros/g4simulations/G4_Piston.C +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Pipe.C" - -#include -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PISTON = false; - bool PISTON_ABSORBER = false; - bool PISTON_OVERLAPCHECK = false; - int PISTON_VERBOSITY = 0; -} // namespace Enable - -namespace G4PISTON -{ - double zpos1 = 305. - 20.; // front of forward ECal/MPC - double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - double calorimeter_hole_diameter = 9.92331 *2; // side length of the middle hole of MPC that -} // namespace G4PISTON - -void PistonInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter/2.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z,((G4PISTON::zpos2 + G4PISTON::zpos1) / 2.+(G4PISTON::zpos2 - G4PISTON::zpos1)/2.) ); -} - -void Piston(PHG4Reco* g4Reco, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::PISTON_ABSORBER || absorberactive; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PISTON_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::PISTON_VERBOSITY); - - string name = "magpiston"; - const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::be_pipe_length * 0.5; // first large GEM station - - const double beampipe_radius = G4PIPE::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 + (G4PISTON::zpos1 - zpos0) / 2; -// cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos -// << endl; - - PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); - magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); - magpiston->SetPlaceZ((G4PISTON::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)) * G4PISTON::zpos1); - magpiston->SetMaterial("G4_Fe"); - magpiston->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston); - -// PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); -// magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); -// magpiston->SetPlaceZ(pos); -// magpiston->Set_eta_range(eta_outter, eta_inner); -// magpiston->SetMaterial("G4_Fe"); -// magpiston->SuperDetector(name); -// 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); - if (AbsorberActive) magpiston->SetActive(); - magpiston->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston); - pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); - } - - // last piece connect to the field return - PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_double_param("length",G4PISTON::zpos2 - G4PISTON::zpos1); - magpiston2->set_double_param("place_z", (G4PISTON::zpos2 + G4PISTON::zpos1) / 2.); - magpiston2->set_double_param("radius",beampipe_radius); - magpiston2->set_double_param("thickness",G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); - magpiston2->set_string_param("material","G4_Fe"); - magpiston2->SuperDetector(name); - if (AbsorberActive) magpiston2->SetActive(); - magpiston2->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston2); - - return; -} diff --git a/macros/g4simulations/G4_PlugDoor.C b/macros/g4simulations/G4_PlugDoor.C deleted file mode 100644 index e37520850..000000000 --- a/macros/g4simulations/G4_PlugDoor.C +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include "GlobalVariables.C" -#include -#include -R__LOAD_LIBRARY(libg4detectors.so) -#endif - -void PlugDoorInit() {} -void PlugDoor(PHG4Reco *g4Reco, - const int absorberactive = 0, - int verbosity = 0) -{ - //---------------------------------------- - // sPHENIX forward flux return(s) - // define via four cornors in the engineering drawing - const double z_1 = 330.81; - const double z_2 = 360.81; - const double r_1 = 30; - const double r_2 = 263.5; - const string material("Steel_1006"); - const int flux_door_active = false; - - - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); - flux_return_plus->set_int_param("lengthviarapidity", 0); - flux_return_plus->set_double_param("length", z_2 - z_1); - flux_return_plus->set_double_param("radius", r_1); - flux_return_plus->set_double_param("place_z", (z_1 + z_2) / 2.); - flux_return_plus->set_double_param("thickness", r_2 - 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); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); - flux_return_minus->set_int_param("lengthviarapidity", 0); - flux_return_minus->set_double_param("length", z_2 - z_1); - flux_return_minus->set_double_param("radius", r_1); - flux_return_minus->set_double_param("place_z", -(z_1 + z_2) / 2.); - flux_return_minus->set_double_param("thickness", r_2 - 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); - g4Reco->registerSubsystem(flux_return_minus); - - return; -} diff --git a/macros/g4simulations/G4_PlugDoor_EIC.C b/macros/g4simulations/G4_PlugDoor_EIC.C deleted file mode 100644 index 1ad14168a..000000000 --- a/macros/g4simulations/G4_PlugDoor_EIC.C +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PLUGDOOR = false; - bool PLUGDOOR_ABSORBER = false; - bool PLUGDOOR_OVERLAPCHECK = false; -} - -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.; -} // namespace G4PLUGDOOR - -void PlugDoorInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); -} - -void PlugDoor(PHG4Reco *g4Reco) -{ - //---------------------------------------- - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; - const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; - - const string material("Steel_1006"); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); - flux_return_minus->set_int_param("lengthviarapidity", 0); - 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); - g4Reco->registerSubsystem(flux_return_minus); - - return; -} diff --git a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C b/macros/g4simulations/G4_PlugDoor_fsPHENIX.C deleted file mode 100644 index 90c7cbe28..000000000 --- a/macros/g4simulations/G4_PlugDoor_fsPHENIX.C +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PLUGDOOR = false; - bool PLUGDOOR_ABSORBER = false; - bool PLUGDOOR_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4PLUGDOOR -{ - double place_z = 335.9; - double length = 10.2; - double inner_radius = 2.1; - double thickness = 258.5; -} // namespace G4PLUGDOOR - -void PlugDoorInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::inner_radius + G4PLUGDOOR::thickness); - 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.)); -} - -void PlugDoor(PHG4Reco *g4Reco) -{ - - - //---------------------------------------- - // fsPHENIX forward flux return(s) - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; - bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; - - const string material("Steel_1006"); - - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_double_param("length", G4PLUGDOOR::length); - flux_return_plus->set_double_param("radius", G4PLUGDOOR::inner_radius); - flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); - 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); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_double_param("length", G4PLUGDOOR::length); - flux_return_minus->set_double_param("radius", G4PLUGDOOR::inner_radius); - flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); - 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); - g4Reco->registerSubsystem(flux_return_minus); - - return; -} diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C deleted file mode 100644 index acc637a56..000000000 --- a/macros/g4simulations/G4_RICH.C +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * \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 $ - */ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool RICH = false; -} - -void RICHInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 135.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 268.); -} - -//! 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.3, // - const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) - const double z_shift = 75, // cm - const double R_shift = 18.5, // cm - const double R_beampipe_front = 8, // clearance for EIC beam pipe flange - const double R_beampipe_back = 27 // clearance for EIC beam pipe flange -) -{ - /* 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()); - - rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); - rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - rich->OverlapCheck(Enable::OVERLAPCHECK); - - /* Register RICH module */ - g4Reco->registerSubsystem(rich); -} diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C deleted file mode 100644 index 3ab487f12..000000000 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec_EIC.C +++ /dev/null @@ -1,369 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -#include -#include - -#include - -#include - -#include - -#include - -//#include - -#include -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) - - -namespace TrackingEicMvtxMacro -{ -const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers -} - -namespace TrackingEicTpcMacro -{ -int n_tpc_layer_inner = 16; -double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. -int tpc_layer_rphi_count_inner = 1152; - -int n_tpc_layer_mid = 16; -double tpc_layer_thick_mid = 1.25; -int tpc_layer_rphi_count_mid = 1536; - -int n_tpc_layer_outer = 16; -double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm -int tpc_layer_rphi_count_outer = 2304; -} - -double inner_cage_radius = 20.; -// double inner_readout_radius = 30.; - deprecated for EIC simulation - -// TPC gas parameters -// These are set for a variety of gas choices... -//============================================== -enum TPC_Gas -{ - Ne2K_100, - Ne2K_400, - NeCF4_100, - NeCF4_300, - NeCF4_400, - ByHand -}; -TPC_Gas ether = TPC_Gas::NeCF4_400; -//TPC_Gas ether = TPC_Gas::ByHand; - -// Data on gasses @20 C and 760 Torr from the following source: -// http://www.slac.stanford.edu/pubs/icfa/summer98/paper3/paper3.pdf -double Ne_dEdx = 1.56; // keV/cm -double CF4_dEdx = 7.00; // keV/cm -double iBut_dEdx = 5.93; // keV/cm - -double Ne_NPrimary = 12; // Number/cm -double CF4_NPrimary = 51; // Number/cm -double iBut_NPrimary = 84; // Number/cm - -double Ne_NTotal = 43; // Number/cm -double CF4_NTotal = 100; // Number/cm -double iBut_NTotal = 195; // Number/cm - -// TPC Performance Parameter (applies extra smear to mimic the avalanche): -double TPC_SigmaT = 0.03; // 0.03 means 300 microns...Prakhar Garg Simulation...desire measurement... - -// to be overwritten... -double TPCDriftVelocity; -double TPC_Trans_Diffusion; -double TPC_Long_Diffusion; -double TPC_dEdx; -double TPC_NPri; -double TPC_NTot; -double TPC_ElectronsPerKeV; - -// TPC readout shaping time and ADC clock parameters -// these set the Z size of the TPC cells -// These need to be set in the init since some of them require the drift velocity... -//======================================= -double TPCADCClock; -double TPCShapingRMSLead; -double TPCShapingRMSTail; -double tpc_cell_z; -double TPC_SmearRPhi; -double TPC_SmearZ; - -//} - -void SvtxInit(int verbosity = 0) -{ - - switch (ether) - { - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_IC4H10_95_3_2.html - case TPC_Gas::Ne2K_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_100" << endl; - TPCDriftVelocity = 3.2 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0065; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0300; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - case TPC_Gas::Ne2K_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::Ne2K_400" << endl; - TPCDriftVelocity = 5.5 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0120; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0175; // cm/SQRT(cm) - TPC_dEdx = 0.95 * Ne_dEdx + 0.03 * CF4_dEdx + 0.02 * iBut_dEdx; - TPC_NPri = 0.95 * Ne_NPrimary + 0.03 * CF4_NPrimary + 0.02 * iBut_NPrimary; - TPC_NTot = 0.95 * Ne_NTotal + 0.03 * CF4_NTotal + 0.02 * iBut_NTotal; - break; - } - // https://www.phenix.bnl.gov/WWW/p/draft/prakhar/tpc/HTML_Gas_Linear/Ne_CF4_90_10.html - case TPC_Gas::NeCF4_100: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_100" << endl; - TPCDriftVelocity = 4.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0045; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0270; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_300: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_300" << endl; - TPCDriftVelocity = 7.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0052; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0170; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::NeCF4_400: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - case TPC_Gas::ByHand: - { - if (verbosity) - cout << "Gas Choice: TPC_Gas::ByHand" << endl; - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0130; // cm/SQRT(cm) - TPC_ElectronsPerKeV = 28.0; - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = TPC_ElectronsPerKeV * TPC_dEdx; - break; - } - default: // defaults to NeCF4_400 - { - if (verbosity) - cout << "Gas Choice Undefined...using TPC_Gas::NeCF4_400" << endl; - TPCDriftVelocity = 8.0 / 1000.0; // cm/ns - TPC_Trans_Diffusion = 0.0060; // cm/SQRT(cm) - TPC_Long_Diffusion = 0.0150; // cm/SQRT(cm) - TPC_dEdx = 0.90 * Ne_dEdx + 0.10 * CF4_dEdx; - TPC_NPri = 0.90 * Ne_NPrimary + 0.10 * CF4_NPrimary; - TPC_NTot = 0.90 * Ne_NTotal + 0.10 * CF4_NTotal; - break; - } - } - - TPC_ElectronsPerKeV = TPC_NTot / TPC_dEdx; - - // TPC readout shaping time and ADC clock parameters - // these set the Z size of the TPC cells - //======================================= - TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA - TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - tpc_cell_z = TPCADCClock * TPCDriftVelocity; // cm - - // these are fudge parameters, tuned to give average of 150 microns r-phi and 500 microns Z resolution in the outer TPC layers with the TPC setup used here and 80 ns SAMPA peaking time - TPC_SmearRPhi = 0.25; - TPC_SmearZ = 0.15; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - gSystem->Load("libg4mvtx.so"); - int n_gas_layer = TrackingEicTpcMacro::n_tpc_layer_inner + TrackingEicTpcMacro::n_tpc_layer_mid + TrackingEicTpcMacro::n_tpc_layer_outer; - if (TrackingEicMvtxMacro::n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - // H?kan Wennl?f : - // Without time-stamping layer: - // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves - // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 - // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 - // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 - // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - - - static const double Degree2Rad = 180. /M_PI; - int N_staves[3] = {18, 24, 30}; - double nom_radius[3] = {36.4, 48.1, 59.8}; - for (int ilyr = 0; ilyr<3; ilyr++) - { - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", nom_radius[ilyr]); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * Degree2Rad +M_PI); - mvtx->set_double_param(ilyr, "phi0", 0); - } - - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - } // if (TrackingEicMvtxMacro::n_maps_layer > 0) - - // int verbosity = 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", TrackingEicMvtxMacro::n_maps_layer); - cyl->set_double_param("radius", radius); - 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 = radius; - // if (inner_readout_radius < radius) inner_readout_radius = radius; - // - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - // - double outer_radius = 78.; - - int n_tpc_layers[3] = {16,16,16}; - int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; - - double tpc_region_thickness[3] = { 20., 20., 18.}; - // Active layers of the TPC (inner layers) -int nlayer = TrackingEicMvtxMacro::n_maps_layer; -for (int irange=0; irange<3; irange++) -{ - double tpc_layer_thickness = tpc_region_thickness[irange]/n_tpc_layers[irange]; // thickness per layer - for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) - { - cyl = new PHG4CylinderSubsystem("SVTX", nlayer); - cyl->set_double_param("radius", radius); - cyl->set_double_param("length", cage_length); - cyl->set_string_param("material", tpcgas.c_str()); - cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thickness; - nlayer++; - } -} - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", nlayer); - 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; -} - -// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now -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 - //----------- - - return; -} - -// Central detector reco is disabled as EIC setup use the fast tracking sim for now -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - return; -} diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C deleted file mode 100644 index 8bcf97f8a..000000000 --- a/macros/g4simulations/G4_TPC.C +++ /dev/null @@ -1,149 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Intt.C" -#include "G4_Mvtx.C" - -#include -#include -#include -#include -#include - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4tpc.so) -R__LOAD_LIBRARY(libtpc.so) - -namespace Enable -{ - bool TPC = false; - bool TPC_ABSORBER = false; - bool TPC_OVERLAPCHECK = false; - bool TPC_CELL = false; - bool TPC_CLUSTER = false; - 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; -} // namespace G4TPC - -void TPCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); - 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; - } -} - -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); - - radius = G4TPC::tpc_outer_radius; - - radius += no_overlapp; - - return radius; -} - -void TPC_Cells() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); - - //========================= - // setup Tpc readout for filling cells - // g4tpc/PHG4TpcElectronDrift uses - // g4tpc/PHG4TpcPadPlaneReadout - //========================= - - PHG4TpcPadPlane* padplane = new PHG4TpcPadPlaneReadout(); - padplane->Verbosity(verbosity); - - PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); - edrift->Detector("TPC"); - edrift->Verbosity(verbosity); - // 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->set_double_param("added_smear_trans",0.085); - //edrift->set_double_param("added_smear_long",0.105); - 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); -} - -void TPC_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); - - Fun4AllServer* se = Fun4AllServer::instance(); - - // Tpc - //==== - 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); - - //------------- - // Cluster Hits - //------------- - - // For the Tpc - //========== - TpcClusterizer* tpcclusterizer = new TpcClusterizer(); - tpcclusterizer->Verbosity(verbosity); - se->registerSubsystem(tpcclusterizer); -} diff --git a/macros/g4simulations/G4_TPC_EIC.C b/macros/g4simulations/G4_TPC_EIC.C deleted file mode 100644 index 7afb6b3b6..000000000 --- a/macros/g4simulations/G4_TPC_EIC.C +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Mvtx_EIC.C" - -#include - -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) - -namespace Enable -{ - bool TPC = false; -} - -namespace G4TPC -{ - int n_tpc_layer_inner = 16; - double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. - int tpc_layer_rphi_count_inner = 1152; - - int n_tpc_layer_mid = 16; - double tpc_layer_thick_mid = 1.25; - int tpc_layer_rphi_count_mid = 1536; - - int n_tpc_layer_outer = 16; - double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm - int tpc_layer_rphi_count_outer = 2304; - - double outer_radius = 78.; - double inner_cage_radius = 20.; - 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 - - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - -} // namespace G4TPC - -void TPCInit(int verbosity = 0) -{ - // BlackHoleGeometry::max_radius set at the end of the TPC function - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length / 2.); -} - -double TPC(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - // time projection chamber layers -------------------------------------------- - - PHG4CylinderSubsystem* cyl; - - radius = G4TPC::inner_cage_radius; - - // inner field cage - cyl = new PHG4CylinderSubsystem("FIELDCAGE", G4MVTX::n_maps_layer); - cyl->set_double_param("radius", radius); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", "G4_KAPTON"); - cyl->set_double_param("thickness", G4TPC::cage_thickness); - cyl->SuperDetector("FIELDCAGE"); - cyl->Verbosity(0); - g4Reco->registerSubsystem(cyl); - - radius += G4TPC::cage_thickness; - - // double inner_readout_radius = radius; - // if (inner_readout_radius < radius) inner_readout_radius = radius; - // - // - - int n_tpc_layers[3] = {16, 16, 16}; - int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; - - double tpc_region_thickness[3] = {20., 20., 18.}; - // Active layers of the TPC (inner layers) - int nlayer = G4MVTX::n_maps_layer; - for (int irange = 0; irange < 3; irange++) - { - double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer - for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) - { - cyl = new PHG4CylinderSubsystem("TPC", nlayer); - cyl->set_double_param("radius", radius); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", G4TPC::tpcgas); - cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); - cyl->SetActive(); - cyl->SuperDetector("TPC"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thickness; - nlayer++; - } - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("FIELDCAGE", nlayer); - cyl->set_double_param("radius", radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", "G4_KAPTON"); - cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("FIELDCAGE"); - g4Reco->registerSubsystem(cyl); - - radius += G4TPC::cage_thickness; - - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); - return radius; -} diff --git a/macros/g4simulations/G4_TopoClusterReco.C b/macros/g4simulations/G4_TopoClusterReco.C deleted file mode 100644 index 42d15508c..000000000 --- a/macros/g4simulations/G4_TopoClusterReco.C +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libcalo_reco.so) -#endif - -void TopoClusterRecoInit() {} - -void TopoClusterReco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libcalo_reco.so"); - - //--------------- - // 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; - -} diff --git a/macros/g4simulations/G4_Tracking.C b/macros/g4simulations/G4_Tracking.C deleted file mode 100644 index 89a33f6dc..000000000 --- a/macros/g4simulations/G4_Tracking.C +++ /dev/null @@ -1,836 +0,0 @@ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include "GlobalVariables.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 -#include -#include -#include -#include -#include - -#if __cplusplus >= 201703L -#include -#include -#include -#include -#include -#endif - -#include - -#include - -R__LOAD_LIBRARY(libg4tpc.so) -R__LOAD_LIBRARY(libg4intt.so) -R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4micromegas.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libintt.so) -R__LOAD_LIBRARY(libmvtx.so) -R__LOAD_LIBRARY(libtpc.so) -R__LOAD_LIBRARY(libmicromegas.so) -R__LOAD_LIBRARY(libtrack_reco.so) -R__LOAD_LIBRARY(libPHTpcTracker.so) - -#endif - -#include - -const bool use_hough_seeding = false; //choose seeding algo //default seed is PHTpcTracker -const bool use_ca_seeding = false; -const bool use_stub_matcher = true; - -// Tracking simulation setup parameters and flag - leave them alone! -//============================================== - -////////////// MVTX -const int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers - -/////////////// INTT -bool flag_ladder_debug = false; // false: run as usual, true: only single ladder in the innermost layer is shoen -int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely -int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI, - PHG4InttDefs::SEGMENTATION_PHI}; - -int nladder[4] = {12, 12, 16, 16}; -// Radius of center of sensor for layer default, the subtractions of 14 um is due to the difference of the glue thickness for the sensors(14 um) and FPHX chips (50um) -// The ladder volume is defined using t_FPHXglue but not t_Siglue to contain everything, the surface of FPHX chips are placed at the planned position. So subtraction of (50-14) um is needed. -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 - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational -}; -enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here - -///////////////// TPC -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; - -///////////////// Micromegas -bool enable_micromegas = false; -const int n_micromegas_layer = 2; - -// Tracking reconstruction setup parameters and flags -//===================================== -//const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events -const int init_vertexing_min_zvtx_tracks = 5; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events - -const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead -const bool useActsFitting = true; // true to use PHActsTrkFitter, false to use PHGenFitTrkFitter -const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit -const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples - -// This is the setup we have been using before PHInitZVertexing was implemented - 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: -//const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex - -// This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event -const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex -//std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. - -void TrackingInit(int verbosity = 0) -{ -} - -double Tracking(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) -{ - // create the three tracker subsystems - gSystem->Load("libg4mvtx.so"); - - if (n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - // MAPS inner barrel layers - //====================================================== - // YCM (2020-01-08): Using default values from PHG4MvtxSubsystem and PHG4MvtxDefs.... - - PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; - radius = radius_lyr; - } - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL ,"stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - } - - if (n_intt_layer > 0) - { - //------------------- - // INTT ladders - //------------------- - - if( flag_ladder_debug == true ) - { - nladder[0] = 1; // number of ladder in the innermost layer - offsetphi[0] = 90.0; // put the first ladder in the innermost layer on the top - - } - - bool intt_overlapcheck = false; // set to true if you want to check for overlaps - - // 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 - 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; i < n_intt_layer; i++) - { - // make only the innermost layer if the flag is true - if( flag_ladder_debug == true && i >= 1 ) - { - break; - } - - // 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(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); - g4Reco->registerSubsystem(sitrack); - - // Set the laddertype and ladder spacing configuration - - cout << "Intt has " << n_intt_layer << " layers with layer setup:" << endl; - for(int i=0;iset_int_param(i, "laddertype", laddertype[i]); - sitrack->set_int_param(i, "nladder", nladder[i]); - sitrack->set_double_param(i,"sensor_radius", sensor_radius[i]); // expecting cm - sitrack->set_double_param(i,"offsetphi",offsetphi[i]); // expecting degrees - } - - cout << string(100, '-' ) << endl << "End of INTT set init params" << endl; - - // outer radius marker (translation back to cm) - radius = intt_radius_max * 0.1; - } - - - // The Tpc - always present! - //================================ - gSystem->Load("libg4tpc.so"); - - PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); - tpc->SetActive(); - tpc->SuperDetector("TPC"); - tpc->set_double_param("steplimits", 1); - // By default uses "sPHENIX_TPC_Gas", defined in PHG4Reco. That is 90:10 Ne:C4 - - if (absorberactive) - { - tpc->SetAbsorberActive(); - } - tpc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(tpc); - - radius = 77. + 1.17; - radius += no_overlapp; - - // micromegas - if( enable_micromegas ) - { - const int mm_layer = n_maps_layer + n_intt_layer + n_gas_layer; - auto mm = new PHG4MicromegasSubsystem( "MICROMEGAS", mm_layer ); - mm->SetActive(); - mm->set_double_param("mm_length", 220); - mm->set_double_param("mm_radius", 82); - g4Reco->registerSubsystem(mm); - } - - return radius; -} - -void Tracking_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (TrkrHits) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libtrack_io.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4tpc.so"); - gSystem->Load("libg4intt.so"); - gSystem->Load("libg4mvtx.so"); - gSystem->Load("libtpc.so"); - gSystem->Load("libintt.so"); - gSystem->Load("libmvtx.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - // Mvtx hit reco - //=========== - - if (n_maps_layer > 0) - { - // new storage containers - PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); - maps_hits->Verbosity(verbosity); - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); - } - se->registerSubsystem(maps_hits); - } - - // Intt hit reco - //=========== - if (n_intt_layer > 0) - { - // new storage containers - PHG4InttHitReco* reco = new PHG4InttHitReco(); - // The timing windows are hard-coded in the INTT ladder model, they can be overridden here - //reco->set_double_param("tmax",80.0); - //reco->set_double_param("tmin",-20.0); - reco->Verbosity(verbosity); - se->registerSubsystem(reco); - } - - //========================= - // setup Tpc readout for filling cells - // g4tpc/PHG4TpcElectronDrift uses - // g4tpc/PHG4TpcPadPlaneReadout - //========================= - - PHG4TpcPadPlane *padplane = new PHG4TpcPadPlaneReadout(); - padplane->Verbosity(0); - - PHG4TpcElectronDrift *edrift = new PHG4TpcElectronDrift(); - edrift->Detector("TPC"); - edrift->Verbosity(0); - // 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->set_double_param("added_smear_trans",0.085); - //edrift->set_double_param("added_smear_long",0.105); - 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", n_maps_layer + n_intt_layer); // sPHENIX layer number of first Tpc readout layer - padplane->set_int_param("ntpc_layers_inner", n_tpc_layer_inner); - padplane->set_int_param("ntpc_phibins_inner", tpc_layer_rphi_count_inner); - - // micromegas - if( enable_micromegas ) - { - - // micromegas - auto reco = new PHG4MicromegasHitReco; - reco->Verbosity(0); - - static constexpr double radius = 82; - static constexpr double tile_length = 50; - static constexpr double tile_width = 25; - - // 12 tiles at mid rapidity, one in front of each TPC sector - static constexpr int ntiles = 12; - MicromegasTile::List tiles; - for( int i = 0; i < ntiles; ++i ) - { tiles.push_back( {{ 2.*M_PI*(0.5+i)/ntiles, 0, tile_width/radius, tile_length }} ); } - reco->set_tiles( tiles ); - - se->registerSubsystem( reco ); - - } - return; -} - -void Tracking_Clus(int verbosity = 0) -{ - // processes the TrkrHits to make clusters, then reconstruct tracks and vertices - - //--------------- - // Load libraries - //--------------- - gSystem->Load("libfun4all.so"); - gSystem->Load("libtrack_reco.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - //------------------------------------------- - // Digitize the hit energy into ADC - //------------------------------------------ - - // Mvtx - //====== - PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); - digimvtx->Verbosity(0); - // 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); - - if (n_intt_layer > 0) - { - -#ifdef SVTXDEADMAP - if (InttDeadMapOption != kInttNoDeadMap) - { - // Load pre-defined deadmaps - PHG4SvtxDeadMapLoader* deadMapIntt = new PHG4SvtxDeadMapLoader("INTT"); - for (int i = 0; i < n_intt_layer; i++) - { - const int database_strip_type = (laddertype[i] == PHG4InttDefs::SEGMENTATION_Z) ? 0 : 1; - string DeadMapConfigName = Form("LadderType%d_RndSeed%d/", database_strip_type, i); - - - if (InttDeadMapOption == kIntt4PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_4Percent/"); //4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); - - } - else if (InttDeadMapOption == kIntt8PercentDeadMap) - { - - string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap_8Percent/"); // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational - DeadMapPath += DeadMapConfigName; - deadMapIntt->deadMapPath(n_maps_layer + i, DeadMapPath); - - } - else - { - cout <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "< Verbosity(1); - se->registerSubsystem(deadMapIntt); - } -#endif // SVTXDEADMAP - - // Intt - //===== - // 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); - for (int i = 0; i < n_intt_layer; i++) - { - digiintt->set_adc_scale(n_maps_layer + i, userrange); - } - se->registerSubsystem(digiintt); - } - - // Tpc - //==== - PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); - digitpc->SetTpcMinLayer(n_maps_layer + 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(0); - cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold - << " maps+Intt layers set to " << n_maps_layer + n_intt_layer << endl; - - se->registerSubsystem(digitpc); - - // micromegas - if(enable_micromegas) - { se->registerSubsystem( new PHG4MicromegasDigitizer ); } - - //------------- - // Cluster Hits - //------------- - - // For the Mvtx layers - //================ - MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); - mvtxclusterizer->Verbosity(verbosity); - se->registerSubsystem(mvtxclusterizer); - - // For the Intt layers - //=============== - InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", n_maps_layer, n_maps_layer + 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 = n_maps_layer; i < n_maps_layer + n_intt_layer; i++) - { - if (laddertype[i - n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) - inttclusterizer->set_z_clustering(i, false); - } - se->registerSubsystem(inttclusterizer); - - // For the Tpc - //========== - TpcClusterizer* tpcclusterizer = new TpcClusterizer(); - tpcclusterizer->Verbosity(0); - se->registerSubsystem(tpcclusterizer); - - // Micromegas - if(enable_micromegas) - { se->registerSubsystem( new MicromegasClusterizer ); } - -} - -void Tracking_Reco(int verbosity = 0) -{ - // processes the TrkrHits to make clusters, then reconstruct tracks and vertices - - //--------------- - // Load libraries - //--------------- - gSystem->Load("libfun4all.so"); - gSystem->Load("libtrack_reco.so"); - gSystem->Load("libPHTpcTracker.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - if(useActsFitting) - { - #if __cplusplus >= 201703L - PHActsSourceLinks *sl = new PHActsSourceLinks(); - sl->Verbosity(1); - se->registerSubsystem(sl); - #endif - } - - - //------------- - // Tracking - //------------ - - if (use_track_prop) - { - //-------------------------------------------------- - // Normal track seeding and propagation - //-------------------------------------------------- - - if(use_truth_vertex) - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - } - else - { - // get the initial vertex for track fitting from the MVTX hits - PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); - int seed_layer[7] = {0,1,2,3,4,5,6}; - init_zvtx->set_seeding_layer(seed_layer,7); - // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). - init_zvtx->set_min_zvtx_tracks(init_vertexing_min_zvtx_tracks); - init_zvtx->Verbosity(0); - se->registerSubsystem(init_zvtx); - } - if(use_hough_seeding){ - // find seed tracks using a subset of TPC layers - int min_layers = 4; - int nlayers_seeds = 12; - auto track_seed = new PHHoughSeeding("PHHoughSeeding", n_maps_layer, n_intt_layer, n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(0); - se->registerSubsystem(track_seed); - }else if(use_ca_seeding){ - auto ca_seed = new PHCASeeding(); - ca_seed->SetLayerRange(7,55); - ca_seed->SetSearchWindow(0.01,0.02); // (eta width, phi width) - ca_seed->SetMinHitsPerCluster(2); - ca_seed->SetMinClustersPerTrack(20); - se->registerSubsystem(ca_seed); - }else{ - 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... - se->registerSubsystem(tracker); - } - - /* - // Find all clusters associated with each seed track - auto track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", n_maps_layer, n_intt_layer, n_gas_layer, enable_micromegas ? n_micromegas_layer:0); - track_prop->Verbosity(0); - se->registerSubsystem(track_prop); - for(int i = 0;iset_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); - } - */ - - } - else - { - //------------------------------------------------------- - // Track finding using truth information only - //------------------------------------------------------ - - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - - // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(0); - se->registerSubsystem(pat_rec); - } - - if(useActsFitting) - { - if(use_stub_matcher) - { - // use truth information to assemble silicon clusters into track stubs - PHSiliconTruthTrackSeeding *silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); - - // Match TPC track stubs from CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding - PHSiliconTpcTrackMatching *silicon_match = new PHSiliconTpcTrackMatching(); - silicon_match ->Verbosity(0); - silicon_match->set_phi_search_window(0.02); // tune8 - optimum - silicon_match->set_eta_search_window(0.015); // tune8 - optimum - se->registerSubsystem(silicon_match); - - // Match TPC track stubs from CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding - PHMicromegasTpcTrackMatching *mm_match = new PHMicromegasTpcTrackMatching(); - mm_match ->Verbosity(0); - 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(13.0); - mm_match-> set_z_search_window_lyr2(0.2); - mm_match->set_min_tpc_layer(38); - se->registerSubsystem(mm_match); - } - else - { - // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder - PHTruthSiliconAssociation *silicon_assoc = new PHTruthSiliconAssociation(); - silicon_assoc ->Verbosity(0); - se->registerSubsystem(silicon_assoc); - } - - /// Use actsTracks or actsPropagation to prepare for ActsTrkFitter - /// actsTracks assumes some other propagation has already happened - /// whereas actstrkprop does the propagation - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - - PHActsTrkProp *actsProp = new PHActsTrkProp(); - actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - //actsFit->setTimeAnalysis(true); - //se->registerSubsystem(actsFit); - - } - - //------------------------------------------------ - // Fitting of tracks using Kalman Filter - //------------------------------------------------ - - if(useActsFitting) - { - #if __cplusplus >= 201703L - PHActsTracks *actsTracks = new PHActsTracks(); - actsTracks->Verbosity(0); - se->registerSubsystem(actsTracks); - - /// Use either PHActsTrkFitter to run the ACTS - /// KF track fitter, or PHActsTrkProp to run the ACTS Combinatorial - /// Kalman Filter which runs track finding and track fitting - /// Always run PHActsTracks first to take the SvtxTrack and convert it - /// to a form that Acts can process - - /// If you run PHActsTrkProp, disable PHGenFitTrkProp - //PHActsTrkProp *actsProp = new PHActsTrkProp(); - //actsProp->Verbosity(0); - //se->registerSubsystem(actsProp); - - PHActsTrkFitter *actsFit = new PHActsTrkFitter(); - actsFit->Verbosity(0); - actsFit->doTimeAnalysis(true); - se->registerSubsystem(actsFit); - #endif - } - else - { - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(0); - - if (use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - - kalman->set_vertexing_method(vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // Track Projections - //------------------ - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); - projection->Verbosity(verbosity); - //se->registerSubsystem(projection); - - } - - return; -} - - - void Tracking_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4eval.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libtrack_reco.so"); - - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer* se = Fun4AllServer::instance(); - - //---------------- - // Tracking evaluation - //---------------- - SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str(), "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); - eval->do_vertex_eval(true); - 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_eval_light(true); - eval->set_use_initial_vertex(true); - eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(0); - //se->registerSubsystem(eval); - - if(useActsFitting) - { - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - //se->registerSubsystem(actsEval); - } - - if(useActsFitting) - { - #if __cplusplus >= 201703L - ActsEvaluator *actsEval = new ActsEvaluator(outputfile+"_acts.root", eval); - actsEval->Verbosity(0); - se->registerSubsystem(actsEval); - #endif - } - 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", n_maps_layer, n_intt_layer, n_gas_layer); 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); - } - - return; -} diff --git a/macros/g4simulations/G4_Tracking_EIC.C b/macros/g4simulations/G4_Tracking_EIC.C deleted file mode 100644 index 45c5829bc..000000000 --- a/macros/g4simulations/G4_Tracking_EIC.C +++ /dev/null @@ -1,235 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_CEmc_EIC.C" -#include "G4_FEMC_EIC.C" -#include "G4_FHCAL.C" -#include "G4_GEM_EIC.C" -#include "G4_Mvtx_EIC.C" -#include "G4_TPC_EIC.C" - -#include - -#include - -#include - -#include - -#include - -R__LOAD_LIBRARY(libtrack_reco.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) - -namespace Enable -{ - bool TRACKING = false; - bool TRACKING_EVAL = false; - int TRACKING_VERBOSITY = 0; -} // namespace Enable - -namespace G4TRACKING -{ - bool DISPLACED_VERTEX = false; - bool PROJECTION_CEMC = false; - bool PROJECTION_FEMC = false; - bool PROJECTION_FHCAL = false; -} // namespace G4TRACKING - -//-----------------------------------------------------------------------------// -void TrackingInit() -{ - TRACKING::TrackNodeName = "TrackMap"; -} -//-----------------------------------------------------------------------------// -void Tracking_Reco() -{ - - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - // kalman->Verbosity(); - // kalman->Smearing(false); - if (G4TRACKING::DISPLACED_VERTEX) - { - //use very loose vertex constraint (1cm in sigma) to allow reco of displaced vertex - kalman->set_use_vertex_in_fitting(false); - kalman->set_vertex_xy_resolution(0); - kalman->set_vertex_z_resolution(0); - kalman->enable_vertexing(true); - kalman->set_vertex_min_ndf(1); - } - else - { - // constraint to a primary vertex and use it as part of the fitting level arm - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50e-4); - kalman->set_vertex_z_resolution(50e-4); - } - - kalman->set_sub_top_node_name("TRACKS"); - kalman->set_trackmap_out_name(TRACKING::TrackNodeName); - - //------------------------- - // Barrel - //------------------------- - if (Enable::BARREL) - { - kalman->add_phg4hits("G4HIT_BARREL0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - 20e-4/sqrt(12), // const float phires, - 20e-4/sqrt(12), // const float lonres, - 0.95, // const float eff, - 0); // const float noise - kalman->add_phg4hits("G4HIT_BARREL1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - 36.4e-4/sqrt(12), // const float phires, - 36.4e-4/sqrt(12), // const float lonres, - 0.95, // const float eff, - 0); // const float noise - } - //------------------------- - // MVTX - //------------------------- - if (Enable::MVTX) - { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // TPC - //------------------------- - if (Enable::TPC) - { - kalman->add_phg4hits( - "G4HIT_TPC", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // EGEM - //------------------------- - if (Enable::EGEM) - { - // GEM, 70um azimuthal resolution, 1cm radial strips - for (int i = 0; i < 4; i++) - { - kalman->add_phg4hits( - Form("G4HIT_EGEM_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - } - //------------------------- - // FGEM - //------------------------- - if (Enable::FGEM) - { - // GEM2, 70um azimuthal resolution, 1cm radial strips - for (int i = 2; i < 5; i++) - { - kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 100e-4, // const float radres, - //100. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FST - //------------------------- - float pitch=20e-4; - if (Enable::FST) - { - for (int i = 0; i < 6; i++) - { - if (i>=3) pitch=36.4e-4; - else pitch=20e-4; - - kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - pitch/sqrt(12), // const float radres, - pitch/sqrt(12), // const float phires, - 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* - 0.95, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FEMC - //------------------------- - // Saved track states (projections) - if (Enable::FEMC && G4TRACKING::PROJECTION_FEMC) - { - kalman->add_state_name("FEMC"); - } - - //------------------------- - // FHCAL - //------------------------- - if (Enable::FHCAL && G4TRACKING::PROJECTION_FHCAL) - { - kalman->add_state_name("FHCAL"); - } - //------------------------- - // CEMC - //------------------------- - - if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) - { - kalman->add_state_name("CEMC"); - } - se->registerSubsystem(kalman); - - return; -} - -//-----------------------------------------------------------------------------// - -void Tracking_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // Fast Tracking evaluation - //---------------- - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); - fast_sim_eval->set_filename(outputfile); - se->registerSubsystem(fast_sim_eval); -} diff --git a/macros/g4simulations/G4_Tracking_fsPHENIX.C b/macros/g4simulations/G4_Tracking_fsPHENIX.C deleted file mode 100644 index 6b356f1b8..000000000 --- a/macros/g4simulations/G4_Tracking_fsPHENIX.C +++ /dev/null @@ -1,209 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include "G4_Mvtx.C" -#include "G4_Intt.C" -#include "G4_TPC.C" - -#include - -#include - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libtrack_reco.so) - -namespace Enable -{ - bool TRACKING_TRACK = false; - bool TRACKING_EVAL = false; - int TRACKING_VERBOSITY = 0; -} - -namespace G4TRACKING -{ - -// Tracking simulation setup parameters and flag - leave them alone! -//============================================== -// Tracking reconstruction setup parameters and flags -//===================================== -const int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events -const bool use_track_prop = true; // true for normal track seeding, false to run with truth track seeding instead -const bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit -const bool use_primary_vertex = false; // if true, refit tracks with primary vertex included - adds second node to node tree, adds second evaluator and outputs separate ntuples - -// This is the setup we have been using before PHInitZVertexing was implemented - 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: -const bool use_truth_vertex = true; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex - -// This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event -//const bool use_truth_vertex = false; // set to false to get initial vertex from MVTX hits using PHInitZVertexing, true for using smeared truth vertex -//std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. -} - - -void TrackingInit(int verbosity = 0) -{ -} - -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 - //------------ - if (G4TRACKING::use_track_prop) - { - //-------------------------------------------------- - // Normal track seeding and propagation - //-------------------------------------------------- - - if(G4TRACKING::use_truth_vertex) - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - } - else - { - // get the initial vertex for track fitting from the MVTX hits - PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); - int seed_layer[7] = {0,1,2,3,4,5,6}; - init_zvtx->set_seeding_layer(seed_layer,7); - // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). - init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); - init_zvtx->Verbosity(verbosity); - se->registerSubsystem(init_zvtx); - } - - // find seed tracks using a subset of TPC layers - int min_layers = 4; - int nlayers_seeds = 12; - PHHoughSeeding* track_seed = new PHHoughSeeding("PHHoughSeeding", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer, nlayers_seeds, min_layers); - track_seed->Verbosity(0); - se->registerSubsystem(track_seed); - - // Find all clusters associated with each seed track - PHGenFitTrkProp* track_prop = new PHGenFitTrkProp("PHGenFitTrkProp", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - track_prop->Verbosity(verbosity); - se->registerSubsystem(track_prop); - for(int i = 0;iset_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); - } - } - else - { - //------------------------------------------------------- - // Track finding using truth information only - //------------------------------------------------------ - - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - - // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(verbosity); - se->registerSubsystem(pat_rec); - } - - //------------------------------------------------ - // Fitting of tracks using Kalman Filter - //------------------------------------------------ - - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - - if (G4TRACKING::use_primary_vertex) - { - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - } - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - - //------------------ - // 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); - 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(false); - eval->do_eval_light(true); - eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - 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(verbosity); - se->registerSubsystem(evalp); - } - - return; -} diff --git a/macros/g4simulations/G4_User.C b/macros/g4simulations/G4_User.C deleted file mode 100644 index f1838eee4..000000000 --- a/macros/g4simulations/G4_User.C +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -namespace Enable -{ - bool USER = false; -} - -namespace G4USER -{ - int myparam = 0; -} - -void UserInit(int verbosity = 0) -{ - // 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); -} - -void UserDetector(PHG4Reco *g4Reco) -{ - return; -} diff --git a/macros/g4simulations/G4_World.C b/macros/g4simulations/G4_World.C deleted file mode 100644 index de7f21534..000000000 --- a/macros/g4simulations/G4_World.C +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "GlobalVariables.C" - -#include - -R__LOAD_LIBRARY(libg4testbench.so) - -namespace G4WORLD -{ - static double AddSpace = 100.; // add this much space in cm around edge of detector - static string WorldMaterial = "G4_AIR"; // default world material, use G4_Galactic for material scan - static string PhysicsList = "QGSP_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(radius, BlackHoleGeometry::max_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, -((g4Reco->GetWorldSizeZ() - 100) / 2.)); - double max_zval = std::max(BlackHoleGeometry::max_z, (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; -} diff --git a/macros/g4simulations/GlobalVariables.C b/macros/g4simulations/GlobalVariables.C deleted file mode 100644 index b10fd6436..000000000 --- a/macros/g4simulations/GlobalVariables.C +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include - -static bool overlapcheck = false; -static double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes - - -// 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; -} - -// Global settings affecting multiple subsystems -namespace Enable -{ - bool OVERLAPCHECK = false; - bool ABSORBER = false; - bool DSTOUT = false; - bool DSTOUT_COMPRESS = false; - int VERBOSITY = 0; -} - -// 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 -{ - string TrackNodeName = "SvtxTrackMap"; -} diff --git a/macros/g4simulations/ReadClustersRunTracking.C b/macros/g4simulations/ReadClustersRunTracking.C deleted file mode 100644 index 2a4bc81db..000000000 --- a/macros/g4simulations/ReadClustersRunTracking.C +++ /dev/null @@ -1,165 +0,0 @@ -/*! - * \file RunGenFit.C - * \brief Example macro to run PHG4KalmanPatRec - * \author Haiwang Yu - */ -#pragma once -#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) -#include "GlobalVariables.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 - - -R__LOAD_LIBRARY(libg4tpc.so) -R__LOAD_LIBRARY(libg4intt.so) -R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libintt.so) -R__LOAD_LIBRARY(libmvtx.so) -R__LOAD_LIBRARY(libtpc.so) -R__LOAD_LIBRARY(libtrack_reco.so) -#endif - -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "G4Setup_sPHENIX.C" -#include "G4_Bbc.C" -#include "G4_Global.C" -#include "G4_CaloTrigger.C" -#include "G4_Jets.C" -#include "G4_HIJetReco.C" -#include "G4_DSTReader.C" -#include "DisplayOn.C" -R__LOAD_LIBRARY(libfun4all.so) -R__LOAD_LIBRARY(libg4testbench.so) -R__LOAD_LIBRARY(libphhepmc.so) -R__LOAD_LIBRARY(libPHPythia6.so) -R__LOAD_LIBRARY(libPHPythia8.so) -#endif - - -//#define _ONLY_SEEDING_ -void ReadClustersRunTracking( - const int nEvents = 1, - const char *inputFile = "G4sPHENIX.root", - const char *outputFile = "G4sPHENIX_tracking.root") -{ - - gSystem->Load("libtrack_reco.so"); - - gROOT->LoadMacro("G4Setup_sPHENIX.C"); - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(10); - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libphool.so"); - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4dst.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4eval.so"); - - gROOT->LoadMacro("G4_Tracking.C"); - - Tracking_Reco(0); - - // explicitely configure the evaluator - SvtxEvaluator* eval; - const int n_maps_layer = 3; - const int n_intt_layer = 4; - int n_gas_layer = 48; - - eval = new SvtxEvaluator("SVTXEVALUATOR", outputFile, "SvtxTrackMap", n_maps_layer, n_intt_layer, n_gas_layer); - eval->do_cluster_eval(false); - eval->do_g4hit_eval(false); - eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... - eval->do_gpoint_eval(false); - eval->do_eval_light(true); - eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(0); - se->registerSubsystem(eval); - - Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTin"); - - TString tstr_input(inputFile); - if (tstr_input.EndsWith(".root")) - in->AddFile(inputFile); - else - in->AddListFile(inputFile); - se->registerInputManager(in); - - se->run(nEvents); - std::cout << " Done Run, ending... " << std::endl; - se->End(); - - se->PrintTimer(); - - std::cout << " Success!! " << std::endl; - // delete se; - gSystem->Exit(0); - - -} - diff --git a/macros/g4simulations/flowAfterburner.xml b/macros/g4simulations/flowAfterburner.xml deleted file mode 100644 index b7c9b482c..000000000 --- a/macros/g4simulations/flowAfterburner.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - 11793 - - sHijing.dat - flowAfterburner.dat - - - -4.0 - 4.0 - 0.0 - 100.0 - - MINBIAS - diff --git a/macros/g4simulations/init_gui_vis.mac b/macros/g4simulations/init_gui_vis.mac deleted file mode 100644 index 8aca21396..000000000 --- a/macros/g4simulations/init_gui_vis.mac +++ /dev/null @@ -1,20 +0,0 @@ -# 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/phpythia6.cfg b/macros/g4simulations/phpythia6.cfg deleted file mode 100644 index 5dc006472..000000000 --- a/macros/g4simulations/phpythia6.cfg +++ /dev/null @@ -1,17 +0,0 @@ -roots 200 -proj p -targ p -frame cms -msel 0 // turn on all prod. mechanisms manually -msub 11 1 // these are the semi-hard QCD 2->2 processes -msub 12 1 -msub 13 1 -msub 28 1 -msub 53 1 -msub 68 1 -mstp 91 1 // gaussian intrinsic kt -parp 91 1.5 // intrinsic kt value -mstp 33 1 // use k factor -parp 31 2.5 // k factor -ckin 3 2.0 // min parton pt of 2.0 -#mstj 1 2 // independent fragmentation diff --git a/macros/g4simulations/phpythia8.cfg b/macros/g4simulations/phpythia8.cfg deleted file mode 100644 index 690260244..000000000 --- a/macros/g4simulations/phpythia8.cfg +++ /dev/null @@ -1,28 +0,0 @@ -! Beam settings -Beams:idA = 2212 ! first beam, p = 2212, pbar = -2212 -Beams:idB = 2212 ! second beam, p = 2212, pbar = -2212 -Beams:eCM = 200. ! CM energy of collision - -! Settings related to output in init(), next() and stat() -Init:showChangedSettings = on -#Next:numberCount = 0 ! print message every n events -Next:numberShowInfo = 1 ! print event information n times -#Next:numberShowProcess = 1 ! print process record n times -#Next:numberShowEvent = 1 ! print event record n times - -! PDF -# PDF:useLHAPDF = on -# PDF:LHAPDFset = CT10.LHgrid -PDF:pSet = 7 ! CTEQ6L, NLO alpha_s(M_Z) = 0.1180. - -! Process -#HardQCD:hardccbar = on -# HardQCD:hardbbbar = on -HardQCD:all = on -# Charmonium:all = on -# Bottomonium:all = on -# SoftQCD:nonDiffractive = on - -! Cuts -PhaseSpace:pTHatMin = 10.0 - diff --git a/macros/g4simulations/sartre.cfg b/macros/g4simulations/sartre.cfg deleted file mode 100644 index 065b27ab2..000000000 --- a/macros/g4simulations/sartre.cfg +++ /dev/null @@ -1,113 +0,0 @@ -//============================================================================== -// sartreRuncard.txt -// -// Copyright (C) 2010-2013 Tobias Toll and Thomas Ullrich -// -// This file is part of Sartre version: 1.1 -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation. -// This program is distributed in the hope that it will be useful, -// but without any warranty; without even the implied warranty of -// merchantability or fitness for a particular purpose. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// Author: Thomas Ullrich -// Last update: -// $Date: 2015-05-29 13:37:30 -0400 (Fri, 29 May 2015) $ -// $Author: tobilibob@gmail.com $ -//============================================================================== -// -// Example Runcard for Sartre Event Generator. -// -// Comments start with a # or // -// -// Name and value are separated by a "=": name = value -// (alternatively ":" can be used as well) -//============================================================================== -# -# Define beams -# -eBeamEnergy = 100 -hBeamEnergy = 100 -A = 197 - -# -# UPC settings, to run in UPC mode set UPC=true and UPCA into the photon emitting species: -# -UPC=true -UPCA=1 - -# -# Number of events and printout frequency -# -numberOfEvents = 100000 -timesToShow = 20 - -# -# Set verbosity -# -verbose = false -verboseLevel = 0 - -# -# Rootfile -# -rootfile = example.root - -# -# Model parameters -# -# vectorMesonID: 22, 113, 333, 443 -# dipoleModel: bSat or bNonSat -# -vectorMesonId = 443 -#dipoleModel = bSat -dipoleModel = bNonSat - -# -# User variable used for vector meson decays -# PDG: pi+ = 211, K+ = 321, e- = 11, mu- = 13 -# -userInt = 11 - -# -# Kinematic range min > max means no limits (given by table range) -# -Q2min = 1000000 -Q2max = 0 -Wmin = 1000000 -Wmax = 0 - -# -# Corrections -# -correctForRealAmplitude = true -correctSkewedness = true -# maxLambdaUsedInCorrections = 0.65 - -# -# Misc -# -enableNuclearBreakup = false -maxNuclearExcitationEnergy = 0.5 - -# -# Random generator seed (if not given current time is used) -# -#seed = 2011987 - -# -# User parameters -# -# userDouble = 0. -# userString = "Hello World!" -# userInt = 0 - -# -# Expert flags -# -# applyPhotonFlux = true diff --git a/macros/g4simulations/vis.mac b/macros/g4simulations/vis.mac deleted file mode 100644 index 5f41263ee..000000000 --- a/macros/g4simulations/vis.mac +++ /dev/null @@ -1,84 +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 OGL 1200x900-0+0 -# increase display limit for more complex detectors -/vis/ogl/set/displayListLimit 500000 -/vis/viewer/set/viewpointThetaPhi -100 -10 -#/vis/viewer/set/viewpointThetaPhi 10 -10 -/vis/viewer/addCutawayPlane -0.5 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/panTo 0.5 0 -/vis/viewer/zoom 2 -# -# 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 2 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. From de036d4e6abe74a30b754c01de403d812a4816db Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 6 Jan 2021 13:48:32 -0500 Subject: [PATCH 0933/1222] Set TOPOCLUSTER to disabled as default. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index ee1628c81..dfbc133e3 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -314,7 +314,7 @@ int Fun4All_G4_sPHENIX( 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; + Enable::TOPOCLUSTER = false && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // particle flow jet reconstruction - needs topoClusters! Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; From 6f453fb4385fcc6933f2696524db05c9717df1ef Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 8 Jan 2021 10:07:05 -0500 Subject: [PATCH 0934/1222] clean up old QA macros --- macros/QA/calorimeter/QA_Draw_ALL.sh | 47 -- macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C | 267 ----------- .../calorimeter/QA_Draw_CEMC_TowerCluster.C | 293 ------------ .../QA_Draw_Calorimeter_Sum_Cluster.C | 196 -------- .../QA_Draw_Calorimeter_Sum_TrackProj.C | 164 ------- .../QA_Draw_Calorimeter_Sum_TrackProjEP.C | 173 ------- macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C | 264 ----------- .../calorimeter/QA_Draw_HCALIN_TowerCluster.C | 300 ------------ macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C | 264 ----------- .../QA_Draw_HCALOUT_TowerCluster.C | 299 ------------ macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C | 415 ---------------- macros/QA/calorimeter/QA_Draw_Jet_Summary.C | 343 -------------- .../calorimeter/QA_Draw_Jet_TruthMatching.C | 294 ------------ macros/QA/calorimeter/QA_Draw_Utility.C | 446 ------------------ 14 files changed, 3765 deletions(-) delete mode 100755 macros/QA/calorimeter/QA_Draw_ALL.sh delete mode 100644 macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C delete mode 100644 macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C delete mode 100644 macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C delete mode 100644 macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C delete mode 100644 macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C delete mode 100644 macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Jet_Summary.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C delete mode 100644 macros/QA/calorimeter/QA_Draw_Utility.C diff --git a/macros/QA/calorimeter/QA_Draw_ALL.sh b/macros/QA/calorimeter/QA_Draw_ALL.sh deleted file mode 100755 index dfc26be51..000000000 --- a/macros/QA/calorimeter/QA_Draw_ALL.sh +++ /dev/null @@ -1,47 +0,0 @@ -#! /bin/tcsh -f - -echo "Usage: $0 new_QA_file [ reference_QA_file ]"; - -set q = '"'; - -if ($# < 1) then - echo "Missing parameters: $*" - exit 1 -endif - -set new_QA_file = "$q$1$q"; -set reference_QA_file = 'NULL'; - - -if ($# >= 2) then - set reference_QA_file = "$q$2$q"; -endif - -echo "$0 - New QA file: $new_QA_file"; -echo "$0 - Reference QA file: $reference_QA_file"; - -set macros = (\ - QA_Draw_CEMC_G4Hit.C \ - QA_Draw_CEMC_TowerCluster.C \ - QA_Draw_HCALIN_G4Hit.C \ - QA_Draw_HCALIN_TowerCluster.C \ - QA_Draw_HCALOUT_G4Hit.C \ - QA_Draw_HCALOUT_TowerCluster.C \ - QA_Draw_Calorimeter_Sum_Cluster.C \ - QA_Draw_Calorimeter_Sum_TrackProj.C \ - QA_Draw_Calorimeter_Sum_TrackProjEP.C \ -); - -# imake nstall-data -foreach macro ($macros) - root -b -q "$macro($new_QA_file, $reference_QA_file)" -end - -# last all jet stuff -root -b -q "QA_Draw_Jet_Spectrum.C(${q}h_QAG4SimJet_AntiKt_Truth_r07${q}, $new_QA_file, $reference_QA_file)" -root -b -q "QA_Draw_Jet_Spectrum.C(${q}h_QAG4SimJet_AntiKt_Tower_r07${q}, $new_QA_file, $reference_QA_file)" -root -b -q "QA_Draw_Jet_Summary.C(${q}AntiKt_Tower${q},$new_QA_file, $reference_QA_file)" - -echo "$0 - Output plots:"; -ls -lh $1*.png; - diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C b/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C deleted file mode 100644 index 47b5b2d2e..000000000 --- a/macros/QA/calorimeter/QA_Draw_CEMC_G4Hit.C +++ /dev/null @@ -1,267 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_CEMC_G4Hit.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_CEMC_G4Hit( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") - -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_CEMC_G4Hit", "QA_Draw_CEMC_G4Hit", 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_CEMC_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_XY", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_XY); - h_QAG4Sim_CEMC_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_CEMC_G4Hit_XY->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_CEMC_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_RZ", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_RZ); - h_QAG4Sim_CEMC_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_CEMC_G4Hit_RZ->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); - assert(h_new); - - h_new->Rebin(5); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F"); - assert(h_ref); - - h_ref->Rebin(5); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_VSF", "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Sumw2(); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C deleted file mode 100644 index c3c450490..000000000 --- a/macros/QA/calorimeter/QA_Draw_CEMC_TowerCluster.C +++ /dev/null @@ -1,293 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_CEMC_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -void QA_Draw_CEMC_TowerCluster( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") - -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_CEMC_TowerCluster", "QA_Draw_CEMC_TowerCluster", 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_3x3", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_1x1_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Tower_4x4_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( - 1.5); - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, - 5); - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, - 5); - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection); - - proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C deleted file mode 100644 index 959f34c88..000000000 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_Cluster.C +++ /dev/null @@ -1,196 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_Calorimeter_Sum_Cluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_Calorimeter_Sum_Cluster( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -//QA_Draw_Calorimeter_Sum_Cluster(const char * qa_file_name_new = -// "data/G4sPHENIXCells_100e24GeV.root_qa.root", -// const char * qa_file_name_ref = -// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - // obtain normalization - double Nevent_new = 1; - double Nevent_ref = 1; - - if (qa_file_new) - { - TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } - if (qa_file_ref) - { - TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } - - TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_Cluster", - "QA_Draw_Calorimeter_Sum_Cluster", 1800, 900); - c1->Divide(3, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - { - TH2F *h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN", "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->GetYaxis()->SetTitleOffset( - 1.5); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN->Draw("COLZ"); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - { - TH2F *h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT", "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->GetYaxis()->SetTitleOffset( - 1.5); - h_QAG4Sim_CalorimeterSum_Cluster_CEMC_HCALIN_HCALOUT->Draw("COLZ"); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // empty pannel - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_Ratio_CEMC_HCALIN_HCALOUT", - "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C deleted file mode 100644 index 8cb5d2de0..000000000 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProj.C +++ /dev/null @@ -1,164 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_Calorimeter_Sum_TrackProj.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_Calorimeter_Sum_TrackProj( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -//QA_Draw_Calorimeter_Sum_TrackProj(const char * qa_file_name_new = -// "data/G4sPHENIXCells_100e24GeV.root_qa.root", -// const char * qa_file_name_ref = -// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - // obtain normalization - double Nevent_new = 1; - double Nevent_ref = 1; - - // obtain normalization - double Ntrack_new = 0; - double Ntrack_ref = 0; - - if (qa_file_new) - { - TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } - if (qa_file_ref) - { - TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } - - vector subsystems; - subsystems.push_back("CEMC"); - subsystems.push_back("HCALIN"); - subsystems.push_back("HCALOUT"); - - TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProj", - "QA_Draw_Calorimeter_Sum_TrackProj", 1100, 1100); - c1->Divide(3, 3); - int idx = 1; - TPad *p; - - for (int i = 0; i < subsystems.size(); ++i) - { - const TString subsystem(subsystems[i].c_str()); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_CalorimeterSum_TrackProj = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_TrackProj); - h_QAG4Sim_CalorimeterSum_TrackProj->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_CalorimeterSum_TrackProj->Draw("COLZ"); - - TH2F *h_QAG4Sim_CalorimeterSum_TrackProj_Ref = NULL; - if (qa_file_ref) - { - h_QAG4Sim_CalorimeterSum_TrackProj_Ref = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_" + subsystem + "_TrackProj", - "TH2F"); - assert(h_QAG4Sim_CalorimeterSum_TrackProj); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - // x projections - { - TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px")); - - h_new->Scale(1. / Ntrack_new); - - TH1 *h_ref = NULL; - if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) - { - h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_px_ref")); - - h_ref->Scale(1. / Ntrack_ref); - } - - h_new->GetXaxis()->SetTitleOffset(1.05); - h_new->GetYaxis()->SetTitle("Energy / track / bin"); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - // y projections - { - TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py")); - - h_new->Scale(1. / Ntrack_new); - - TH1 *h_ref = NULL; - if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref) - { - h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString("_py_ref")); - - h_ref->Scale(1. / Ntrack_ref); - } - - h_new->GetXaxis()->SetTitleOffset(1.05); - h_new->GetYaxis()->SetTitle("Energy / track / bin"); - - DrawReference(h_new, h_ref); - } - } - -// PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); - - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C b/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C deleted file mode 100644 index e75f2cd2c..000000000 --- a/macros/QA/calorimeter/QA_Draw_Calorimeter_Sum_TrackProjEP.C +++ /dev/null @@ -1,173 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_Calorimeter_Sum_TrackProjEP.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_Calorimeter_Sum_TrackProjEP( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -//QA_Draw_Calorimeter_Sum_TrackProjEP(const char * qa_file_name_new = -// "data/G4sPHENIXCells_100e24GeV.root_qa.root", -// const char * qa_file_name_ref = -// "data/G4Hits_sPHENIX_e-_eta0_24GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - // obtain normalization - double Nevent_new = 1; - double Nevent_ref = 1; - - // obtain normalization - double Ntrack_new = 0; - double Ntrack_ref = 0; - - if (qa_file_new) - { - TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } - if (qa_file_ref) - { - TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString("h_QAG4Sim_CalorimeterSum_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Track")); - } - - TCanvas *c1 = new TCanvas("QA_Draw_Calorimeter_Sum_TrackProjEP", - "QA_Draw_Calorimeter_Sum_TrackProjEP", 1800, 600); - c1->Divide(3, 1); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - if (Ntrack_new > 0) - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Ntrack_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_3x3Tower_EP", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Ntrack_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / track / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - if (Ntrack_new > 0) - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Ntrack_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_TrackProj_5x5Tower_EP", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Ntrack_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / track / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - if (Nevent_new > 0) - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - if (h_new) - { - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_CalorimeterSum_Cluster_EP", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - } - -// PutInputFileName(c1, 0.07, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C deleted file mode 100644 index a8786a379..000000000 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_G4Hit.C +++ /dev/null @@ -1,264 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALIN_G4Hit.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -void QA_Draw_HCALIN_G4Hit( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") - -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_G4Hit", "QA_Draw_HCALIN_G4Hit", - 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALIN_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_XY", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_XY); - h_QAG4Sim_HCALIN_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_HCALIN_G4Hit_XY->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALIN_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_RZ", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_RZ); - h_QAG4Sim_HCALIN_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_HCALIN_G4Hit_RZ->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection); - - proj_ref = h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALIN_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_HitTime", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - // h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_VSF", "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .2); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C deleted file mode 100644 index 0ca698407..000000000 --- a/macros/QA/calorimeter/QA_Draw_HCALIN_TowerCluster.C +++ /dev/null @@ -1,300 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALIN_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_HCALIN_TowerCluster( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_TowerCluster", - "QA_Draw_HCALIN_TowerCluster", 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Tower_4x4_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( - 1.5); - // h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, - // 5); - // h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, - // 5); - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); - proj_new->Rebin(4); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_px"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); - - proj_new->Rebin(4); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALIN_Cluster_LateralTruthProjection_py"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALIN_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C deleted file mode 100644 index 000bbc11e..000000000 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_G4Hit.C +++ /dev/null @@ -1,264 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALOUT_G4Hit.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -void QA_Draw_HCALOUT_G4Hit( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_G4Hit", "QA_Draw_HCALOUT_G4Hit", - 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALOUT_G4Hit_XY = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_XY", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_XY); - h_QAG4Sim_HCALOUT_G4Hit_XY->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_HCALOUT_G4Hit_XY->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALOUT_G4Hit_RZ = (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_RZ", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_RZ); - h_QAG4Sim_HCALOUT_G4Hit_RZ->GetYaxis()->SetTitleOffset(1.5); - h_QAG4Sim_HCALOUT_G4Hit_RZ->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_px"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALOUT_G4Hit_LateralTruthProjection_py"); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_HitTime", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized energy per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(20); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionTruthEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(20); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); - assert(h_new); - - // h_new->Rebin(2); - // h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_VSF", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_new); - - h_new->Rebin(4); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_G4Hit_FractionEMVisibleEnergy", "TH1F"); - assert(h_ref); - - h_ref->Rebin(4); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C b/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C deleted file mode 100644 index 6e373c367..000000000 --- a/macros/QA/calorimeter/QA_Draw_HCALOUT_TowerCluster.C +++ /dev/null @@ -1,299 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALOUT_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" - -using namespace std; - -void QA_Draw_HCALOUT_TowerCluster( - const char *qa_file_name_new = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root", - const char *qa_file_name_ref = - "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - TCanvas *c1 = new TCanvas("QA_Draw_HCALOUT_TowerCluster", - "QA_Draw_HCALOUT_TowerCluster", 1800, 900); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); - assert(h_new); - - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_3x3", "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Normalized tower count per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_1x1_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogx(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); - assert(h_new); - - h_new->Rebin(40); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Tower_4x4_max", "TH1F"); - assert(h_ref); - - h_ref->Rebin(40); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogz(); - - TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset( - 1.5); - // h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5, - // 5); - // h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5, - // 5); - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->Draw("COLZ"); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); - proj_new->Rebin(4); - - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX( - "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - TH1D *proj_new = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); - - proj_new->Rebin(4); - proj_new->Scale(1. / proj_new->GetSum()); - - TH1D *proj_ref = NULL; - if (qa_file_ref) - { - TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection = - (TH2F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", "TH2F"); - assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection); - - proj_ref = - h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY( - "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py"); - proj_ref->Rebin(4); - proj_ref->Scale(1. / proj_ref->GetSum()); - } - - proj_new->GetYaxis()->SetTitleOffset(1.); - proj_new->GetXaxis()->SetTitleOffset(1.); - proj_new->GetYaxis()->SetTitle("Normalized energy distribution"); - // proj_new->GetXaxis()->SetRangeUser(-10, 10); - - DrawReference(proj_new, proj_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / h_new->GetSum()); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / h_ref->GetSum()); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Probability per bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C b/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C deleted file mode 100644 index 3129f9f4e..000000000 --- a/macros/QA/calorimeter/QA_Draw_Jet_Spectrum.C +++ /dev/null @@ -1,415 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALOUT_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -void QA_Draw_Jet_Spectrum( - // - // const char * jet = "h_QAG4SimJet_AntiKt_Tower_r07", - const char *jet = "h_QAG4SimJet_AntiKt_Truth_r07", - const char *qa_file_name_new = - "data/G4sPHENIXCells_250jets25GeV.root_qa.root", - const char *qa_file_name_ref = - "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") -{ - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - // obtain normalization - double Nevent_new = 1; - double Nevent_ref = 1; - - if (qa_file_new) - { - TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } - if (qa_file_ref) - { - TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Normalization"), "TH1D"); - assert(h_norm); - - Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin("Event")); - } - - TCanvas *c1 = new TCanvas(TString("QA_Draw_Jet_Spectrum_") + TString(jet), - TString("QA_Draw_Jet_Spectrum_") + TString(jet), 1800, 1000); - c1->Divide(4, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_eta"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_eta"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_phi"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_phi"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Et"), "TH1F"); - assert(h_new); - - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Et"), "TH1F"); - assert(h_ref); - - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Mass"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Mass"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogx(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_CompSize"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CompSize"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_Ratio"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_CEMC_HCalIN_Ratio"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - - if (TString(jet).Contains("Truth")) - { - // truth jets - - p = (TPad *) c1->cd(idx++); - c1->Update(); - p->SetLogy(); - - { - TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked( - TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); - assert(h_new); - - h_new->Rebin(2); - h_new->Sumw2(); - h_new->Scale(1. / Nevent_new); - - TH1F *h_ref = NULL; - if (qa_file_ref) - { - h_ref = (TH1F *) qa_file_ref->GetObjectChecked( - TString(jet) + TString("_Leading_Leakage_Ratio"), "TH1F"); - assert(h_ref); - - h_ref->Rebin(2); - h_ref->Scale(1. / Nevent_ref); - } - - h_new->GetYaxis()->SetTitleOffset(1.5); - h_new->GetYaxis()->SetTitle("Count / event / bin"); - // h_new->GetXaxis()->SetRangeUser(-0, .1); - - DrawReference(h_new, h_ref); - } - } - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} - -// inclusive jet stuff. Not very interesting. - -// p = (TPad *) c1->cd(idx++); -// c1->Update(); -// p->SetLogy(); -// -// { -// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( -// TString(jet) + TString("_Inclusive_eta"), "TH1F"); -// assert(h_new); -// -//// h_new->Sumw2(); -// h_new->Scale(1. / Nevent_new); -// -// TH1F * h_ref = NULL; -// if (qa_file_ref) -// { -// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( -// TString(jet) + TString("_Inclusive_eta"), "TH1F"); -// assert(h_ref); -// -// h_ref->Scale(1. / Nevent_ref); -// } -// -// h_new->GetYaxis()->SetTitleOffset(1.5); -// h_new->GetYaxis()->SetTitle("Energy (GeV) / event / bin"); -// // h_new->GetXaxis()->SetRangeUser(-0, .1); -// -// DrawReference(h_new, h_ref); -// } -// -// p = (TPad *) c1->cd(idx++); -// c1->Update(); -// p->SetLogy(); -// -// { -// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( -// TString(jet) + TString("_Inclusive_phi"), "TH1F"); -// assert(h_new); -// -//// h_new->Sumw2(); -// h_new->Scale(1. / Nevent_new); -// -// TH1F * h_ref = NULL; -// if (qa_file_ref) -// { -// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( -// TString(jet) + TString("_Inclusive_phi"), "TH1F"); -// assert(h_ref); -// -// h_ref->Scale(1. / Nevent_ref); -// } -// -// h_new->GetYaxis()->SetTitleOffset(1.5); -// h_new->GetYaxis()->SetTitle("Energy (GeV) / event / bin"); -// // h_new->GetXaxis()->SetRangeUser(-0, .1); -// -// DrawReference(h_new, h_ref); -// } -// -// p = (TPad *) c1->cd(idx++); -// c1->Update(); -// p->SetLogy(); -// p->SetLogx(); -// -// { -// TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked( -// TString(jet) + TString("_Inclusive_E"), "TH1F"); -// assert(h_new); -// -// h_new->Sumw2(); -// h_new->Scale(1. / Nevent_new); -// -// TH1F * h_ref = NULL; -// if (qa_file_ref) -// { -// TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked( -// TString(jet) + TString("_Inclusive_E"), "TH1F"); -// assert(h_ref); -// -// h_ref->Scale(1. / Nevent_ref); -// } -// -// h_new->GetYaxis()->SetTitleOffset(1.5); -// h_new->GetYaxis()->SetTitle("Count / event / bin"); -// // h_new->GetXaxis()->SetRangeUser(-0, .1); -// -// DrawReference(h_new, h_ref); -// } diff --git a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C b/macros/QA/calorimeter/QA_Draw_Jet_Summary.C deleted file mode 100644 index 116d19e16..000000000 --- a/macros/QA/calorimeter/QA_Draw_Jet_Summary.C +++ /dev/null @@ -1,343 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALOUT_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//some common style files -#include "QA_Draw_Jet_TruthMatching.C" -//#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -void QA_Draw_Jet_Summary(const char *jet_family = "AntiKt_Tower", - const char *qa_file_name_new = - "data/G4sPHENIXCells_2000jets25GeV.root_qa.root", - const char *qa_file_name_ref = - "data/G4sPHENIXCells_250jets25GeV.root_qa.root") -{ - //! drawing energy range - const double min_Et = 10; - const double max_Et = 80; - - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - // file IO - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - // buffer for results - vector vec_radius; - vector vec_phi_res; - vector vec_eta_res; - vector vec_e_res; - vector vec_et_res; - vector vec_reco_eff; - vector vec_purity; - - // list and process all jets - TList *hist_key_list = qa_file_new->GetListOfKeys(); - for (int i = 0; i < hist_key_list->GetSize(); ++i) - { - TString key_name = hist_key_list->At(i)->GetName(); - - TString s_re_fullname = Form( - "h_QAG4SimJet_.*_r[0-9]*_%s_r[0-9]*_Matching_Count_Truth_Et", - jet_family); // regular expression for search - TRegexp re_fullname(s_re_fullname, false); - if (key_name.Index(re_fullname) == kNPOS) - continue; - - // cout << " key_name = " << key_name << endl; - TString jet_pair_name = key_name(0, - key_name.Length() - TString("_Matching_Count_Truth_Et").Length()); // remove suffix - - // cout << " jet_pair_name = " << jet_pair_name << endl; - - //get jet radius - TRegexp re_jetradius("_r[0-9]*", false); - Ssiz_t index_radius = key_name.Index(re_jetradius); // first radius - index_radius = key_name.Index(re_jetradius, index_radius + 1); // second radius - assert(index_radius != kNPOS); - float radius = 0; - sscanf(key_name(index_radius, 100).Data(), "_r%f", &radius); - // cout << " index_radius = " << index_radius << endl; - assert(radius != 0); - radius /= 10; // jet radius convention in DST names - - cout << "QA_Draw_Jet_Summary - process jet pair " << jet_pair_name - << " with radius = " << radius << endl; - - vector resolution_efficiency_summary( - QA_Draw_Jet_TruthMatching(jet_pair_name, qa_file_name_new, - qa_file_name_ref)); - - //save results - vec_radius.push_back(radius); - vec_phi_res.push_back(resolution_efficiency_summary[0]); - vec_eta_res.push_back(resolution_efficiency_summary[1]); - vec_e_res.push_back(resolution_efficiency_summary[2]); - vec_et_res.push_back(resolution_efficiency_summary[3]); - vec_reco_eff.push_back(resolution_efficiency_summary[4]); - vec_purity.push_back(resolution_efficiency_summary[5]); - - // break; - } - - // plot - TCanvas *c1 = new TCanvas( - TString("QA_Draw_Jet_Summary_") + TString(jet_family), - TString("QA_Draw_Jet_Summary_") + TString(jet_family), 1800, 900); - c1->Divide(3, 2); - int idx = 1; - TPad *p; - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - TH1 *h_frame = - p->DrawFrame(min_Et, -.1, max_Et, .1, - TString(jet_family) + " #phi Reconstruction;E_{T, Truth} (GeV);#phi_{Reco} - #phi_{Truth} (rad)"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - TLine *l = new TLine(min_Et, 0, max_Et, 0); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - TLegend *legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_phi_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - h_frame = - p->DrawFrame(min_Et, -.1, max_Et, .1, - TString(jet_family) + " #eta Reconstruction;E_{T, Truth} (GeV);#eta_{Reco} - #eta_{Truth}"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - l = new TLine(min_Et, 0, max_Et, 0); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_eta_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - h_frame = p->DrawFrame(min_Et, 0, max_Et, 2, - TString(jet_family) + " Jet Energy Reconstruction;E_{Truth} (GeV);E_{Reco} / E_{Truth}"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_e_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - h_frame = - p->DrawFrame(min_Et, 0, max_Et, 2, - TString(jet_family) + " Jet E_{T} Reconstruction;E_{T, Truth} (GeV);E_{T, Reco} / E_{T, Truth}"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_et_res[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, - TString(jet_family) + " Reco Efficiency;E_{T, Truth} (GeV);Reco efficiency"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_reco_eff[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // ------------------------------------ - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - h_frame = p->DrawFrame(min_Et, 0, max_Et, 1.2, - TString(jet_family) + " Reconstruction Purity;E_{T, Reco} (GeV);Reconstruction Purity"); - // h_frame->GetYaxis()->SetTitleOffset(1.01); - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - p->SetGridx(0); - p->SetGridy(0); - legend = new TLegend(0.7, 0.2, .95, 0.5); - legend->SetFillColor(kWhite); - legend->SetFillStyle(1001); - legend->SetLineWidth(2); - legend->SetLineColor(kBlack); - legend->SetLineStyle(kSolid); - for (int i = 0; i < vec_radius.size(); ++i) - { - const float radius = vec_radius[i]; - - TGraphErrors *ge = vec_purity[i]; - assert(ge); - ge = new TGraphErrors(*ge); // make a copy - - ge->SetLineColor(i + 2); // automatic color scheme from ROOT - ge->SetMarkerColor(i + 2); // automatic color scheme from ROOT - for (int idata = 0; idata < ge->GetN(); ++idata) - { - (ge->GetX())[idata] += i * 0.5; // shift x a little bit - (ge->GetEX())[idata] = 0; // no x error bar - } - ge->Draw("p E l"); - legend->AddEntry(ge, Form("r = %.1f", radius), "elp"); - } - legend->Draw(); - - // PutInputFileName(c1, .03, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); -} diff --git a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C b/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C deleted file mode 100644 index ec17c2d17..000000000 --- a/macros/QA/calorimeter/QA_Draw_Jet_TruthMatching.C +++ /dev/null @@ -1,294 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_HCALOUT_TowerCluster.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -//some common style files -#include "../../sPHENIXStyle/sPhenixStyle.C" -#include "QA_Draw_Utility.C" -using namespace std; - -vector -QA_Draw_Jet_TruthMatching(const char *jet = - "h_QAG4SimJet_AntiKt_Truth_r07_AntiKt_Tower_r07", - const char *qa_file_name_new = - "data/G4sPHENIXCells_250jets25GeV.root_qa.root", - const char *qa_file_name_ref = - "data/G4sPHENIXCells_2000jets25GeV.root_qa.root") -{ - //! drawing energy range - const double min_Et = 10; - const double max_Et = 80; - - SetsPhenixStyle(); - TVirtualFitter::SetDefaultFitter("Minuit2"); - - TFile *qa_file_new = new TFile(qa_file_name_new); - assert(qa_file_new->IsOpen()); - - TFile *qa_file_ref = NULL; - if (qa_file_name_ref) - { - qa_file_ref = new TFile(qa_file_name_ref); - assert(qa_file_ref->IsOpen()); - } - - vector resolution_collections; - - TCanvas *c1 = new TCanvas( - TString("QA_Draw_Jet_TruthMatching_") + TString(jet), - TString("QA_Draw_Jet_TruthMatching_") + TString(jet), 1800, 900); - c1->Divide(3, 2); - int idx = 1; - TPad *p; - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dPhi", "TH2F"); - - assert(proj_new); - - proj_new->Rebin2D(1, 5); - - TGraphErrors *ge = FitProfile(proj_new); - - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); - - TGraphErrors *ge_ref = NULL; - if (qa_file_ref) - { - TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dPhi", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors *ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); - - resolution_collections.push_back(ge); - } - TLine *l = new TLine(min_Et, 0, max_Et, 00); - l->Draw(); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dEta", "TH2F"); - - assert(proj_new); - - proj_new->Rebin2D(1, 5); - TGraphErrors *ge = FitProfile(proj_new); - - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); - - TGraphErrors *ge_ref = NULL; - if (qa_file_ref) - { - TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dEta", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors *ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); - - resolution_collections.push_back(ge); - } - l = new TLine(min_Et, 0, max_Et, 00); - l->Draw(); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dE", "TH2F"); - - assert(proj_new); - - // proj_new->Rebin2D(1,5); - - TGraphErrors *ge = FitProfile(proj_new); - - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); - - TGraphErrors *ge_ref = NULL; - if (qa_file_ref) - { - TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dE", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors *ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); - - resolution_collections.push_back(ge); - } - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *proj_new = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_dEt", "TH2F"); - - assert(proj_new); - - // proj_new->Rebin2D(1,5); - TGraphErrors *ge = FitProfile(proj_new); - - proj_new->GetXaxis()->SetRangeUser(min_Et, max_Et); - proj_new->GetYaxis()->SetTitleOffset(1.5); - proj_new->Draw("COLZ"); - - TGraphErrors *ge_ref = NULL; - if (qa_file_ref) - { - TH2F *proj_ref = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_dEt", "TH2F"); - assert(proj_ref); - proj_ref->Rebin2D(1, 5); - TGraphErrors *ge_ref = FitProfile(proj_ref); - } - DrawReference(ge, ge_ref); - - resolution_collections.push_back(ge); - } - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); - assert(h2); - - TH1 *h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); - // TH1 * h_pass = h2->ProjectionX( - // TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match - TH1 *h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm); - - h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); - h_ratio->GetYaxis()->SetTitle("Reco efficiency"); - h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); - - TH1 *h_ratio_ref = NULL; - if (qa_file_ref) - { - TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_Count_Truth_Et", "TH2F"); - assert(h2); - TH1 *h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_All", 1, 1); - // TH1 * h_pass = h2->ProjectionX( - // TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 2, 2);// inclusive match - TH1 *h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Truth_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm); - } - - DrawReference(h_ratio, h_ratio_ref, true); - - resolution_collections.push_back(new TGraphErrors(h_ratio)); - } - - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - - p = (TPad *) c1->cd(idx++); - c1->Update(); - // p->SetLogz(); - - { - TH2F *h2 = (TH2F *) qa_file_new->GetObjectChecked( - TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); - assert(h2); - - TH1 *h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); - // TH1 * h_pass = h2->ProjectionX( - // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match - TH1 *h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - TH1 *h_ratio = GetBinominalRatio(h_pass, h_norm); - - h_ratio->GetXaxis()->SetRangeUser(min_Et, max_Et); - h_ratio->GetYaxis()->SetTitle("Reconstruction Purity"); - h_ratio->GetYaxis()->SetRangeUser(-0, 1.2); - - TH1 *h_ratio_ref = NULL; - if (qa_file_ref) - { - TH2F *h2 = (TH2F *) qa_file_ref->GetObjectChecked( - TString(jet) + "_Matching_Count_Reco_Et", "TH2F"); - assert(h2); - - TH1 *h_norm = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_All", 1, 1); - // TH1 * h_pass = h2->ProjectionX( - // TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 2, 2); // inclusive match - TH1 *h_pass = h2->ProjectionX( - TString(jet) + "_Matching_Count_Reco_Et" + "_Matched", 3, 3); // unique match - assert(h_norm); - assert(h_pass); - h_ratio_ref = GetBinominalRatio(h_pass, h_norm); - } - - DrawReference(h_ratio, h_ratio_ref, true); - - resolution_collections.push_back(new TGraphErrors(h_ratio)); - } - - l = new TLine(min_Et, 1, max_Et, 1); - l->Draw(); - -// PutInputFileName(c1, .04, qa_file_name_new, qa_file_name_ref); - SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), true); - - return resolution_collections; -} diff --git a/macros/QA/calorimeter/QA_Draw_Utility.C b/macros/QA/calorimeter/QA_Draw_Utility.C deleted file mode 100644 index 8f0ab4e58..000000000 --- a/macros/QA/calorimeter/QA_Draw_Utility.C +++ /dev/null @@ -1,446 +0,0 @@ -// $Id: $ - -/*! - * \file QA_Draw_Utility.C - * \brief - * \author Jin Huang - * \version $Revision: $ - * \date $Date: $ - */ - -#ifndef QA_Draw_Utility_C -#define QA_Draw_Utility_C - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include - -using namespace std; - -//! Service function to SaveCanvas() -void SavePad(TPad *p) -{ - if (!p) - return; - - TList *l = p->GetListOfPrimitives(); - // l->Print(); - - TIter next(l); - TObject *obj = NULL; - while ((obj = next())) - { - if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TPad")) >= 0) - { - if ((TPad *) obj != p) - SavePad((TPad *) obj); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TH1")) >= 0) - { - cout << "Save TH1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TF1")) >= 0) - { - cout << "Save TF1 " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - else if (obj->IsA()->GetBaseClassOffset(TClass::GetClass("TGraph")) >= 0) - { - cout << "Save TGraph " << obj->GetName() << endl; - obj->Clone()->Write(obj->GetName(), TObject::kOverwrite); - } - } -} - -//! Save canvas to multiple formats -/*! - * @param[in] c pointer to the canvas - * @param[in] name Base of the file name. The default is the name of the cavas - * @param[in] bEPS true = save .eps and .pdf format too. - */ -void SaveCanvas(TCanvas *c, TString name = "", Bool_t bEPS = kTRUE) -{ - if (name.Length() == 0) - name = c->GetName(); - - c->Print(name + ".png"); - - TDirectory *oldd = gDirectory; - - TString rootfilename; - - c->Print(rootfilename = name + ".root"); - - TFile f(rootfilename, "update"); - - SavePad(c); - - f.Close(); - - oldd->cd(); - - if (bEPS) - { - // c->Print(name + ".pdf"); - - float x = 20; - float y = 20; - gStyle->GetPaperSize(x, y); - - gStyle->SetPaperSize(c->GetWindowWidth() / 72 * 2.54, - c->GetWindowHeight() / 72 * 2.54); - // c->Print(name + ".eps"); - c->Print(name + ".svg"); - gSystem->Exec("rsvg-convert -f pdf -o " + name + ".pdf " + name + ".svg"); - gSystem->Exec("rm -fv " + name + ".svg"); - - gStyle->SetPaperSize(x, y); - } - // c->Print(name+".C"); -} - -//! Draw 1D histogram along with its reference as shade -//! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -double DrawReference(TH1 *hnew, TH1 *href, bool draw_href_error = false) -{ - hnew->SetLineColor(kBlue + 3); - hnew->SetMarkerColor(kBlue + 3); - // hnew->SetLineWidth(2); - hnew->SetMarkerStyle(kFullCircle); - // hnew->SetMarkerSize(1); - - if (href) - { - if (draw_href_error) - { - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(kSolid); - href->SetMarkerColor(kGreen + 1); - // href->SetLineWidth(2); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - } - else - { - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(0); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(0); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - } - } - - hnew->Draw(); // set scale - - double ks_test = NAN; - - if (href) - { - if (draw_href_error) - { - href->DrawClone("E2 same"); - href->SetFillStyle(0); - href->SetLineWidth(8); - href->DrawClone("HIST same ]["); - } - else - href->Draw("HIST same"); - hnew->Draw("same"); // over lay data points - - ks_test = hnew->KolmogorovTest(href, "D"); - } - - // --------------------------------- - // now, make summary header - // --------------------------------- - if (href) - { - gPad->SetTopMargin(.14); - TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); - legend->Draw(); - legend = new TLegend(0, .86, .3, .93, NULL, "NB NDC"); - legend->AddEntry(href, Form("Reference"), "f"); - legend->Draw(); - legend = new TLegend(0.3, .86, 1, .93, NULL, "NB NDC"); - TLegendEntry *le = legend->AddEntry(hnew, Form("New: KS-Test P=%.3f", ks_test), "lpe"); - if (ks_test>=1) - le->SetTextColor(kBlue+1); - else if (ks_test>=.2) - le->SetTextColor(kGreen+2); - else if (ks_test>=.05) - le->SetTextColor(kYellow+1); - else - le->SetTextColor(kRed+1); - legend->Draw(); - } - else - { - gPad->SetTopMargin(.7); - TLegend *legend = new TLegend(0, .93, 0, 1, hnew->GetTitle(), "NB NDC"); - legend->Draw(); - } - - return ks_test; -} - -//! Draw 1D TGraph along with its reference as shade -//! @param[in] draw_href_error whether to draw error band for reference plot. Otherwise, it is a filled histogram (default) -void DrawReference(TGraph *hnew, TGraph *href, bool draw_href_error = true) -{ - hnew->SetLineColor(kBlue + 3); - hnew->SetMarkerColor(kBlue + 3); - hnew->SetLineWidth(2); - hnew->SetMarkerStyle(kFullCircle); - hnew->SetMarkerSize(1); - - if (href) - { - if (draw_href_error) - { - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetFillStyle(0); - href->SetLineStyle(kSolid); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(4); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - } - else - { - href->SetLineColor(kGreen + 1); - href->SetFillColor(kGreen + 1); - href->SetLineStyle(0); - href->SetMarkerColor(kGreen + 1); - href->SetLineWidth(0); - href->SetMarkerStyle(kDot); - href->SetMarkerSize(0); - } - } - - if (href) - { - if (draw_href_error) - { - href->DrawClone("E2"); - } - else - href->Draw("HIST same"); - hnew->Draw("p e"); // over lay data points - } -} - -//! Fit for resolution of TH2F -TGraphErrors * -FitResolution(const TH2F *h2, const bool normalize_mean = true) -{ - TProfile *p2 = h2->ProfileX(); - - int n = 0; - double x[1000]; - double ex[1000]; - double y[1000]; - double ey[1000]; - - for (int i = 1; i <= h2->GetNbinsX(); i++) - { - TH1D *h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); - - if (h1->GetSum() < 10) - continue; - - TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, - p2->GetBinError(i) * 4); - - TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", - -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); - - fgaus.SetParameter(1, p2->GetBinContent(i)); - fgaus.SetParameter(2, p2->GetBinError(i)); - - h1->Fit(&fgaus, "MQ0"); - - x[n] = p2->GetBinCenter(i); - ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; - - const double norm = normalize_mean ? fgaus.GetParameter(1) : 1; - - y[n] = fgaus.GetParameter(2) / norm; - ey[n] = fgaus.GetParError(2) / norm; - - n++; - delete h1; - } - - TGraphErrors *ge = new TGraphErrors(n, x, y, 0, ey); - ge->SetName(TString(h2->GetName()) + "_FitResolution"); - - ge->SetLineColor(kBlue + 3); - ge->SetMarkerColor(kBlue + 3); - ge->SetLineWidth(2); - ge->SetMarkerStyle(kFullCircle); - ge->SetMarkerSize(1); - return ge; -} - -//! Fit for profile along the Y direction of TH2F -TGraphErrors * -FitProfile(const TH2F *h2) -{ - TProfile *p2 = h2->ProfileX(); - - int n = 0; - double x[1000]; - double ex[1000]; - double y[1000]; - double ey[1000]; - - for (int i = 1; i <= h2->GetNbinsX(); i++) - { - TH1D *h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i); - - if (h1->GetSum() < 10) - continue; - - TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4, - p2->GetBinError(i) * 4); - - TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]", - -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4); - - fgaus.SetParameter(1, p2->GetBinContent(i)); - fgaus.SetParameter(2, p2->GetBinError(i)); - - h1->Fit(&fgaus, "MQ0"); - - // f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1), - // fgaus.GetParameter(2), fgaus.GetParameter(0) / 2, - // fgaus.GetParameter(2) / 4, 0); - // - // h1->Fit(&f2, "MQ0"); - - // new TCanvas; - // h1->Draw(); - // fgaus.Draw("same"); - // break; - - x[n] = p2->GetBinCenter(i); - ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2; - y[n] = fgaus.GetParameter(1); - ey[n] = fgaus.GetParameter(2); - - // p2->SetBinContent(i, fgaus.GetParameter(1)); - // p2->SetBinError(i, fgaus.GetParameter(2)); - - n++; - delete h1; - } - - TGraphErrors *ge = new TGraphErrors(n, x, y, ex, ey); - ge->SetName(TString(h2->GetName()) + "_FitProfile"); - ge->SetLineColor(kBlue + 3); - ge->SetMarkerColor(kBlue + 3); - ge->SetLineWidth(2); - ge->SetMarkerStyle(kFullCircle); - ge->SetMarkerSize(1); - return ge; -} - -//!ratio between two histograms with binominal error based on Wilson score interval. Assuming each histogram is count. -TH1 *GetBinominalRatio(TH1 *h_pass, TH1 *h_n_trial, bool process_zero_bins = false) -{ - assert(h_pass); - assert(h_n_trial); - - assert(h_pass->GetNbinsX() == h_n_trial->GetNbinsX()); - assert(h_pass->GetNbinsY() == h_n_trial->GetNbinsY()); - assert(h_pass->GetNbinsZ() == h_n_trial->GetNbinsZ()); - - TH1 *h_ratio = (TH1 *) h_pass->Clone(TString(h_pass->GetName()) + "_Ratio"); - assert(h_ratio); - h_ratio->Divide(h_n_trial); // a rough estimation first, also taking care of the overflow bins and zero bins - - for (int x = 1; x <= h_n_trial->GetNbinsX(); ++x) - for (int y = 1; y <= h_n_trial->GetNbinsY(); ++y) - for (int z = 1; z <= h_n_trial->GetNbinsZ(); ++z) - { - const double n_trial = h_n_trial->GetBinContent(x, y, z); - - if (n_trial > 0) - { - const double p = h_pass->GetBinContent(x, y, z) / n_trial; - - // Wilson score interval - h_ratio->SetBinContent(x, y, z, // - (p + 1 / (2 * n_trial)) / (1 + 1 / n_trial)); - h_ratio->SetBinError(x, y, - z, // - TMath::Sqrt( - 1. / n_trial * p * (1 - p) + 1. / (4 * n_trial * n_trial)) / - (1 + 1 / n_trial)); - } - else if (process_zero_bins) - { - h_ratio->SetBinContent(x, y, z, 0.5); - h_ratio->SetBinError(x, y, z, 0.5); - } - } - - return h_ratio; -} - -//! Put input file name on the canvas -//! \param[in] c1 canvas pointer -//! \param[in] bottom height fraction height of the canvas to be used for this label -//! \param[in] new_file_name new file name being inspected -//! \param[in] ref_file_name reference file name -void PutInputFileName(TCanvas *c1, const double height, const char *new_file_name, const char *ref_file_name) -{ - c1->cd(); - TPad *pad = new TPad("PutInputFileName", "PutInputFileName", 0, 0, 1, height, 18); - pad->Draw(); - pad->cd(); - - if (new_file_name) - { - TText *t = new TText(0.05, 0.75, TString("New QA File: ") + TString(new_file_name)); - t->SetTextAlign(12); - t->SetTextColor(kBlue + 3); - t->SetTextSize(.4); - t->Draw(); - } - if (ref_file_name) - { - TText *t = new TText(0.05, 0.25, TString("Reference QA File: ") + TString(ref_file_name)); - t->SetTextAlign(12); - t->SetTextColor(kGreen + 1); - t->SetTextSize(.4); - t->Draw(); - } -} - -#endif From 906ad6583918357e923021eacb68d136996855a3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 9 Jan 2021 13:04:34 -0500 Subject: [PATCH 0935/1222] deprecate PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map_2015_Chris_Cullen_2D_spacal() --- common/G4_CEmc_Spacal.C | 50 +++++++++++++---------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 6c3248455..1ff60a3f0 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -242,42 +242,22 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) 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); - } + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - 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_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); - } + 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); From 0f57f20ba471e6992458a6b097756f032631f3f1 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 9 Jan 2021 13:53:33 -0500 Subject: [PATCH 0936/1222] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 60156a27e..10d927834 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ This is the standard macros respository for [sPHENIX collaboration](https://www. [![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) From 47b9b00707216a371df73f63cf79538d9e05e899 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sat, 9 Jan 2021 13:54:41 -0500 Subject: [PATCH 0937/1222] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10d927834..3620f0cfa 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ The default sPHENIX simulation + reconstruction macro is Fun4All_G4_sPHENIX.C, w Then let's see what is implemented by firing up one event: ``` -[jinhuang@rcas2072 macros]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +[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 macros]$ root +[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() @@ -54,8 +54,8 @@ root [] displaycmd() # this one show more Geant4 command we can run from the ROO This is simpler, just run with first parameter as the intended number of event: ``` -[jinhuang@rcas2072 macros]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so -[jinhuang@rcas2072 macros]$ root +[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 ``` From 6faf0d95eb4b504e1abdef3d742ad3751a9092c5 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 11 Jan 2021 13:51:00 -0500 Subject: [PATCH 0938/1222] make acts silicon seeding default --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index aaa6fa888..f96123250 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -89,7 +89,7 @@ namespace G4TRACKING bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_init_vertexing = false; // if true runs acts silicon seeding+initial vertexing + bool use_acts_init_vertexing = true; // if true runs acts silicon seeding+initial vertexing bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples From 225db5490331dc476e50946b1c914b61ee808509 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 18 Jan 2021 19:27:34 -0500 Subject: [PATCH 0939/1222] Add TpcClusterCleaner module to G4_TPC.C. --- common/G4_TPC.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 120bea780..fd14d4cff 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -223,6 +224,10 @@ void TPC_Clustering() tpcclusterizer->Verbosity(verbosity); se->registerSubsystem(tpcclusterizer); + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); + // space charge correction if( G4TPC::ENABLE_CORRECTIONS ) { From a8efc14fb42ce14237de4db2216c0cfe08d0b98e Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 20 Jan 2021 14:05:50 -0500 Subject: [PATCH 0940/1222] Remove spurious cout statements, update verbosity Add flag for setting up Acts magnetic field to work with both field map and constant field --- common/G4_Tracking.C | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f96123250..d33f34f85 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -178,6 +178,11 @@ void Tracking_Reco() geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + + /// 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); /// Always run PHActsSourceLinks first, to convert TrkrClusters @@ -219,7 +224,6 @@ void Tracking_Reco() else { // We cheat to get the initial vertex for the full track reconstruction case - std::cout << "JOE TRUTH VERTEXING"<Verbosity(verbosity); se->registerSubsystem(init_vtx); @@ -256,7 +260,7 @@ void Tracking_Reco() 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(0); + tracker->Verbosity(verbosity); se->registerSubsystem(tracker); } else @@ -265,7 +269,7 @@ void Tracking_Reco() auto seeder = new PHCASeeding("PHCASeeding"); seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right - seeder->Verbosity(0); + seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) seeder->SetMinHitsPerCluster(2); @@ -343,14 +347,14 @@ void Tracking_Reco() if(!G4TRACKING::use_acts_init_vertexing) { PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); + silicon_seeding->Verbosity(verbosity); se->registerSubsystem(silicon_seeding); - std::cout << "JOE SILICON TRUTH TRACK SEEDING"<Verbosity(0); + silicon_match->Verbosity(verbosity); if (!G4TRACKING::use_PHTpcTracker_seeding) silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding silicon_match->set_field(G4MAGNET::magfield); @@ -381,7 +385,7 @@ void Tracking_Reco() // Match TPC track stubs from CA seeder to clusters in the micromegas layers PHMicromegasTpcTrackMatching* mm_match = new PHMicromegasTpcTrackMatching(); - mm_match->Verbosity(0); + mm_match->Verbosity(verbosity); mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { @@ -499,7 +503,7 @@ void Tracking_Eval(const std::string& outputfile) if (G4TRACKING::use_acts_evaluator) { ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); - actsEval->Verbosity(0); + actsEval->Verbosity(verbosity); actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); } From 224ab61b338671347c48de5769c401482333e2df Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 21 Jan 2021 15:01:22 -0500 Subject: [PATCH 0941/1222] Added hybrid TPC seeding --- common/G4_Tracking.C | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f96123250..747c5ff37 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -86,10 +87,11 @@ namespace G4TRACKING // Possible variations - these are normally false 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_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_init_vertexing = true; // if true runs acts silicon seeding+initial vertexing + bool use_acts_init_vertexing = false; // if true runs acts silicon seeding+initial vertexing bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples @@ -195,6 +197,7 @@ void Tracking_Reco() if(G4TRACKING::use_acts_init_vertexing && !G4TRACKING::use_Genfit) { #if __cplusplus >= 201703L + PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); silicon_Seeding->Verbosity(verbosity); se->registerSubsystem(silicon_Seeding); @@ -202,6 +205,7 @@ void Tracking_Reco() PHActsInitialVertexFinder *initFinder = new PHActsInitialVertexFinder(); initFinder->Verbosity(verbosity); se->registerSubsystem(initFinder); + #endif } else if (G4TRACKING::use_phinit_vertexing) @@ -245,7 +249,7 @@ void Tracking_Reco() std::cout << "Using normal TPC track seeding " << std::endl; // TPC track seeding from data - if (G4TRACKING::use_PHTpcTracker_seeding) + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) { std::cout << " Using PHTpcTracker track seeding " << std::endl; @@ -259,8 +263,25 @@ void Tracking_Reco() tracker->Verbosity(0); 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->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(0); + se->registerSubsystem(hseeder); + } else { + 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 << " Since config doesn't make sense, reverting to default..." << std::endl; + } std::cout << " Using PHCASeeding track seeding " << std::endl; auto seeder = new PHCASeeding("PHCASeeding"); From 676b92ce018700594e1d20536fb16a12cd025bcc Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 21 Jan 2021 15:06:37 -0500 Subject: [PATCH 0942/1222] Fixed default settings --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 747c5ff37..4e99040dc 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -91,7 +91,7 @@ namespace G4TRACKING bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_init_vertexing = false; // if true runs acts silicon seeding+initial vertexing + bool use_acts_init_vertexing = true; // if true runs acts silicon seeding+initial vertexing bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples From 94a56ebdbaa38c1bcfca32e40fd94f3d8d8ac29f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 20 Jan 2021 14:05:50 -0500 Subject: [PATCH 0943/1222] Remove spurious cout statements, update verbosity Add flag for setting up Acts magnetic field to work with both field map and constant field --- common/G4_Tracking.C | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 4e99040dc..bc32cd98c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -180,6 +180,11 @@ void Tracking_Reco() geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + + /// 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); /// Always run PHActsSourceLinks first, to convert TrkrClusters @@ -223,7 +228,6 @@ void Tracking_Reco() else { // We cheat to get the initial vertex for the full track reconstruction case - std::cout << "JOE TRUTH VERTEXING"<Verbosity(verbosity); se->registerSubsystem(init_vtx); @@ -260,7 +264,7 @@ void Tracking_Reco() 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(0); + tracker->Verbosity(verbosity); se->registerSubsystem(tracker); } else if(G4TRACKING::use_hybrid_seeding && !G4TRACKING::use_PHTpcTracker_seeding) @@ -286,7 +290,7 @@ void Tracking_Reco() auto seeder = new PHCASeeding("PHCASeeding"); seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right - seeder->Verbosity(0); + seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) seeder->SetMinHitsPerCluster(2); @@ -364,14 +368,14 @@ void Tracking_Reco() if(!G4TRACKING::use_acts_init_vertexing) { PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); + silicon_seeding->Verbosity(verbosity); se->registerSubsystem(silicon_seeding); - std::cout << "JOE SILICON TRUTH TRACK SEEDING"<Verbosity(0); + silicon_match->Verbosity(verbosity); if (!G4TRACKING::use_PHTpcTracker_seeding) silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding silicon_match->set_field(G4MAGNET::magfield); @@ -402,7 +406,7 @@ void Tracking_Reco() // Match TPC track stubs from CA seeder to clusters in the micromegas layers PHMicromegasTpcTrackMatching* mm_match = new PHMicromegasTpcTrackMatching(); - mm_match->Verbosity(0); + mm_match->Verbosity(verbosity); mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { @@ -520,7 +524,7 @@ void Tracking_Eval(const std::string& outputfile) if (G4TRACKING::use_acts_evaluator) { ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); - actsEval->Verbosity(0); + actsEval->Verbosity(verbosity); actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); } From e02f00cb68091b6bcd045d1b0e898653fb50b0d3 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 25 Jan 2021 13:21:21 -0500 Subject: [PATCH 0944/1222] make truth vertexing default with acts silicon revert false rave vertexing --- common/G4_Tracking.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index bc32cd98c..652cfcfc6 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -207,9 +207,10 @@ void Tracking_Reco() silicon_Seeding->Verbosity(verbosity); se->registerSubsystem(silicon_Seeding); - PHActsInitialVertexFinder *initFinder = new PHActsInitialVertexFinder(); - initFinder->Verbosity(verbosity); - se->registerSubsystem(initFinder); + PHTruthVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(verbosity); + init_vtx->set_acts_silicon(true); + se->registerSubsystem(init_vtx); #endif } From 5057c4451e7fc50cf5cd44bd37ecd6ddfbc365f5 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 26 Jan 2021 12:08:23 -0500 Subject: [PATCH 0945/1222] Added field direction setter for PHHybridSeeder --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index bc32cd98c..f1813ceb0 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -271,6 +271,7 @@ void Tracking_Reco() { 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) From b6eb1c6e32686d49791bd54fa7accadc01141f18 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 2 Feb 2021 08:29:42 -0500 Subject: [PATCH 0946/1222] Update tracking macro with second fit pass --- common/G4_Tracking.C | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 221bd5c53..4679978ff 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -447,7 +447,7 @@ void Tracking_Reco() actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); - PHActsTrkFitter* actsFit = new PHActsTrkFitter(); + PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); actsFit->Verbosity(verbosity); actsFit->doTimeAnalysis(false); /// If running with distortions, fit only the silicon+MMs first @@ -466,6 +466,16 @@ void Tracking_Reco() vtxer->Verbosity(verbosity); se->registerSubsystem(vtxer); + PHActsTracks *actsTracks2 = new PHActsTracks(); + actsTracks2->Verbosity(verbosity); + se->registerSubsystem(actsTracks2); + + PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); + actsFit2->Verbosity(verbosity); + actsFit2->doTimeAnalysis(false); + actsFit2->fitSiliconMMs(false); + se->registerSubsystem(actsFit2); + #endif } From a0cc3d2aa7b1b8f2ebe46e4b2b1a430423c8ecae Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Feb 2021 21:19:26 -0500 Subject: [PATCH 0947/1222] run multiple input managers (synchronized) --- common/G4_Input.C | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index de9ad24ce..e5aeb2ba4 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -77,10 +77,9 @@ namespace Input int SIMPLE_NUMBER = 1; int SIMPLE_VERBOSITY = 0; -// bool UPSILON = false; // moved to GlobalVariables.C, as used in downstream vairables int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; -// std::set UPSILON_EmbedIds; // moved to GlobalVariables.C, as used in downstream vairables + // other UPSILON settings which are also used elsewhere are in GlobalVariables.C double PILEUPRATE = 0.; bool READHITS = false; @@ -105,14 +104,16 @@ namespace INPUTREADEIC namespace INPUTREADHITS { - string filename; - string listfile; + map filename; + map listfile; } // namespace INPUTREADHITS namespace INPUTEMBED { - string filename; - string listfile; +// map filename; +// map listfile; +std::string filename; +std::string listfile; } // namespace INPUTEMBED namespace PYTHIA6 @@ -454,22 +455,32 @@ void InputManagers() } else if (Input::READHITS) { - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - if (!INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty()) + 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()) { - hitsin->fileopen(INPUTREADHITS::filename); + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); } - else if (!INPUTREADHITS::listfile.empty()) + for (auto iter = INPUTREADHITS::filename.begin(); iter != INPUTREADHITS::filename.end(); ++iter) { - hitsin->AddListFile(INPUTREADHITS::listfile); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); } - else + for (auto iter = INPUTREADHITS::listfile.begin(); iter != INPUTREADHITS::listfile.end(); ++iter) { - cout << "no filename INPUTREADHITS::filename or listfile INPUTREADHITS::listfile given" << endl; - gSystem->Exit(1); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); } - hitsin->Verbosity(Input::VERBOSITY); - se->registerInputManager(hitsin); } else { From b9574e0469a51a6c03ba363160a84c7467c1f54a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Feb 2021 21:55:17 -0500 Subject: [PATCH 0948/1222] run multiple input managers (synchronized), fix upsilon embedding vertex --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index dfbc133e3..e7765490b 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -69,8 +69,9 @@ int Fun4All_G4_sPHENIX( // 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 = inputFile; - + INPUTREADHITS::filename[0] = inputFile; + // if you use a filelist + // INPUTREADHITS::filelist[0] = inputFile; // Or: // Use particle generator // And @@ -153,6 +154,11 @@ int Fun4All_G4_sPHENIX( 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 From 65b24d825693d52a955c4f60329a97d4535ec814 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Feb 2021 22:03:23 -0500 Subject: [PATCH 0949/1222] run multiple input managers (synchronized), fix upsilon embedding vertex --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index d607c0298..68ec00df9 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -66,8 +66,9 @@ int Fun4All_G4_fsPHENIX( // 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 = false; - INPUTREADHITS::filename = inputFile; - + INPUTREADHITS::filename[0] = inputFile; + // if you use a filelist + // INPUTREADHITS::filelist[0] = inputFile; // Or: // Use particle generator // And @@ -144,6 +145,11 @@ int Fun4All_G4_fsPHENIX( 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 From ebcc369f0c5d22198dd31e4aacf0198ce6fae142 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Feb 2021 22:06:34 -0500 Subject: [PATCH 0950/1222] run multiple input managers (synchronized), fix upsilon embedding vertex --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index c423474ab..113fd0805 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -59,7 +59,9 @@ int Fun4All_G4_EICDetector( // about the number of layers used for the cell reco code // //Input::READHITS = true; - INPUTREADHITS::filename = inputFile; + INPUTREADHITS::filename[0] = inputFile; + // if you use a filelist + // INPUTREADHITS::filelist[0] = inputFile; // Or: // Use one or more particle generators @@ -145,6 +147,11 @@ int Fun4All_G4_EICDetector( 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 From f91701e06bcbd1267ebdfa61367b0ad7a41ef981 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 3 Feb 2021 08:40:01 -0500 Subject: [PATCH 0951/1222] fix second track fit vertex node access --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 4679978ff..7b0aaf60d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -468,6 +468,7 @@ void Tracking_Reco() PHActsTracks *actsTracks2 = new PHActsTracks(); actsTracks2->Verbosity(verbosity); + actsTracks2->setSecondFit(true); se->registerSubsystem(actsTracks2); PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); From 70eb68ecbd1447b477552c73357d7ef65c78c7bf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Feb 2021 11:28:20 -0500 Subject: [PATCH 0952/1222] use multiple input managers for embedding --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index e7765490b..c70071c06 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -71,7 +71,7 @@ int Fun4All_G4_sPHENIX( // Input::READHITS = true; INPUTREADHITS::filename[0] = inputFile; // if you use a filelist - // INPUTREADHITS::filelist[0] = inputFile; + // INPUTREADHITS::listfile[0] = inputFile; // Or: // Use particle generator // And @@ -79,7 +79,9 @@ int Fun4All_G4_sPHENIX( // 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 = embed_input_file; + INPUTEMBED::filename[0] = embed_input_file; + // if you use a filelist + INPUTEMBED::listfile[0] = embed_input_file; Input::SIMPLE = true; // Input::SIMPLE_NUMBER = 2; // if you need 2 of them From 9b8f1e51f1fd486386cf0f72c2bb3a04f058017a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Feb 2021 11:29:23 -0500 Subject: [PATCH 0953/1222] oops, listfile and filename cannot work together --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index c70071c06..8eddf4c33 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -81,7 +81,7 @@ int Fun4All_G4_sPHENIX( // Input::EMBED = true; INPUTEMBED::filename[0] = embed_input_file; // if you use a filelist - INPUTEMBED::listfile[0] = embed_input_file; + //INPUTEMBED::listfile[0] = embed_input_file; Input::SIMPLE = true; // Input::SIMPLE_NUMBER = 2; // if you need 2 of them From c776cdf69baaddb83c3ac76fc806d1f7ce617d0c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Feb 2021 12:13:45 -0500 Subject: [PATCH 0954/1222] use multiple input managers for embedding --- common/G4_Input.C | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index e5aeb2ba4..1117f4168 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -110,10 +110,8 @@ namespace INPUTREADHITS namespace INPUTEMBED { -// map filename; -// map listfile; -std::string filename; -std::string listfile; + map filename; + map listfile; } // namespace INPUTEMBED namespace PYTHIA6 @@ -133,7 +131,7 @@ namespace SARTRE namespace PILEUP { - string pileupfile = "/sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat"; + string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; double TpcDriftVelocity = 8.0 / 1000.0; } // namespace PILEUP @@ -418,22 +416,34 @@ void InputManagers() if (Input::EMBED) { gSystem->Load("libg4dst.so"); - Fun4AllInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - if (!INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) + if (!INPUTEMBED::filename.empty() && !INPUTEMBED::listfile.empty()) { - in1->fileopen(INPUTEMBED::filename); + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); } - else if (!INPUTEMBED::listfile.empty()) + if (INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) { - in1->AddListFile(INPUTEMBED::listfile); + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); } - else + for (auto iter = INPUTEMBED::filename.begin(); iter != INPUTEMBED::filename.end(); ++iter) { - cout << "no filename INPUTEMBED::filename or listfile INPUTEMBED::listfile given" << endl; - gSystem->Exit(1); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + 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); + hitsin->Repeat(); + se->registerInputManager(hitsin); } - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning - se->registerInputManager(in1); } if (Input::HEPMC) { @@ -455,6 +465,7 @@ void InputManagers() } 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; From bc2632b48e8a56ba1748291b4c3fb8c6d44afc45 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Feb 2021 12:31:37 -0500 Subject: [PATCH 0955/1222] use multiple input managers for embedding --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 68ec00df9..d7def8b4c 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -68,7 +68,7 @@ int Fun4All_G4_fsPHENIX( Input::READHITS = false; INPUTREADHITS::filename[0] = inputFile; // if you use a filelist - // INPUTREADHITS::filelist[0] = inputFile; + // INPUTREADHITS::listfile[0] = inputFile; // Or: // Use particle generator // And @@ -77,7 +77,9 @@ int Fun4All_G4_fsPHENIX( // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ // Input::EMBED = true; - INPUTEMBED::filename = embed_input_file; + INPUTEMBED::filename[0] = embed_input_file; + // if you use a filelist + //INPUTEMBED::listfile[0] = embed_input_file; Input::SIMPLE = true; // Input::SIMPLE_NUMBER = 2; // if you need 2 of them From cdb5a445ae2e45dad89b790cc7b395ba4c22a086 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 3 Feb 2021 12:35:38 -0500 Subject: [PATCH 0956/1222] use multiple input managers for embedding --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 113fd0805..500dd6785 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -61,7 +61,7 @@ int Fun4All_G4_EICDetector( //Input::READHITS = true; INPUTREADHITS::filename[0] = inputFile; // if you use a filelist - // INPUTREADHITS::filelist[0] = inputFile; + // INPUTREADHITS::listfile[0] = inputFile; // Or: // Use one or more particle generators @@ -69,7 +69,10 @@ int Fun4All_G4_EICDetector( // all other options only play a role if it is active // In case embedding into a production output, please double check your G4Setup_EICDetector.C and G4_*.C consistent with those in the production macro folder // Input::EMBED = true; - INPUTEMBED::filename = embed_input_file; + INPUTEMBED::filename[0] = embed_input_file; + // if you use a filelist + //INPUTEMBED::listfile[0] = embed_input_file; + // Use Pythia 8 // Input::PYTHIA8 = true; From 61b26c0619bb8c0d20455a3adf2b8b2649678177 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 9 Feb 2021 16:09:05 -0500 Subject: [PATCH 0957/1222] remove final IVF --- common/G4_Tracking.C | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7b0aaf60d..6654abc14 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -443,7 +443,7 @@ void Tracking_Reco() #if __cplusplus >= 201703L - PHActsTracks* actsTracks = new PHActsTracks(); + PHActsTracks* actsTracks = new PHActsTracks("PHActsTracks1"); actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); @@ -462,11 +462,7 @@ void Tracking_Reco() se->registerSubsystem(residuals); } - PHActsVertexFinder* vtxer = new PHActsVertexFinder(); - vtxer->Verbosity(verbosity); - se->registerSubsystem(vtxer); - - PHActsTracks *actsTracks2 = new PHActsTracks(); + PHActsTracks *actsTracks2 = new PHActsTracks("PHActsTracks2"); actsTracks2->Verbosity(verbosity); actsTracks2->setSecondFit(true); se->registerSubsystem(actsTracks2); From b027b281dc2296e4bc1f61fe839b3865b352ba4d Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 9 Feb 2021 21:05:45 -0500 Subject: [PATCH 0958/1222] Set PHSiliconTpcTrackMatching search windows to the new tune. --- common/G4_Tracking.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7b0aaf60d..db9aebd5a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -379,7 +379,7 @@ void Tracking_Reco() PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); silicon_match->Verbosity(verbosity); if (!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding + silicon_match->set_seeder(true); // module defaults to PHTpcTracker seeding, for PHCASeeding use true here silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); @@ -394,8 +394,8 @@ void Tracking_Reco() 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.02); - silicon_match->set_eta_search_window(0.004); + 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); From 2faed19c4fa55e3b749a5c088626b560efd36b8f Mon Sep 17 00:00:00 2001 From: Friederike Bock Date: Fri, 12 Feb 2021 17:18:46 -0500 Subject: [PATCH 0959/1222] Adaptions for more modular running --- common/G4_FEMC_EIC.C | 28 +++++-- common/G4_FHCAL.C | 193 +++++++++++++++++++++++++++++++------------ common/G4_FST_EIC.C | 39 ++++----- common/G4_FwdJets.C | 176 +++++++++++++++++++++++++++++++++++++-- common/G4_GEM_EIC.C | 14 +++- 5 files changed, 358 insertions(+), 92 deletions(-) diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index 529f224b1..62eb8775f 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -54,7 +54,7 @@ void FEMCInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMCSetup(PHG4Reco *g4Reco) +void FEMCSetup(PHG4Reco *g4Reco, TString specialSetting = "") { bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; @@ -66,13 +66,16 @@ void FEMCSetup(PHG4Reco *g4Reco) ostringstream mapping_femc; - // femc->SetEICDetector(); - + // PbScint ECAL with nominal eta coverage + if (specialSetting.Contains("FullEtaAcc")) + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; // fsPHENIX ECAL - // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + else if (specialSetting.Contains("sPHENIX")) + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - + else + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + cout << mapping_femc.str() << endl; femc->SetTowerMappingFile(mapping_femc.str()); femc->OverlapCheck(OverlapCheck); @@ -88,8 +91,7 @@ void FEMC_Cells() return; } -void FEMC_Towers() -{ +void FEMC_Towers(TString specialSetting = "" ){ int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -100,7 +102,15 @@ void FEMC_Towers() // mapping_femc << getenv("CALIBRATIONROOT") << // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + // PbScint ECAL with nominal eta coverage + if (specialSetting.Contains("FullEtaAcc")) + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; + // fsPHENIX ECAL + else if (specialSetting.Contains("sPHENIX")) + mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + else + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; RawTowerBuilderByHitIndex *tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index bea6f32b2..074e7a5ed 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -59,8 +59,7 @@ void FHCALInit() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); } -void FHCALSetup(PHG4Reco *g4Reco) -{ +void FHCALSetup(PHG4Reco *g4Reco, TString specialSetting = ""){ const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FHCAL_OVERLAPCHECK; Fun4AllServer *se = Fun4AllServer::instance(); @@ -68,15 +67,23 @@ void FHCALSetup(PHG4Reco *g4Reco) /** 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_v005.txt"; - // cout << mapping_hhcal.str() << endl; - //mapping_hhcal << "towerMap_FHCAL_latest.txt"; + ostringstream mapping_fhcal; - hhcal->SetTowerMappingFile(mapping_hhcal.str()); + // Switch to desired calo setup + // full HCal Fe-Scint with nominal acceptance + if (specialSetting.Contains("FullEtaAcc")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + // full HCal Fe-Scint with nominal acceptance doubled granularity + else if (specialSetting.Contains("HC2x")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + // full HCal Fe-Scint with nominal acceptance four times granularity + else if (specialSetting.Contains("HC4x")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe + else + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + + hhcal->SetTowerMappingFile(mapping_fhcal.str()); hhcal->OverlapCheck(OverlapCheck); if (AbsorberActive) hhcal->SetAbsorberActive(); @@ -89,61 +96,143 @@ void FHCAL_Cells(int verbosity = 0) return; } -void FHCAL_Towers() +void FHCAL_Towers( TString specialSetting = "") { int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + // Switch to desired calo setup + // full HCal Fe-Scint with nominal acceptance + if (specialSetting.Contains("FullEtaAcc")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + // full HCal Fe-Scint with nominal acceptance doubled granularity + else if (specialSetting.Contains("HC2x")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + // full HCal Fe-Scint with nominal acceptance four times granularity + else if (specialSetting.Contains("HC4x")) + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe + else + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.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); + + // enable usage of different tower calibrations for systematic studies + if(specialSetting.Contains("towercalib1")){ + cout << "1: using " << specialSetting.Data() << " for FHCAL towers" << endl; + 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::kSiPM_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 ); + } else if(specialSetting.Contains("towercalibSiPM")){ + //from https://sphenix-collaboration.github.io/doxygen/d4/d58/Fun4All__G4__Prototype4_8C_source.html + const double sampling_fraction =0.019441; // +/- 0.019441 from 0 Degree indenting 12 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 + + cout << "2: using " << specialSetting.Data() << " for FHCAL towers" << endl; + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_raw_tower_node_prefix("RAW"); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSiPM_photon_digitization); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); + 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); + + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); + TowerCalibration->Detector("FHCAL"); + TowerCalibration->set_raw_tower_node_prefix("RAW"); + 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); + } else if(specialSetting.Contains("towercalibHCALIN")){ + const double visible_sample_fraction_HCALIN = 7.19505e-02; // 1.34152e-02 + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_raw_tower_node_prefix("RAW"); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); + 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); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); + TowerCalibration->Detector("FHCAL"); + TowerCalibration->set_raw_tower_node_prefix("RAW"); + 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); + } else if(specialSetting.Contains("towercalib3")){ + cout << "3: using " << specialSetting.Data() << " for FHCAL towers" << endl; + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(8);// eRD1 test beam setting + 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); + } else { + cout << "def: using default for FHCAL towers" << endl; + 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() diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index 4b152bf26..825d1b5e4 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -1,7 +1,6 @@ -#ifndef MACRO_G4FSTEIC_C -#define MACRO_G4FSTEIC_C +#pragma once -#include +#include "GlobalVariables.C" #include @@ -12,13 +11,12 @@ R__LOAD_LIBRARY(libg4detectors.so) int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax); + double Rmax,double tSilicon); //-----------------------------------------------------------------------------------// namespace Enable { - bool FST = false; - bool FST_OVERLAPCHECK = false; -} // namespace Enable + static bool FST = false; +} //-----------------------------------------------------------------------------------// void FST_Init() { @@ -28,24 +26,28 @@ void FST_Init() //-----------------------------------------------------------------------------------// void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); - //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); + make_LANL_FST_station("FST_0", g4Reco, 25, 3.18, 18.5, 35*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 49, 3.18, 36.26, 35*um); + make_LANL_FST_station("FST_2", g4Reco, 73, 3.5, 43.23, 35*um); + make_LANL_FST_station("FST_3", g4Reco, 97, 4.7, 43.23, 85*um); + make_LANL_FST_station("FST_4", g4Reco, 121, 5.91, 43.23, 85*um); +// make_LANL_FST_station("FST_5", g4Reco, 300, 15, 45, 85*um); +// make_LANL_FST_station("FST_5", g4Reco, 280, 15, 170, 85*um); +// make_LANL_FST_station("FST_6", g4Reco, 340, 18, 240, 85*um); } //-----------------------------------------------------------------------------------// int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax) + double zpos, double Rmin, double Rmax,double tSilicon) //silicon thickness { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " // << name << endl; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK; - // always facing the interaction point double polar_angle = 0; if (zpos < 0) @@ -77,14 +79,14 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); fst->get_geometry().set_N_Sector(1); fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(OverlapCheck); + fst->OverlapCheck(true); const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); const double mm = .1 * cm; const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); @@ -96,4 +98,3 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, return 0; } //-----------------------------------------------------------------------------------// -#endif diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C index 7b11234f0..d90d9fadf 100644 --- a/common/G4_FwdJets.C +++ b/common/G4_FwdJets.C @@ -1,10 +1,14 @@ #ifndef MACRO_G4FWDJETS_C #define MACRO_G4FWDJETS_C +// #include + +#include #include #include #include #include +// #include #include @@ -29,7 +33,7 @@ void Jet_FwdReco() Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets - JetReco *truthjetreco = new JetReco(); + 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"); @@ -38,13 +42,15 @@ void Jet_FwdReco() // 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Truth_r10"); + // 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(); + JetReco *towerjetreco = new JetReco("TOWERJETRECO"); towerjetreco->add_input(new TowerJetInput(Jet::FEMC_TOWER)); towerjetreco->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); @@ -57,11 +63,109 @@ void Jet_FwdReco() // 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Tower_r10"); + // 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"); + // TODO: WE NEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // clusterjetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + // clusterjetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Cluster_r10"); + clusterjetreco->set_algo_node("ANTIKT"); + clusterjetreco->set_input_node("CLUSTER"); + clusterjetreco->Verbosity(verbosity); + se->registerSubsystem(clusterjetreco); + + // tower jets + JetReco *towerjetrecofwd = new JetReco("TOWERJETRECOFWD"); + towerjetrecofwd->add_input(new TowerJetInput(Jet::FEMC_TOWER)); + towerjetrecofwd->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); + // towerjetrecofwd->add_input(new TowerJetInput(Jet::CEMC_TOWER)); + // towerjetrecofwd->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); + // towerjetrecofwd->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); + // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_TowerFwd_r03"); + // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_TowerFwd_r05"); + // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_TowerFwd_r07"); + // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_TowerFwd_r10"); + // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); + towerjetrecofwd->set_algo_node("ANTIKT"); + towerjetrecofwd->set_input_node("TOWER"); + towerjetrecofwd->Verbosity(verbosity); + se->registerSubsystem(towerjetrecofwd); + + // cluster jets + JetReco *clusterjetrecofwd = new JetReco("CLUSTERJETRECOFWD"); + clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); + // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); + // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); + // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Cluster_r02"); + // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ClusterFwd_r03"); + // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Cluster_r04"); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_ClusterFwd_r05"); + // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Cluster_r06"); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_ClusterFwd_r07"); + // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Cluster_r08"); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_ClusterFwd_r10"); + clusterjetrecofwd->set_algo_node("ANTIKT"); + clusterjetrecofwd->set_input_node("CLUSTER"); + clusterjetrecofwd->Verbosity(verbosity); + se->registerSubsystem(clusterjetrecofwd); + + + // // track jets + // JetReco *fulljetreco = new JetReco("fulljetreco"); + // fulljetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + // fulljetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + // fulljetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); + // fulljetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + // fulljetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); + // fulljetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); + // fulljetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Full_r02"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Full_r03"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Full_r04"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Full_r05"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Full_r06"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Full_r07"); + // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Full_r08"); + // fulljetreco->set_algo_node("ANTIKT"); + // fulljetreco->set_input_node("FULL"); + // fulljetreco->Verbosity(verbosity); + // se->registerSubsystem(fulljetreco); + + return; } @@ -70,12 +174,68 @@ void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); - JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r05", - "AntiKt_Truth_r05", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); + JetEvaluator *evalt05 = new JetEvaluator("JETEVALUATORTOWER05","AntiKt_Tower_r05", + "AntiKt_Truth_r05", "g4fwdjets_tower_05_eval.root"); + evalt05->Verbosity(verbosity); + se->registerSubsystem(evalt05); + JetEvaluator *evalt07 = new JetEvaluator("JETEVALUATORTOWER07","AntiKt_Tower_r07", + "AntiKt_Truth_r07", "g4fwdjets_tower_07_eval.root"); + evalt07->Verbosity(verbosity); + se->registerSubsystem(evalt07); + JetEvaluator *evalt10 = new JetEvaluator("JETEVALUATORTOWER10","AntiKt_Tower_r10", + "AntiKt_Truth_r10", "g4fwdjets_tower_10_eval.root"); + evalt10->Verbosity(verbosity); + se->registerSubsystem(evalt10); + + JetEvaluator *evalc05 = new JetEvaluator("JETEVALUATORCLUSTER05", "AntiKt_Cluster_r05", + "AntiKt_Truth_r05", "g4fwdjets_cluster_05_eval.root"); + evalc05->Verbosity(verbosity); + se->registerSubsystem(evalc05); + + JetEvaluator *evalc07 = new JetEvaluator("JETEVALUATORCLUSTER07", "AntiKt_Cluster_r07", + "AntiKt_Truth_r07", "g4fwdjets_cluster_07_eval.root"); + evalc07->Verbosity(verbosity); + se->registerSubsystem(evalc07); + + JetEvaluator *evalc10 = new JetEvaluator("JETEVALUATORCLUSTER10", "AntiKt_Cluster_r10", + "AntiKt_Truth_r10", "g4fwdjets_cluster_10_eval.root"); + evalc10->Verbosity(verbosity); + se->registerSubsystem(evalc10); + + JetEvaluator *evaltfwd05 = new JetEvaluator("JETEVALUATORFWDTOWER05","AntiKt_TowerFwd_r05", + "AntiKt_Truth_r05", "g4fwdjets_TowerFwd_05_eval.root"); + evaltfwd05->Verbosity(verbosity); + se->registerSubsystem(evaltfwd05); + JetEvaluator *evaltfwd07 = new JetEvaluator("JETEVALUATORFWDTOWER07","AntiKt_TowerFwd_r07", + "AntiKt_Truth_r07", "g4fwdjets_TowerFwd_07_eval.root"); + evaltfwd07->Verbosity(verbosity); + se->registerSubsystem(evaltfwd07); + JetEvaluator *evaltfwd10 = new JetEvaluator("JETEVALUATORFWDTOWER10","AntiKt_TowerFwd_r10", + "AntiKt_Truth_r10", "g4fwdjets_TowerFwd_10_eval.root"); + evaltfwd10->Verbosity(verbosity); + se->registerSubsystem(evaltfwd10); + + JetEvaluator *evalcfwd05 = new JetEvaluator("JETEVALUATORFWDCLUSTER05", "AntiKt_ClusterFwd_r05", + "AntiKt_Truth_r05", "g4fwdjets_ClusterFwd_05_eval.root"); + evalcfwd05->Verbosity(verbosity); + se->registerSubsystem(evalcfwd05); + + JetEvaluator *evalcfwd07 = new JetEvaluator("JETEVALUATORFWDCLUSTER07", "AntiKt_ClusterFwd_r07", + "AntiKt_Truth_r07", "g4fwdjets_ClusterFwd_07_eval.root"); + evalcfwd07->Verbosity(verbosity); + se->registerSubsystem(evalcfwd07); + + JetEvaluator *evalcfwd10 = new JetEvaluator("JETEVALUATORFWDCLUSTER10", "AntiKt_ClusterFwd_r10", + "AntiKt_Truth_r10", "g4fwdjets_ClusterFwd_10_eval.root"); + evalcfwd10->Verbosity(verbosity); + se->registerSubsystem(evalcfwd10); + + // JetEvaluator *eval3 = new JetEvaluator("JETEVALUATOR3", + // "AntiKt_Full_r07", + // "AntiKt_Truth_r07", + // "g4fwdjets_full_07_eval.root"); + // eval3->Verbosity(verbosity); + // se->registerSubsystem(eval3); return; } diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C index 0acc4d7a7..a7cb700e6 100644 --- a/common/G4_GEM_EIC.C +++ b/common/G4_GEM_EIC.C @@ -17,6 +17,7 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); namespace Enable { bool EGEM = false; + bool EGEM_FULL = true; bool FGEM = false; } // namespace Enable @@ -42,10 +43,15 @@ void EGEMSetup(PHG4Reco *g4Reco) * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ float thickness = 3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + if (Enable::EGEM_FULL){ + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + } else { + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + } } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // From 2f09df0fe473fa68629b26f663d82e44ae724013 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 12 Feb 2021 20:47:09 -0500 Subject: [PATCH 0960/1222] Update G4_FST_EIC.C no #pragma - this has caused problems in including macros --- common/G4_FST_EIC.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index 825d1b5e4..cbf39e46f 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -1,4 +1,5 @@ -#pragma once +#ifndef MACRO_G4FSTEIC_C +#define MACRO_G4FSTEIC_C #include "GlobalVariables.C" @@ -97,4 +98,7 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, g4Reco->registerSubsystem(fst); return 0; } + +#endif + //-----------------------------------------------------------------------------------// From fee0480a530b57275fe0a3eb9836fcc508388915 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 18 Feb 2021 14:12:37 -0500 Subject: [PATCH 0961/1222] readd vertex finder --- common/G4_Tracking.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ded976257..c27ec741f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -462,6 +462,10 @@ void Tracking_Reco() se->registerSubsystem(residuals); } + PHActsVertexFinder *finder = new PHActsVertexFinder("PHActsVertexFinder"); + finder->Verbosity(verbosity); + se->registerSubsystem(finder); + PHActsTracks *actsTracks2 = new PHActsTracks("PHActsTracks2"); actsTracks2->Verbosity(verbosity); actsTracks2->setSecondFit(true); From ac9b00129449be852a8a23446be9f49c1e18feda Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 19 Feb 2021 16:00:11 -0500 Subject: [PATCH 0962/1222] add init vtx finder --- common/G4_Tracking.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7b0aaf60d..8cc7fd974 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -39,7 +39,6 @@ #include #include #include -#include #include #endif @@ -207,9 +206,8 @@ void Tracking_Reco() silicon_Seeding->Verbosity(verbosity); se->registerSubsystem(silicon_Seeding); - PHTruthVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); init_vtx->Verbosity(verbosity); - init_vtx->set_acts_silicon(true); se->registerSubsystem(init_vtx); #endif From fe42d52e7a097c7a5ef038634942bf47021ada23 Mon Sep 17 00:00:00 2001 From: FriederikeBock Date: Fri, 19 Feb 2021 18:18:48 -0500 Subject: [PATCH 0963/1222] added FST and Barrel tracker version according to 2009.028 --- common/G4_Barrel_EIC.C | 113 +++++++++++++++++++++++++---------------- common/G4_FST_EIC.C | 58 +++++++++++++++++---- 2 files changed, 119 insertions(+), 52 deletions(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index e25078a4a..a15c03fc7 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -14,6 +14,10 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) + +int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, + double radius, double halflength, double tSilicon); + //---------------------------------------------------------------------// namespace Enable { @@ -25,67 +29,90 @@ void BarrelInit() { } //---------------------------------------------------------------------// -double Barrel(PHG4Reco* g4Reco, double radius) +double Barrel(PHG4Reco* g4Reco, double radius, TString specialSetting = "") { const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; //--------------------------------- //build barrel detector //--------------------------------- - const int nLayer = 5; - const int nSubLayer = 7; + int nLayer = 5; const float um = 0.0001; //convert um to cm - double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm - double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm + // Different Barrel versions documented in arXiv:2009.0288 + double r[6] = { 3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm + double halfLength[6] = { 20, 20, 25, 25, 25, 25}; //cm + double tSilicon[6] = { 100*um, 100*um, 100*um, 100*um, 100*um, 100*um}; + + if (specialSetting.Contains("BARRELV1") || specialSetting.Contains("BARRELV2")){ + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50*um; + } else if (specialSetting.Contains("BARRELV3")){ + for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35*um; + } else if (specialSetting.Contains("BARRELV4")){ + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50*um; + nLayer = 6; + r[3] = 9.2; + r[4] = 17.; + r[5] = 27.; + } + + double max_bh_radius = 0.; + for (int i = 0; i < nLayer; i++){ + make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i]); + max_bh_radius = r[i]+1.5; +// std::cout << "done with barrel layer intialization at "<< r[i] << std::endl; + } + + // update now that we know the outer radius + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); + return max_bh_radius; + +} +//---------------------------------------------------------------------// +//-----------------------------------------------------------------------------------// +int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, + double radius, double halflength, double tSilicon){ + + //--------------------------------- + //build barrel layer + //--------------------------------- + const int nSubLayer = 7; + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", "Support1", "Support_Gap", "Support2"}; string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {285 * um, 15 * um, 20 * um, 100 * um, + double thickness[nSubLayer] = {tSilicon , 15 * um, 20 * um, 100 * um, 50 * um, 1, 50 * um}; - int k = 0; //layer id. Must be unique. double max_bh_radius = 0.; PHG4CylinderSubsystem* cyl; - for (int i = 0; i < nLayer; i++) - { - //if (i>2) continue; - for (int j = 0; j < nSubLayer; j++) - { - cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); - if (j == 0) - { - cyl->set_double_param("radius", r[i]); - } - else - { - cyl->set_double_param("radius", r[i] + thickness[j - 1]); - } - cyl->set_double_param("length", 2.0 * halfLength[i]); - cyl->set_string_param("material", material[j]); - cyl->set_double_param("thickness", thickness[j]); - max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); - cyl->SuperDetector("BARREL"); - if (j == 0) - { - cyl->SetActive(); //only the Silicon Sensor is active - } - else - { - if (AbsorberActive) cyl->SetActive(); - } - g4Reco->registerSubsystem(cyl); - k++; - } + cout << "started to create cylinder layer: " << name << endl; + + double currRadius = radius; +// cout << currRadius << endl; + for (int l = 0; l < nSubLayer; l++) { + cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l],l); + cyl->SuperDetector(name); + cyl->set_double_param("radius", currRadius); + cyl->set_double_param("length", 2.0 * halflength); + cyl->set_string_param("material", material[l]); + cyl->set_double_param("thickness", thickness[l]); + if (l == 0) cyl->SetActive(); //only the Silicon Sensor is active + cyl->OverlapCheck(true); + g4Reco->registerSubsystem(cyl); + currRadius = currRadius+thickness[l]; } - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); - return max_bh_radius; + return 0; } -//---------------------------------------------------------------------// + +//-----------------------------------------------------------------------------------// + + #endif diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index cbf39e46f..d07e7028b 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -25,21 +25,61 @@ void FST_Init() BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } //-----------------------------------------------------------------------------------// -void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) +void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245, TString specialSetting = "") { const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); const double mm = .1 * cm; const double um = 1e-3 * mm; //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 25, 3.18, 18.5, 35*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 49, 3.18, 36.26, 35*um); - make_LANL_FST_station("FST_2", g4Reco, 73, 3.5, 43.23, 35*um); - make_LANL_FST_station("FST_3", g4Reco, 97, 4.7, 43.23, 85*um); - make_LANL_FST_station("FST_4", g4Reco, 121, 5.91, 43.23, 85*um); -// make_LANL_FST_station("FST_5", g4Reco, 300, 15, 45, 85*um); -// make_LANL_FST_station("FST_5", g4Reco, 280, 15, 170, 85*um); -// make_LANL_FST_station("FST_6", g4Reco, 340, 18, 240, 85*um); + // Different FST version documented in arXiv:2009.0288 + if ( specialSetting.Contains("FSTV1")){ // version 1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50*um); + } if ( specialSetting.Contains("FSTV2")){ // version 2 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); + make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50*um); + } if ( specialSetting.Contains("FSTV3")){ // version 3 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); + } if ( specialSetting.Contains("FSTV41")){ // version 4.1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100*um); + } if ( specialSetting.Contains("FSTV42")){ // version 4.1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100*um); + } if ( specialSetting.Contains("FSTV4")){ // version 4 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50*um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50*um); + } else { // Version 0 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 100*um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 100*um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); + } + } //-----------------------------------------------------------------------------------// int make_LANL_FST_station(string name, PHG4Reco *g4Reco, From 7866d346f4dc684267c46902936ddf220de1ac2b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Feb 2021 22:16:04 -0500 Subject: [PATCH 0964/1222] remove TString from function args --- common/G4_Barrel_EIC.C | 94 ++++++++++++++++++++++++++--------------- common/G4_FEMC_EIC.C | 63 +++++++++++++++++++-------- common/G4_FHCAL.C | 96 ++++++++++++++++++++++++++++-------------- 3 files changed, 171 insertions(+), 82 deletions(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index a15c03fc7..d402e3bd4 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -15,8 +15,8 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) -int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon); +int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, + double radius, double halflength, double tSilicon); //---------------------------------------------------------------------// namespace Enable @@ -24,12 +24,33 @@ namespace Enable bool BARREL = false; bool BARREL_ABSORBER = false; } // namespace Enable + +namespace G4BARREL +{ + namespace SETTING + { + bool BARRELV1 = false; + bool BARRELV2 = false; + bool BARRELV3 = false; + bool BARRELV4 = false; + } // namespace SETTING +} // namespace G4BARREL //---------------------------------------------------------------------// void BarrelInit() { + if ((G4BARREL::SETTING::BARRELV1 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV4 ? 1 : 0)) + { + cout << "use only G4BARREL::SETTING::BARRELV1=true or G4BARREL::SETTING::BARRELV2=true or G4BARREL::SETTING::BARRELV3=true or G4BARREL::SETTING::BARRELV4=true" << endl; + + gSystem->Exit(1); + } } + //---------------------------------------------------------------------// -double Barrel(PHG4Reco* g4Reco, double radius, TString specialSetting = "") +double Barrel(PHG4Reco *g4Reco, double radius) { const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; @@ -40,27 +61,33 @@ double Barrel(PHG4Reco* g4Reco, double radius, TString specialSetting = "") const float um = 0.0001; //convert um to cm // Different Barrel versions documented in arXiv:2009.0288 - double r[6] = { 3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm - double halfLength[6] = { 20, 20, 25, 25, 25, 25}; //cm - double tSilicon[6] = { 100*um, 100*um, 100*um, 100*um, 100*um, 100*um}; - - if (specialSetting.Contains("BARRELV1") || specialSetting.Contains("BARRELV2")){ - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50*um; - } else if (specialSetting.Contains("BARRELV3")){ - for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35*um; - } else if (specialSetting.Contains("BARRELV4")){ - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50*um; - nLayer = 6; - r[3] = 9.2; - r[4] = 17.; - r[5] = 27.; + double r[6] = {3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm + double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm + double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um}; + + if (G4BARREL::SETTING::BARRELV1 || G4BARREL::SETTING::BARRELV2) + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + } + else if (G4BARREL::SETTING::BARRELV3) + { + for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um; } - + else if (G4BARREL::SETTING::BARRELV4) + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + nLayer = 6; + r[3] = 9.2; + r[4] = 17.; + r[5] = 27.; + } + double max_bh_radius = 0.; - for (int i = 0; i < nLayer; i++){ - make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i]); - max_bh_radius = r[i]+1.5; -// std::cout << "done with barrel layer intialization at "<< r[i] << std::endl; + for (int i = 0; i < nLayer; i++) + { + make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i]); + max_bh_radius = r[i] + 1.5; + // std::cout << "done with barrel layer intialization at "<< r[i] << std::endl; } // update now that we know the outer radius @@ -68,13 +95,12 @@ double Barrel(PHG4Reco* g4Reco, double radius, TString specialSetting = "") BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); return max_bh_radius; - } //---------------------------------------------------------------------// //-----------------------------------------------------------------------------------// -int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon){ - +int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, + double radius, double halflength, double tSilicon) +{ //--------------------------------- //build barrel layer //--------------------------------- @@ -87,17 +113,18 @@ int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, "Support1", "Support_Gap", "Support2"}; string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {tSilicon , 15 * um, 20 * um, 100 * um, + double thickness[nSubLayer] = {tSilicon, 15 * um, 20 * um, 100 * um, 50 * um, 1, 50 * um}; double max_bh_radius = 0.; - PHG4CylinderSubsystem* cyl; + PHG4CylinderSubsystem *cyl; cout << "started to create cylinder layer: " << name << endl; - + double currRadius = radius; -// cout << currRadius << endl; - for (int l = 0; l < nSubLayer; l++) { - cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l],l); + // cout << currRadius << endl; + for (int l = 0; l < nSubLayer; l++) + { + cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l], l); cyl->SuperDetector(name); cyl->set_double_param("radius", currRadius); cyl->set_double_param("length", 2.0 * halflength); @@ -106,7 +133,7 @@ int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, if (l == 0) cyl->SetActive(); //only the Silicon Sensor is active cyl->OverlapCheck(true); g4Reco->registerSubsystem(cyl); - currRadius = currRadius+thickness[l]; + currRadius = currRadius + thickness[l]; } return 0; @@ -114,5 +141,4 @@ int make_barrel_pixel_layer(string name, PHG4Reco *g4Reco, //-----------------------------------------------------------------------------------// - #endif diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index 62eb8775f..59d39b107 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -3,17 +3,22 @@ #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) @@ -46,15 +51,27 @@ namespace G4FEMC enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; + namespace SETTING + { + bool FullEtaAcc = false; + bool fsPHENIX = false; + } // namespace SETTING } // namespace G4FEMC void FEMCInit() { + // simple way to check if only 1 of the settings is true + if ((G4FEMC::SETTING::FullEtaAcc ? 1 : 0) + (G4FEMC::SETTING::fsPHENIX ? 1 : 0) > 1) + { + cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::fsPHENIX=true" << endl; + gSystem->Exit(1); + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } -void FEMCSetup(PHG4Reco *g4Reco, TString specialSetting = "") +void FEMCSetup(PHG4Reco *g4Reco) { bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; @@ -67,15 +84,20 @@ void FEMCSetup(PHG4Reco *g4Reco, TString specialSetting = "") ostringstream mapping_femc; // PbScint ECAL with nominal eta coverage - if (specialSetting.Contains("FullEtaAcc")) + if (G4FEMC::SETTING::FullEtaAcc) + { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; + } // fsPHENIX ECAL - else if (specialSetting.Contains("sPHENIX")) - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + else if (G4FEMC::SETTING::fsPHENIX) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + } // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - else + else + { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - + } cout << mapping_femc.str() << endl; femc->SetTowerMappingFile(mapping_femc.str()); femc->OverlapCheck(OverlapCheck); @@ -91,7 +113,8 @@ void FEMC_Cells() return; } -void FEMC_Towers(TString specialSetting = "" ){ +void FEMC_Towers() +{ int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); @@ -102,15 +125,21 @@ void FEMC_Towers(TString specialSetting = "" ){ // mapping_femc << getenv("CALIBRATIONROOT") << // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - // PbScint ECAL with nominal eta coverage - if (specialSetting.Contains("FullEtaAcc")) + // PbScint ECAL with nominal eta coverage + if (G4FEMC::SETTING::FullEtaAcc) + { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; + } // fsPHENIX ECAL - else if (specialSetting.Contains("sPHENIX")) - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + else if (G4FEMC::SETTING::fsPHENIX) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + } // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - else + else + { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + } RawTowerBuilderByHitIndex *tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -263,7 +292,7 @@ void FEMC_Eval(const std::string &outputfile) Fun4AllServer *se = Fun4AllServer::instance(); - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); + CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile); eval->Verbosity(verbosity); se->registerSubsystem(eval); diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index 074e7a5ed..34d96fb89 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -51,15 +51,41 @@ namespace G4FHCAL enu_FHcal_clusterizer FHcal_clusterizer = kFHcalTemplateClusterizer; // graph clusterizer //enu_FHcal_clusterizer FHcal_clusterizer = kFHcalGraphClusterizer; + namespace SETTING + { + bool FullEtaAcc = false; + bool HC2x = false; + bool HC4x = false; + bool towercalib1 = false; + bool towercalibSiPM = false; + bool towercalibHCALIN = false; + bool towercalib3 = false; + } // namespace SETTING } // namespace G4FHCAL void FHCALInit() { + // simple way to check if only 1 of the settings is true + if ((G4FHCAL::SETTING::FullEtaAcc ? 1 : 0) + (G4FHCAL::SETTING::HC4x ? 1 : 0) + (G4FHCAL::SETTING::HC2x ? 1 : 0) > 1) + { + cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::HC2x=true or G4FHCAL::SETTING::HC4x=true" << endl; + gSystem->Exit(1); + } + if ((G4FHCAL::SETTING::towercalib1 ? 1 : 0) + (G4FHCAL::SETTING::towercalibSiPM ? 1 : 0) + + (G4FHCAL::SETTING::towercalibHCALIN ? 1 : 0) + (G4FHCAL::SETTING::towercalib3 ? 1 : 0) > + 1) + { + cout << "use only G4FHCAL::SETTING::towercalib1 = true or G4FHCAL::SETTING::towercalibSiPM = true" + << " or G4FHCAL::SETTING::towercalibHCALIN = true or G4FHCAL::SETTING::towercalib3 = true" << endl; + gSystem->Exit(1); + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); } -void FHCALSetup(PHG4Reco *g4Reco, TString specialSetting = ""){ +void FHCALSetup(PHG4Reco *g4Reco) +{ const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FHCAL_OVERLAPCHECK; Fun4AllServer *se = Fun4AllServer::instance(); @@ -71,16 +97,16 @@ void FHCALSetup(PHG4Reco *g4Reco, TString specialSetting = ""){ // Switch to desired calo setup // full HCal Fe-Scint with nominal acceptance - if (specialSetting.Contains("FullEtaAcc")) + if (G4FHCAL::SETTING::FullEtaAcc) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (specialSetting.Contains("HC2x")) + else if (G4FHCAL::SETTING::HC2x) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; // full HCal Fe-Scint with nominal acceptance four times granularity - else if (specialSetting.Contains("HC4x")) + else if (G4FHCAL::SETTING::HC2x) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe - else + else mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; hhcal->SetTowerMappingFile(mapping_fhcal.str()); @@ -96,7 +122,7 @@ void FHCAL_Cells(int verbosity = 0) return; } -void FHCAL_Towers( TString specialSetting = "") +void FHCAL_Towers() { int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); @@ -106,28 +132,29 @@ void FHCAL_Towers( TString specialSetting = "") // Switch to desired calo setup // full HCal Fe-Scint with nominal acceptance - if (specialSetting.Contains("FullEtaAcc")) + if (G4FHCAL::SETTING::FullEtaAcc) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (specialSetting.Contains("HC2x")) + else if (G4FHCAL::SETTING::HC2x) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; // full HCal Fe-Scint with nominal acceptance four times granularity - else if (specialSetting.Contains("HC4x")) + else if (G4FHCAL::SETTING::HC4x) mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe - else + else mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.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); - + // enable usage of different tower calibrations for systematic studies - if(specialSetting.Contains("towercalib1")){ - cout << "1: using " << specialSetting.Data() << " for FHCAL towers" << endl; + if (G4FHCAL::SETTING::towercalib1) + { + cout << "1: using towercalib1 for FHCAL towers" << endl; const double FHCAL_photoelectron_per_GeV = 500; RawTowerDigitizer *TowerDigitizer_FHCAL = new RawTowerDigitizer("FHCALRawTowerDigitizer"); @@ -136,29 +163,31 @@ void FHCAL_Towers( TString specialSetting = "") TowerDigitizer_FHCAL->set_raw_tower_node_prefix("RAW"); TowerDigitizer_FHCAL->set_digi_algorithm(RawTowerDigitizer::kSiPM_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 + 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 ); + 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 ); + TowerCalibration_FHCAL->set_calib_const_GeV_ADC(1. / FHCAL_photoelectron_per_GeV); + TowerCalibration_FHCAL->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration_FHCAL ); - } else if(specialSetting.Contains("towercalibSiPM")){ + se->registerSubsystem(TowerCalibration_FHCAL); + } + else if (G4FHCAL::SETTING::towercalibSiPM) + { //from https://sphenix-collaboration.github.io/doxygen/d4/d58/Fun4All__G4__Prototype4_8C_source.html - const double sampling_fraction =0.019441; // +/- 0.019441 from 0 Degree indenting 12 GeV electron showers + const double sampling_fraction = 0.019441; // +/- 0.019441 from 0 Degree indenting 12 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 - cout << "2: using " << specialSetting.Data() << " for FHCAL towers" << endl; + cout << "2: using towercalibSiPM for FHCAL towers" << endl; RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); TowerDigitizer->Detector("FHCAL"); TowerDigitizer->set_raw_tower_node_prefix("RAW"); @@ -170,7 +199,6 @@ void FHCAL_Towers( TString specialSetting = "") TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression se->registerSubsystem(TowerDigitizer); - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); TowerCalibration->Detector("FHCAL"); TowerCalibration->set_raw_tower_node_prefix("RAW"); @@ -179,7 +207,9 @@ void FHCAL_Towers( TString specialSetting = "") TowerCalibration->set_pedstal_ADC(0); TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression se->registerSubsystem(TowerCalibration); - } else if(specialSetting.Contains("towercalibHCALIN")){ + } + else if (G4FHCAL::SETTING::towercalibHCALIN) + { const double visible_sample_fraction_HCALIN = 7.19505e-02; // 1.34152e-02 RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); TowerDigitizer->Detector("FHCAL"); @@ -200,12 +230,14 @@ void FHCAL_Towers( TString specialSetting = "") TowerCalibration->set_pedstal_ADC(0); TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression se->registerSubsystem(TowerCalibration); - } else if(specialSetting.Contains("towercalib3")){ - cout << "3: using " << specialSetting.Data() << " for FHCAL towers" << endl; + } + else if (G4FHCAL::SETTING::towercalib3) + { + cout << "3: using towercalib3 for FHCAL towers" << endl; RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); TowerDigitizer->Detector("FHCAL"); TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(8);// eRD1 test beam setting + TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting TowerDigitizer->Verbosity(verbosity); TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer); @@ -217,7 +249,9 @@ void FHCAL_Towers( TString specialSetting = "") TowerCalibration->set_calib_const_GeV_ADC(1. / 0.03898); // calibrated with muons TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); - } else { + } + else + { cout << "def: using default for FHCAL towers" << endl; RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); TowerDigitizer->Detector("FHCAL"); From 5c07cc2edbf647ba2eba126e0803762ffbcdf4b9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Feb 2021 22:41:46 -0500 Subject: [PATCH 0965/1222] remove TString from function args --- common/G4_FST_EIC.C | 142 ++++++++++++++++++++++++++++---------------- 1 file changed, 90 insertions(+), 52 deletions(-) diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index d07e7028b..38b379e35 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -11,21 +11,47 @@ R__LOAD_LIBRARY(libg4detectors.so) -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax,double tSilicon); +int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax, double tSilicon); //-----------------------------------------------------------------------------------// namespace Enable { static bool FST = false; } + +namespace G4FST +{ + namespace SETTING + { + bool FSTV1 = false; + bool FSTV2 = false; + bool FSTV3 = false; + bool FSTV41 = false; + bool FSTV42 = false; + bool FSTV4 = false; + } // namespace SETTING +} // namespace G4FST + //-----------------------------------------------------------------------------------// void FST_Init() { + if ((G4FST::SETTING::FSTV1 ? 1 : 0) + + (G4FST::SETTING::FSTV2 ? 1 : 0) + + (G4FST::SETTING::FSTV3 ? 1 : 0) + + (G4FST::SETTING::FSTV4 ? 1 : 0) + + (G4FST::SETTING::FSTV41 ? 1 : 0) + + (G4FST::SETTING::FSTV42 ? 1 : 0) > + 1) + { + cout << "use only G4FST::SETTING::FSTV1=true or G4FST::SETTING::FSTV2=true or G4FST::SETTING::FSTV13 = true or G4FST::SETTING::FSTV3=true or G4FST::SETTING::FSTV4=true or G4FST::SETTING::FSTV41=true or G4FST::SETTING::FSTV42=true" << endl; + gSystem->Exit(1); + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } //-----------------------------------------------------------------------------------// -void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245, TString specialSetting = "") +void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); const double mm = .1 * cm; @@ -33,57 +59,69 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245, TString specialSet //Design from Xuan Li @LANL // Different FST version documented in arXiv:2009.0288 - if ( specialSetting.Contains("FSTV1")){ // version 1 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50*um); - } if ( specialSetting.Contains("FSTV2")){ // version 2 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); - make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50*um); - } if ( specialSetting.Contains("FSTV3")){ // version 3 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); - } if ( specialSetting.Contains("FSTV41")){ // version 4.1 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100*um); - } if ( specialSetting.Contains("FSTV42")){ // version 4.1 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100*um); - } if ( specialSetting.Contains("FSTV4")){ // version 4 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50*um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50*um); - } else { // Version 0 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 100*um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 100*um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100*um); - } - + if (G4FST::SETTING::FSTV1) + { // version 1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); + } + if (G4FST::SETTING::FSTV2) + { // version 2 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50 * um); + } + if (G4FST::SETTING::FSTV3) + { // version 3 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + } + if (G4FST::SETTING::FSTV41) + { // version 4.1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); + } + if (G4FST::SETTING::FSTV42) + { // version 4.1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); + } + if (G4FST::SETTING::FSTV4) + { // version 4 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50 * um); + } + else + { // Version 0 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 100 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 100 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + } } //-----------------------------------------------------------------------------------// -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax,double tSilicon) //silicon thickness +int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, + double zpos, double Rmin, double Rmax, double tSilicon) //silicon thickness { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " From 9c383e2f6a3d171346c857e3afdee5cd78720fd2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Feb 2021 22:42:10 -0500 Subject: [PATCH 0966/1222] fix test for only one bool true --- common/G4_Barrel_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index d402e3bd4..ad88243ba 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -41,7 +41,7 @@ void BarrelInit() if ((G4BARREL::SETTING::BARRELV1 ? 1 : 0) + (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV4 ? 1 : 0)) + (G4BARREL::SETTING::BARRELV4 ? 1 : 0) > 1) { cout << "use only G4BARREL::SETTING::BARRELV1=true or G4BARREL::SETTING::BARRELV2=true or G4BARREL::SETTING::BARRELV3=true or G4BARREL::SETTING::BARRELV4=true" << endl; From f542e93878664cc7b1148838812046eb7570d002 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Feb 2021 22:42:57 -0500 Subject: [PATCH 0967/1222] use sqrt(12.) instead of sqrt(12), result is identical but it makes me feel better looking at it --- common/G4_FGEM_fsPHENIX.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C index c1d7b6b4c..a6737a42d 100644 --- a/common/G4_FGEM_fsPHENIX.C +++ b/common/G4_FGEM_fsPHENIX.C @@ -267,7 +267,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_0", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -277,7 +277,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -299,7 +299,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_2", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -309,7 +309,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_3", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -319,7 +319,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_4", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, From fe6464cd5a6172440eda58b0fc9899d2f1835a48 Mon Sep 17 00:00:00 2001 From: FriederikeBock Date: Tue, 23 Feb 2021 10:29:58 -0500 Subject: [PATCH 0968/1222] fixed isues with BARREL and FST --- common/G4_Barrel_EIC.C | 22 ++++++++++++++-------- common/G4_FST_EIC.C | 16 +++++++++------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index ad88243ba..1875acf1f 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -16,7 +16,7 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon); + double radius, double halflength, double tSilicon, double tAirgap); //---------------------------------------------------------------------// namespace Enable @@ -29,6 +29,7 @@ namespace G4BARREL { namespace SETTING { + bool BARRELV0 = false; bool BARRELV1 = false; bool BARRELV2 = false; bool BARRELV3 = false; @@ -38,12 +39,13 @@ namespace G4BARREL //---------------------------------------------------------------------// void BarrelInit() { - if ((G4BARREL::SETTING::BARRELV1 ? 1 : 0) + + if ((G4BARREL::SETTING::BARRELV0 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV1 ? 1 : 0) + (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + (G4BARREL::SETTING::BARRELV4 ? 1 : 0) > 1) { - cout << "use only G4BARREL::SETTING::BARRELV1=true or G4BARREL::SETTING::BARRELV2=true or G4BARREL::SETTING::BARRELV3=true or G4BARREL::SETTING::BARRELV4=true" << endl; + cout << "use only G4BARREL::SETTING::BARRELV0=true or G4BARREL::SETTING::BARRELV1=true or G4BARREL::SETTING::BARRELV2=true or G4BARREL::SETTING::BARRELV3=true or G4BARREL::SETTING::BARRELV4=true" << endl; gSystem->Exit(1); } @@ -64,7 +66,8 @@ double Barrel(PHG4Reco *g4Reco, double radius) double r[6] = {3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um}; - + double tAirgap[6] = {0.9, 0.9, 1, 1, 1, 1}; + if (G4BARREL::SETTING::BARRELV1 || G4BARREL::SETTING::BARRELV2) { for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; @@ -85,7 +88,7 @@ double Barrel(PHG4Reco *g4Reco, double radius) double max_bh_radius = 0.; for (int i = 0; i < nLayer; i++) { - make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i]); + make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i], tAirgap[i]); max_bh_radius = r[i] + 1.5; // std::cout << "done with barrel layer intialization at "<< r[i] << std::endl; } @@ -99,7 +102,7 @@ double Barrel(PHG4Reco *g4Reco, double radius) //---------------------------------------------------------------------// //-----------------------------------------------------------------------------------// int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon) + double radius, double halflength, double tSilicon, double tAirgap) { //--------------------------------- //build barrel layer @@ -114,16 +117,17 @@ int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; double thickness[nSubLayer] = {tSilicon, 15 * um, 20 * um, 100 * um, - 50 * um, 1, 50 * um}; + 50 * um, tAirgap, 50 * um}; double max_bh_radius = 0.; PHG4CylinderSubsystem *cyl; cout << "started to create cylinder layer: " << name << endl; double currRadius = radius; - // cout << currRadius << endl; +// cout << currRadius << endl; for (int l = 0; l < nSubLayer; l++) { + cout << name << "_" << layerName[l] << "\t" << currRadius ; cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l], l); cyl->SuperDetector(name); cyl->set_double_param("radius", currRadius); @@ -134,7 +138,9 @@ int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, cyl->OverlapCheck(true); g4Reco->registerSubsystem(cyl); currRadius = currRadius + thickness[l]; + cout << "\t" << currRadius << endl; } + return 0; } diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index 38b379e35..c36f1abaa 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -23,6 +23,7 @@ namespace G4FST { namespace SETTING { + bool FSTV0 = false; bool FSTV1 = false; bool FSTV2 = false; bool FSTV3 = false; @@ -35,7 +36,8 @@ namespace G4FST //-----------------------------------------------------------------------------------// void FST_Init() { - if ((G4FST::SETTING::FSTV1 ? 1 : 0) + + if ((G4FST::SETTING::FSTV0 ? 1 : 0) + + (G4FST::SETTING::FSTV1 ? 1 : 0) + (G4FST::SETTING::FSTV2 ? 1 : 0) + (G4FST::SETTING::FSTV3 ? 1 : 0) + (G4FST::SETTING::FSTV4 ? 1 : 0) + @@ -43,7 +45,7 @@ void FST_Init() (G4FST::SETTING::FSTV42 ? 1 : 0) > 1) { - cout << "use only G4FST::SETTING::FSTV1=true or G4FST::SETTING::FSTV2=true or G4FST::SETTING::FSTV13 = true or G4FST::SETTING::FSTV3=true or G4FST::SETTING::FSTV4=true or G4FST::SETTING::FSTV41=true or G4FST::SETTING::FSTV42=true" << endl; + cout << "use only G4FST::SETTING::FSTV0=true or G4FST::SETTING::FSTV1=true or G4FST::SETTING::FSTV2=true or G4FST::SETTING::FSTV3=true or G4FST::SETTING::FSTV4=true or G4FST::SETTING::FSTV41=true or G4FST::SETTING::FSTV42=true" << endl; gSystem->Exit(1); } @@ -67,7 +69,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); } - if (G4FST::SETTING::FSTV2) + else if (G4FST::SETTING::FSTV2) { // version 2 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50 * um); @@ -75,7 +77,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50 * um); } - if (G4FST::SETTING::FSTV3) + else if (G4FST::SETTING::FSTV3) { // version 3 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); @@ -83,7 +85,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); } - if (G4FST::SETTING::FSTV41) + else if (G4FST::SETTING::FSTV41) { // version 4.1 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); @@ -92,7 +94,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); } - if (G4FST::SETTING::FSTV42) + else if (G4FST::SETTING::FSTV42) { // version 4.1 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); @@ -101,7 +103,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); } - if (G4FST::SETTING::FSTV4) + else if (G4FST::SETTING::FSTV4) { // version 4 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); From f0e8b7dbe6382a72183bca2984b5bd03ffceeb96 Mon Sep 17 00:00:00 2001 From: Nicolas Schmidt Date: Tue, 23 Feb 2021 15:51:20 +0100 Subject: [PATCH 0969/1222] added full jets and cluster jets to forward jetfinder --- common/G4_FwdJets.C | 101 +++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 67 deletions(-) diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C index d90d9fadf..998dffb6b 100644 --- a/common/G4_FwdJets.C +++ b/common/G4_FwdJets.C @@ -8,7 +8,7 @@ #include #include #include -// #include +#include #include @@ -35,15 +35,9 @@ void Jet_FwdReco() // 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Truth_r10"); - // 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); @@ -56,15 +50,9 @@ void Jet_FwdReco() 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Tower_r10"); - // 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); @@ -72,29 +60,14 @@ void Jet_FwdReco() // cluster jets JetReco *clusterjetreco = new JetReco("CLUSTERJETRECO"); - // TODO: WE NEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // clusterjetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); - // clusterjetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! - // TODO: WENEED TO IMPLEMENT FORWARD CLUSTERS IN JET RECO!!! + clusterjetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Cluster_r10"); clusterjetreco->set_algo_node("ANTIKT"); clusterjetreco->set_input_node("CLUSTER"); @@ -105,18 +78,9 @@ void Jet_FwdReco() JetReco *towerjetrecofwd = new JetReco("TOWERJETRECOFWD"); towerjetrecofwd->add_input(new TowerJetInput(Jet::FEMC_TOWER)); towerjetrecofwd->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); - // towerjetrecofwd->add_input(new TowerJetInput(Jet::CEMC_TOWER)); - // towerjetrecofwd->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); - // towerjetrecofwd->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); - // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); - towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_TowerFwd_r03"); - // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_TowerFwd_r05"); - // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_TowerFwd_r07"); - // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_TowerFwd_r10"); - // towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); towerjetrecofwd->set_algo_node("ANTIKT"); towerjetrecofwd->set_input_node("TOWER"); towerjetrecofwd->Verbosity(verbosity); @@ -126,17 +90,8 @@ void Jet_FwdReco() JetReco *clusterjetrecofwd = new JetReco("CLUSTERJETRECOFWD"); clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); - // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); - // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); - // clusterjetrecofwd->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Cluster_r02"); - // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ClusterFwd_r03"); - // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Cluster_r04"); clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_ClusterFwd_r05"); - // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Cluster_r06"); clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_ClusterFwd_r07"); - // clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Cluster_r08"); clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_ClusterFwd_r10"); clusterjetrecofwd->set_algo_node("ANTIKT"); clusterjetrecofwd->set_input_node("CLUSTER"); @@ -145,25 +100,27 @@ void Jet_FwdReco() // // track jets - // JetReco *fulljetreco = new JetReco("fulljetreco"); - // fulljetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); - // fulljetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); - // fulljetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); - // fulljetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - // fulljetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); - // fulljetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); - // fulljetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Full_r02"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Full_r03"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Full_r04"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Full_r05"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Full_r06"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Full_r07"); - // fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Full_r08"); - // fulljetreco->set_algo_node("ANTIKT"); - // fulljetreco->set_input_node("FULL"); - // fulljetreco->Verbosity(verbosity); - // se->registerSubsystem(fulljetreco); + JetReco *trackjetreco = new JetReco("TRACKJETRECO"); + trackjetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Track_r05"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Track_r07"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Track_r10"); + trackjetreco->set_algo_node("ANTIKT"); + trackjetreco->set_input_node("TRACK"); + trackjetreco->Verbosity(verbosity); + se->registerSubsystem(trackjetreco); + + // // track jets + JetReco *fulljetreco = new JetReco("FULLJETRECO"); + fulljetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + fulljetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Full_r05"); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Full_r07"); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Full_r08"); + fulljetreco->set_algo_node("ANTIKT"); + fulljetreco->set_input_node("FULL"); + fulljetreco->Verbosity(verbosity); + se->registerSubsystem(fulljetreco); return; @@ -174,6 +131,16 @@ void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); + JetEvaluator *evaltrk05 = new JetEvaluator("JETEVALUATORTRACK05","AntiKt_Track_r05", + "AntiKt_Truth_r05", "g4fwdjets_track_05_eval.root"); + evaltrk05->Verbosity(verbosity); + se->registerSubsystem(evaltrk05); + + JetEvaluator *evalfull05 = new JetEvaluator("JETEVALUATORFULL05","AntiKt_Full_r05", + "AntiKt_Truth_r05", "g4fwdjets_full_05_eval.root"); + evalfull05->Verbosity(verbosity); + se->registerSubsystem(evalfull05); + JetEvaluator *evalt05 = new JetEvaluator("JETEVALUATORTOWER05","AntiKt_Tower_r05", "AntiKt_Truth_r05", "g4fwdjets_tower_05_eval.root"); evalt05->Verbosity(verbosity); From a76fcb1e2a892958688fde978c9f0e2a110ca62b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 25 Feb 2021 22:39:52 -0500 Subject: [PATCH 0970/1222] Modified G4_Tracking.C to add PHTpcTrackSeedVertexAssoc. --- common/G4_Tracking.C | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index c27ec741f..515067b79 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,7 @@ namespace G4TRACKING // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_tpc_seed_vertex_assoc = true; // Possible variations - these are normally false bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker @@ -301,6 +303,14 @@ void Tracking_Reco() } } + if(G4TRACKING::use_tpc_seed_vertex_assoc) + { + // This does not care which seeder is used + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); + } + // Genfit track propagation and final fitting (starts from TPC track seeds) //================================================= if (G4TRACKING::use_Genfit) @@ -378,8 +388,8 @@ void Tracking_Reco() // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); silicon_match->Verbosity(verbosity); - if (!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // module defaults to PHTpcTracker seeding, for PHCASeeding use true here + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_tpc_seed_vertex_assoc) + silicon_match->set_seeder(false); // module defaults to CASeeding, for PHTpcTracker seeding use false here ONLY when not using PHTpcTrackSeedVertexAssoc. silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); From 3a80e9197068fb60a6f0c1a98cb587a61313cbf1 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 26 Feb 2021 16:11:11 -0500 Subject: [PATCH 0971/1222] Add flag for truth or acts init vertexing change default scan for embed to true in SvtxEvalutor --- common/G4_Tracking.C | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 8cc7fd974..3cdd07b57 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -90,7 +90,8 @@ namespace G4TRACKING bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_init_vertexing = true; // if true runs acts silicon seeding+initial vertexing + bool use_acts_silicon_seeding = true; // if true runs acts silicon seeding + bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples @@ -198,18 +199,26 @@ void Tracking_Reco() // Initial vertex finding //================================= - if(G4TRACKING::use_acts_init_vertexing && !G4TRACKING::use_Genfit) + if(G4TRACKING::use_acts_silicon_seeding && !G4TRACKING::use_Genfit) { #if __cplusplus >= 201703L PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); silicon_Seeding->Verbosity(verbosity); se->registerSubsystem(silicon_Seeding); - - PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - + + if(G4TRACKING::use_acts_init_vertexing) + { + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + } + else + { + PHTruthVertexing *init_vtx = new PHTruthVertexing(); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + } #endif } else if (G4TRACKING::use_phinit_vertexing) @@ -441,7 +450,7 @@ void Tracking_Reco() #if __cplusplus >= 201703L - PHActsTracks* actsTracks = new PHActsTracks(); + PHActsTracks* actsTracks = new PHActsTracks("PHActsTracks1"); actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); @@ -464,7 +473,7 @@ void Tracking_Reco() vtxer->Verbosity(verbosity); se->registerSubsystem(vtxer); - PHActsTracks *actsTracks2 = new PHActsTracks(); + PHActsTracks *actsTracks2 = new PHActsTracks("PHActsTracks2"); actsTracks2->Verbosity(verbosity); actsTracks2->setSecondFit(true); se->registerSubsystem(actsTracks2); @@ -525,7 +534,7 @@ void Tracking_Eval(const std::string& outputfile) eval->do_gpoint_eval(false); eval->do_eval_light(true); eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true eval->Verbosity(verbosity); se->registerSubsystem(eval); From 6501de1218c74d7ba545d97d999137f50daa20bb Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Sun, 28 Feb 2021 10:20:16 -0500 Subject: [PATCH 0972/1222] missed init_vtx flag --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 868d3adb3..7f4b57a71 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -384,7 +384,7 @@ void Tracking_Reco() // start with a complete TPC track seed from one of the CA seeders // use truth information to assemble silicon clusters into track stubs for now - if(!G4TRACKING::use_acts_init_vertexing) + if(!G4TRACKING::use_acts_silicon_seeding) { PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); silicon_seeding->Verbosity(verbosity); From 290282496947a27de7cf8a5491110073d1d258ec Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Sun, 28 Feb 2021 10:45:15 -0500 Subject: [PATCH 0973/1222] forgot silicon flag... --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7f4b57a71..abd041c1f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -219,6 +219,7 @@ void Tracking_Reco() { PHTruthVertexing *init_vtx = new PHTruthVertexing(); init_vtx->Verbosity(verbosity); + init_vtx->set_acts_silicon(true); se->registerSubsystem(init_vtx); } #endif From 20cd79234e349b2a6e86c6069898dc723a27ad2c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 28 Feb 2021 22:34:58 -0500 Subject: [PATCH 0974/1222] EIC parameters --- common/G4_Input.C | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/common/G4_Input.C b/common/G4_Input.C index 1117f4168..6d6f82cfc 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -85,6 +86,50 @@ namespace Input bool READHITS = false; int VERBOSITY = 0; int EmbedId = 1; + + //! apply EIC beam parameter to any HepMC generator, + //! 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"<set_beam_direction_theta_phi(1e-3,0,M_PI - 1e-3,0); //2mrad x-ing of sPHENIX + + HepMCGen->set_beam_direction_theta_phi(25e-3,0,M_PI ,0); //25mrad x-ing as in EIC CDR + HepMCGen->set_beam_angular_divergence_hv( + 119-6, 119e-6, // EIC CDR Table 1.1 + 211e-6, 152e-6 // EIC CDR Table 1.1 + ); + + // 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), + sigma_p_v*sigma_e_v / sqrt(sigma_p_v*sigma_p_v+sigma_e_v*sigma_e_v), + collision_sigma_z, + collision_sigma_t ); + HepMCGen->set_vertex_distribution_function( + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus); + } + + + } // namespace Input namespace INPUTHEPMC From aa79b49a1411d91fbb4223608cee5c1967cc519c Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Mon, 1 Mar 2021 21:50:13 -0500 Subject: [PATCH 0975/1222] EIC parameters --- common/G4_Input.C | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 6d6f82cfc..7d3bab5e1 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -18,10 +18,10 @@ #include -#include #include #include #include +#include #include #include @@ -90,18 +90,18 @@ namespace Input //! apply EIC beam parameter to any HepMC generator, //! 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) + void ApplyEICBeamParameter(PHHepMCGenHelper *HepMCGen) { if (HepMCGen == nullptr) { - std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen"<set_beam_direction_theta_phi(1e-3,0,M_PI - 1e-3,0); //2mrad x-ing of sPHENIX - HepMCGen->set_beam_direction_theta_phi(25e-3,0,M_PI ,0); //25mrad x-ing as in EIC CDR + HepMCGen->set_beam_direction_theta_phi(25e-3, 0, M_PI, 0); //25mrad x-ing as in EIC CDR HepMCGen->set_beam_angular_divergence_hv( - 119-6, 119e-6, // EIC CDR Table 1.1 - 211e-6, 152e-6 // EIC CDR Table 1.1 + 119 - 6, 119e-6, // EIC CDR Table 1.1 + 211e-6, 152e-6 // EIC CDR Table 1.1 ); // calculate beam sigma width at IP as in EIC CDR table 1.1 @@ -113,14 +113,14 @@ namespace Input 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 + 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), - sigma_p_v*sigma_e_v / sqrt(sigma_p_v*sigma_p_v+sigma_e_v*sigma_e_v), + sigma_p_h * sigma_e_h / sqrt(sigma_p_h * sigma_p_h + sigma_e_h * sigma_e_h), + sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v), collision_sigma_z, - collision_sigma_t ); + collision_sigma_t); HepMCGen->set_vertex_distribution_function( PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, @@ -128,8 +128,6 @@ namespace Input PHHepMCGenHelper::Gaus); } - - } // namespace Input namespace INPUTHEPMC From 1de03476d14204badd84428b7e23e3daeb76f8a6 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 2 Mar 2021 04:43:48 -0500 Subject: [PATCH 0976/1222] Added propagator to tracking reco sequence --- common/G4_Tracking.C | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index abd041c1f..9df5917b5 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -29,6 +29,7 @@ #include #include #include +#include #if __cplusplus >= 201703L #include @@ -287,8 +288,21 @@ void Tracking_Reco() hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) hseeder->setMinTrackSize(10,5); // (iter1, iter2) hseeder->setNThreads(1); - hseeder->Verbosity(0); + hseeder->Verbosity(verbosity); se->registerSubsystem(hseeder); + + std::cout << " Using intermediate vertex associator module " << std::endl; + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc("PHTpcTrackSeedVertexAssoc_prePropagator"); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); + + std::cout << " Using PHSimpleKFProp propagator " << std::endl; + PHSimpleKFProp* hprop = new PHSimpleKFProp("PHSimpleKFProp"); + hprop->set_field_dir(G4MAGNET::magfield_rescale); + hprop->set_max_window(.04); + hprop->Verbosity(verbosity); + se->registerSubsystem(hprop); + } else { @@ -304,10 +318,22 @@ void Tracking_Reco() 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); + seeder->SetSearchWindow(0.01, 0.04); // (eta width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(5); se->registerSubsystem(seeder); + + std::cout << " Using intermediate vertex associator module " << std::endl; + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc("PHTpcTrackSeedVertexAssoc_prePropagator"); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); + + std::cout << " Using PHSimpleKFProp propagator " << std::endl; + PHSimpleKFProp* cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + cprop->set_max_window(.04); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); } } From 20250fd4a778429335190c0133ceaed6d4814ccb Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 2 Mar 2021 11:27:59 -0500 Subject: [PATCH 0977/1222] RHIC parameter --- common/G4_Input.C | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 7d3bab5e1..5391d188c 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -87,6 +87,28 @@ namespace Input 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; + } + 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, //! 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 @@ -127,7 +149,6 @@ namespace Input PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); } - } // namespace Input namespace INPUTHEPMC From cb01d2e68b42df3266ab892c8e0f6c1341e42fa0 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 2 Mar 2021 11:53:11 -0500 Subject: [PATCH 0978/1222] introduce beam parameter to detector macros --- common/G4_Input.C | 2 +- .../EICDetector/Fun4All_G4_EICDetector.C | 21 +++++++++- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 33 ++++++++++++---- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 38 +++++++++++++++---- 4 files changed, 75 insertions(+), 19 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 5391d188c..7d0b42f45 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -109,7 +109,7 @@ namespace Input PHHepMCGenHelper::Gaus); } - //! apply EIC beam parameter to any HepMC generator, + //! 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) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 500dd6785..c59cf2d72 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -168,6 +168,20 @@ int Fun4All_G4_EICDetector( if (Input::PYTHIA6) { INPUTGENERATOR::Pythia6->set_config_file(string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6_ep.cfg"); + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTGENERATOR::Pythia6); + } + // pythia8 + if (Input::PYTHIA8) + { + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTGENERATOR::Pythia8); + } + // Sartre + if (Input::SARTRE) + { + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTGENERATOR::Sartre); } //-------------- @@ -177,10 +191,13 @@ int Fun4All_G4_EICDetector( if (Input::HEPMC) { - INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 30, 0); //optional collision smear in space, time + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTMANAGER::HepMCInputManager); + // optional overriding beam parameters + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 30, 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); + // 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 diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index d7def8b4c..715ffb784 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -162,6 +162,19 @@ int Fun4All_G4_fsPHENIX( 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 //-------------- @@ -169,15 +182,14 @@ int Fun4All_G4_fsPHENIX( if (Input::HEPMC) { - 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 + //! 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); + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); if (Input::PILEUPRATE > 0) { // Copy vertex settings from foreground hepmc input @@ -186,6 +198,11 @@ int Fun4All_G4_fsPHENIX( // 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(); diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8eddf4c33..9b2e187b6 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -171,6 +171,19 @@ int Fun4All_G4_sPHENIX( 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 //-------------- @@ -178,10 +191,14 @@ int Fun4All_G4_sPHENIX( if (Input::HEPMC) { - 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 + //! 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); + //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 @@ -195,6 +212,11 @@ int Fun4All_G4_sPHENIX( // 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(); @@ -489,7 +511,7 @@ int Fun4All_G4_sPHENIX( if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); //if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco(); - + //---------------------- // Standard QAs //---------------------- @@ -523,10 +545,10 @@ int Fun4All_G4_sPHENIX( string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); if (Enable::DSTOUT_COMPRESS) - { - ShowerCompress(); - DstCompress(out); - } + { + ShowerCompress(); + DstCompress(out); + } se->registerOutputManager(out); } //----------------- From 48c0ac981f4874d57c7585ca009d9a94df6548f6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Mar 2021 12:30:45 -0500 Subject: [PATCH 0979/1222] use {} even for single lines in ifs, just indenting is too error prone, need to set fhcal to active --- common/G4_FHCAL.C | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index 34d96fb89..23a428971 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -91,30 +91,43 @@ void FHCALSetup(PHG4Reco *g4Reco) Fun4AllServer *se = Fun4AllServer::instance(); /** Use dedicated FHCAL module */ - PHG4ForwardHcalSubsystem *hhcal = new PHG4ForwardHcalSubsystem("FHCAL"); + PHG4ForwardHcalSubsystem *fhcal = new PHG4ForwardHcalSubsystem("FHCAL"); ostringstream mapping_fhcal; // Switch to desired calo setup // full HCal Fe-Scint with nominal acceptance if (G4FHCAL::SETTING::FullEtaAcc) - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + { + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + } // full HCal Fe-Scint with nominal acceptance doubled granularity else if (G4FHCAL::SETTING::HC2x) - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + { + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + } // full HCal Fe-Scint with nominal acceptance four times granularity else if (G4FHCAL::SETTING::HC2x) - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + { + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + } // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe else - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; - - hhcal->SetTowerMappingFile(mapping_fhcal.str()); - hhcal->OverlapCheck(OverlapCheck); + { + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + } - if (AbsorberActive) hhcal->SetAbsorberActive(); + fhcal->SetTowerMappingFile(mapping_fhcal.str()); + fhcal->OverlapCheck(OverlapCheck); + fhcal->SetActive(); + fhcal->SuperDetector("FHCAL"); + if (AbsorberActive) fhcal->SetAbsorberActive(); - g4Reco->registerSubsystem(hhcal); + g4Reco->registerSubsystem(fhcal); } void FHCAL_Cells(int verbosity = 0) @@ -133,16 +146,24 @@ void FHCAL_Towers() // Switch to desired calo setup // full HCal Fe-Scint with nominal acceptance if (G4FHCAL::SETTING::FullEtaAcc) + { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + } // full HCal Fe-Scint with nominal acceptance doubled granularity else if (G4FHCAL::SETTING::HC2x) + { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + } // full HCal Fe-Scint with nominal acceptance four times granularity else if (G4FHCAL::SETTING::HC4x) + { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + } // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe else + { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + } RawTowerBuilderByHitIndex *tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); tower_FHCAL->Detector("FHCAL"); From 7ad6eb1c3168bbac5dfe9dcd8cf086f86a851685 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 2 Mar 2021 13:37:35 -0500 Subject: [PATCH 0980/1222] fix typo --- common/G4_Input.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 7d0b42f45..76cc794f7 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -122,8 +122,8 @@ namespace Input HepMCGen->set_beam_direction_theta_phi(25e-3, 0, M_PI, 0); //25mrad x-ing as in EIC CDR HepMCGen->set_beam_angular_divergence_hv( - 119 - 6, 119e-6, // EIC CDR Table 1.1 - 211e-6, 152e-6 // EIC CDR Table 1.1 + 119e-6, 119e-6, // proton beam as in EIC CDR Table 1.1 + 211e-6, 152e-6 // electron beam as in EIC CDR Table 1.1 ); // calculate beam sigma width at IP as in EIC CDR table 1.1 From c01eaa85f321c0e8f7298521289aab3d432190b7 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 2 Mar 2021 13:55:50 -0500 Subject: [PATCH 0981/1222] add documentation --- common/G4_Input.C | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 76cc794f7..af00c12c0 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -120,10 +120,16 @@ namespace Input } //INPUTMANAGER::HepMCInputManager->set_beam_direction_theta_phi(1e-3,0,M_PI - 1e-3,0); //2mrad x-ing of sPHENIX - HepMCGen->set_beam_direction_theta_phi(25e-3, 0, M_PI, 0); //25mrad x-ing as in EIC CDR + //25mrad x-ing as in EIC CDR + HepMCGen->set_beam_direction_theta_phi( + 25e-3, // beamA_theta + 0, // beamA_phi + M_PI, // beamB_theta + 0 // beamB_phi + ); HepMCGen->set_beam_angular_divergence_hv( - 119e-6, 119e-6, // proton beam as in EIC CDR Table 1.1 - 211e-6, 152e-6 // electron beam as in EIC CDR Table 1.1 + 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 ); // calculate beam sigma width at IP as in EIC CDR table 1.1 @@ -139,15 +145,15 @@ namespace Input 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), - sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v), - collision_sigma_z, - collision_sigma_t); + 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, - PHHepMCGenHelper::Gaus, - PHHepMCGenHelper::Gaus, - PHHepMCGenHelper::Gaus); + PHHepMCGenHelper::Gaus, //x + PHHepMCGenHelper::Gaus, //y + PHHepMCGenHelper::Gaus, //z + PHHepMCGenHelper::Gaus); //t } } // namespace Input From 41bd96b0d39bb2258991dba463ea85c0c449d732 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 2 Mar 2021 14:02:17 -0500 Subject: [PATCH 0982/1222] force exit if invalid input --- common/G4_Input.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index af00c12c0..dc2d846b8 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -94,6 +94,7 @@ namespace Input 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 @@ -117,8 +118,8 @@ namespace Input if (HepMCGen == nullptr) { std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; + exit (1); } - //INPUTMANAGER::HepMCInputManager->set_beam_direction_theta_phi(1e-3,0,M_PI - 1e-3,0); //2mrad x-ing of sPHENIX //25mrad x-ing as in EIC CDR HepMCGen->set_beam_direction_theta_phi( From 988b8d108a1ed09440a8d4568beb6e421749208e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 5 Mar 2021 08:05:07 -0500 Subject: [PATCH 0983/1222] Revert "Added propagator to tracking reco sequence" --- common/G4_Tracking.C | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9df5917b5..abd041c1f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -29,7 +29,6 @@ #include #include #include -#include #if __cplusplus >= 201703L #include @@ -288,21 +287,8 @@ void Tracking_Reco() hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) hseeder->setMinTrackSize(10,5); // (iter1, iter2) hseeder->setNThreads(1); - hseeder->Verbosity(verbosity); + hseeder->Verbosity(0); se->registerSubsystem(hseeder); - - std::cout << " Using intermediate vertex associator module " << std::endl; - PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc("PHTpcTrackSeedVertexAssoc_prePropagator"); - vtxassoc->Verbosity(0); - se->registerSubsystem(vtxassoc); - - std::cout << " Using PHSimpleKFProp propagator " << std::endl; - PHSimpleKFProp* hprop = new PHSimpleKFProp("PHSimpleKFProp"); - hprop->set_field_dir(G4MAGNET::magfield_rescale); - hprop->set_max_window(.04); - hprop->Verbosity(verbosity); - se->registerSubsystem(hprop); - } else { @@ -318,22 +304,10 @@ void Tracking_Reco() seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); - seeder->SetSearchWindow(0.01, 0.04); // (eta width, phi width) - seeder->SetMinHitsPerCluster(0); - seeder->SetMinClustersPerTrack(5); + seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) + seeder->SetMinHitsPerCluster(2); + seeder->SetMinClustersPerTrack(20); se->registerSubsystem(seeder); - - std::cout << " Using intermediate vertex associator module " << std::endl; - PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc("PHTpcTrackSeedVertexAssoc_prePropagator"); - vtxassoc->Verbosity(0); - se->registerSubsystem(vtxassoc); - - std::cout << " Using PHSimpleKFProp propagator " << std::endl; - PHSimpleKFProp* cprop = new PHSimpleKFProp("PHSimpleKFProp"); - cprop->set_field_dir(G4MAGNET::magfield_rescale); - cprop->set_max_window(.04); - cprop->Verbosity(verbosity); - se->registerSubsystem(cprop); } } From f7f8e06f21ae5bb6c7b32d438efe3fad8863646d Mon Sep 17 00:00:00 2001 From: FriederikeBock Date: Mon, 8 Mar 2021 22:38:10 -0500 Subject: [PATCH 0984/1222] added fine granularity hCal and Ecal configs --- common/G4_FEMC_EIC.C | 11 +++++++++++ common/G4_FHCAL.C | 47 ++++++++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index 59d39b107..7db6e4244 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -55,6 +55,7 @@ namespace G4FEMC { bool FullEtaAcc = false; bool fsPHENIX = false; + bool EC2x = false; } // namespace SETTING } // namespace G4FEMC @@ -88,6 +89,11 @@ void FEMCSetup(PHG4Reco *g4Reco) { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; } + // doubled granularity ECAL + else if (G4FEMC::SETTING::EC2x) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; + } // fsPHENIX ECAL else if (G4FEMC::SETTING::fsPHENIX) { @@ -130,6 +136,11 @@ void FEMC_Towers() { mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; } + // doubled granularity ECAL + else if (G4FEMC::SETTING::EC2x) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; + } // fsPHENIX ECAL else if (G4FEMC::SETTING::fsPHENIX) { diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index 23a428971..16f46f065 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -96,23 +96,30 @@ void FHCALSetup(PHG4Reco *g4Reco) ostringstream mapping_fhcal; // Switch to desired calo setup - // full HCal Fe-Scint with nominal acceptance - if (G4FHCAL::SETTING::FullEtaAcc) + // HCal Fe-Scint with doubled granularity + if (G4FHCAL::SETTING::HC2x ) { - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; } // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (G4FHCAL::SETTING::HC2x) + else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) { - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + } + // HCal Fe-Scint with four times granularity + else if (G4FHCAL::SETTING::HC4x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; } // full HCal Fe-Scint with nominal acceptance four times granularity - else if (G4FHCAL::SETTING::HC2x) + else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) { - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + } + // full HCal Fe-Scint with nominal acceptance + else if (G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; } // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe else @@ -144,21 +151,31 @@ void FHCAL_Towers() ostringstream mapping_fhcal; // Switch to desired calo setup - // full HCal Fe-Scint with nominal acceptance - if (G4FHCAL::SETTING::FullEtaAcc) + // HCal Fe-Scint with doubled granularity + if (G4FHCAL::SETTING::HC2x ) { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; } // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (G4FHCAL::SETTING::HC2x) + else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; } + // HCal Fe-Scint with four times granularity + else if (G4FHCAL::SETTING::HC4x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; + } // full HCal Fe-Scint with nominal acceptance four times granularity - else if (G4FHCAL::SETTING::HC4x) + else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) { mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; } + // full HCal Fe-Scint with nominal acceptance + else if (G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + } // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe else { From 933faf6d185e0c755dd1e2a3c056d14e1ad69f4b Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 9 Mar 2021 13:32:05 -0500 Subject: [PATCH 0985/1222] Modify macros to build acts geometry before clustering --- common/G4_Tracking.C | 34 +++++++++++++++++--------- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 +++- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index abd041c1f..fbbf1adbe 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -157,6 +157,26 @@ void TrackingInit() std::cout << "Cannot enable space charge correction if not using GenFit tracking chain" << std::endl; G4TPC::ENABLE_CORRECTIONS = 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); + + /// 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() @@ -177,18 +197,7 @@ void Tracking_Reco() if(!G4TRACKING::use_Genfit) { #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); - - /// 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); - + /// Always run PHActsSourceLinks first, to convert TrkrClusters /// to the Acts equivalent PHActsSourceLinks* sl = new PHActsSourceLinks(); @@ -495,6 +504,7 @@ void Tracking_Reco() actsFit2->fitSiliconMMs(false); se->registerSubsystem(actsFit2); + #endif } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8eddf4c33..333b56c46 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -410,6 +410,10 @@ int Fun4All_G4_sPHENIX( //-------------- // 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(); @@ -417,7 +421,6 @@ int Fun4All_G4_sPHENIX( if (Enable::TRACKING_TRACK) { - TrackingInit(); Tracking_Reco(); } //----------------- From a12e2e34584c054dbb05c3b92dd0b071dd1b7bb0 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 10 Mar 2021 10:36:41 -0500 Subject: [PATCH 0986/1222] Update tracking macro with acts-svtx changes --- common/G4_Tracking.C | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index fbbf1adbe..8f91d920a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -194,20 +193,6 @@ void Tracking_Reco() // Tracking //------------ - if(!G4TRACKING::use_Genfit) - { -#if __cplusplus >= 201703L - - /// Always run PHActsSourceLinks first, to convert TrkrClusters - /// to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(verbosity); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); -#endif - } - // Initial vertex finding //================================= if(G4TRACKING::use_acts_silicon_seeding && !G4TRACKING::use_Genfit) @@ -220,8 +205,11 @@ void Tracking_Reco() if(G4TRACKING::use_acts_init_vertexing) { + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); init_vtx->Verbosity(verbosity); + init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); + init_vtx->setSvtxVertexMapName("SvtxVertexMap"); se->registerSubsystem(init_vtx); } else @@ -469,11 +457,6 @@ void Tracking_Reco() #if __cplusplus >= 201703L - - PHActsTracks* actsTracks = new PHActsTracks("PHActsTracks1"); - actsTracks->Verbosity(verbosity); - se->registerSubsystem(actsTracks); - PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); actsFit->Verbosity(verbosity); actsFit->doTimeAnalysis(false); @@ -489,15 +472,14 @@ void Tracking_Reco() se->registerSubsystem(residuals); } - PHActsVertexFinder *finder = new PHActsVertexFinder("PHActsVertexFinder"); + PHActsInitialVertexFinder *finder = new PHActsInitialVertexFinder("PHActsVertexFinder"); finder->Verbosity(verbosity); + finder->setSvtxTrackMapName("SvtxTrackMap"); + finder->setSvtxVertexMapName("SvtxVertexMap"); + /// Determines whether or not to reset track covariance matrix + finder->setInitialVertexer(false); se->registerSubsystem(finder); - PHActsTracks *actsTracks2 = new PHActsTracks("PHActsTracks2"); - actsTracks2->Verbosity(verbosity); - actsTracks2->setSecondFit(true); - se->registerSubsystem(actsTracks2); - PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); actsFit2->Verbosity(verbosity); actsFit2->doTimeAnalysis(false); From 28560d07ee632f3e74d24fa1bd01ea96c6f7c05f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 11 Mar 2021 09:14:30 -0500 Subject: [PATCH 0987/1222] set default physics list to ftfp_bert (same as in the code) --- common/G4_World.C | 2 +- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_World.C b/common/G4_World.C index ceeafdca7..eacb53a83 100644 --- a/common/G4_World.C +++ b/common/G4_World.C @@ -11,7 +11,7 @@ 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 = "QGSP_BERT"; // for calorimeters use HP lists + string PhysicsList = "FTFP_BERT"; // for calorimeters use HP lists } // namespace G4WORLD void WorldInit(PHG4Reco *g4Reco) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8eddf4c33..c87528c8f 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -337,7 +337,7 @@ int Fun4All_G4_sPHENIX( //--------------- // World Settings //--------------- - // G4WORLD::PhysicsList = "QGSP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans //--------------- From 20f7c151e07c60f364e6d9966ea7e83a65831fa5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 11 Mar 2021 09:15:41 -0500 Subject: [PATCH 0988/1222] set default physics list to ftfp_bert (same as in the code) --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 2 +- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 500dd6785..55e9bdbc6 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -322,7 +322,7 @@ int Fun4All_G4_EICDetector( //--------------- // World Settings //--------------- - // G4WORLD::PhysicsList = "QGSP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans //--------------- diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index d7def8b4c..86693746a 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -312,7 +312,7 @@ int Fun4All_G4_fsPHENIX( //--------------- // World Settings //--------------- - // G4WORLD::PhysicsList = "QGSP_BERT"; // FTFP_BERT_HP best for calo + // G4WORLD::PhysicsList = "FTFP_BERT"; // FTFP_BERT_HP best for calo // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans //--------------- From 6ce54341ce1e9456ca5df002d5fce0c94a1d1df3 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 12 Mar 2021 20:37:04 -0500 Subject: [PATCH 0989/1222] introduce crab cavity kicks --- common/G4_Input.C | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index dc2d846b8..59966c1ef 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -94,7 +94,7 @@ namespace Input if (HepMCGen == nullptr) { std::cout << "ApplysPHENIXBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; - exit (1); + 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 @@ -118,21 +118,32 @@ namespace Input if (HepMCGen == nullptr) { std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; - exit (1); + exit(1); } //25mrad x-ing as in EIC CDR + const double EIC_hadron_crossing_angle = 25e-3; + HepMCGen->set_beam_direction_theta_phi( - 25e-3, // beamA_theta - 0, // beamA_phi - M_PI, // beamB_theta - 0 // beamB_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 = 52e3; // 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); From 544925c4bef686816f9f174236c2a5d6de39f529 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 12 Mar 2021 20:42:55 -0500 Subject: [PATCH 0990/1222] fix typo --- common/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 59966c1ef..7b1934553 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -138,7 +138,7 @@ namespace Input // 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 = 52e3; // CDR Fig 3.3 + 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, From 2a2d98a81ef94c667522914b5cbadf3570f935de Mon Sep 17 00:00:00 2001 From: Barak Schmookler Date: Sat, 13 Mar 2021 10:55:43 -0500 Subject: [PATCH 0991/1222] Updated FST and forward GEM configurations. --- common/G4_FST_EIC.C | 19 +++++++++++--- common/G4_GEM_EIC.C | 14 +++++++++-- common/G4_Tracking_EIC.C | 25 +++++++++++++++---- .../EICDetector/Fun4All_G4_EICDetector.C | 7 +++++- detectors/EICDetector/G4Setup_EICDetector.C | 12 ++++++--- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index c36f1abaa..d143ea884 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -30,6 +30,7 @@ namespace G4FST bool FSTV41 = false; bool FSTV42 = false; bool FSTV4 = false; + bool FST_MVTX_TPC = false; } // namespace SETTING } // namespace G4FST @@ -42,14 +43,15 @@ void FST_Init() (G4FST::SETTING::FSTV3 ? 1 : 0) + (G4FST::SETTING::FSTV4 ? 1 : 0) + (G4FST::SETTING::FSTV41 ? 1 : 0) + - (G4FST::SETTING::FSTV42 ? 1 : 0) > + (G4FST::SETTING::FSTV42 ? 1 : 0) + + (G4FST::SETTING::FST_MVTX_TPC ? 1 : 0) > 1) { - cout << "use only G4FST::SETTING::FSTV0=true or G4FST::SETTING::FSTV1=true or G4FST::SETTING::FSTV2=true or G4FST::SETTING::FSTV3=true or G4FST::SETTING::FSTV4=true or G4FST::SETTING::FSTV41=true or G4FST::SETTING::FSTV42=true" << endl; + cout << "use only G4FST::SETTING::FSTV0=true or G4FST::SETTING::FSTV1=true or G4FST::SETTING::FSTV2=true or G4FST::SETTING::FSTV3=true or G4FST::SETTING::FSTV4=true or G4FST::SETTING::FSTV41=true or G4FST::SETTING::FSTV42=true or G4FST::SETTING::FST_MVTX_TPC=true" << endl; gSystem->Exit(1); } - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 45.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } //-----------------------------------------------------------------------------------// @@ -95,7 +97,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); } else if (G4FST::SETTING::FSTV42) - { // version 4.1 + { // version 4.2 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); @@ -112,6 +114,15 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50 * um); } + else if (G4FST::SETTING::FST_MVTX_TPC) + { // mvtx_tpc version (based on version 4) + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 19.5, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 19.5, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 19.5, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 7.5, 19.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 50 * um); + make_LANL_FST_station("FST_5", g4Reco, 280, 16, 45, 50 * um); + } else { // Version 0 make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100 * um); //cm diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C index a7cb700e6..8a724e2bc 100644 --- a/common/G4_GEM_EIC.C +++ b/common/G4_GEM_EIC.C @@ -19,6 +19,7 @@ namespace Enable bool EGEM = false; bool EGEM_FULL = true; bool FGEM = false; + bool FGEM_ORIG = false; } // namespace Enable void EGEM_Init() @@ -66,10 +67,19 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // double zpos; PHG4SectorSubsystem *gem; + if(Enable::FGEM_ORIG){ + make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 1.95, N_Sector); + make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 3.20, N_Sector); + } /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; - etamax = 2; + if(Enable::FGEM_ORIG){ + etamax = 3.3; + } + else{ + etamax = 2; + } etamin = min_eta; zpos = 134.0; @@ -90,7 +100,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// name = "FGEM_3"; - etamax = 2; + etamax = 3.3; etamin = min_eta; zpos = 157.0; diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index 4bd32a52b..de5a650e3 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -33,6 +33,7 @@ namespace Enable namespace G4TRACKING { bool DISPLACED_VERTEX = false; + bool PROJECTION_EEMC = false; bool PROJECTION_CEMC = false; bool PROJECTION_FEMC = false; bool PROJECTION_FHCAL = false; @@ -143,10 +144,16 @@ void Tracking_Reco() //------------------------- // FGEM //------------------------- - if (Enable::FGEM) + if (Enable::FGEM || Enable::FGEM_ORIG) { + int first_gem(0); + if (Enable::FGEM_ORIG){ + first_gem = 0; + }else{ + first_gem = 2; + } // GEM2, 70um azimuthal resolution, 1cm radial strips - for (int i = 2; i < 5; i++) + for (int i = first_gem; i < 5; i++) { kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, @@ -162,7 +169,7 @@ void Tracking_Reco() //------------------------- if (Enable::FST) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, @@ -192,16 +199,23 @@ void Tracking_Reco() //------------------------- // CEMC //------------------------- - if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) { kalman->add_state_name("CEMC"); } - se->registerSubsystem(kalman); + //------------------------- + // EEMC + //------------------------- + if (Enable::EEMC && G4TRACKING::PROJECTION_EEMC) + { + kalman->add_state_name("EEMC"); + } + se->registerSubsystem(kalman); return; } + //-----------------------------------------------------------------------------// void Tracking_Eval(const std::string &outputfile) @@ -217,6 +231,7 @@ void Tracking_Eval(const std::string &outputfile) // Fast Tracking evaluation //---------------- + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); fast_sim_eval->set_filename(outputfile); diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 55e9bdbc6..6896ee416 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -225,11 +225,15 @@ int Fun4All_G4_EICDetector( // EIC beam pipe extension beyond the Be-section: //G4PIPE::use_forward_pipes = true; + // gems Enable::EGEM = true; Enable::FGEM = true; + Enable::FGEM_ORIG = false; //5 forward gems; cannot be used with FST // barrel tracker Enable::BARREL = false; - Enable::FST = false; + // fst + Enable::FST = true; + G4FST::SETTING::FST_MVTX_TPC = true; // mvtx/tpc tracker Enable::MVTX = true; Enable::TPC = true; @@ -239,6 +243,7 @@ int Fun4All_G4_EICDetector( Enable::TRACKING_EVAL = Enable::TRACKING && true; G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes // projections to calorimeters + G4TRACKING::PROJECTION_EEMC = false; G4TRACKING::PROJECTION_CEMC = false; G4TRACKING::PROJECTION_FEMC = false; G4TRACKING::PROJECTION_FHCAL = false; diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 3cc9fccc1..14a61a268 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -48,7 +48,7 @@ void G4Init() { // First some check for subsystems which do not go together - if (Enable::TPC && Enable::FST) + if (Enable::TPC && Enable::FST && !G4FST::SETTING::FST_MVTX_TPC) { cout << "TPC and FST cannot be enabled together" << endl; gSystem->Exit(1); @@ -59,11 +59,17 @@ void G4Init() gSystem->Exit(1); } + if(Enable::FGEM_ORIG && Enable::FST) + { + cout << "FST cannot be enabled with 5 FGEM setup" << endl; + gSystem->Exit(1); + } + // load detector/material macros and execute Init() function if (Enable::PIPE) PipeInit(); if (Enable::PLUGDOOR) PlugDoorInit(); if (Enable::EGEM) EGEM_Init(); - if (Enable::FGEM) FGEM_Init(); + if (Enable::FGEM || Enable::FGEM_ORIG) FGEM_Init(); if (Enable::FST) FST_Init(); if (Enable::BARREL) BarrelInit(); if (Enable::MVTX) MvtxInit(); @@ -134,7 +140,7 @@ int G4Setup() if (Enable::PIPE) radius = Pipe(g4Reco, radius); if (Enable::EGEM) EGEMSetup(g4Reco); - if (Enable::FGEM) FGEMSetup(g4Reco); + if (Enable::FGEM || Enable::FGEM_ORIG) FGEMSetup(g4Reco); if (Enable::FST) FSTSetup(g4Reco); if (Enable::BARREL) Barrel(g4Reco, radius); if (Enable::MVTX) radius = Mvtx(g4Reco, radius); From 61d41e889292e6527e0f4fe1c252902403a2bf9a Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 15 Mar 2021 15:47:21 -0400 Subject: [PATCH 0992/1222] latest FST and barrel design (V5) and additional FST and barrel design that can fit in the TPC --- common/G4_Barrel_EIC.C | 194 ++++++++--- common/G4_CEmc_Spacal.C | 50 +-- common/G4_DSTReader_EICDetector.C | 31 +- common/G4_EEMC.C | 52 ++- common/G4_FEMC.C | 6 - common/G4_FEMC_EIC.C | 80 +++-- common/G4_FGEM_fsPHENIX.C | 10 +- common/G4_FHCAL.C | 313 ++++++++++++++---- common/G4_FST_EIC.C | 163 +++++++-- common/G4_FwdJets.C | 163 ++++++++- common/G4_GEM_EIC.C | 28 +- common/G4_HcalIn_ref.C | 2 +- common/G4_HcalOut_ref.C | 2 +- common/G4_Input.C | 76 +++-- common/G4_KFParticle.C | 166 ++++++++++ common/G4_TPC.C | 5 + common/G4_Tracking.C | 175 +++++++--- common/G4_Tracking_EIC.C | 82 ++++- common/G4_World.C | 2 +- .../EICDetector/Fun4All_G4_EICDetector.C | 73 ++-- detectors/EICDetector/G4Setup_EICDetector.C | 22 +- 21 files changed, 1330 insertions(+), 365 deletions(-) create mode 100644 common/G4_KFParticle.C diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index e25078a4a..ff58a9658 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -1,3 +1,11 @@ +/*---------------------------------------------------------------------* + * Barrel tracker designed by LANL EIC team * + * See technical notes for details: arXiv:2009.02888 * + * Contact Ping and Xuan @LANL for questions: * + * Xuan: xuanli@lanl.gov * + * Ping: cpwong@lanl.gov * + *---------------------------------------------------------------------*/ + #ifndef MACRO_G4BARRELEIC_C #define MACRO_G4BARRELEIC_C @@ -14,78 +22,178 @@ R__LOAD_LIBRARY(libg4eval.so) R__LOAD_LIBRARY(libg4mvtx.so) + +int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, + double radius, double halflength, double tSilicon, double tAirgap); + //---------------------------------------------------------------------// namespace Enable { bool BARREL = false; bool BARREL_ABSORBER = false; } // namespace Enable + +namespace G4BARREL +{ + namespace SETTING + { + bool BARRELV0 = false; + bool BARRELV1 = false; + bool BARRELV2 = false; + bool BARRELV3 = false; + bool BARRELV4 = false; + bool BARRELV5 = false; + bool BARRELV6 = false; + } // namespace SETTING +} // namespace G4BARREL //---------------------------------------------------------------------// void BarrelInit() { + //check barrel setting + if ((G4BARREL::SETTING::BARRELV0 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV1 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV4 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV5 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV6 ? 1 : 0) > 1) + { + cout << "use only "; + for (int i=0;i<7;i++) { + if (i==0) cout<<"G4BARREL::SETTING::BARRELV"<Exit(1); + } } + //---------------------------------------------------------------------// -double Barrel(PHG4Reco* g4Reco, double radius) +double Barrel(PHG4Reco *g4Reco, double radius) { const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; + double max_bh_radius = 0.; //--------------------------------- //build barrel detector //--------------------------------- - const int nLayer = 5; - const int nSubLayer = 7; + int nLayer = 5; const float um = 0.0001; //convert um to cm - double r[nLayer] = {3.64, 4.81, 5.98, 16.0, 22.0}; //cm - double halfLength[nLayer] = {20, 20, 25, 25, 25}; //cm + // Different Barrel versions documented in arXiv:2009.02888 + double r[6] = {3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm + double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm + double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um}; + double tAirgap[6] = {0.9, 0.9, 1, 1, 1, 1}; + + if (G4BARREL::SETTING::BARRELV1 || G4BARREL::SETTING::BARRELV2) + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + } + else if (G4BARREL::SETTING::BARRELV3) + { + for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um; + } + else if (G4BARREL::SETTING::BARRELV4) + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + nLayer = 6; + r[3] = 9.2; + r[4] = 17.; + r[5] = 27.; + } + + if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) + { + int nLayer1 = 3; //barrel 1 + int nLayer2 = 2; //barrel 2 + if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC + + int my_nLayer[2]={nLayer1,nLayer2}; + + double my_r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 + {16, 22.0}}; //barrel 2 + + double my_halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 + {25,25}}; //barrel 2 + + double my_tSilicon = 35 * um; + + for (int n=0;n<2;n++) { + if (n==1) my_tSilicon = 85 *um; + for (int i=0;i2) continue; - for (int j = 0; j < nSubLayer; j++) + PHG4CylinderSubsystem *cyl; + cout << "started to create cylinder layer: " << name << endl; + + double currRadius = radius; + // cout << currRadius << endl; + for (int l = 0; l < nSubLayer; l++) { - cyl = new PHG4CylinderSubsystem("Barrel_" + layerName[j], k); - if (j == 0) - { - cyl->set_double_param("radius", r[i]); - } - else - { - cyl->set_double_param("radius", r[i] + thickness[j - 1]); - } - cyl->set_double_param("length", 2.0 * halfLength[i]); - cyl->set_string_param("material", material[j]); - cyl->set_double_param("thickness", thickness[j]); - max_bh_radius = std::max(max_bh_radius, (r[i] + thickness[j - 1] + thickness[j])); - cyl->SuperDetector("BARREL"); - if (j == 0) - { - cyl->SetActive(); //only the Silicon Sensor is active - } - else - { - if (AbsorberActive) cyl->SetActive(); - } + cout << name << "_" << layerName[l] << "\t" << currRadius ; + cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l], l); + cyl->SuperDetector(name); + cyl->set_double_param("radius", currRadius); + cyl->set_double_param("length", 2.0 * halflength); + cyl->set_string_param("material", material[l]); + cyl->set_double_param("thickness", thickness[l]); + if (l == 0) cyl->SetActive(); //only the Silicon Sensor is active + cyl->OverlapCheck(true); g4Reco->registerSubsystem(cyl); - k++; + currRadius = currRadius + thickness[l]; + cout << "\t" << currRadius << endl; } - } + - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); - return max_bh_radius; + return 0; } -//---------------------------------------------------------------------// + +//-----------------------------------------------------------------------------------// + #endif diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 6c3248455..1ff60a3f0 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -242,42 +242,22 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) 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); - } + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - 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_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); - } + 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); diff --git a/common/G4_DSTReader_EICDetector.C b/common/G4_DSTReader_EICDetector.C index 4525f18a4..b2d4adcfa 100644 --- a/common/G4_DSTReader_EICDetector.C +++ b/common/G4_DSTReader_EICDetector.C @@ -68,8 +68,30 @@ void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") } if (Enable::BARREL) { - ana->AddNode("BARREL"); - } + if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) { + int nLayer1 = 3; //barrel 1 + int nLayer2 = 2; //barrel 2 + if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC + int nLayer[2]={nLayer1,nLayer2}; + + for (int n=0;n<2;n++) + { + for (int i;iAddNode(Form("BARREL%d_%d",n,i)); + } + } + } + else + { + int nLayer=5; + if (G4BARREL::SETTING::BARRELV4) nLayer=6; + for (int i;iAddNode(Form("BARREL%d",i)); + } + } + } if (Enable::MVTX) { ana->AddNode("MVTX"); @@ -99,7 +121,10 @@ void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") ana->AddNode("FST_2"); ana->AddNode("FST_3"); ana->AddNode("FST_4"); - ana->AddNode("FST_5"); + if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) + { + ana->AddNode("FST_5"); + } } if (Enable::CEMC) diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index ff9b735e6..cb3bfd8a0 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -39,6 +40,16 @@ namespace G4EEMC int use_projective_geometry = 0; double Gdz = 18. + 0.0001; double Gz0 = -170.; + enum enu_Eemc_clusterizer + { + kEemcGraphClusterizer, + kEemcTemplateClusterizer + }; + //default template clusterizer, as developed by Sasha Bazilevsky + enu_Eemc_clusterizer Eemc_clusterizer = kEemcTemplateClusterizer; + // graph clusterizer + //enu_Eemc_clusterizer Eemc_clusterizer = kEemcGraphClusterizer; + } // namespace G4EEMC void EEMCInit() @@ -70,19 +81,23 @@ void EEMCSetup(PHG4Reco *g4Reco) eemc->SetAbsorberActive(); } - /* path to central copy of calibrations repositry */ + /* path to central copy of calibrations repository */ ostringstream mapping_eemc; /* Use non-projective geometry */ if (!G4EEMC::use_projective_geometry) { mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - eemc->SetTowerMappingFile(mapping_eemc.str()); + eemc->set_string_param("mappingtower", mapping_eemc.str()); } /* use projective geometry */ else { + cout << "The projective version has serious problems with overlaps" << endl; + cout << "Do Not Use!" << endl; + cout << "If you insist, copy G4_EEMC.C locally and comment out this exit" << endl; + gSystem->Exit(1); ostringstream mapping_eemc_4x4construct; mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; @@ -98,15 +113,6 @@ void EEMCSetup(PHG4Reco *g4Reco) void EEMC_Cells() { - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); - hc->Detector("EEMC"); - se->registerSubsystem(hc); - - return; } void EEMC_Towers() @@ -161,11 +167,27 @@ void EEMC_Clusters() Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); + if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EEMCRawClusterBuilderTemplate"); + + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcGraphClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); + ClusterBuilder->Detector("EEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "EEMC_Clusters - unknown clusterizer setting " << G4EEMC::Eemc_clusterizer << endl; + gSystem->Exit(1); + } return; } diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C index 20e162cd5..5311458bd 100644 --- a/common/G4_FEMC.C +++ b/common/G4_FEMC.C @@ -89,12 +89,6 @@ void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) void FEMC_Cells() { - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - return; } diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C index dbdd29162..7db6e4244 100644 --- a/common/G4_FEMC_EIC.C +++ b/common/G4_FEMC_EIC.C @@ -3,17 +3,22 @@ #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) @@ -46,10 +51,23 @@ namespace G4FEMC enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; // graph clusterizer //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; + namespace SETTING + { + bool FullEtaAcc = false; + bool fsPHENIX = false; + bool EC2x = false; + } // namespace SETTING } // namespace G4FEMC void FEMCInit() { + // simple way to check if only 1 of the settings is true + if ((G4FEMC::SETTING::FullEtaAcc ? 1 : 0) + (G4FEMC::SETTING::fsPHENIX ? 1 : 0) > 1) + { + cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::fsPHENIX=true" << endl; + gSystem->Exit(1); + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); } @@ -66,13 +84,26 @@ void FEMCSetup(PHG4Reco *g4Reco) ostringstream mapping_femc; - // femc->SetEICDetector(); - + // PbScint ECAL with nominal eta coverage + if (G4FEMC::SETTING::FullEtaAcc) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; + } + // doubled granularity ECAL + else if (G4FEMC::SETTING::EC2x) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; + } // fsPHENIX ECAL - // mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + else if (G4FEMC::SETTING::fsPHENIX) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + } // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - + else + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + } cout << mapping_femc.str() << endl; femc->SetTowerMappingFile(mapping_femc.str()); femc->OverlapCheck(OverlapCheck); @@ -85,14 +116,6 @@ void FEMCSetup(PHG4Reco *g4Reco) void FEMC_Cells() { - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - return; } @@ -108,7 +131,26 @@ void FEMC_Towers() // mapping_femc << getenv("CALIBRATIONROOT") << // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + // PbScint ECAL with nominal eta coverage + if (G4FEMC::SETTING::FullEtaAcc) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; + } + // doubled granularity ECAL + else if (G4FEMC::SETTING::EC2x) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; + } + // fsPHENIX ECAL + else if (G4FEMC::SETTING::fsPHENIX) + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; + } + // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe + else + { + mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; + } RawTowerBuilderByHitIndex *tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); tower_FEMC->Detector("FEMC"); @@ -261,7 +303,7 @@ void FEMC_Eval(const std::string &outputfile) Fun4AllServer *se = Fun4AllServer::instance(); - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); + CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile); eval->Verbosity(verbosity); se->registerSubsystem(eval); diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C index c1d7b6b4c..a6737a42d 100644 --- a/common/G4_FGEM_fsPHENIX.C +++ b/common/G4_FGEM_fsPHENIX.C @@ -267,7 +267,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_0", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -277,7 +277,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_1", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -299,7 +299,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_2", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -309,7 +309,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_3", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, @@ -319,7 +319,7 @@ void FGEM_FastSim_Reco() kalman->add_phg4hits( "G4HIT_FGEM_4", // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12), // const float radres, + 1. / sqrt(12.), // const float radres, 70e-4, // const float phires, 100e-4, // const float lonres, 1, // const float eff, diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C index dfef894f9..16f46f065 100644 --- a/common/G4_FHCAL.C +++ b/common/G4_FHCAL.C @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -41,10 +42,44 @@ namespace G4FHCAL double Gz0 = 400.; double Gdz = 100.; double outer_radius = 262.; + enum enu_FHcal_clusterizer + { + kFHcalGraphClusterizer, + kFHcalTemplateClusterizer + }; + //template clusterizer, as developed by Sasha Bazilevsky + enu_FHcal_clusterizer FHcal_clusterizer = kFHcalTemplateClusterizer; + // graph clusterizer + //enu_FHcal_clusterizer FHcal_clusterizer = kFHcalGraphClusterizer; + namespace SETTING + { + bool FullEtaAcc = false; + bool HC2x = false; + bool HC4x = false; + bool towercalib1 = false; + bool towercalibSiPM = false; + bool towercalibHCALIN = false; + bool towercalib3 = false; + } // namespace SETTING } // namespace G4FHCAL void FHCALInit() { + // simple way to check if only 1 of the settings is true + if ((G4FHCAL::SETTING::FullEtaAcc ? 1 : 0) + (G4FHCAL::SETTING::HC4x ? 1 : 0) + (G4FHCAL::SETTING::HC2x ? 1 : 0) > 1) + { + cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::HC2x=true or G4FHCAL::SETTING::HC4x=true" << endl; + gSystem->Exit(1); + } + if ((G4FHCAL::SETTING::towercalib1 ? 1 : 0) + (G4FHCAL::SETTING::towercalibSiPM ? 1 : 0) + + (G4FHCAL::SETTING::towercalibHCALIN ? 1 : 0) + (G4FHCAL::SETTING::towercalib3 ? 1 : 0) > + 1) + { + cout << "use only G4FHCAL::SETTING::towercalib1 = true or G4FHCAL::SETTING::towercalibSiPM = true" + << " or G4FHCAL::SETTING::towercalibHCALIN = true or G4FHCAL::SETTING::towercalib3 = true" << endl; + gSystem->Exit(1); + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); } @@ -56,32 +91,54 @@ void FHCALSetup(PHG4Reco *g4Reco) 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_v005.txt"; - // cout << mapping_hhcal.str() << endl; - //mapping_hhcal << "towerMap_FHCAL_latest.txt"; + PHG4ForwardHcalSubsystem *fhcal = new PHG4ForwardHcalSubsystem("FHCAL"); - hhcal->SetTowerMappingFile(mapping_hhcal.str()); - hhcal->OverlapCheck(OverlapCheck); - - if (AbsorberActive) hhcal->SetAbsorberActive(); + ostringstream mapping_fhcal; - g4Reco->registerSubsystem(hhcal); + // Switch to desired calo setup + // HCal Fe-Scint with doubled granularity + if (G4FHCAL::SETTING::HC2x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; + } + // full HCal Fe-Scint with nominal acceptance doubled granularity + else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + } + // HCal Fe-Scint with four times granularity + else if (G4FHCAL::SETTING::HC4x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; + } + // full HCal Fe-Scint with nominal acceptance four times granularity + else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + } + // full HCal Fe-Scint with nominal acceptance + else if (G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + } + // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe + else + { + mapping_fhcal << getenv("CALIBRATIONROOT") + << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + } + + fhcal->SetTowerMappingFile(mapping_fhcal.str()); + fhcal->OverlapCheck(OverlapCheck); + fhcal->SetActive(); + fhcal->SuperDetector("FHCAL"); + if (AbsorberActive) fhcal->SetAbsorberActive(); + + g4Reco->registerSubsystem(fhcal); } void FHCAL_Cells(int verbosity = 0) { - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); - hc->Detector("FHCAL"); - se->registerSubsystem(hc); - return; } @@ -92,9 +149,38 @@ void FHCAL_Towers() Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; - //mapping_fhcal << "towerMap_FHCAL_latest.txt"; + + // Switch to desired calo setup + // HCal Fe-Scint with doubled granularity + if (G4FHCAL::SETTING::HC2x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; + } + // full HCal Fe-Scint with nominal acceptance doubled granularity + else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; + } + // HCal Fe-Scint with four times granularity + else if (G4FHCAL::SETTING::HC4x ) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; + } + // full HCal Fe-Scint with nominal acceptance four times granularity + else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; + } + // full HCal Fe-Scint with nominal acceptance + else if (G4FHCAL::SETTING::FullEtaAcc) + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; + } + // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe + else + { + mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; + } RawTowerBuilderByHitIndex *tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); tower_FHCAL->Detector("FHCAL"); @@ -103,44 +189,122 @@ void FHCAL_Towers() 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); + // enable usage of different tower calibrations for systematic studies + if (G4FHCAL::SETTING::towercalib1) + { + cout << "1: using towercalib1 for FHCAL towers" << endl; + 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::kSiPM_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); + } + else if (G4FHCAL::SETTING::towercalibSiPM) + { + //from https://sphenix-collaboration.github.io/doxygen/d4/d58/Fun4All__G4__Prototype4_8C_source.html + const double sampling_fraction = 0.019441; // +/- 0.019441 from 0 Degree indenting 12 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 + + cout << "2: using towercalibSiPM for FHCAL towers" << endl; + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_raw_tower_node_prefix("RAW"); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSiPM_photon_digitization); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); + 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); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); + TowerCalibration->Detector("FHCAL"); + TowerCalibration->set_raw_tower_node_prefix("RAW"); + 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); + } + else if (G4FHCAL::SETTING::towercalibHCALIN) + { + const double visible_sample_fraction_HCALIN = 7.19505e-02; // 1.34152e-02 + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_raw_tower_node_prefix("RAW"); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); + 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); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); + TowerCalibration->Detector("FHCAL"); + TowerCalibration->set_raw_tower_node_prefix("RAW"); + 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); + } + else if (G4FHCAL::SETTING::towercalib3) + { + cout << "3: using towercalib3 for FHCAL towers" << endl; + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); + TowerDigitizer->Detector("FHCAL"); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + 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); + } + else + { + cout << "def: using default for FHCAL towers" << endl; + 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() @@ -148,11 +312,28 @@ void FHCAL_Clusters() int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem(ClusterBuilder); + if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("FHCALRawClusterBuilderTemplate"); + ClusterBuilder->Detector("FHCAL"); + ClusterBuilder->SetPlanarGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); + } + else if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) + { + RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); + ClusterBuilder->Detector("FHCAL"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.100); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "FHCAL_Clusters - unknown clusterizer setting " << G4FHCAL::FHcal_clusterizer << endl; + gSystem->Exit(1); + } return; } diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index 4b152bf26..2dd58f2c9 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -1,7 +1,15 @@ +/*---------------------------------------------------------------------* + * Barrel tracker designed by LANL EIC team * + * See technical notes for details: arXiv:2009.02888 * + * Contact Ping and Xuan @LANL for questions: * + * Xuan: xuanli@lanl.gov * + * Ping: cpwong@lanl.gov * + *---------------------------------------------------------------------*/ + #ifndef MACRO_G4FSTEIC_C #define MACRO_G4FSTEIC_C -#include +#include "GlobalVariables.C" #include @@ -11,41 +19,154 @@ R__LOAD_LIBRARY(libg4detectors.so) -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax); +int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, double zpos, double Rmin, + double Rmax, double tSilicon); //-----------------------------------------------------------------------------------// namespace Enable { - bool FST = false; - bool FST_OVERLAPCHECK = false; -} // namespace Enable + static bool FST = false; +} + +namespace G4FST +{ + namespace SETTING + { + bool FSTV0 = false; + bool FSTV1 = false; + bool FSTV2 = false; + bool FSTV3 = false; + bool FSTV41 = false; + bool FSTV42 = false; + bool FSTV4 = false; + bool FSTV5 = false; + bool FST_TPC = false; + } // namespace SETTING +} // namespace G4FST + //-----------------------------------------------------------------------------------// void FST_Init() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 44.); + if ((G4FST::SETTING::FSTV0 ? 1 : 0) + + (G4FST::SETTING::FSTV1 ? 1 : 0) + + (G4FST::SETTING::FSTV2 ? 1 : 0) + + (G4FST::SETTING::FSTV3 ? 1 : 0) + + (G4FST::SETTING::FSTV4 ? 1 : 0) + + (G4FST::SETTING::FSTV41 ? 1 : 0) + + (G4FST::SETTING::FSTV42 ? 1 : 0) + + (G4FST::SETTING::FSTV5 ? 1 : 0) + + (G4FST::SETTING::FST_TPC ? 1 : 0) > 1) + { + cout << "use only G4FST::SETTING::FSTV0=true "; + cout << "or G4FST::SETTING::FSTV1=true "; + cout << "or G4FST::SETTING::FSTV2=true "; + cout << "or G4FST::SETTING::FSTV3=true "; + cout << "or G4FST::SETTING::FSTV4=true "; + cout << "or G4FST::SETTING::FSTV41=true "; + cout << "or G4FST::SETTING::FSTV42=true "; + cout << "or G4FST::SETTING::FSTV5=true "; + cout << "or G4FST::SETTING::FST_TPC=true "<< endl; + gSystem->Exit(1); + } + + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 45.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); } //-----------------------------------------------------------------------------------// void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) { + const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); + const double mm = .1 * cm; + const double um = 1e-3 * mm; + //Design from Xuan Li @LANL - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 40); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 40); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 43); - //make_LANL_FST_station("FST_5", g4Reco, 280, 17, 41); + // Different FST version documented in arXiv:2009.0288 + if (G4FST::SETTING::FSTV1) + { // version 1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); + } + else if (G4FST::SETTING::FSTV2) + { // version 2 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50 * um); + } + else if (G4FST::SETTING::FSTV3) + { // version 3 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + } + else if (G4FST::SETTING::FSTV41) + { // version 4.1 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); + } + else if (G4FST::SETTING::FSTV42) + { // version 4.2 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); + } + else if (G4FST::SETTING::FSTV4) + { // version 4 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); + make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50 * um); + } + else if (G4FST::SETTING::FSTV5) + { + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35*um); //cm + make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35*um); + make_LANL_FST_station("FST_2", g4Reco, 90, 6.5, 43, 35*um); + make_LANL_FST_station("FST_3", g4Reco, 115, 8.9, 44, 85*um); + make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85*um); + make_LANL_FST_station("FST_5", g4Reco, 300, 16.8, 45, 85*um); //optional disk at further location + } + else if (G4FST::SETTING::FST_TPC) + { // tpc version (based on version 4) + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 17, 35 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 17, 35 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 17, 35 * um); + make_LANL_FST_station("FST_3", g4Reco, 101,7.5, 17, 85 * um); + make_LANL_FST_station("FST_4", g4Reco, 125,9.5, 45, 85 * um); + //make_LANL_FST_station("FST_5", g4Reco, 280, 16, 45, 50 * um); //optional disk at further location + + } + else + { // Version 0 + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 100 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 100 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); + } } //-----------------------------------------------------------------------------------// -int make_LANL_FST_station(string name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax) +int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, + double zpos, double Rmin, double Rmax, double tSilicon) //silicon thickness { // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " // << name << endl; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK; - // always facing the interaction point double polar_angle = 0; if (zpos < 0) @@ -77,14 +198,14 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); fst->get_geometry().set_N_Sector(1); fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(OverlapCheck); + fst->OverlapCheck(true); const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); const double mm = .1 * cm; const double um = 1e-3 * mm; // build up layers - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", 285 * um, true, 100); + fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); @@ -95,5 +216,7 @@ int make_LANL_FST_station(string name, PHG4Reco *g4Reco, g4Reco->registerSubsystem(fst); return 0; } -//-----------------------------------------------------------------------------------// + #endif + +//-----------------------------------------------------------------------------------// diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C index 7b11234f0..998dffb6b 100644 --- a/common/G4_FwdJets.C +++ b/common/G4_FwdJets.C @@ -1,10 +1,14 @@ #ifndef MACRO_G4FWDJETS_C #define MACRO_G4FWDJETS_C +// #include + +#include #include #include #include #include +#include #include @@ -29,39 +33,96 @@ void Jet_FwdReco() Fun4AllServer *se = Fun4AllServer::instance(); // truth particle level jets - JetReco *truthjetreco = new JetReco(); + 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Truth_r10"); truthjetreco->set_algo_node("ANTIKT"); truthjetreco->set_input_node("TRUTH"); truthjetreco->Verbosity(verbosity); se->registerSubsystem(truthjetreco); // tower jets - JetReco *towerjetreco = new JetReco(); + JetReco *towerjetreco = new JetReco("TOWERJETRECO"); 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->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Tower_r10"); 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::FEMC_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + 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.5), "AntiKt_Cluster_r05"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Cluster_r07"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Cluster_r10"); + clusterjetreco->set_algo_node("ANTIKT"); + clusterjetreco->set_input_node("CLUSTER"); + clusterjetreco->Verbosity(verbosity); + se->registerSubsystem(clusterjetreco); + + // tower jets + JetReco *towerjetrecofwd = new JetReco("TOWERJETRECOFWD"); + towerjetrecofwd->add_input(new TowerJetInput(Jet::FEMC_TOWER)); + towerjetrecofwd->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_TowerFwd_r05"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_TowerFwd_r07"); + towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_TowerFwd_r10"); + towerjetrecofwd->set_algo_node("ANTIKT"); + towerjetrecofwd->set_input_node("TOWER"); + towerjetrecofwd->Verbosity(verbosity); + se->registerSubsystem(towerjetrecofwd); + + // cluster jets + JetReco *clusterjetrecofwd = new JetReco("CLUSTERJETRECOFWD"); + clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_ClusterFwd_r05"); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_ClusterFwd_r07"); + clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_ClusterFwd_r10"); + clusterjetrecofwd->set_algo_node("ANTIKT"); + clusterjetrecofwd->set_input_node("CLUSTER"); + clusterjetrecofwd->Verbosity(verbosity); + se->registerSubsystem(clusterjetrecofwd); + + + // // track jets + JetReco *trackjetreco = new JetReco("TRACKJETRECO"); + trackjetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Track_r05"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Track_r07"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Track_r10"); + trackjetreco->set_algo_node("ANTIKT"); + trackjetreco->set_input_node("TRACK"); + trackjetreco->Verbosity(verbosity); + se->registerSubsystem(trackjetreco); + + // // track jets + JetReco *fulljetreco = new JetReco("FULLJETRECO"); + fulljetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + fulljetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Full_r05"); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Full_r07"); + fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Full_r08"); + fulljetreco->set_algo_node("ANTIKT"); + fulljetreco->set_input_node("FULL"); + fulljetreco->Verbosity(verbosity); + se->registerSubsystem(fulljetreco); + + return; } @@ -70,12 +131,78 @@ void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); - JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r05", - "AntiKt_Truth_r05", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); + JetEvaluator *evaltrk05 = new JetEvaluator("JETEVALUATORTRACK05","AntiKt_Track_r05", + "AntiKt_Truth_r05", "g4fwdjets_track_05_eval.root"); + evaltrk05->Verbosity(verbosity); + se->registerSubsystem(evaltrk05); + + JetEvaluator *evalfull05 = new JetEvaluator("JETEVALUATORFULL05","AntiKt_Full_r05", + "AntiKt_Truth_r05", "g4fwdjets_full_05_eval.root"); + evalfull05->Verbosity(verbosity); + se->registerSubsystem(evalfull05); + + JetEvaluator *evalt05 = new JetEvaluator("JETEVALUATORTOWER05","AntiKt_Tower_r05", + "AntiKt_Truth_r05", "g4fwdjets_tower_05_eval.root"); + evalt05->Verbosity(verbosity); + se->registerSubsystem(evalt05); + JetEvaluator *evalt07 = new JetEvaluator("JETEVALUATORTOWER07","AntiKt_Tower_r07", + "AntiKt_Truth_r07", "g4fwdjets_tower_07_eval.root"); + evalt07->Verbosity(verbosity); + se->registerSubsystem(evalt07); + JetEvaluator *evalt10 = new JetEvaluator("JETEVALUATORTOWER10","AntiKt_Tower_r10", + "AntiKt_Truth_r10", "g4fwdjets_tower_10_eval.root"); + evalt10->Verbosity(verbosity); + se->registerSubsystem(evalt10); + + JetEvaluator *evalc05 = new JetEvaluator("JETEVALUATORCLUSTER05", "AntiKt_Cluster_r05", + "AntiKt_Truth_r05", "g4fwdjets_cluster_05_eval.root"); + evalc05->Verbosity(verbosity); + se->registerSubsystem(evalc05); + + JetEvaluator *evalc07 = new JetEvaluator("JETEVALUATORCLUSTER07", "AntiKt_Cluster_r07", + "AntiKt_Truth_r07", "g4fwdjets_cluster_07_eval.root"); + evalc07->Verbosity(verbosity); + se->registerSubsystem(evalc07); + + JetEvaluator *evalc10 = new JetEvaluator("JETEVALUATORCLUSTER10", "AntiKt_Cluster_r10", + "AntiKt_Truth_r10", "g4fwdjets_cluster_10_eval.root"); + evalc10->Verbosity(verbosity); + se->registerSubsystem(evalc10); + + JetEvaluator *evaltfwd05 = new JetEvaluator("JETEVALUATORFWDTOWER05","AntiKt_TowerFwd_r05", + "AntiKt_Truth_r05", "g4fwdjets_TowerFwd_05_eval.root"); + evaltfwd05->Verbosity(verbosity); + se->registerSubsystem(evaltfwd05); + JetEvaluator *evaltfwd07 = new JetEvaluator("JETEVALUATORFWDTOWER07","AntiKt_TowerFwd_r07", + "AntiKt_Truth_r07", "g4fwdjets_TowerFwd_07_eval.root"); + evaltfwd07->Verbosity(verbosity); + se->registerSubsystem(evaltfwd07); + JetEvaluator *evaltfwd10 = new JetEvaluator("JETEVALUATORFWDTOWER10","AntiKt_TowerFwd_r10", + "AntiKt_Truth_r10", "g4fwdjets_TowerFwd_10_eval.root"); + evaltfwd10->Verbosity(verbosity); + se->registerSubsystem(evaltfwd10); + + JetEvaluator *evalcfwd05 = new JetEvaluator("JETEVALUATORFWDCLUSTER05", "AntiKt_ClusterFwd_r05", + "AntiKt_Truth_r05", "g4fwdjets_ClusterFwd_05_eval.root"); + evalcfwd05->Verbosity(verbosity); + se->registerSubsystem(evalcfwd05); + + JetEvaluator *evalcfwd07 = new JetEvaluator("JETEVALUATORFWDCLUSTER07", "AntiKt_ClusterFwd_r07", + "AntiKt_Truth_r07", "g4fwdjets_ClusterFwd_07_eval.root"); + evalcfwd07->Verbosity(verbosity); + se->registerSubsystem(evalcfwd07); + + JetEvaluator *evalcfwd10 = new JetEvaluator("JETEVALUATORFWDCLUSTER10", "AntiKt_ClusterFwd_r10", + "AntiKt_Truth_r10", "g4fwdjets_ClusterFwd_10_eval.root"); + evalcfwd10->Verbosity(verbosity); + se->registerSubsystem(evalcfwd10); + + // JetEvaluator *eval3 = new JetEvaluator("JETEVALUATOR3", + // "AntiKt_Full_r07", + // "AntiKt_Truth_r07", + // "g4fwdjets_full_07_eval.root"); + // eval3->Verbosity(verbosity); + // se->registerSubsystem(eval3); return; } diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C index 0acc4d7a7..8a724e2bc 100644 --- a/common/G4_GEM_EIC.C +++ b/common/G4_GEM_EIC.C @@ -17,7 +17,9 @@ void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); namespace Enable { bool EGEM = false; + bool EGEM_FULL = true; bool FGEM = false; + bool FGEM_ORIG = false; } // namespace Enable void EGEM_Init() @@ -42,10 +44,15 @@ void EGEMSetup(PHG4Reco *g4Reco) * TPC length = 211 cm --> from z = -105.5 to z = +105.5 */ float thickness = 3.; - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + if (Enable::EGEM_FULL){ + make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); + make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + } else { + make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); + make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); + } } void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // @@ -60,10 +67,19 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // double zpos; PHG4SectorSubsystem *gem; + if(Enable::FGEM_ORIG){ + make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 1.95, N_Sector); + make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 3.20, N_Sector); + } /////////////////////////////////////////////////////////////////////////// name = "FGEM_2"; - etamax = 2; + if(Enable::FGEM_ORIG){ + etamax = 3.3; + } + else{ + etamax = 2; + } etamin = min_eta; zpos = 134.0; @@ -84,7 +100,7 @@ void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // /////////////////////////////////////////////////////////////////////////// name = "FGEM_3"; - etamax = 2; + etamax = 3.3; etamin = min_eta; zpos = 157.0; diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 547b074c0..9d6cec245 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -272,7 +272,7 @@ void HCALInner_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->SetCylindricalGeometry(); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index d5254f226..77108b938 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -196,7 +196,7 @@ void HCALOuter_Clusters() { RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->SetCylindricalGeometry(); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() ClusterBuilder->Verbosity(verbosity); se->registerSubsystem(ClusterBuilder); } diff --git a/common/G4_Input.C b/common/G4_Input.C index de9ad24ce..1117f4168 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -77,10 +77,9 @@ namespace Input int SIMPLE_NUMBER = 1; int SIMPLE_VERBOSITY = 0; -// bool UPSILON = false; // moved to GlobalVariables.C, as used in downstream vairables int UPSILON_NUMBER = 1; int UPSILON_VERBOSITY = 0; -// std::set UPSILON_EmbedIds; // moved to GlobalVariables.C, as used in downstream vairables + // other UPSILON settings which are also used elsewhere are in GlobalVariables.C double PILEUPRATE = 0.; bool READHITS = false; @@ -105,14 +104,14 @@ namespace INPUTREADEIC namespace INPUTREADHITS { - string filename; - string listfile; + map filename; + map listfile; } // namespace INPUTREADHITS namespace INPUTEMBED { - string filename; - string listfile; + map filename; + map listfile; } // namespace INPUTEMBED namespace PYTHIA6 @@ -132,7 +131,7 @@ namespace SARTRE namespace PILEUP { - string pileupfile = "/sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat"; + string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; double TpcDriftVelocity = 8.0 / 1000.0; } // namespace PILEUP @@ -417,22 +416,34 @@ void InputManagers() if (Input::EMBED) { gSystem->Load("libg4dst.so"); - Fun4AllInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - if (!INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) + if (!INPUTEMBED::filename.empty() && !INPUTEMBED::listfile.empty()) { - in1->fileopen(INPUTEMBED::filename); + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); } - else if (!INPUTEMBED::listfile.empty()) + if (INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) { - in1->AddListFile(INPUTEMBED::listfile); + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); } - else + for (auto iter = INPUTEMBED::filename.begin(); iter != INPUTEMBED::filename.end(); ++iter) { - cout << "no filename INPUTEMBED::filename or listfile INPUTEMBED::listfile given" << endl; - gSystem->Exit(1); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + 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); + hitsin->Repeat(); + se->registerInputManager(hitsin); } - in1->Repeat(); // if file(or filelist) is exhausted, start from beginning - se->registerInputManager(in1); } if (Input::HEPMC) { @@ -454,22 +465,33 @@ void InputManagers() } else if (Input::READHITS) { - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - if (!INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty()) + 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()) { - hitsin->fileopen(INPUTREADHITS::filename); + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); } - else if (!INPUTREADHITS::listfile.empty()) + for (auto iter = INPUTREADHITS::filename.begin(); iter != INPUTREADHITS::filename.end(); ++iter) { - hitsin->AddListFile(INPUTREADHITS::listfile); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); } - else + for (auto iter = INPUTREADHITS::listfile.begin(); iter != INPUTREADHITS::listfile.end(); ++iter) { - cout << "no filename INPUTREADHITS::filename or listfile INPUTREADHITS::listfile given" << endl; - gSystem->Exit(1); + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); } - hitsin->Verbosity(Input::VERBOSITY); - se->registerInputManager(hitsin); } else { diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C new file mode 100644 index 000000000..206b77e1a --- /dev/null +++ b/common/G4_KFParticle.C @@ -0,0 +1,166 @@ +#ifndef MACRO_G4KFPARTICLE_C +#define MACRO_G4KFPARTICLE_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libkfparticle_sphenix.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 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 KFParticleInit() {} //I guess this line isnt needed + +void KFParticle_Upsilon_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "Upsilon"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(2); + daughterList[0] = make_pair("electron", +1); + daughterList[1] = make_pair("electron", -1); + kfparticle->getChargeConjugate(false); + kfparticle->setDaughters(daughterList); + 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->setMotherName(motherName); + kfparticle->setMinimumMass(7); + kfparticle->setMaximumMass(11); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +void KFParticle_D0_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "D0"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(2); + daughterList[0] = make_pair("kaon", -1); + daughterList[1] = make_pair("pion", +1); + kfparticle->getChargeConjugate(true); + kfparticle->setDaughters(daughterList); + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMotherName(motherName); + kfparticle->setMinimumMass(1.750); + kfparticle->setMaximumMass(1.950); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +void KFParticle_Lambdac_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + std::string motherName = "Lambdac"; + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + kfparticle->Verbosity(verbosity); + + 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->setContainerName(motherName); + kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); + + std::pair daughterList[99]; + kfparticle->setNumberOfTracks(3); + daughterList[0] = make_pair("proton", +1); + daughterList[1] = make_pair("kaon", -1); + daughterList[2] = make_pair("pion", +1); + kfparticle->getChargeConjugate(true); + kfparticle->setDaughters(daughterList); + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMotherName(motherName); + kfparticle->setMinimumMass(2.150); + kfparticle->setMaximumMass(2.400); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + se->registerSubsystem(kfparticle); + + return; +} + + +#endif diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 120bea780..fd14d4cff 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -223,6 +224,10 @@ void TPC_Clustering() tpcclusterizer->Verbosity(verbosity); se->registerSubsystem(tpcclusterizer); + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); + // space charge correction if( G4TPC::ENABLE_CORRECTIONS ) { diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 7771aefe1..abd041c1f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -32,11 +34,12 @@ #include #include #include +#include #include #include #include +#include #include -#include #include #endif @@ -81,13 +84,17 @@ namespace G4TRACKING // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_tpc_seed_vertex_assoc = true; // Possible variations - these are normally false 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_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_init_vertexing = false; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing + bool use_acts_silicon_seeding = true; // if true runs acts silicon seeding + bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing + bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple @@ -167,16 +174,57 @@ void Tracking_Reco() // Tracking //------------ - // Initial vertex finding (independent of tracking) + if(!G4TRACKING::use_Genfit) + { +#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); + + /// 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); + + /// Always run PHActsSourceLinks first, to convert TrkrClusters + /// to the Acts equivalent + PHActsSourceLinks* sl = new PHActsSourceLinks(); + sl->Verbosity(verbosity); + sl->setMagField(G4MAGNET::magfield); + sl->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(sl); +#endif + } + + // Initial vertex finding //================================= - if (!G4TRACKING::use_init_vertexing) - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(0); - se->registerSubsystem(init_vtx); - } - else + if(G4TRACKING::use_acts_silicon_seeding && !G4TRACKING::use_Genfit) + { + #if __cplusplus >= 201703L + + PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); + silicon_Seeding->Verbosity(verbosity); + se->registerSubsystem(silicon_Seeding); + + if(G4TRACKING::use_acts_init_vertexing) + { + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + } + else + { + PHTruthVertexing *init_vtx = new PHTruthVertexing(); + init_vtx->Verbosity(verbosity); + init_vtx->set_acts_silicon(true); + se->registerSubsystem(init_vtx); + } + #endif + } + else if (G4TRACKING::use_phinit_vertexing) { // get the initial vertex for track fitting from the MVTX hits PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); @@ -188,6 +236,14 @@ void Tracking_Reco() init_zvtx->Verbosity(verbosity); se->registerSubsystem(init_zvtx); } + else + { + // We cheat to get the initial vertex for the full track reconstruction case + PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); + init_vtx->Verbosity(verbosity); + se->registerSubsystem(init_vtx); + + } // Truth track seeding and propagation in one module // ==================================== @@ -208,7 +264,7 @@ void Tracking_Reco() std::cout << "Using normal TPC track seeding " << std::endl; // TPC track seeding from data - if (G4TRACKING::use_PHTpcTracker_seeding) + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) { std::cout << " Using PHTpcTracker track seeding " << std::endl; @@ -219,16 +275,34 @@ void Tracking_Reco() 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(0); + 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(0); + se->registerSubsystem(hseeder); + } else { + 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 << " Since config doesn't make sense, reverting to default..." << std::endl; + } 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(0); + seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) seeder->SetMinHitsPerCluster(2); @@ -237,6 +311,14 @@ void Tracking_Reco() } } + if(G4TRACKING::use_tpc_seed_vertex_assoc) + { + // This does not care which seeder is used + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); + } + // Genfit track propagation and final fitting (starts from TPC track seeds) //================================================= if (G4TRACKING::use_Genfit) @@ -292,7 +374,7 @@ void Tracking_Reco() // 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(0); + silicon_assoc->Verbosity(verbosity); se->registerSubsystem(silicon_assoc); } else @@ -303,15 +385,19 @@ void Tracking_Reco() // start with a complete TPC track seed from one of the CA seeders // use truth information to assemble silicon clusters into track stubs for now - PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(0); - se->registerSubsystem(silicon_seeding); + if(!G4TRACKING::use_acts_silicon_seeding) + { + PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); + silicon_seeding->Verbosity(verbosity); + se->registerSubsystem(silicon_seeding); + + } // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); - silicon_match->Verbosity(0); - if (!G4TRACKING::use_PHTpcTracker_seeding) - silicon_match->set_seeder(true); // module defaults to PHCASeeding, use true for PHTpcTracker seeding + silicon_match->Verbosity(verbosity); + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_tpc_seed_vertex_assoc) + silicon_match->set_seeder(false); // module defaults to CASeeding, for PHTpcTracker seeding use false here ONLY when not using PHTpcTrackSeedVertexAssoc. silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); @@ -326,8 +412,8 @@ void Tracking_Reco() 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.02); - silicon_match->set_eta_search_window(0.004); + 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); @@ -340,7 +426,7 @@ void Tracking_Reco() // Match TPC track stubs from CA seeder to clusters in the micromegas layers PHMicromegasTpcTrackMatching* mm_match = new PHMicromegasTpcTrackMatching(); - mm_match->Verbosity(0); + mm_match->Verbosity(verbosity); mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { @@ -373,25 +459,13 @@ void Tracking_Reco() std::cout << " Using Acts track fitting " << std::endl; #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); - se->registerSubsystem(geom); - - /// Always run PHActsSourceLinks and PHActsTracks first, to convert TrkRClusters and SvtxTracks to the Acts equivalent - PHActsSourceLinks* sl = new PHActsSourceLinks(); - sl->Verbosity(verbosity); - sl->setMagField(G4MAGNET::magfield); - sl->setMagFieldRescale(G4MAGNET::magfield_rescale); - se->registerSubsystem(sl); - - PHActsTracks* actsTracks = new PHActsTracks(); + + + PHActsTracks* actsTracks = new PHActsTracks("PHActsTracks1"); actsTracks->Verbosity(verbosity); se->registerSubsystem(actsTracks); - PHActsTrkFitter* actsFit = new PHActsTrkFitter(); + PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); actsFit->Verbosity(verbosity); actsFit->doTimeAnalysis(false); /// If running with distortions, fit only the silicon+MMs first @@ -406,9 +480,20 @@ void Tracking_Reco() se->registerSubsystem(residuals); } - PHActsVertexFinder* vtxer = new PHActsVertexFinder(); - vtxer->Verbosity(verbosity); - se->registerSubsystem(vtxer); + PHActsVertexFinder *finder = new PHActsVertexFinder("PHActsVertexFinder"); + finder->Verbosity(verbosity); + se->registerSubsystem(finder); + + PHActsTracks *actsTracks2 = new PHActsTracks("PHActsTracks2"); + actsTracks2->Verbosity(verbosity); + actsTracks2->setSecondFit(true); + se->registerSubsystem(actsTracks2); + + PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); + actsFit2->Verbosity(verbosity); + actsFit2->doTimeAnalysis(false); + actsFit2->fitSiliconMMs(false); + se->registerSubsystem(actsFit2); #endif } @@ -460,7 +545,7 @@ void Tracking_Eval(const std::string& outputfile) eval->do_gpoint_eval(false); eval->do_eval_light(true); eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true + eval->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true eval->Verbosity(verbosity); se->registerSubsystem(eval); @@ -470,7 +555,7 @@ void Tracking_Eval(const std::string& outputfile) if (G4TRACKING::use_acts_evaluator) { ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); - actsEval->Verbosity(0); + actsEval->Verbosity(verbosity); actsEval->setEvalCKF(false); se->registerSubsystem(actsEval); } diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index 4bd32a52b..3c4e8134d 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -33,6 +33,7 @@ namespace Enable namespace G4TRACKING { bool DISPLACED_VERTEX = false; + bool PROJECTION_EEMC = false; bool PROJECTION_CEMC = false; bool PROJECTION_FEMC = false; bool PROJECTION_FHCAL = false; @@ -82,13 +83,42 @@ void Tracking_Reco() //------------------------- if (Enable::BARREL) { - kalman->add_phg4hits("G4HIT_BARREL", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise + double pitch=20e-4/sqrt(12); + + if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) { + int nLayer1 = 3; //barrel 1 + int nLayer2 = 2; //barrel 2 + if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC + int nLayer[2]={nLayer1,nLayer2}; + + for (int n=0;n<2;n++) { + if (n==1) pitch=36.4e-4/sqrt(12); + for (int i;iadd_phg4hits(Form("G4HIT_BARREL%d_%d",n,i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + pitch, // const float phires, + pitch, // const float lonres, + 0.95, // const float eff, + 0); // const float noise + } + } + } + else + { + int nLayer=5; + if (G4BARREL::SETTING::BARRELV4) nLayer=6; + for (int i;iadd_phg4hits(Form("G4HIT_BARREL_%d",i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + pitch, // const float phires, + pitch, // const float lonres, + 0.95, // const float eff, + 0); // const float noise + } + } } //------------------------- // MVTX @@ -143,10 +173,16 @@ void Tracking_Reco() //------------------------- // FGEM //------------------------- - if (Enable::FGEM) + if (Enable::FGEM || Enable::FGEM_ORIG) { + int first_gem(0); + if (Enable::FGEM_ORIG){ + first_gem = 0; + }else{ + first_gem = 2; + } // GEM2, 70um azimuthal resolution, 1cm radial strips - for (int i = 2; i < 5; i++) + for (int i = first_gem; i < 5; i++) { kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, @@ -162,13 +198,21 @@ void Tracking_Reco() //------------------------- if (Enable::FST) { - for (int i = 0; i < 5; i++) + float pitch=20e-4; + int nPlane=5; + if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) { + nPlane=6; + } + + for (int i = 0; i < nPlane; i++) + { + if (i>=3) pitch=36.4e-4; kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, + pitch, // const float radres, + pitch, // const float phires, + 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* 1, // const float eff, 0); // const float noise } @@ -192,16 +236,23 @@ void Tracking_Reco() //------------------------- // CEMC //------------------------- - if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) { kalman->add_state_name("CEMC"); } - se->registerSubsystem(kalman); + //------------------------- + // EEMC + //------------------------- + if (Enable::EEMC && G4TRACKING::PROJECTION_EEMC) + { + kalman->add_state_name("EEMC"); + } + se->registerSubsystem(kalman); return; } + //-----------------------------------------------------------------------------// void Tracking_Eval(const std::string &outputfile) @@ -217,6 +268,7 @@ void Tracking_Eval(const std::string &outputfile) // Fast Tracking evaluation //---------------- + PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); fast_sim_eval->set_filename(outputfile); diff --git a/common/G4_World.C b/common/G4_World.C index ceeafdca7..eacb53a83 100644 --- a/common/G4_World.C +++ b/common/G4_World.C @@ -11,7 +11,7 @@ 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 = "QGSP_BERT"; // for calorimeters use HP lists + string PhysicsList = "FTFP_BERT"; // for calorimeters use HP lists } // namespace G4WORLD void WorldInit(PHG4Reco *g4Reco) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index dc5e23afe..caa02a21f 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -59,7 +59,9 @@ int Fun4All_G4_EICDetector( // about the number of layers used for the cell reco code // //Input::READHITS = true; - INPUTREADHITS::filename = inputFile; + INPUTREADHITS::filename[0] = inputFile; + // if you use a filelist + // INPUTREADHITS::listfile[0] = inputFile; // Or: // Use one or more particle generators @@ -67,7 +69,10 @@ int Fun4All_G4_EICDetector( // all other options only play a role if it is active // In case embedding into a production output, please double check your G4Setup_EICDetector.C and G4_*.C consistent with those in the production macro folder // Input::EMBED = true; - INPUTEMBED::filename = embed_input_file; + INPUTEMBED::filename[0] = embed_input_file; + // if you use a filelist + //INPUTEMBED::listfile[0] = embed_input_file; + // Use Pythia 8 // Input::PYTHIA8 = true; @@ -145,6 +150,11 @@ int Fun4All_G4_EICDetector( 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 @@ -188,13 +198,13 @@ int Fun4All_G4_EICDetector( // Write the DST //====================== - // Enable::DSTOUT = true; + Enable::DSTOUT = false; DstOut::OutputDir = outdir; DstOut::OutputFile = outputFile; Enable::DSTOUT_COMPRESS = false; // Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs - //Enable::DSTREADER = true; + Enable::DSTREADER = true; // turn the display on (default off) Enable::DISPLAY = false; @@ -213,34 +223,40 @@ int Fun4All_G4_EICDetector( // whether to simulate the Be section of the beam pipe Enable::PIPE = true; // EIC beam pipe extension beyond the Be-section: - //G4PIPE::use_forward_pipes = true; + G4PIPE::use_forward_pipes = true; - Enable::EGEM = true; - Enable::FGEM = true; + // gems + Enable::EGEM = false; + Enable::FGEM = false; + Enable::FGEM_ORIG = false; //5 forward gems; cannot be used with FST // barrel tracker Enable::BARREL = false; - Enable::FST = false; + //G4BARREL::SETTING::BARRELV6=true; + // fst + Enable::FST = true; + G4FST::SETTING::FSTV5 = true; // mvtx/tpc tracker - Enable::MVTX = true; - Enable::TPC = true; + Enable::MVTX = false; + Enable::TPC = false; // Enable::TPC_ENDCAP = true; Enable::TRACKING = true; Enable::TRACKING_EVAL = Enable::TRACKING && true; G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes // projections to calorimeters + G4TRACKING::PROJECTION_EEMC = false; G4TRACKING::PROJECTION_CEMC = false; G4TRACKING::PROJECTION_FEMC = false; G4TRACKING::PROJECTION_FHCAL = false; - Enable::CEMC = 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::HCALIN = true; + Enable::HCALIN = false; // Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -249,7 +265,7 @@ int Fun4All_G4_EICDetector( Enable::MAGNET = true; - Enable::HCALOUT = true; + Enable::HCALOUT = false; // Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; @@ -257,34 +273,31 @@ int Fun4All_G4_EICDetector( Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; // EICDetector geometry - barrel - Enable::DIRC = true; + Enable::DIRC = false; // EICDetector geometry - 'hadron' direction - Enable::RICH = true; - Enable::AEROGEL = true; + Enable::RICH = false; + Enable::AEROGEL = false; - Enable::FEMC = true; + Enable::FEMC = false; // Enable::FEMC_ABSORBER = true; - Enable::FEMC_CELL = Enable::FEMC && true; - Enable::FEMC_TOWER = Enable::FEMC_CELL && true; + Enable::FEMC_TOWER = Enable::FEMC && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; - Enable::FHCAL = true; + Enable::FHCAL = false; // Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_CELL = Enable::FHCAL && true; - Enable::FHCAL_TOWER = Enable::FHCAL_CELL && true; + Enable::FHCAL_TOWER = Enable::FHCAL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; // EICDetector geometry - 'electron' direction - Enable::EEMC = true; - Enable::EEMC_CELL = Enable::EEMC && true; - Enable::EEMC_TOWER = Enable::EEMC_CELL && true; + Enable::EEMC = false; + Enable::EEMC_TOWER = Enable::EEMC && true; Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; - Enable::PLUGDOOR = true; + Enable::PLUGDOOR = false; // Other options Enable::GLOBAL_RECO = true; @@ -315,7 +328,7 @@ int Fun4All_G4_EICDetector( //--------------- // World Settings //--------------- - // G4WORLD::PhysicsList = "QGSP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans //--------------- @@ -359,12 +372,6 @@ int Fun4All_G4_EICDetector( if (Enable::HCALOUT_CELL) HCALOuter_Cells(); - if (Enable::FEMC_CELL) FEMC_Cells(); - - if (Enable::FHCAL_CELL) FHCAL_Cells(); - - if (Enable::EEMC_CELL) EEMC_Cells(); - //----------------------------- // CEMC towering and clustering //----------------------------- diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 3cc9fccc1..56144b318 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -48,14 +48,24 @@ void G4Init() { // First some check for subsystems which do not go together - if (Enable::TPC && Enable::FST) + if (Enable::TPC && Enable::FST && !G4FST::SETTING::FST_TPC) { - cout << "TPC and FST cannot be enabled together" << endl; + cout << "FST setup cannot fit in the TPC" << endl; gSystem->Exit(1); } - else if ((Enable::TPC || Enable::MVTX) && Enable::BARREL) + else if (Enable::MVTX && Enable::BARREL) { - cout << "TPC/MVTX and BARREL cannot be enabled together" << endl; + cout << "MVTX and BARREL cannot be enabled together" << endl; + gSystem->Exit(1); + } + else if (Enable::TPC && Enable::BARREL && !G4BARREL::SETTING::BARRELV6) { + cout << "Barrel setup cannot fit in the TPC" << endl; + gSystem->Exit(1); + } + + if(Enable::FGEM_ORIG && Enable::FST) + { + cout << "FST cannot be enabled with 5 FGEM setup" << endl; gSystem->Exit(1); } @@ -63,7 +73,7 @@ void G4Init() if (Enable::PIPE) PipeInit(); if (Enable::PLUGDOOR) PlugDoorInit(); if (Enable::EGEM) EGEM_Init(); - if (Enable::FGEM) FGEM_Init(); + if (Enable::FGEM || Enable::FGEM_ORIG) FGEM_Init(); if (Enable::FST) FST_Init(); if (Enable::BARREL) BarrelInit(); if (Enable::MVTX) MvtxInit(); @@ -134,7 +144,7 @@ int G4Setup() if (Enable::PIPE) radius = Pipe(g4Reco, radius); if (Enable::EGEM) EGEMSetup(g4Reco); - if (Enable::FGEM) FGEMSetup(g4Reco); + if (Enable::FGEM || Enable::FGEM_ORIG) FGEMSetup(g4Reco); if (Enable::FST) FSTSetup(g4Reco); if (Enable::BARREL) Barrel(g4Reco, radius); if (Enable::MVTX) radius = Mvtx(g4Reco, radius); From e35c819d3d16623238fd87a942361c65bf84673d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 15 Mar 2021 18:05:09 -0400 Subject: [PATCH 0993/1222] Update macro with vertexing fix --- common/G4_Tracking.C | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 8f91d920a..4af6aa55c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -472,12 +472,9 @@ void Tracking_Reco() se->registerSubsystem(residuals); } - PHActsInitialVertexFinder *finder = new PHActsInitialVertexFinder("PHActsVertexFinder"); + + PHActsVertexFinder *finder = new PHActsVertexFinder(); finder->Verbosity(verbosity); - finder->setSvtxTrackMapName("SvtxTrackMap"); - finder->setSvtxVertexMapName("SvtxVertexMap"); - /// Determines whether or not to reset track covariance matrix - finder->setInitialVertexer(false); se->registerSubsystem(finder); PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); From 29c58098517f475058cd49e7d0b50b1fa5948bf5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 16 Mar 2021 09:15:08 -0400 Subject: [PATCH 0994/1222] enable barrel detectors again (we want the complete detector here, users can disable whatever they want), disable DSTreader by default - it produces humongous output files --- .../EICDetector/Fun4All_G4_EICDetector.C | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 5c1210232..944b5e015 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -204,7 +204,7 @@ int Fun4All_G4_EICDetector( Enable::DSTOUT_COMPRESS = false; // Compress DST files //Option to convert DST to human command readable TTree for quick poke around the outputs - Enable::DSTREADER = true; +// Enable::DSTREADER = true; // turn the display on (default off) Enable::DISPLAY = false; @@ -249,14 +249,14 @@ int Fun4All_G4_EICDetector( G4TRACKING::PROJECTION_FEMC = false; G4TRACKING::PROJECTION_FHCAL = false; - Enable::CEMC = false; + Enable::CEMC = true; // 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::HCALIN = false; + Enable::HCALIN = true; // Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -265,7 +265,7 @@ int Fun4All_G4_EICDetector( Enable::MAGNET = true; - Enable::HCALOUT = false; + Enable::HCALOUT = true; // Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; @@ -273,19 +273,19 @@ int Fun4All_G4_EICDetector( Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; // EICDetector geometry - barrel - Enable::DIRC = false; + Enable::DIRC = true; // EICDetector geometry - 'hadron' direction - Enable::RICH = false; - Enable::AEROGEL = false; + Enable::RICH = true; + Enable::AEROGEL = true; - Enable::FEMC = false; + Enable::FEMC = true; // Enable::FEMC_ABSORBER = true; Enable::FEMC_TOWER = Enable::FEMC && true; Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; - Enable::FHCAL = false; + Enable::FHCAL = true; // Enable::FHCAL_ABSORBER = true; Enable::FHCAL_TOWER = Enable::FHCAL && true; Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; @@ -297,7 +297,7 @@ int Fun4All_G4_EICDetector( Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; - Enable::PLUGDOOR = false; + Enable::PLUGDOOR = true; // Other options Enable::GLOBAL_RECO = true; From 38687710088879067340f9181e1f26882cdb1e55 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 19 Mar 2021 21:48:28 -0400 Subject: [PATCH 0995/1222] fix merge error --- common/G4_Barrel_EIC.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index 27b525ce2..4d3ef10c7 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -148,7 +148,7 @@ double Barrel(PHG4Reco *g4Reco, double radius) BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); return max_bh_radius; } -} + return 0; } From 5ab875af1c04d538c0cd6fe2a094d3ff0dbb3318 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Fri, 19 Mar 2021 21:48:44 -0400 Subject: [PATCH 0996/1222] clang-format --- common/G4_Barrel_EIC.C | 131 +++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C index 4d3ef10c7..5c1a2b153 100644 --- a/common/G4_Barrel_EIC.C +++ b/common/G4_Barrel_EIC.C @@ -51,21 +51,25 @@ void BarrelInit() { //check barrel setting if ((G4BARREL::SETTING::BARRELV0 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV1 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV4 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV5 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV6 ? 1 : 0) > 1) + (G4BARREL::SETTING::BARRELV1 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV4 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV5 ? 1 : 0) + + (G4BARREL::SETTING::BARRELV6 ? 1 : 0) > + 1) + { + cout << "use only "; + for (int i = 0; i < 7; i++) { - cout << "use only "; - for (int i=0;i<7;i++) { - if (i==0) cout<<"G4BARREL::SETTING::BARRELV"<Exit(1); + if (i == 0) + cout << "G4BARREL::SETTING::BARRELV" << i << "=true "; + else + cout << " or G4BARREL::SETTING::BARRELV" << i << "=true "; } + + gSystem->Exit(1); + } } //---------------------------------------------------------------------// @@ -85,63 +89,66 @@ double Barrel(PHG4Reco *g4Reco, double radius) double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um}; double tAirgap[6] = {0.9, 0.9, 1, 1, 1, 1}; - + if (G4BARREL::SETTING::BARRELV1 || G4BARREL::SETTING::BARRELV2) - { - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; - } + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + } else if (G4BARREL::SETTING::BARRELV3) - { - for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um; - } + { + for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um; + } else if (G4BARREL::SETTING::BARRELV4) - { - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; - nLayer = 6; - r[3] = 9.2; - r[4] = 17.; - r[5] = 27.; - } + { + for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; + nLayer = 6; + r[3] = 9.2; + r[4] = 17.; + r[5] = 27.; + } - if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) - { - int nLayer1 = 3; //barrel 1 - int nLayer2 = 2; //barrel 2 - if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC + if (G4BARREL::SETTING::BARRELV5 || G4BARREL::SETTING::BARRELV6) + { + int nLayer1 = 3; //barrel 1 + int nLayer2 = 2; //barrel 2 + if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC - int my_nLayer[2]={nLayer1,nLayer2}; + int my_nLayer[2] = {nLayer1, nLayer2}; - double my_r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 - {16, 22.0}}; //barrel 2 + double my_r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 + {16, 22.0}}; //barrel 2 - double my_halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 - {25,25}}; //barrel 2 - - double my_tSilicon = 35 * um; + double my_halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 + {25, 25}}; //barrel 2 - for (int n=0;n<2;n++) { - if (n==1) my_tSilicon = 85 *um; - for (int i=0;iSuperDetector(name); cyl->set_double_param("radius", currRadius); @@ -192,7 +198,6 @@ int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, currRadius = currRadius + thickness[l]; cout << "\t" << currRadius << endl; } - return 0; } From ca9725d5e84e636bdfcb4fdee3053ae51275200f Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Sun, 21 Mar 2021 11:17:48 -0400 Subject: [PATCH 0997/1222] Clean up for tracking and FST macros (#392) * Setup overlap check flag * apply verbosity; clang-format --- common/G4_FST_EIC.C | 47 ++++++++++++---------- common/G4_Tracking_EIC.C | 87 +++++++++++++++++++++------------------- 2 files changed, 71 insertions(+), 63 deletions(-) diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C index df78f841e..9a821f129 100644 --- a/common/G4_FST_EIC.C +++ b/common/G4_FST_EIC.C @@ -25,7 +25,8 @@ int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, double zpos, dou namespace Enable { static bool FST = false; -} + bool FST_OVERLAPCHECK = false; +} // namespace Enable namespace G4FST { @@ -47,14 +48,15 @@ namespace G4FST void FST_Init() { if ((G4FST::SETTING::FSTV0 ? 1 : 0) + - (G4FST::SETTING::FSTV1 ? 1 : 0) + - (G4FST::SETTING::FSTV2 ? 1 : 0) + - (G4FST::SETTING::FSTV3 ? 1 : 0) + - (G4FST::SETTING::FSTV4 ? 1 : 0) + - (G4FST::SETTING::FSTV41 ? 1 : 0) + - (G4FST::SETTING::FSTV42 ? 1 : 0) + - (G4FST::SETTING::FSTV5 ? 1 : 0) + - (G4FST::SETTING::FST_TPC ? 1 : 0) > 1) + (G4FST::SETTING::FSTV1 ? 1 : 0) + + (G4FST::SETTING::FSTV2 ? 1 : 0) + + (G4FST::SETTING::FSTV3 ? 1 : 0) + + (G4FST::SETTING::FSTV4 ? 1 : 0) + + (G4FST::SETTING::FSTV41 ? 1 : 0) + + (G4FST::SETTING::FSTV42 ? 1 : 0) + + (G4FST::SETTING::FSTV5 ? 1 : 0) + + (G4FST::SETTING::FST_TPC ? 1 : 0) > + 1) { cout << "use only G4FST::SETTING::FSTV0=true "; cout << "or G4FST::SETTING::FSTV1=true "; @@ -64,7 +66,7 @@ void FST_Init() cout << "or G4FST::SETTING::FSTV41=true "; cout << "or G4FST::SETTING::FSTV42=true "; cout << "or G4FST::SETTING::FSTV5=true "; - cout << "or G4FST::SETTING::FST_TPC=true "<< endl; + cout << "or G4FST::SETTING::FST_TPC=true " << endl; gSystem->Exit(1); } @@ -133,20 +135,20 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) } else if (G4FST::SETTING::FSTV5) { - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35*um); //cm - make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35*um); - make_LANL_FST_station("FST_2", g4Reco, 90, 6.5, 43, 35*um); - make_LANL_FST_station("FST_3", g4Reco, 115, 8.9, 44, 85*um); - make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85*um); - make_LANL_FST_station("FST_5", g4Reco, 300, 16.8, 45, 85*um); //optional disk at further location + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35 * um); //cm + make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35 * um); + make_LANL_FST_station("FST_2", g4Reco, 90, 6.5, 43, 35 * um); + make_LANL_FST_station("FST_3", g4Reco, 115, 8.9, 44, 85 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85 * um); + make_LANL_FST_station("FST_5", g4Reco, 300, 16.8, 45, 85 * um); //optional disk at further location } else if (G4FST::SETTING::FST_TPC) - { // tpc version (based on version 4) - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 17, 35 * um); //cm + { // tpc version (based on version 4) + make_LANL_FST_station("FST_0", g4Reco, 35, 4, 17, 35 * um); //cm make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 17, 35 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 17, 35 * um); - make_LANL_FST_station("FST_3", g4Reco, 101,7.5, 17, 85 * um); - make_LANL_FST_station("FST_4", g4Reco, 125,9.5, 45, 85 * um); + make_LANL_FST_station("FST_2", g4Reco, 77, 5, 17, 35 * um); + make_LANL_FST_station("FST_3", g4Reco, 101, 7.5, 17, 85 * um); + make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85 * um); //make_LANL_FST_station("FST_5", g4Reco, 280, 16, 45, 50 * um); //optional disk at further location } else @@ -162,6 +164,7 @@ void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, double zpos, double Rmin, double Rmax, double tSilicon) //silicon thickness { + const bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK; // cout // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " // << name << endl; @@ -197,7 +200,7 @@ int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); fst->get_geometry().set_N_Sector(1); fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(true); + fst->OverlapCheck(OverlapCheck); const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); const double mm = .1 * cm; diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index 3c4e8134d..e7ff3839d 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -55,7 +55,7 @@ void Tracking_Reco() Fun4AllServer *se = Fun4AllServer::instance(); PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - // kalman->Verbosity(); + kalman->Verbosity(verbosity); // kalman->Smearing(false); if (G4TRACKING::DISPLACED_VERTEX) { @@ -83,40 +83,43 @@ void Tracking_Reco() //------------------------- if (Enable::BARREL) { - double pitch=20e-4/sqrt(12); - - if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) { - int nLayer1 = 3; //barrel 1 - int nLayer2 = 2; //barrel 2 - if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC - int nLayer[2]={nLayer1,nLayer2}; - - for (int n=0;n<2;n++) { - if (n==1) pitch=36.4e-4/sqrt(12); - for (int i;iadd_phg4hits(Form("G4HIT_BARREL%d_%d",n,i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - pitch, // const float phires, - pitch, // const float lonres, - 0.95, // const float eff, - 0); // const float noise - } + double pitch = 20e-4 / sqrt(12); + + if (G4BARREL::SETTING::BARRELV5 || G4BARREL::SETTING::BARRELV6) + { + int nLayer1 = 3; //barrel 1 + int nLayer2 = 2; //barrel 2 + if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC + int nLayer[2] = {nLayer1, nLayer2}; + + for (int n = 0; n < 2; n++) + { + if (n == 1) pitch = 36.4e-4 / sqrt(12); + for (int i; i < nLayer[n]; i++) + { + kalman->add_phg4hits(Form("G4HIT_BARREL%d_%d", n, i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + pitch, // const float phires, + pitch, // const float lonres, + 0.95, // const float eff, + 0); // const float noise + } } } - else + else { - int nLayer=5; - if (G4BARREL::SETTING::BARRELV4) nLayer=6; - for (int i;iadd_phg4hits(Form("G4HIT_BARREL_%d",i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - pitch, // const float phires, - pitch, // const float lonres, - 0.95, // const float eff, - 0); // const float noise + kalman->add_phg4hits(Form("G4HIT_BARREL_%d", i), // const std::string& phg4hitsNames, + PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, + 5e-4, // const float radres, *ignored in cylindrical detector* + pitch, // const float phires, + pitch, // const float lonres, + 0.95, // const float eff, + 0); // const float noise } } } @@ -176,9 +179,12 @@ void Tracking_Reco() if (Enable::FGEM || Enable::FGEM_ORIG) { int first_gem(0); - if (Enable::FGEM_ORIG){ + if (Enable::FGEM_ORIG) + { first_gem = 0; - }else{ + } + else + { first_gem = 2; } // GEM2, 70um azimuthal resolution, 1cm radial strips @@ -198,19 +204,19 @@ void Tracking_Reco() //------------------------- if (Enable::FST) { - float pitch=20e-4; - int nPlane=5; - if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) + float pitch = 20e-4; + int nPlane = 5; + if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) { - nPlane=6; + nPlane = 6; } for (int i = 0; i < nPlane; i++) { - if (i>=3) pitch=36.4e-4; + if (i >= 3) pitch = 36.4e-4; kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - pitch, // const float radres, + pitch, // const float radres, pitch, // const float phires, 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* 1, // const float eff, @@ -252,7 +258,6 @@ void Tracking_Reco() return; } - //-----------------------------------------------------------------------------// void Tracking_Eval(const std::string &outputfile) @@ -268,10 +273,10 @@ void Tracking_Eval(const std::string &outputfile) // Fast Tracking evaluation //---------------- - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); fast_sim_eval->set_filename(outputfile); + fast_sim_eval->Verbosity(verbosity); se->registerSubsystem(fast_sim_eval); } #endif From 1c12dd0d963b4525c2e5eafd0ac62dfa40a44ccd Mon Sep 17 00:00:00 2001 From: pingwong Date: Mon, 22 Mar 2021 15:54:35 -0400 Subject: [PATCH 0998/1222] switch off forward pipe and switch on MVTX and TPC --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index b7facb98a..56e23d9e6 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -240,7 +240,7 @@ int Fun4All_G4_EICDetector( // whether to simulate the Be section of the beam pipe Enable::PIPE = true; // EIC beam pipe extension beyond the Be-section: - G4PIPE::use_forward_pipes = true; + G4PIPE::use_forward_pipes = false; // gems Enable::EGEM = true; @@ -253,8 +253,8 @@ int Fun4All_G4_EICDetector( Enable::FST = true; G4FST::SETTING::FST_TPC = true; // mvtx/tpc tracker - Enable::MVTX = false; - Enable::TPC = false; + Enable::MVTX = true; + Enable::TPC = true; // Enable::TPC_ENDCAP = true; Enable::TRACKING = true; From 49878b6ce0bd90eecffd92220e30f5c485b61009 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 23 Mar 2021 08:48:48 -0400 Subject: [PATCH 0999/1222] initial implementation of hadron forward beamline and detectors --- common/G4_hFarFwdBeamLine_ip6_EIC.C | 330 ++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 common/G4_hFarFwdBeamLine_ip6_EIC.C diff --git a/common/G4_hFarFwdBeamLine_ip6_EIC.C b/common/G4_hFarFwdBeamLine_ip6_EIC.C new file mode 100644 index 000000000..e279c3f25 --- /dev/null +++ b/common/G4_hFarFwdBeamLine_ip6_EIC.C @@ -0,0 +1,330 @@ +#ifndef MACRO_G4HFARFWDBEAMLINEIP6EIC_C +#define MACRO_G4HFARFWDBEAMLINEIP6EIC_C + +#include + +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +// This creates the Enable Flag to be used in the main steering macro +namespace Enable +{ + bool HFARFWD_PIPE = false; + bool HFARFWD_OVERLAPCHECK = false; + int HFARFWD_VERBOSITY = 0; +} // namespace Enable + +void defineMagnets(PHG4Reco*,const string,int, int); +void defineDetectors(PHG4Reco*); +void defineBeamPipe(PHG4Reco*); + +//! construct ip6 hadron forward region +void hFarFwdBeamLine(PHG4Reco* g4Reco, + double radius){ + + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + + defineMagnents(g4Reco, + string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat", + verbosity,OverlapCheck); + defineDetectors(g4Reco); + + // beampipe as used for initial EICroot analysis (is full of overlaps - use only as starting point) + //defineBeamPipe(g4Reco); + +} + +void defineMagnets(PHG4Reco* g4Reco, const string magFile, + int verbosity, int overlapcheck){ + // setup of G4: + // no saving of geometry: it takes time and we do not do tracking + // so we do not need the geometry + g4Reco->save_DST_geometry(false); + g4Reco->set_field(0); + g4Reco->SetWorldMaterial("G4_Galactic"); + + 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 << "coud 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 "<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/TMath::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",dipole_field_x); + bl->set_double_param("field_x",0.); + bl->set_double_param("fieldgradient",fieldgradient); + bl->set_string_param("magtype",magtype); + bl->set_double_param("length",length); + bl->set_double_param("place_x",x); + bl->set_double_param("place_y",y); + bl->set_double_param("place_z",z); + bl->set_double_param("rot_y",angle); + bl->set_double_param("inner_radius",inner_radius_zin); + bl->set_double_param("outer_radius", outer_magnet_diameter/2.); + bl->SetActive(magnet_active); + bl->BlackHole(); + if (absorberactive) + { + bl->SetAbsorberActive(); + } + bl->OverlapCheck(overlapcheck); + bl->SuperDetector("BEAMLINEMAGNET"); + g4Reco->registerSubsystem(bl); + } + imagnet++; + if (fabs(z)+length > biggest_z) + { + biggest_z = fabs(z)+length; + } + } + } + } + infile.close(); + if (biggest_z*2. > g4Reco->GetWorldSizeZ()) + { + g4Reco->SetWorldSizeZ((biggest_z+100.)*2); // leave 1m on both sides + } + } +} + +void defineDetectors(PHG4Reco* g4Reco){ + + auto *detZDC = new PHG4BlockSubsystem("zdcTruth"); + detZDC->set_double_param("place_x",96.24); + detZDC->set_double_param("place_y",0); + detZDC->set_double_param("place_z",3750); + detZDC->set_double_param("rot_y",-0.025*TMath::RadToDeg()); + detZDC->set_double_param("size_x",60); + detZDC->set_double_param("size_y",60); + detZDC->set_double_param("size_z",0.03); + detZDC->set_string_param("material","G4_Galactic"); + detZDC->SetActive(); + if(verbose) + detZDC->Verbosity(4); + g4Reco->registerSubsystem(detZDC); + + const int rpDetNr = 2; + const double rp_zCent[rpDetNr]={2600 ,2800}; + const double rp_xCent[rpDetNr]={84.49 ,93.59}; + for(int i=0;iset_double_param("place_x",rp_xCent[i]); + detRP->set_double_param("place_y",0); + detRP->set_double_param("place_z",rp_zCent[i]); + detRP->set_double_param("rot_y",-0.025*TMath::RadToDeg()); + detRP->set_double_param("size_x",25); + detRP->set_double_param("size_y",10); + detRP->set_double_param("size_z",0.03); + detRP->set_string_param("material","G4_Si"); + detRP->SetActive(); + if(verbose) + detRP->Verbosity(4); + g4Reco->registerSubsystem(detRP); + } + + const int b0DetNr = 4; + const double b0Mag_zCent = 590; + const double b0Mag_zLen = 120; + for(int i=0;iset_double_param("radius",3.7); + detB0->set_double_param("thickness",20 - 3.7); + detB0->set_double_param("length",0.1); + detB0->set_string_param("material","G4_Si"); + detB0->set_double_param("place_x",13.2); + detB0->set_double_param("place_y",0); + detB0->set_double_param("place_z", (b0Mag_zCent - b0Mag_zLen/2) + b0Mag_zLen/(b0DetNr-1) * i); + detB0->SetActive(true); + g4Reco->registerSubsystem(detB0); + } + + +} + + +void defineBeamPipe(PHG4Reco* g4Reco){ + //exit window + PHG4CylinderSubsystem *exitWin = new PHG4CylinderSubsystem("exitWin",0); + exitWin->set_double_param("radius" ,3.2); + exitWin->set_double_param("thickness",11.8); + exitWin->set_double_param("length" ,0.15); + exitWin->set_double_param("rot_y" ,-0.025*TMath::RadToDeg()); + exitWin->set_string_param("material" ,"G4_STAINLESS-STEEL"); + exitWin->set_double_param("place_x" ,12.5); + exitWin->set_double_param("place_y" ,0); + exitWin->set_double_param("place_z" ,500); + exitWin->SetActive(false); + g4Reco->registerSubsystem(exitWin); + + //B0 magnet pipe + PHG4CylinderSubsystem *pipeB0 = new PHG4CylinderSubsystem("beamPipeB0",0); + pipeB0->set_double_param("radius",2.8); + pipeB0->set_double_param("thickness",0.25); + pipeB0->set_double_param("length",195); + pipeB0->set_double_param("rot_y",-0.025*TMath::RadToDeg()); + pipeB0->set_string_param("material","G4_Al"); + pipeB0->set_double_param("place_x",14.748); + pipeB0->set_double_param("place_y",0); + pipeB0->set_double_param("place_z",590); + pipeB0->SetActive(false); + g4Reco->registerSubsystem(pipeB0); + + //Quad pipes + const int nSecQ = 5; //B0apf, Q1apf, Q1bpf, Q2pf, B1pf + const string nm [nSecQ]={"B0apf", "Q1apf", "Q1bpf", "Q2pf", "B1pf"}; + const double qlen[nSecQ]={160 , 150 , 220 , 440 , 330 }; + const double qir [nSecQ]={4 , 5.1 , 7 , 12 , 12.2 }; + const double qor [nSecQ]={4.1 , 5.2 , 7.2 , 12.2 , 12.4 }; + const double qrot[nSecQ]={25 , 19.5 , 15 , 15 , 34 };//mrad + const double qxC [nSecQ]={19.8 , 24.47 , 30.05 , 39.5 , 48 }; + const double qyC [nSecQ]={0 , 0 , 0 , 0 , 0 }; + const double qzC [nSecQ]={770 , 922.8 , 1106.3 , 1416.7, 1806.7}; + for(int i=0;iset_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]/1000*TMath::RadToDeg()); + pipe->set_string_param("material","G4_Al"); + pipe->set_double_param("place_x",qxC[i]); + pipe->set_double_param("place_y",qyC[i]); + pipe->set_double_param("place_z",qzC[i]); + pipe->SetActive(false); + g4Reco->registerSubsystem(pipe); + } + + //Electron pipe + PHG4CylinderSubsystem *pipeElectron = new PHG4CylinderSubsystem("beamPipeElectron",0); + pipeElectron->set_double_param("radius",1); + pipeElectron->set_double_param("thickness",1); + pipeElectron->set_double_param("length",3000); + pipeElectron->set_double_param("rot_y",-0.025*TMath::RadToDeg()); + pipeElectron->set_string_param("material","G4_Al"); + pipeElectron->set_double_param("place_x",0); + pipeElectron->set_double_param("place_y",0); + pipeElectron->set_double_param("place_z",2000); + pipeElectron->SetActive(false); + //g4Reco->registerSubsystem(pipeElectron); + + //ZDC pipe + PHG4CylinderSubsystem *pipeZDC = new PHG4CylinderSubsystem("beamPipeZDC",0); + pipeZDC->set_double_param("radius",16.5); + pipeZDC->set_double_param("thickness",0.1); + pipeZDC->set_double_param("length",170); + pipeZDC->set_double_param("rot_y",-0.025*TMath::RadToDeg()); + pipeZDC->set_string_param("material","G4_Al"); + pipeZDC->set_double_param("place_x",59); + pipeZDC->set_double_param("place_y",0); + pipeZDC->set_double_param("place_z",2041.59); + pipeZDC->SetActive(false); + g4Reco->registerSubsystem(pipeZDC); + + //Roman Pot pipe + const int nSec = 2; + const double len[nSec]={850,1150 }; + const double ir1[nSec]={17 , 17 }; + const double or1[nSec]={17.1,17.1}; + const double ir2[nSec]={17 , 7 }; + const double or2[nSec]={17.1, 7.1}; + const double xC[nSec] ={83 , 130}; + const double yC[nSec] ={0 , 0}; + const double zC[nSec] ={2550,3550}; + for(int i=0;iset_string_param("material","G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x",xC[i]); + pipe->set_double_param("place_y",yC[i]); + pipe->set_double_param("place_z",zC[i]); + pipe->set_double_param("length",len[i]/2); + 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]); + pipe->set_double_param("rot_y",-0.027*TMath::RadToDeg()); + g4Reco->registerSubsystem(pipe); + } +} + + +#endif From 6db2067cf72cbdfcb463dc6ff8f4c96446d185d4 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 23 Mar 2021 09:45:56 -0400 Subject: [PATCH 1000/1222] fix typos --- common/G4_hFarFwdBeamLine_ip6_EIC.C | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/common/G4_hFarFwdBeamLine_ip6_EIC.C b/common/G4_hFarFwdBeamLine_ip6_EIC.C index e279c3f25..f64117e66 100644 --- a/common/G4_hFarFwdBeamLine_ip6_EIC.C +++ b/common/G4_hFarFwdBeamLine_ip6_EIC.C @@ -23,7 +23,7 @@ namespace Enable } // namespace Enable void defineMagnets(PHG4Reco*,const string,int, int); -void defineDetectors(PHG4Reco*); +void defineDetectors(PHG4Reco*,int); void defineBeamPipe(PHG4Reco*); //! construct ip6 hadron forward region @@ -33,10 +33,10 @@ void hFarFwdBeamLine(PHG4Reco* g4Reco, bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); - defineMagnents(g4Reco, - string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat", - verbosity,OverlapCheck); - defineDetectors(g4Reco); + defineMagnets(g4Reco, + string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat", + verbosity,OverlapCheck); + defineDetectors(g4Reco,verbosity); // beampipe as used for initial EICroot analysis (is full of overlaps - use only as starting point) //defineBeamPipe(g4Reco); @@ -52,6 +52,14 @@ void defineMagnets(PHG4Reco* g4Reco, const string magFile, g4Reco->set_field(0); g4Reco->SetWorldMaterial("G4_Galactic"); + // make magnet active volume if you want to study the hits + bool magnet_active=false; + int absorberactive = 0; + + // 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()) @@ -95,7 +103,7 @@ void defineMagnets(PHG4Reco* g4Reco, const string magFile, << " needs change in code (replace tube by cone for beamline)" << endl; gSystem->Exit(1); } - if(verbosity>0)){ + if(verbosity>0){ cout << endl << endl << "\tID number "<set_double_param("place_x",96.24); @@ -180,7 +188,7 @@ void defineDetectors(PHG4Reco* g4Reco){ detZDC->set_double_param("size_z",0.03); detZDC->set_string_param("material","G4_Galactic"); detZDC->SetActive(); - if(verbose) + if(verbosity) detZDC->Verbosity(4); g4Reco->registerSubsystem(detZDC); @@ -198,7 +206,7 @@ void defineDetectors(PHG4Reco* g4Reco){ detRP->set_double_param("size_z",0.03); detRP->set_string_param("material","G4_Si"); detRP->SetActive(); - if(verbose) + if(verbosity) detRP->Verbosity(4); g4Reco->registerSubsystem(detRP); } From 41e64726aba3604f95b59f60c4560c6de3c4fa17 Mon Sep 17 00:00:00 2001 From: pingwong Date: Fri, 26 Mar 2021 02:11:09 -0400 Subject: [PATCH 1001/1222] fixing bug that caused barrel couldn't be registered in G4_Tracking_EIC.C --- common/G4_Tracking_EIC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C index e7ff3839d..0be72c655 100644 --- a/common/G4_Tracking_EIC.C +++ b/common/G4_Tracking_EIC.C @@ -95,7 +95,7 @@ void Tracking_Reco() for (int n = 0; n < 2; n++) { if (n == 1) pitch = 36.4e-4 / sqrt(12); - for (int i; i < nLayer[n]; i++) + for (int i=0; i < nLayer[n]; i++) { kalman->add_phg4hits(Form("G4HIT_BARREL%d_%d", n, i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, @@ -111,7 +111,7 @@ void Tracking_Reco() { int nLayer = 5; if (G4BARREL::SETTING::BARRELV4) nLayer = 6; - for (int i; i < nLayer; i++) + for (int i=0; i < nLayer; i++) { kalman->add_phg4hits(Form("G4HIT_BARREL_%d", i), // const std::string& phg4hitsNames, PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, From 14eb5521dbcd0bab739b52b6cf8f36634cc2edaa Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 31 Mar 2021 18:15:20 -0400 Subject: [PATCH 1002/1222] apply EIC beam parameter by default to EICSmear event generators --- common/G4_Input.C | 10 ++++++---- detectors/EICDetector/Fun4All_G4_EICDetector.C | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 7b1934553..ed0ec5bd7 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -182,7 +182,7 @@ namespace INPUTHEPMC namespace INPUTREADEIC { string filename; -} +} // namespace INPUTREADEIC namespace INPUTREADHITS { @@ -230,6 +230,7 @@ namespace INPUTGENERATOR PHPythia8 *Pythia8 = nullptr; PHSartre *Sartre = nullptr; PHSartreParticleTrigger *SartreTrigger = nullptr; + ReadEICFiles *EICFileReader = nullptr; } // namespace INPUTGENERATOR namespace INPUTMANAGER @@ -462,9 +463,10 @@ void InputRegister() } if (Input::READEIC) { - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(INPUTREADEIC::filename); - se->registerSubsystem(eicr); + 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 diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 56e23d9e6..023cf0064 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -183,6 +183,12 @@ int Fun4All_G4_EICDetector( //! apply EIC beam parameter following EIC CDR Input::ApplyEICBeamParameter(INPUTGENERATOR::Sartre); } + // EIC smear files + if (Input::READEIC) + { + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTGENERATOR::EICFileReader); + } //-------------- // Set Input Manager specific options From 85ff0b90ef24850067b599668ba8016e45ff2dc2 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 31 Mar 2021 19:39:32 -0400 Subject: [PATCH 1003/1222] fix calling order --- detectors/EICDetector/Fun4All_G4_EICDetector.C | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index 023cf0064..eaca03904 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -183,12 +183,6 @@ int Fun4All_G4_EICDetector( //! apply EIC beam parameter following EIC CDR Input::ApplyEICBeamParameter(INPUTGENERATOR::Sartre); } - // EIC smear files - if (Input::READEIC) - { - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTGENERATOR::EICFileReader); - } //-------------- // Set Input Manager specific options @@ -214,6 +208,13 @@ int Fun4All_G4_EICDetector( // register all input generators with Fun4All InputRegister(); + // Reads event generators in EIC smear files, which is registered in InputRegister + if (Input::READEIC) + { + //! apply EIC beam parameter following EIC CDR + Input::ApplyEICBeamParameter(INPUTGENERATOR::EICFileReader); + } + // set up production relatedstuff // Enable::PRODUCTION = true; From 0f6f2417b0cb2ba66b2f30e3620c0239c47337e9 Mon Sep 17 00:00:00 2001 From: cipriangal Date: Fri, 2 Apr 2021 11:01:50 -0400 Subject: [PATCH 1004/1222] integration with the main setup macro (#397) * macro works for both magnet configs * add hadron forward beam line to the grand setup * add output files * bring in line with other macros in prep for inclusion in the main setup macro * do not include multiple times * not clear how to add this * different view point * try DIS event -- this crashes * change size for zdc and material for better vis * no hole in the b0 detectors ideal detectors * valgrind output files * fix typo * fix typo * Revert "try DIS event -- this crashes" Leaves the macro consistent with previous behaviour This reverts commit b5ba9c910eb29d4dfddc67e9b4cfe781269847a5. --- .gitignore | 8 ++ common/DisplayOn.C | 4 +- ...ine_ip6_EIC.C => G4_hFarFwdBeamLine_EIC.C} | 107 +++++++++++------- .../EICDetector/Fun4All_G4_EICDetector.C | 5 + detectors/EICDetector/G4Setup_EICDetector.C | 10 ++ detectors/EICDetector/vis.mac | 4 +- 6 files changed, 97 insertions(+), 41 deletions(-) rename common/{G4_hFarFwdBeamLine_ip6_EIC.C => G4_hFarFwdBeamLine_EIC.C} (79%) 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/common/DisplayOn.C b/common/DisplayOn.C index f458a1c4b..61ebef1b1 100644 --- a/common/DisplayOn.C +++ b/common/DisplayOn.C @@ -1,4 +1,5 @@ -#pragma once +#ifndef MACRO_DISPLAYON_C +#define MACRO_DISPLAYON_C #include @@ -60,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_hFarFwdBeamLine_ip6_EIC.C b/common/G4_hFarFwdBeamLine_EIC.C similarity index 79% rename from common/G4_hFarFwdBeamLine_ip6_EIC.C rename to common/G4_hFarFwdBeamLine_EIC.C index f64117e66..0a5a84aeb 100644 --- a/common/G4_hFarFwdBeamLine_ip6_EIC.C +++ b/common/G4_hFarFwdBeamLine_EIC.C @@ -1,5 +1,5 @@ -#ifndef MACRO_G4HFARFWDBEAMLINEIP6EIC_C -#define MACRO_G4HFARFWDBEAMLINEIP6EIC_C +#ifndef MACRO_G4HFARFWDBEAMLINE_EIC_C +#define MACRO_G4HFARFWDBEAMLINE_EIC_C #include @@ -17,41 +17,55 @@ R__LOAD_LIBRARY(libg4detectors.so) // This creates the Enable Flag to be used in the main steering macro namespace Enable { + bool HFARFWD_MAGNETS_IP6 = false; + bool HFARFWD_MAGNETS_IP8 = false; + bool HFARFWD_VIRTUAL_DETECTORS_IP8 = false; + bool HFARFWD_VIRTUAL_DETECTORS_IP6 = false; bool HFARFWD_PIPE = false; bool HFARFWD_OVERLAPCHECK = false; int HFARFWD_VERBOSITY = 0; } // namespace Enable -void defineMagnets(PHG4Reco*,const string,int, int); -void defineDetectors(PHG4Reco*,int); -void defineBeamPipe(PHG4Reco*); -//! construct ip6 hadron forward region -void hFarFwdBeamLine(PHG4Reco* g4Reco, - double radius){ - - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); +void hFarFwdBeamLineInit() +{ - defineMagnets(g4Reco, - string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat", - verbosity,OverlapCheck); - defineDetectors(g4Reco,verbosity); + if (Enable::HFARFWD_MAGNETS_IP6 && Enable::HFARFWD_MAGNETS_IP8) + { + cout << "You cannot have magnets for both IP6 and IP8 ON at the same time" << endl; + gSystem->Exit(1); + } - // beampipe as used for initial EICroot analysis (is full of overlaps - use only as starting point) - //defineBeamPipe(g4Reco); + if (Enable::HFARFWD_MAGNETS_IP6) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 4500.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, 0.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 180.0); + } + if (Enable::HFARFWD_MAGNETS_IP8) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 4800.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -2050.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.0); + } } -void defineMagnets(PHG4Reco* g4Reco, const string magFile, - int verbosity, int overlapcheck){ - // setup of G4: - // no saving of geometry: it takes time and we do not do tracking - // so we do not need the geometry - g4Reco->save_DST_geometry(false); - g4Reco->set_field(0); - g4Reco->SetWorldMaterial("G4_Galactic"); +void hFarFwdDefineMagnets(PHG4Reco* g4Reco){ + + bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + string magFile; + if(Enable::HFARFWD_MAGNETS_IP6) + magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat"; + else if(Enable::HFARFWD_MAGNETS_IP8) + magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip8_35mrad_h_farFwdBeamLineMagnets.dat"; + else{ + cout << " You have to enable either the IP6 or IP8 Magnet configuration to define magnets! "<Exit(1); + } + // make magnet active volume if you want to study the hits bool magnet_active=false; int absorberactive = 0; @@ -156,8 +170,10 @@ void defineMagnets(PHG4Reco* g4Reco, const string magFile, { bl->SetAbsorberActive(); } - bl->OverlapCheck(overlapcheck); + bl->OverlapCheck(overlapCheck); bl->SuperDetector("BEAMLINEMAGNET"); + if(verbosity) + bl->Verbosity(verbosity); g4Reco->registerSubsystem(bl); } imagnet++; @@ -169,27 +185,37 @@ void defineMagnets(PHG4Reco* g4Reco, const string magFile, } } infile.close(); - if (biggest_z*2. > g4Reco->GetWorldSizeZ()) - { - g4Reco->SetWorldSizeZ((biggest_z+100.)*2); // leave 1m on both sides - } } } -void defineDetectors(PHG4Reco* g4Reco, int verbosity){ +void hFarFwdDefineDetectors(PHG4Reco* g4Reco){ + + if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP6 && Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) + { + cout << "You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl; + gSystem->Exit(1); + } + + if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) { + cout << " IP8 h far forward detectors not defined right now. " <SuperDetector("ZDC"); detZDC->set_double_param("place_x",96.24); detZDC->set_double_param("place_y",0); detZDC->set_double_param("place_z",3750); detZDC->set_double_param("rot_y",-0.025*TMath::RadToDeg()); detZDC->set_double_param("size_x",60); detZDC->set_double_param("size_y",60); - detZDC->set_double_param("size_z",0.03); - detZDC->set_string_param("material","G4_Galactic"); + detZDC->set_double_param("size_z",0.1); + detZDC->set_string_param("material","G4_Si"); detZDC->SetActive(); if(verbosity) - detZDC->Verbosity(4); + detZDC->Verbosity(verbosity); g4Reco->registerSubsystem(detZDC); const int rpDetNr = 2; @@ -197,6 +223,7 @@ void defineDetectors(PHG4Reco* g4Reco, int verbosity){ const double rp_xCent[rpDetNr]={84.49 ,93.59}; for(int i=0;iSuperDetector("RomanPots"); detRP->set_double_param("place_x",rp_xCent[i]); detRP->set_double_param("place_y",0); detRP->set_double_param("place_z",rp_zCent[i]); @@ -207,7 +234,7 @@ void defineDetectors(PHG4Reco* g4Reco, int verbosity){ detRP->set_string_param("material","G4_Si"); detRP->SetActive(); if(verbosity) - detRP->Verbosity(4); + detRP->Verbosity(verbosity); g4Reco->registerSubsystem(detRP); } @@ -216,14 +243,17 @@ void defineDetectors(PHG4Reco* g4Reco, int verbosity){ const double b0Mag_zLen = 120; for(int i=0;iset_double_param("radius",3.7); - detB0->set_double_param("thickness",20 - 3.7); + //detB0->SuperDetector("B0detectors"); + detB0->set_double_param("radius",0); + detB0->set_double_param("thickness",20); detB0->set_double_param("length",0.1); detB0->set_string_param("material","G4_Si"); detB0->set_double_param("place_x",13.2); detB0->set_double_param("place_y",0); detB0->set_double_param("place_z", (b0Mag_zCent - b0Mag_zLen/2) + b0Mag_zLen/(b0DetNr-1) * i); detB0->SetActive(true); + if(verbosity) + detB0->Verbosity(verbosity); g4Reco->registerSubsystem(detB0); } @@ -231,7 +261,8 @@ void defineDetectors(PHG4Reco* g4Reco, int verbosity){ } -void defineBeamPipe(PHG4Reco* g4Reco){ +void hFarFwdDefineBeamPipe(PHG4Reco* g4Reco){ + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); //exit window PHG4CylinderSubsystem *exitWin = new PHG4CylinderSubsystem("exitWin",0); exitWin->set_double_param("radius" ,3.2); diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C index eaca03904..853028a74 100644 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ b/detectors/EICDetector/Fun4All_G4_EICDetector.C @@ -248,6 +248,11 @@ int Fun4All_G4_EICDetector( Enable::PIPE = true; // EIC beam pipe extension beyond the Be-section: G4PIPE::use_forward_pipes = false; + //EIC hadron far forward magnets and detectors. IP6 and IP8 are incompatible (pick either or); + Enable::HFARFWD_MAGNETS_IP6=true; + Enable::HFARFWD_VIRTUAL_DETECTORS_IP6=true; + Enable::HFARFWD_MAGNETS_IP8=false; + Enable::HFARFWD_VIRTUAL_DETECTORS_IP8=false; // gems Enable::EGEM = true; diff --git a/detectors/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C index 0747817f8..eb4d042ad 100644 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ b/detectors/EICDetector/G4Setup_EICDetector.C @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -77,6 +78,7 @@ void G4Init() // load detector/material macros and execute Init() function if (Enable::PIPE) PipeInit(); + if (Enable::HFARFWD_MAGNETS_IP6 || Enable::HFARFWD_MAGNETS_IP8) hFarFwdBeamLineInit(); if (Enable::PLUGDOOR) PlugDoorInit(); if (Enable::EGEM) EGEM_Init(); if (Enable::FGEM || Enable::FGEM_ORIG) FGEM_Init(); @@ -149,6 +151,8 @@ int G4Setup() double radius = 0.; if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::HFARFWD_MAGNETS_IP6 || Enable::HFARFWD_MAGNETS_IP8) hFarFwdDefineMagnets(g4Reco); + if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP6 || Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) hFarFwdDefineDetectors(g4Reco); if (Enable::EGEM) EGEMSetup(g4Reco); if (Enable::FGEM || Enable::FGEM_ORIG) FGEMSetup(g4Reco); if (Enable::FST) FSTSetup(g4Reco); @@ -196,6 +200,9 @@ void ShowerCompress() PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); compress->AddHitContainer("G4HIT_PIPE"); + compress->AddHitContainer("G4HIT_ZDC"); + compress->AddHitContainer("G4HIT_RomanPots"); + compress->AddHitContainer("G4HIT_B0detector"); compress->AddHitContainer("G4HIT_FIELDCAGE"); compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); compress->AddHitContainer("G4HIT_CEMC"); @@ -253,6 +260,9 @@ void DstCompress(Fun4AllDstOutputManager *out) if (out) { out->StripNode("G4HIT_PIPE"); + out->StripNode("G4HIT_ZDC"); + out->StripNode("G4HIT_RomanPots"); + out->StripNode("G4HIT_B0detectors"); out->StripNode("G4HIT_SVTXSUPPORT"); out->StripNode("G4HIT_CEMC_ELECTRONICS"); out->StripNode("G4HIT_CEMC"); diff --git a/detectors/EICDetector/vis.mac b/detectors/EICDetector/vis.mac index 47db266aa..caba6e883 100644 --- a/detectors/EICDetector/vis.mac +++ b/detectors/EICDetector/vis.mac @@ -29,8 +29,8 @@ /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 +/vis/viewer/set/viewpointThetaPhi 240 -40 +/vis/viewer/addCutawayPlane 0 0 0 m 0 -1 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 From 79a8cb20af46e59f9e8558d44dd054a1f5bf0ddc Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 5 Apr 2021 12:14:36 -0400 Subject: [PATCH 1005/1222] Moved the digitization from the _clustering to _cells. --- common/G4_Intt.C | 19 +++++++++++-------- common/G4_Micromegas.C | 3 ++- common/G4_Mvtx.C | 13 ++++++++----- common/G4_TPC.C | 19 ++++++++++--------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index c96b87a92..5458d0d2c 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -129,15 +129,9 @@ void Intt_Cells() //reco->set_double_param("tmin",-20.0); reco->Verbosity(verbosity); se->registerSubsystem(reco); - return; -} -void Intt_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); - // Intt - //===== + // Intt digitization + //=========== // these should be used for the Intt /* How threshold are calculated based on default FPHX settings @@ -177,6 +171,15 @@ void Intt_Clustering() 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) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 6c63c8904..efaa860e4 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -170,12 +170,13 @@ void Micromegas_Cells() } se->registerSubsystem(reco); + + se->registerSubsystem(new PHG4MicromegasDigitizer); } void Micromegas_Clustering() { auto se = Fun4AllServer::instance(); - se->registerSubsystem(new PHG4MicromegasDigitizer); se->registerSubsystem(new MicromegasClusterizer); } #endif diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 37ac24b69..561d0c35f 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -223,6 +223,13 @@ void Mvtx_Cells() maps_hits->set_timing_window(ilayer, -5000, 5000); } 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; } @@ -230,11 +237,7 @@ void Mvtx_Clustering() { int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - 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); + // For the Mvtx layers //================ MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); diff --git a/common/G4_TPC.C b/common/G4_TPC.C index fd14d4cff..234d6fca7 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -192,16 +192,9 @@ void TPC_Cells() 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); -} - -void TPC_Clustering() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); - - Fun4AllServer* se = Fun4AllServer::instance(); - // Tpc - //==== + // Tpc digitizer + //========= PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); digitpc->SetTpcMinLayer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); double ENC = 670.0; // standard @@ -214,6 +207,14 @@ void TPC_Clustering() se->registerSubsystem(digitpc); +} + +void TPC_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + //------------- // Cluster Hits //------------- From 5700123de357ddbbe85c6ca69f48b3af832f0992 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 8 Apr 2021 17:29:37 -0400 Subject: [PATCH 1006/1222] make digitisation configurable via G4* namespace --- common/G4_CEmc_EIC.C | 25 +++++++++++++++++++++---- common/G4_CEmc_Spacal.C | 11 ++++++++++- common/G4_EEMC.C | 11 ++++++++++- common/G4_HcalIn_ref.C | 11 ++++++++++- common/G4_HcalOut_ref.C | 12 +++++++++++- 5 files changed, 62 insertions(+), 8 deletions(-) diff --git a/common/G4_CEmc_EIC.C b/common/G4_CEmc_EIC.C index e1f6cb386..c3c2a840d 100644 --- a/common/G4_CEmc_EIC.C +++ b/common/G4_CEmc_EIC.C @@ -60,6 +60,15 @@ namespace G4CEMC // if the user changes these, the z position of the // calorimeter must be changed in the function CEmc(...) + // 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_Cemc_clusterizer { kCemcGraphClusterizer, @@ -67,13 +76,17 @@ namespace G4CEMC kCemcTemplateClusterizer }; - //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha - //! Bazilevsky + // default: template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; - //! graph clusterizer, RawClusterBuilderGraph + // graph clusterizer, RawClusterBuilderGraph // enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; } // namespace G4CEMC +namespace CEMC_TOWER +{ + double emin = NAN; +} + // Black hole and size parameters set in CEmc function void CEmcInit(const int nslats = 1) { @@ -245,6 +258,10 @@ void CEMC_Towers() RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); CemcTowerBuilder->Detector("CEMC"); CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); + if (isfinite(CEMC_TOWER::emin)) + { + CemcTowerBuilder->EminCut(CEMC_TOWER::emin); + } CemcTowerBuilder->Verbosity(verbosity); se->registerSubsystem(CemcTowerBuilder); @@ -254,7 +271,7 @@ void CEMC_Towers() RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); CemcTowerDigitizer->Detector("CEMC"); CemcTowerDigitizer->Verbosity(verbosity); - CemcTowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); + CemcTowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); CemcTowerDigitizer->set_pedstal_central_ADC(0); CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 1ff60a3f0..56d8d3c00 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -56,6 +56,15 @@ 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 + // set a default value for SPACAL configuration // // 1D azimuthal projective SPACAL (fast) //int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal; @@ -351,7 +360,7 @@ void CEMC_Towers() RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); TowerDigitizer->Detector("CEMC"); TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); + 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 diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index cb3bfd8a0..fa9720437 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -40,6 +40,15 @@ namespace G4EEMC int use_projective_geometry = 0; double Gdz = 18. + 0.0001; double Gz0 = -170.; + // 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_Eemc_clusterizer { kEemcGraphClusterizer, @@ -140,7 +149,7 @@ void EEMC_Towers() 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_digi_algorithm(G4EEMC::TowerDigi); 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 diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 9d6cec245..1334609bd 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -57,6 +57,15 @@ namespace G4HCALIN 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, @@ -237,7 +246,7 @@ void HCALInner_Towers() 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_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.); diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 77108b938..59b8b1540 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -44,6 +44,16 @@ 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, @@ -164,7 +174,7 @@ void HCALOuter_Towers() 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_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.); From 47eec2754932d2c5585e60a57801204b2863448d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 9 Apr 2021 14:41:56 -0400 Subject: [PATCH 1007/1222] Fix Fun4All fsPHENIX macro --- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C index 2c15bb373..9ec82f326 100644 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C @@ -403,13 +403,17 @@ int Fun4All_G4_fsPHENIX( //-------------- // 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::TRACKING_TRACK) { - TrackingInit(); Tracking_Reco(); } From 1dd88e6d6aba4f05281754dee3b42f4822afffd6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 14 Apr 2021 09:34:08 -0400 Subject: [PATCH 1008/1222] use sampling fraction for tower calibration if kNo_digitization is chosen --- common/G4_CEmc_EIC.C | 9 ++++++++- common/G4_EEMC.C | 9 ++++++++- common/G4_HcalIn_ref.C | 9 ++++++++- common/G4_HcalOut_ref.C | 9 ++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/common/G4_CEmc_EIC.C b/common/G4_CEmc_EIC.C index c3c2a840d..860dab622 100644 --- a/common/G4_CEmc_EIC.C +++ b/common/G4_CEmc_EIC.C @@ -283,7 +283,14 @@ void CEMC_Towers() CemcTowerCalibration->Detector("CEMC"); CemcTowerCalibration->Verbosity(verbosity); CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + CemcTowerCalibration->set_calib_const_GeV_ADC(1.0 / 0.023); // 2.3% sampling fraction from test beam + } + else + { + CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); + } CemcTowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(CemcTowerCalibration); diff --git a/common/G4_EEMC.C b/common/G4_EEMC.C index fa9720437..f5f8b18f0 100644 --- a/common/G4_EEMC.C +++ b/common/G4_EEMC.C @@ -164,7 +164,14 @@ void EEMC_Towers() 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); + if (G4EEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + TowerCalibration_EEMC->set_calib_const_GeV_ADC(1.); + } + else + { + TowerCalibration_EEMC->set_calib_const_GeV_ADC(1. / EEMC_photoelectron_per_GeV); + } TowerCalibration_EEMC->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration_EEMC); diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 1334609bd..908852d16 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -264,7 +264,14 @@ void HCALInner_Towers() // 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); + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALIN); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); + } TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 59b8b1540..1b9d146dd 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -189,7 +189,14 @@ void HCALOuter_Towers() // 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); + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALOUT); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); + } TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); From f41a23bf277aa5c48936160cfc5923e5bf83a616 Mon Sep 17 00:00:00 2001 From: FriederikeBock Date: Fri, 16 Apr 2021 13:05:49 -0400 Subject: [PATCH 1009/1222] Removing EIC related detector macros --- common/G4_Aerogel.C | 57 -- common/G4_Barrel_EIC.C | 207 ------- common/G4_CEmc_EIC.C | 342 ----------- common/G4_DIRC.C | 106 ---- common/G4_DSTReader_EICDetector.C | 251 -------- common/G4_DSTReader_fsPHENIX.C | 184 ------ common/G4_EEMC.C | 222 ------- common/G4_FEMC.C | 261 -------- common/G4_FEMC_EIC.C | 312 ---------- common/G4_FGEM_fsPHENIX.C | 354 ----------- common/G4_FHCAL.C | 352 ----------- common/G4_FST_EIC.C | 224 ------- common/G4_FwdJets.C | 209 ------- common/G4_GEM_EIC.C | 238 -------- common/G4_Mvtx_EIC.C | 89 --- common/G4_Pipe_EIC.C | 125 ---- common/G4_Piston.C | 122 ---- common/G4_PlugDoor_EIC.C | 59 -- common/G4_PlugDoor_fsPHENIX.C | 67 -- common/G4_RICH.C | 64 -- common/G4_TPC_EIC.C | 154 ----- common/G4_Tracking_EIC.C | 282 --------- common/G4_hFarFwdBeamLine_EIC.C | 369 ----------- detectors/EICDetector/DisplayOn.C | 64 -- .../EICDetector/Fun4All_G4_EICDetector.C | 574 ------------------ detectors/EICDetector/G4Setup_EICDetector.C | 296 --------- detectors/EICDetector/init_gui_vis.mac | 20 - detectors/EICDetector/vis.mac | 82 --- detectors/fsPHENIX/DisplayOn.C | 64 -- detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C | 572 ----------------- detectors/fsPHENIX/G4Setup_fsPHENIX.C | 294 --------- detectors/fsPHENIX/init_gui_vis.mac | 20 - detectors/fsPHENIX/vis.mac | 82 --- 33 files changed, 6718 deletions(-) delete mode 100644 common/G4_Aerogel.C delete mode 100644 common/G4_Barrel_EIC.C delete mode 100644 common/G4_CEmc_EIC.C delete mode 100644 common/G4_DIRC.C delete mode 100644 common/G4_DSTReader_EICDetector.C delete mode 100644 common/G4_DSTReader_fsPHENIX.C delete mode 100644 common/G4_EEMC.C delete mode 100644 common/G4_FEMC.C delete mode 100644 common/G4_FEMC_EIC.C delete mode 100644 common/G4_FGEM_fsPHENIX.C delete mode 100644 common/G4_FHCAL.C delete mode 100644 common/G4_FST_EIC.C delete mode 100644 common/G4_FwdJets.C delete mode 100644 common/G4_GEM_EIC.C delete mode 100644 common/G4_Mvtx_EIC.C delete mode 100644 common/G4_Pipe_EIC.C delete mode 100644 common/G4_Piston.C delete mode 100644 common/G4_PlugDoor_EIC.C delete mode 100644 common/G4_PlugDoor_fsPHENIX.C delete mode 100644 common/G4_RICH.C delete mode 100644 common/G4_TPC_EIC.C delete mode 100644 common/G4_Tracking_EIC.C delete mode 100644 common/G4_hFarFwdBeamLine_EIC.C delete mode 100644 detectors/EICDetector/DisplayOn.C delete mode 100644 detectors/EICDetector/Fun4All_G4_EICDetector.C delete mode 100644 detectors/EICDetector/G4Setup_EICDetector.C delete mode 100644 detectors/EICDetector/init_gui_vis.mac delete mode 100644 detectors/EICDetector/vis.mac delete mode 100644 detectors/fsPHENIX/DisplayOn.C delete mode 100644 detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C delete mode 100644 detectors/fsPHENIX/G4Setup_fsPHENIX.C delete mode 100644 detectors/fsPHENIX/init_gui_vis.mac delete mode 100644 detectors/fsPHENIX/vis.mac diff --git a/common/G4_Aerogel.C b/common/G4_Aerogel.C deleted file mode 100644 index fef33af08..000000000 --- a/common/G4_Aerogel.C +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef MACRO_G4AEROGEL_C -#define MACRO_G4AEROGEL_C - -#include - -#include - -#include - -/*! - * \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 $ - */ - -namespace Enable -{ - bool AEROGEL = false; - bool AEROGEL_OVERLAPCHECK = false; -} // namespace Enable - -void AerogelInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 164.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 287.); -} - -void AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.242) -{ - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::AEROGEL_OVERLAPCHECK; - - PHG4SectorSubsystem* 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.85)); - 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 = 18.; // 10.; - - ag->get_geometry().AddLayers_AeroGel_ePHENIX(radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), - expansion_length * PHG4Sector::Sector_Geometry::Unit_cm()); - g4Reco->registerSubsystem(ag); -} -#endif diff --git a/common/G4_Barrel_EIC.C b/common/G4_Barrel_EIC.C deleted file mode 100644 index 5c1a2b153..000000000 --- a/common/G4_Barrel_EIC.C +++ /dev/null @@ -1,207 +0,0 @@ -/*---------------------------------------------------------------------* - * Barrel tracker designed by LANL EIC team * - * See technical notes for details: arXiv:2009.02888 * - * Contact Ping and Xuan @LANL for questions: * - * Xuan: xuanli@lanl.gov * - * Ping: cpwong@lanl.gov * - *---------------------------------------------------------------------*/ - -#ifndef MACRO_G4BARRELEIC_C -#define MACRO_G4BARRELEIC_C - -#include - -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) - -int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon, double tAirgap); - -//---------------------------------------------------------------------// -namespace Enable -{ - bool BARREL = false; - bool BARREL_ABSORBER = false; -} // namespace Enable - -namespace G4BARREL -{ - namespace SETTING - { - bool BARRELV0 = false; - bool BARRELV1 = false; - bool BARRELV2 = false; - bool BARRELV3 = false; - bool BARRELV4 = false; - bool BARRELV5 = false; - bool BARRELV6 = false; - } // namespace SETTING -} // namespace G4BARREL -//---------------------------------------------------------------------// -void BarrelInit() -{ - //check barrel setting - if ((G4BARREL::SETTING::BARRELV0 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV1 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV2 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV3 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV4 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV5 ? 1 : 0) + - (G4BARREL::SETTING::BARRELV6 ? 1 : 0) > - 1) - { - cout << "use only "; - for (int i = 0; i < 7; i++) - { - if (i == 0) - cout << "G4BARREL::SETTING::BARRELV" << i << "=true "; - else - cout << " or G4BARREL::SETTING::BARRELV" << i << "=true "; - } - - gSystem->Exit(1); - } -} - -//---------------------------------------------------------------------// -double Barrel(PHG4Reco *g4Reco, double radius) -{ - const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER; - double max_bh_radius = 0.; - - //--------------------------------- - //build barrel detector - //--------------------------------- - int nLayer = 5; - const float um = 0.0001; //convert um to cm - - // Different Barrel versions documented in arXiv:2009.02888 - double r[6] = {3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm - double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm - double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um}; - double tAirgap[6] = {0.9, 0.9, 1, 1, 1, 1}; - - if (G4BARREL::SETTING::BARRELV1 || G4BARREL::SETTING::BARRELV2) - { - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; - } - else if (G4BARREL::SETTING::BARRELV3) - { - for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um; - } - else if (G4BARREL::SETTING::BARRELV4) - { - for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um; - nLayer = 6; - r[3] = 9.2; - r[4] = 17.; - r[5] = 27.; - } - - if (G4BARREL::SETTING::BARRELV5 || G4BARREL::SETTING::BARRELV6) - { - int nLayer1 = 3; //barrel 1 - int nLayer2 = 2; //barrel 2 - if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC - - int my_nLayer[2] = {nLayer1, nLayer2}; - - double my_r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1 - {16, 22.0}}; //barrel 2 - - double my_halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1 - {25, 25}}; //barrel 2 - - double my_tSilicon = 35 * um; - - for (int n = 0; n < 2; n++) - { - if (n == 1) my_tSilicon = 85 * um; - for (int i = 0; i < my_nLayer[n]; i++) - { - make_barrel_pixel_layer(Form("BARREL%d_%d", n, i), g4Reco, my_r[n][i], my_halfLength[n][i], my_tSilicon, tAirgap[i]); - } - } - - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer1 + nLayer2 - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer1 + nLayer2 - 1]); - - max_bh_radius = my_r[1][nLayer2 - 1] + 1.5; - return max_bh_radius; - } - else - { //ver 0 - 4 - for (int i = 0; i < nLayer; i++) - { - make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i], 1); - max_bh_radius = r[i] + 1.5; - //std::cout << "done with barrel layer intialization at "<< r[i] << std::endl; - } - - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, max_bh_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer - 1]); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]); - return max_bh_radius; - } - - return 0; -} -//-----------------------------------------------------------------------------------// -int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco, - double radius, double halflength, double tSilicon, double tAirgap) -{ - //--------------------------------- - //build barrel layer - //--------------------------------- - const int nSubLayer = 7; - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - - string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling", - "Support1", "Support_Gap", "Support2"}; - string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER", - "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"}; - double thickness[nSubLayer] = {tSilicon, 15 * um, 20 * um, 100 * um, - 50 * um, tAirgap, 50 * um}; - - double max_bh_radius = 0.; - PHG4CylinderSubsystem *cyl; - cout << "started to create cylinder layer: " << name << endl; - - double currRadius = radius; - // cout << currRadius << endl; - for (int l = 0; l < nSubLayer; l++) - { - cout << name << "_" << layerName[l] << "\t" << currRadius; - cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l], l); - cyl->SuperDetector(name); - cyl->set_double_param("radius", currRadius); - cyl->set_double_param("length", 2.0 * halflength); - cyl->set_string_param("material", material[l]); - cyl->set_double_param("thickness", thickness[l]); - if (l == 0) cyl->SetActive(); //only the Silicon Sensor is active - cyl->OverlapCheck(true); - g4Reco->registerSubsystem(cyl); - currRadius = currRadius + thickness[l]; - cout << "\t" << currRadius << endl; - } - - return 0; -} - -//-----------------------------------------------------------------------------------// - -#endif diff --git a/common/G4_CEmc_EIC.C b/common/G4_CEmc_EIC.C deleted file mode 100644 index 860dab622..000000000 --- a/common/G4_CEmc_EIC.C +++ /dev/null @@ -1,342 +0,0 @@ -#ifndef MACRO_G4CEMCEIC_C -#define MACRO_G4CEMCEIC_C - -#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 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; - int CEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4CEMC -{ - double cemcdepth = 9; - // tungs to scint width ratio of ~10:1 - // corresponds to approx 2% sampling fraction - - // 18 radiation lengths for 40 layers - double scint_width = 0.05; - double tungs_width = 0.245; - double electronics_width = 0.5; - - int min_cemc_layer = 1; - int max_cemc_layer = 41; - - double topradius = 106.8; // cm - double bottomradius = 95; // cm - double negrapidity = -1.5; - double posrapidity = 1.24; - // this is default set to -1.5 95) - { - cout << "inconsistency, radius: " << radius - << " larger than allowed inner radius for CEMC = 95 cm" << endl; - gSystem->Exit(-1); - } - - radius = 95; - - PHG4CylinderSubsystem *cemc; - - // determine the length of the calorimeter - // can adjust length coverage by just adjusting these values - // rapidity coverage will be determined by z shift of EMCAl - // as indicated in the loop below - - // eta = -ln(tan(theta/2)) - double theta1 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::posrapidity)); - double theta2 = 2. * TMath::ATan(TMath::Exp(-1 * G4CEMC::negrapidity)); - // get the angle between the beam pipe and negative pseudorapidity axis - theta2 = M_PI - theta2; - - double z1 = G4CEMC::topradius / TMath::Tan(theta1); - double z2 = G4CEMC::topradius / TMath::Tan(theta2); - - double z3 = G4CEMC::bottomradius / TMath::Tan(theta1); - double z4 = G4CEMC::bottomradius / TMath::Tan(theta2); - - // this is the top layer length - double totaltoplength = z1 + z2; - // this is the bottom layer length - double totalbottomlength = z3 + z4; - - //Added by Barak, 12/12/19 - double ztemp = 0; - double layer_shift = 0; - - double height = 0; - for (int thislayer = G4CEMC::min_cemc_layer; thislayer <= G4CEMC::max_cemc_layer; - thislayer++) - { - // the length for a particular layer is determined from the bottom length - double thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); - - cemc = new PHG4CylinderSubsystem("ABSORBER_CEMC", thislayer); - cemc->set_double_param("radius", radius); - cemc->set_string_param("material", "Spacal_W_Epoxy"); - cemc->set_double_param("thickness", G4CEMC::tungs_width); - cemc->set_double_param("length", thislength); - cemc->set_int_param("lengthviarapidity", 0); - - // starts centered around IP - // shift backwards 30 cm for total 370 cm length to cover -1.5set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - ztemp = radius / TMath::Tan(theta2); - layer_shift = -1. * (ztemp - (thislength / 2.)); - cemc->set_double_param("place_z", layer_shift); - - cemc->SuperDetector("ABSORBER_CEMC"); - if (AbsorberActive) cemc->SetActive(); - cemc->OverlapCheck(OverlapCheck); - - g4Reco->registerSubsystem(cemc); - - radius += G4CEMC::tungs_width; - radius += no_overlapp; - - height += G4CEMC::tungs_width; - height += no_overlapp; //Added by Barak, 12/13/19 - - //Added by Barak, 12/13/19 - thislength = totalbottomlength + (height / TMath::Tan(theta1)) + (height / TMath::Tan(theta2)); - - cemc = new PHG4CylinderSubsystem("CEMC", thislayer); - cemc->set_double_param("radius", radius); - cemc->set_string_param("material", "PMMA"); - cemc->set_double_param("thickness", G4CEMC::scint_width); - cemc->set_int_param("lightyield", 1); - cemc->set_int_param("lengthviarapidity", 0); - cemc->set_double_param("length", thislength); - - // shift back -30 cm to cover -1.4set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - cemc->set_double_param("place_z", layer_shift); - - cemc->SuperDetector("CEMC"); - - cemc->SetActive(); - cemc->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cemc); - - radius += G4CEMC::scint_width; - radius += no_overlapp; - - height += G4CEMC::scint_width; - height += no_overlapp; //Added by Barak, 12/13/19 - } - - PHG4CylinderSubsystem *cemc_cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cemc_cyl->set_double_param("radius", radius); - cemc_cyl->set_string_param("material", "G4_TEFLON"); - cemc_cyl->set_double_param("thickness", G4CEMC::electronics_width); - - double l1 = (radius + 0.5) / TMath::Tan(theta1); - double l2 = (radius + 0.5) / TMath::Tan(theta2); - cemc_cyl->set_int_param("lengthviarapidity", 0); - cemc_cyl->set_double_param("length", l1 + l2); - // shift back -30 cm to cover -1.4set_double_param("place_z", -30); - - //Modified by Barak, 12/12/19 - layer_shift = -1. * ((l2 - l1) / 2.); - cemc_cyl->set_double_param("place_z", layer_shift); - - if (AbsorberActive) cemc_cyl->SetActive(); - cemc_cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cemc_cyl); - // update black hole settings since we have the values here - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + G4CEMC::electronics_width); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, layer_shift + (l1 + l2) / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, layer_shift - (l1 + l2) / 2.); - - return radius; -} - -void CEMC_Cells() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - double radius = 95; - for (int i = G4CEMC::min_cemc_layer; i <= G4CEMC::max_cemc_layer; i++) - { - //Added by Barak, 12/13/19 - radius += (G4CEMC::tungs_width + no_overlapp); - if (i > 1) radius += (G4CEMC::scint_width + no_overlapp); - - cemc_cells->cellsize(i, 2. * M_PI / 256. * radius, 2. * M_PI / 256. * radius); - } - se->registerSubsystem(cemc_cells); - - return; -} - -void CEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - RawTowerBuilder *CemcTowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - CemcTowerBuilder->Detector("CEMC"); - CemcTowerBuilder->set_sim_tower_node_prefix("SIM"); - if (isfinite(CEMC_TOWER::emin)) - { - CemcTowerBuilder->EminCut(CEMC_TOWER::emin); - } - CemcTowerBuilder->Verbosity(verbosity); - se->registerSubsystem(CemcTowerBuilder); - - const double photoelectron_per_GeV = 500; // 500 photon per total GeV deposition - // just set a 4% sampling fraction - already tuned by tungs/scint width ratio - double sampling_fraction = 4e-02; - RawTowerDigitizer *CemcTowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); - CemcTowerDigitizer->Detector("CEMC"); - CemcTowerDigitizer->Verbosity(verbosity); - CemcTowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); - CemcTowerDigitizer->set_pedstal_central_ADC(0); - CemcTowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - CemcTowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error - CemcTowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - CemcTowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting - se->registerSubsystem(CemcTowerDigitizer); - - RawTowerCalibration *CemcTowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - CemcTowerCalibration->Detector("CEMC"); - CemcTowerCalibration->Verbosity(verbosity); - CemcTowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) - { - CemcTowerCalibration->set_calib_const_GeV_ADC(1.0 / 0.023); // 2.3% sampling fraction from test beam - } - else - { - CemcTowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); - } - CemcTowerCalibration->set_pedstal_ADC(0); - - se->registerSubsystem(CemcTowerCalibration); - - return; -} - -void CEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) - { - RawClusterBuilderTemplate *cemc_clusterbuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - - cemc_clusterbuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; - cemc_clusterbuilder->LoadProfile(femc_prof); - se->registerSubsystem(cemc_clusterbuilder); - } - else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) - { - RawClusterBuilderGraph *cemc_clusterbuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); - cemc_clusterbuilder->Detector("CEMC"); - cemc_clusterbuilder->Verbosity(verbosity); - se->registerSubsystem(cemc_clusterbuilder); - } - else - { - cout << "CEMC_Clusters - unknown clusterizer setting!! " << endl; - exit(1); - } - 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.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - return; -} -#endif diff --git a/common/G4_DIRC.C b/common/G4_DIRC.C deleted file mode 100644 index 65cc51152..000000000 --- a/common/G4_DIRC.C +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef MACRO_G4DIRC_C -#define MACRO_G4DIRC_C - -#include - -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -/*! - * \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 $ - */ - -namespace Enable -{ - bool DIRC = false; - bool DIRC_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4DIRC -{ - double radiator_R = 83.65; - double length = 400; - double z_shift = -75; //115 - double z_start = z_shift + length / 2.; - double z_end = z_shift - length / 2.; - double outer_skin_radius = 89.25; -} // namespace G4DIRC - -void DIRCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4DIRC::outer_skin_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4DIRC::z_start); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4DIRC::z_end); -} - -//! 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) -{ - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::DIRC_OVERLAPCHECK; - - PHG4SectorSubsystem *dirc; - dirc = new PHG4SectorSubsystem("DIRC"); - dirc->get_geometry().set_normal_polar_angle(M_PI / 2); - dirc->get_geometry().set_normal_start(83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(G4DIRC::radiator_R, G4DIRC::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_double_param("length", G4DIRC::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", G4DIRC::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", G4DIRC::outer_skin_radius - 0.076); - cyl->set_double_param("length", G4DIRC::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", G4DIRC::z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(OverlapCheck); - - g4Reco->registerSubsystem(cyl); - - // Done - return G4DIRC::outer_skin_radius; -} -#endif diff --git a/common/G4_DSTReader_EICDetector.C b/common/G4_DSTReader_EICDetector.C deleted file mode 100644 index b2d4adcfa..000000000 --- a/common/G4_DSTReader_EICDetector.C +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef MACRO_G4DSTREADEREICDETECTOR_C -#define MACRO_G4DSTREADEREICDETECTOR_C - -#include - -#include -#include -#include -#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 G4DSTreader_EICDetectorInit() {} -void G4DSTreader_EICDetector(const string &outputFile = "G4sPHENIXCells.root") -{ - //! debug output on screen? - 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::PIPE && Enable::PIPE_ABSORBER) - { - ana->AddNode("PIPE"); - } - if (Enable::BARREL) - { - if (G4BARREL::SETTING::BARRELV5 ||G4BARREL::SETTING::BARRELV6) { - int nLayer1 = 3; //barrel 1 - int nLayer2 = 2; //barrel 2 - if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC - int nLayer[2]={nLayer1,nLayer2}; - - for (int n=0;n<2;n++) - { - for (int i;iAddNode(Form("BARREL%d_%d",n,i)); - } - } - } - else - { - int nLayer=5; - if (G4BARREL::SETTING::BARRELV4) nLayer=6; - for (int i;iAddNode(Form("BARREL%d",i)); - } - } - } - if (Enable::MVTX) - { - ana->AddNode("MVTX"); - } - if (Enable::TPC) - { - ana->AddNode("TPC"); - } - - if (Enable::EGEM) - { - ana->AddNode("EGEM_0"); - ana->AddNode("EGEM_1"); - ana->AddNode("EGEM_2"); - ana->AddNode("EGEM_3"); - } - if (Enable::FGEM) - { - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - if (Enable::FST) - { - ana->AddNode("FST_0"); - ana->AddNode("FST_1"); - ana->AddNode("FST_2"); - ana->AddNode("FST_3"); - ana->AddNode("FST_4"); - if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) - { - ana->AddNode("FST_5"); - } - } - - if (Enable::CEMC) - { - ana->AddNode("CEMC"); - if (Enable::ABSORBER || Enable::CEMC_ABSORBER) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS_0"); - } - } - - if (Enable::HCALIN) - { - ana->AddNode("HCALIN"); - if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) - { - ana->AddNode("ABSORBER_HCALIN"); - ana->AddNode("HCALIN_SPT"); - } - } - - 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::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } - - if (Enable::EEMC) - { - ana->AddNode("EEMC"); - } - if (Enable::DIRC) - { - ana->AddNode("DIRC"); - } - if (Enable::RICH) - { - ana->AddNode("RICH"); - } - - 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"); - } - if (Enable::FHCAL_TOWER) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (Enable::FEMC_TOWER) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - if (Enable::EEMC_TOWER) - { - 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); -} -#endif diff --git a/common/G4_DSTReader_fsPHENIX.C b/common/G4_DSTReader_fsPHENIX.C deleted file mode 100644 index 0c06bccc8..000000000 --- a/common/G4_DSTReader_fsPHENIX.C +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef MACRO_G4DSTREADERFSPHENIX_C -#define MACRO_G4DSTREADERFSPHENIX_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 G4DSTreader_fsPHENIXInit() {} - -void G4DSTreader_fsPHENIX(const string &outputFile = "G4sPHENIXCells.root") -{ - //! debug output on screen? - 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::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::FHCAL) - { - ana->AddNode("FHCAL"); - if (Enable::ABSORBER || Enable::FHCAL_ABSORBER) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (Enable::FEMC) - { - ana->AddNode("FEMC"); - if (Enable::ABSORBER || Enable::FEMC_ABSORBER) - ana->AddNode("ABSORBER_FEMC"); - } - - if (Enable::FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - 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"); - } - if (Enable::FHCAL_TOWER) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (Enable::FEMC_TOWER) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - - // Jets disabled for now - // if (Enable::JETS) - // { - // - // 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_EEMC.C b/common/G4_EEMC.C deleted file mode 100644 index f5f8b18f0..000000000 --- a/common/G4_EEMC.C +++ /dev/null @@ -1,222 +0,0 @@ -#ifndef MACRO_G4EEMC_C -#define MACRO_G4EEMC_C - -#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 EEMC = false; - bool EEMC_ABSORBER = false; - bool EEMC_CELL = false; - bool EEMC_TOWER = false; - bool EEMC_CLUSTER = false; - bool EEMC_EVAL = false; - bool EEMC_OVERLAPCHECK = false; - int EEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4EEMC -{ - int use_projective_geometry = 0; - double Gdz = 18. + 0.0001; - double Gz0 = -170.; - // 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_Eemc_clusterizer - { - kEemcGraphClusterizer, - kEemcTemplateClusterizer - }; - //default template clusterizer, as developed by Sasha Bazilevsky - enu_Eemc_clusterizer Eemc_clusterizer = kEemcTemplateClusterizer; - // graph clusterizer - //enu_Eemc_clusterizer Eemc_clusterizer = kEemcGraphClusterizer; - -} // namespace G4EEMC - -void EEMCInit() -{ - if (G4EEMC::use_projective_geometry) - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 81.); - } - else - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 65.6); - } - // from towerMap_EEMC_v006.txt - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4EEMC::Gz0 - G4EEMC::Gdz / 2.); -} - -void EEMCSetup(PHG4Reco *g4Reco) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::EEMC_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::EEMC_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - /** Use dedicated EEMC module */ - PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); - eemc->SuperDetector("EEMC"); - eemc->SetActive(); - if (AbsorberActive) - { - eemc->SetAbsorberActive(); - } - - /* path to central copy of calibrations repository */ - ostringstream mapping_eemc; - - /* Use non-projective geometry */ - if (!G4EEMC::use_projective_geometry) - { - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.txt"; - eemc->set_string_param("mappingtower", mapping_eemc.str()); - } - - /* use projective geometry */ - else - { - cout << "The projective version has serious problems with overlaps" << endl; - cout << "Do Not Use!" << endl; - cout << "If you insist, copy G4_EEMC.C locally and comment out this exit" << endl; - gSystem->Exit(1); - ostringstream mapping_eemc_4x4construct; - - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/crystals_v005.txt"; - mapping_eemc_4x4construct << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/4_by_4_construction_v005.txt"; - eemc->SetProjectiveGeometry(mapping_eemc.str(), mapping_eemc_4x4construct.str()); - } - - eemc->OverlapCheck(OverlapCheck); - - /* register Ecal module */ - g4Reco->registerSubsystem(eemc); -} - -void EEMC_Cells() -{ -} - -void EEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_eemc; - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v006.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(G4EEMC::TowerDigi); - 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); - if (G4EEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) - { - TowerCalibration_EEMC->set_calib_const_GeV_ADC(1.); - } - else - { - 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 = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EEMCRawClusterBuilderTemplate"); - - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); - } - else if (G4EEMC::Eemc_clusterizer == G4EEMC::kEemcGraphClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "EEMC_Clusters - unknown clusterizer setting " << G4EEMC::Eemc_clusterizer << endl; - gSystem->Exit(1); - } - return; -} - -void EEMC_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::EEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} -#endif diff --git a/common/G4_FEMC.C b/common/G4_FEMC.C deleted file mode 100644 index 5311458bd..000000000 --- a/common/G4_FEMC.C +++ /dev/null @@ -1,261 +0,0 @@ -#ifndef MACRO_G4FEMC_C -#define MACRO_G4FEMC_C - -#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 FEMC = false; - bool FEMC_ABSORBER = false; - bool FEMC_CELL = false; - bool FEMC_TOWER = false; - bool FEMC_CLUSTER = false; - bool FEMC_EVAL = false; - bool FEMC_OVERLAPCHECK = false; - int FEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4FEMC -{ - // from ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt - double Gz0 = 305.; - double Gdz = 40.; - double outer_radius = 180.; - string calibfile = "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - enum enu_Femc_clusterizer - { - kFemcGraphClusterizer, - kFemcTemplateClusterizer - }; - - //template clusterizer, as developed by Sasha Bazilevsky - enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; - // graph clusterizer - //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; -} // namespace G4FEMC - -void FEMCInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); -} - -void FEMCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER || (absorberactive > 0); - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); - mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - - // cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile(mapping_femc.str()); - femc->OverlapCheck(OverlapCheck); - femc->SetActive(); - femc->SuperDetector("FEMC"); - if (AbsorberActive) femc->SetAbsorberActive(AbsorberActive); - - g4Reco->registerSubsystem(femc); -} - -void FEMC_Cells() -{ - return; -} - -void FEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << G4FEMC::calibfile; - - 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 ); - - // E864 towers (three types for three sizes) - RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); - TowerDigitizer3->Detector("FEMC"); - TowerDigitizer3->TowerType(3); - TowerDigitizer3->Verbosity(verbosity); - TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer3); - - RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); - TowerDigitizer4->Detector("FEMC"); - TowerDigitizer4->TowerType(4); - TowerDigitizer4->Verbosity(verbosity); - TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer4); - - RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); - TowerDigitizer5->Detector("FEMC"); - TowerDigitizer5->TowerType(5); - TowerDigitizer5->Verbosity(verbosity); - TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer5); - - RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); - TowerDigitizer6->Detector("FEMC"); - TowerDigitizer6->TowerType(6); - TowerDigitizer6->Verbosity(verbosity); - TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem(TowerDigitizer6); - - // 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 ); - - // E864 towers (three types for three sizes) - RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); - TowerCalibration3->Detector("FEMC"); - TowerCalibration3->TowerType(3); - TowerCalibration3->Verbosity(verbosity); - TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration3->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration3->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration3); - - RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); - TowerCalibration4->Detector("FEMC"); - TowerCalibration4->TowerType(4); - TowerCalibration4->Verbosity(verbosity); - TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration4->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration4->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration4); - - RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); - TowerCalibration5->Detector("FEMC"); - TowerCalibration5->TowerType(5); - TowerCalibration5->Verbosity(verbosity); - TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration5->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration5->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration5); - - RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); - TowerCalibration6->Detector("FEMC"); - TowerCalibration6->TowerType(6); - TowerCalibration6->Verbosity(verbosity); - TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration6->set_calib_const_GeV_ADC(1.0 / 0.030); // sampling fraction = 0.030 - TowerCalibration6->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration6); -} - -void FEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; - exit(1); - } - - return; -} - -void FEMC_Eval(std::string outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} -#endif diff --git a/common/G4_FEMC_EIC.C b/common/G4_FEMC_EIC.C deleted file mode 100644 index 7db6e4244..000000000 --- a/common/G4_FEMC_EIC.C +++ /dev/null @@ -1,312 +0,0 @@ -#ifndef MACRO_G4FEMCEIC_C -#define MACRO_G4FEMCEIC_C - -#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 FEMC = false; - bool FEMC_ABSORBER = false; - bool FEMC_CELL = false; - bool FEMC_TOWER = false; - bool FEMC_CLUSTER = false; - bool FEMC_EVAL = false; - bool FEMC_OVERLAPCHECK = false; - int FEMC_VERBOSITY = 0; -} // namespace Enable - -namespace G4FEMC -{ - // from ForwardEcal/mapping/towerMap_FEMC_v007.txt - const double Gz0 = 310.; - const double Gdz = 36.5; - const double outer_radius = 182.655; - enum enu_Femc_clusterizer - { - kFemcGraphClusterizer, - kFemcTemplateClusterizer - }; - //template clusterizer, as developed by Sasha Bazilevsky - enu_Femc_clusterizer Femc_clusterizer = kFemcTemplateClusterizer; - // graph clusterizer - //enu_Femc_clusterizer Femc_clusterizer = kFemcGraphClusterizer; - namespace SETTING - { - bool FullEtaAcc = false; - bool fsPHENIX = false; - bool EC2x = false; - } // namespace SETTING -} // namespace G4FEMC - -void FEMCInit() -{ - // simple way to check if only 1 of the settings is true - if ((G4FEMC::SETTING::FullEtaAcc ? 1 : 0) + (G4FEMC::SETTING::fsPHENIX ? 1 : 0) > 1) - { - cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::fsPHENIX=true" << endl; - gSystem->Exit(1); - } - - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FEMC::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FEMC::Gz0 + G4FEMC::Gdz / 2.); -} - -void FEMCSetup(PHG4Reco *g4Reco) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::FEMC_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FEMC_OVERLAPCHECK; - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // PbScint ECAL with nominal eta coverage - if (G4FEMC::SETTING::FullEtaAcc) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; - } - // doubled granularity ECAL - else if (G4FEMC::SETTING::EC2x) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; - } - // fsPHENIX ECAL - else if (G4FEMC::SETTING::fsPHENIX) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - } - // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - else - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.txt"; - } - cout << mapping_femc.str() << endl; - femc->SetTowerMappingFile(mapping_femc.str()); - femc->OverlapCheck(OverlapCheck); - femc->SetActive(); - femc->SuperDetector("FEMC"); - if (AbsorberActive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem(femc); -} - -void FEMC_Cells() -{ - return; -} - -void FEMC_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // // fsPHENIX ECAL - // mapping_femc << getenv("CALIBRATIONROOT") << - // "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - // PbScint ECAL with nominal eta coverage - if (G4FEMC::SETTING::FullEtaAcc) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fullEtaCov.txt"; - } - // doubled granularity ECAL - else if (G4FEMC::SETTING::EC2x) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_2x.txt"; - } - // fsPHENIX ECAL - else if (G4FEMC::SETTING::fsPHENIX) - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v004.txt"; - } - // PbScint ECAL with enlarged beam pipe opening for Mar 2020 beam pipe - else - { - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v007.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); - - // // E864 towers (three types for three sizes) - // RawTowerDigitizer *TowerDigitizer3 = new RawTowerDigitizer("FEMCRawTowerDigitizer3"); - // TowerDigitizer3->Detector("FEMC"); - // TowerDigitizer3->TowerType(3); - // TowerDigitizer3->Verbosity(verbosity); - // TowerDigitizer3->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer3 ); - // - // RawTowerDigitizer *TowerDigitizer4 = new RawTowerDigitizer("FEMCRawTowerDigitizer4"); - // TowerDigitizer4->Detector("FEMC"); - // TowerDigitizer4->TowerType(4); - // TowerDigitizer4->Verbosity(verbosity); - // TowerDigitizer4->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer4 ); - // - // RawTowerDigitizer *TowerDigitizer5 = new RawTowerDigitizer("FEMCRawTowerDigitizer5"); - // TowerDigitizer5->Detector("FEMC"); - // TowerDigitizer5->TowerType(5); - // TowerDigitizer5->Verbosity(verbosity); - // TowerDigitizer5->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer5 ); - // - // RawTowerDigitizer *TowerDigitizer6 = new RawTowerDigitizer("FEMCRawTowerDigitizer6"); - // TowerDigitizer6->Detector("FEMC"); - // TowerDigitizer6->TowerType(6); - // TowerDigitizer6->Verbosity(verbosity); - // TowerDigitizer6->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - // se->registerSubsystem( TowerDigitizer6 ); - - // 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); - - // // E864 towers (three types for three sizes) - // RawTowerCalibration *TowerCalibration3 = new RawTowerCalibration("FEMCRawTowerCalibration3"); - // TowerCalibration3->Detector("FEMC"); - // TowerCalibration3->TowerType(3); - // TowerCalibration3->Verbosity(verbosity); - // TowerCalibration3->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration3->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration3->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration3 ); - // - // RawTowerCalibration *TowerCalibration4 = new RawTowerCalibration("FEMCRawTowerCalibration4"); - // TowerCalibration4->Detector("FEMC"); - // TowerCalibration4->TowerType(4); - // TowerCalibration4->Verbosity(verbosity); - // TowerCalibration4->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration4->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration4->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration4 ); - // - // RawTowerCalibration *TowerCalibration5 = new RawTowerCalibration("FEMCRawTowerCalibration5"); - // TowerCalibration5->Detector("FEMC"); - // TowerCalibration5->TowerType(5); - // TowerCalibration5->Verbosity(verbosity); - // TowerCalibration5->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration5->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration5->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration5 ); - // - // RawTowerCalibration *TowerCalibration6 = new RawTowerCalibration("FEMCRawTowerCalibration6"); - // TowerCalibration6->Detector("FEMC"); - // TowerCalibration6->TowerType(6); - // TowerCalibration6->Verbosity(verbosity); - // TowerCalibration6->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration6->set_calib_const_GeV_ADC(1.0/0.030); // sampling fraction = 0.030 - // TowerCalibration6->set_pedstal_ADC(0); - // se->registerSubsystem( TowerCalibration6 ); -} - -void FEMC_Clusters() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplateFEMC"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.020); // This threshold should be the same as in FEMCprof_Thresh**.root file below - std::string femc_prof = getenv("CALIBRATIONROOT"); - femc_prof += "/EmcProfile/FEMCprof_Thresh20MeV.root"; - ClusterBuilder->LoadProfile(femc_prof.c_str()); - se->registerSubsystem(ClusterBuilder); - } - else if (G4FEMC::Femc_clusterizer == G4FEMC::kFemcGraphClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.010); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "FEMC_Clusters - unknown clusterizer setting!" << endl; - exit(1); - } - - return; -} - -void FEMC_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FEMC_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} -#endif diff --git a/common/G4_FGEM_fsPHENIX.C b/common/G4_FGEM_fsPHENIX.C deleted file mode 100644 index a6737a42d..000000000 --- a/common/G4_FGEM_fsPHENIX.C +++ /dev/null @@ -1,354 +0,0 @@ -#ifndef MACRO_G4FGEMFSPHENIX_C -#define MACRO_G4FGEMFSPHENIX_C - -#include - -#include -#include - -#include - -#include - -#include -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) - -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8); -void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); - -namespace Enable -{ - bool FGEM = false; - bool FGEM_OVERLAPCHECK = false; - bool FGEM_TRACK = false; - bool FGEM_EVAL = false; - int FGEM_VERBOSITY = 0; -} // namespace Enable - -void FGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 130.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 280.); - TRACKING::TrackNodeName = "SvtxTrackMap"; // node name for tracks -} - -void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // -) -{ - const double tilt = .1; - - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; - - 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); - - 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); - - 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); - - 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; - - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FGEM_OVERLAPCHECK; - - 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); - - 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); - return 0; -} - -void FGEM_FastSim_Reco() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(verbosity); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name(TRACKING::TrackNodeName); - - // MAPS in MVTX detector - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM0, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_0", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM1, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_1", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // TPC - kalman->add_phg4hits( - "G4HIT_TPC", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // GEM2, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_2", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM3, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_3", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - // GEM4, 70um azimuthal resolution, 1cm radial strips - kalman->add_phg4hits( - "G4HIT_FGEM_4", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - - // Saved track states (projections) - - if (Enable::FEMC) - { - kalman->add_state_name("FEMC"); - } - if (Enable::FHCAL) - { - kalman->add_state_name("FHCAL"); - } - se->registerSubsystem(kalman); -} - -void FGEM_FastSim_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FGEM_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); - fast_sim_eval->set_filename(outputfile); - se->registerSubsystem(fast_sim_eval); - - return; -} -#endif diff --git a/common/G4_FHCAL.C b/common/G4_FHCAL.C deleted file mode 100644 index 16f46f065..000000000 --- a/common/G4_FHCAL.C +++ /dev/null @@ -1,352 +0,0 @@ -#ifndef MACRO_G4FHCAL_C -#define MACRO_G4FHCAL_C - -#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 FHCAL = false; - bool FHCAL_ABSORBER = false; - bool FHCAL_CELL = false; - bool FHCAL_TOWER = false; - bool FHCAL_CLUSTER = false; - bool FHCAL_EVAL = false; - bool FHCAL_OVERLAPCHECK = false; - int FHCAL_VERBOSITY = 0; -} // namespace Enable - -namespace G4FHCAL -{ - // from ForwardHcal/mapping/towerMap_FHCAL_v005.txt - double Gz0 = 400.; - double Gdz = 100.; - double outer_radius = 262.; - enum enu_FHcal_clusterizer - { - kFHcalGraphClusterizer, - kFHcalTemplateClusterizer - }; - //template clusterizer, as developed by Sasha Bazilevsky - enu_FHcal_clusterizer FHcal_clusterizer = kFHcalTemplateClusterizer; - // graph clusterizer - //enu_FHcal_clusterizer FHcal_clusterizer = kFHcalGraphClusterizer; - namespace SETTING - { - bool FullEtaAcc = false; - bool HC2x = false; - bool HC4x = false; - bool towercalib1 = false; - bool towercalibSiPM = false; - bool towercalibHCALIN = false; - bool towercalib3 = false; - } // namespace SETTING -} // namespace G4FHCAL - -void FHCALInit() -{ - // simple way to check if only 1 of the settings is true - if ((G4FHCAL::SETTING::FullEtaAcc ? 1 : 0) + (G4FHCAL::SETTING::HC4x ? 1 : 0) + (G4FHCAL::SETTING::HC2x ? 1 : 0) > 1) - { - cout << "use only G4FHCAL::SETTING::FullEtaAcc=true or G4FHCAL::SETTING::HC2x=true or G4FHCAL::SETTING::HC4x=true" << endl; - gSystem->Exit(1); - } - if ((G4FHCAL::SETTING::towercalib1 ? 1 : 0) + (G4FHCAL::SETTING::towercalibSiPM ? 1 : 0) + - (G4FHCAL::SETTING::towercalibHCALIN ? 1 : 0) + (G4FHCAL::SETTING::towercalib3 ? 1 : 0) > - 1) - { - cout << "use only G4FHCAL::SETTING::towercalib1 = true or G4FHCAL::SETTING::towercalibSiPM = true" - << " or G4FHCAL::SETTING::towercalibHCALIN = true or G4FHCAL::SETTING::towercalib3 = true" << endl; - gSystem->Exit(1); - } - - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4FHCAL::outer_radius); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4FHCAL::Gz0 + G4FHCAL::Gdz / 2.); -} - -void FHCALSetup(PHG4Reco *g4Reco) -{ - const bool AbsorberActive = Enable::ABSORBER || Enable::FHCAL_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FHCAL_OVERLAPCHECK; - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FHCAL module */ - PHG4ForwardHcalSubsystem *fhcal = new PHG4ForwardHcalSubsystem("FHCAL"); - - ostringstream mapping_fhcal; - - // Switch to desired calo setup - // HCal Fe-Scint with doubled granularity - if (G4FHCAL::SETTING::HC2x ) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; - } - // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; - } - // HCal Fe-Scint with four times granularity - else if (G4FHCAL::SETTING::HC4x ) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; - } - // full HCal Fe-Scint with nominal acceptance four times granularity - else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; - } - // full HCal Fe-Scint with nominal acceptance - else if (G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; - } - // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe - else - { - mapping_fhcal << getenv("CALIBRATIONROOT") - << "/ForwardHcal/mapping/towerMap_FHCAL_v005.txt"; - } - - fhcal->SetTowerMappingFile(mapping_fhcal.str()); - fhcal->OverlapCheck(OverlapCheck); - fhcal->SetActive(); - fhcal->SuperDetector("FHCAL"); - if (AbsorberActive) fhcal->SetAbsorberActive(); - - g4Reco->registerSubsystem(fhcal); -} - -void FHCAL_Cells(int verbosity = 0) -{ - return; -} - -void FHCAL_Towers() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_fhcal; - - // Switch to desired calo setup - // HCal Fe-Scint with doubled granularity - if (G4FHCAL::SETTING::HC2x ) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x.txt"; - } - // full HCal Fe-Scint with nominal acceptance doubled granularity - else if (G4FHCAL::SETTING::HC2x && G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_2x_fullEtaCov.txt"; - } - // HCal Fe-Scint with four times granularity - else if (G4FHCAL::SETTING::HC4x ) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x.txt"; - } - // full HCal Fe-Scint with nominal acceptance four times granularity - else if (G4FHCAL::SETTING::HC4x && G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_4x_fullEtaCov.txt"; - } - // full HCal Fe-Scint with nominal acceptance - else if (G4FHCAL::SETTING::FullEtaAcc) - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_default_fullEtaCov.txt"; - } - // full HCal Fe-Scint with enlarged beam pipe opening for Mar 2020 beam pipe - else - { - mapping_fhcal << getenv("CALIBRATIONROOT") << "/ForwardHcal/mapping/towerMap_FHCAL_v005.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); - - // enable usage of different tower calibrations for systematic studies - if (G4FHCAL::SETTING::towercalib1) - { - cout << "1: using towercalib1 for FHCAL towers" << endl; - 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::kSiPM_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); - } - else if (G4FHCAL::SETTING::towercalibSiPM) - { - //from https://sphenix-collaboration.github.io/doxygen/d4/d58/Fun4All__G4__Prototype4_8C_source.html - const double sampling_fraction = 0.019441; // +/- 0.019441 from 0 Degree indenting 12 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 - - cout << "2: using towercalibSiPM for FHCAL towers" << endl; - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - TowerDigitizer->Detector("FHCAL"); - TowerDigitizer->set_raw_tower_node_prefix("RAW"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSiPM_photon_digitization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); - 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); - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); - TowerCalibration->Detector("FHCAL"); - TowerCalibration->set_raw_tower_node_prefix("RAW"); - 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); - } - else if (G4FHCAL::SETTING::towercalibHCALIN) - { - const double visible_sample_fraction_HCALIN = 7.19505e-02; // 1.34152e-02 - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - TowerDigitizer->Detector("FHCAL"); - TowerDigitizer->set_raw_tower_node_prefix("RAW"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); - 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); - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); - TowerCalibration->Detector("FHCAL"); - TowerCalibration->set_raw_tower_node_prefix("RAW"); - 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); - } - else if (G4FHCAL::SETTING::towercalib3) - { - cout << "3: using towercalib3 for FHCAL towers" << endl; - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - TowerDigitizer->Detector("FHCAL"); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - 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); - } - else - { - cout << "def: using default for FHCAL towers" << endl; - 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 = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) - { - RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("FHCALRawClusterBuilderTemplate"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->SetPlanarGeometry(); // has to be called after Detector() - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem(ClusterBuilder); - } - else if (G4FHCAL::FHcal_clusterizer == G4FHCAL::kFHcalTemplateClusterizer) - { - RawClusterBuilderFwd *ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem(ClusterBuilder); - } - else - { - cout << "FHCAL_Clusters - unknown clusterizer setting " << G4FHCAL::FHcal_clusterizer << endl; - gSystem->Exit(1); - } - - return; -} - -void FHCAL_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FHCAL_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} -#endif diff --git a/common/G4_FST_EIC.C b/common/G4_FST_EIC.C deleted file mode 100644 index 9a821f129..000000000 --- a/common/G4_FST_EIC.C +++ /dev/null @@ -1,224 +0,0 @@ -/*---------------------------------------------------------------------* - * Barrel tracker designed by LANL EIC team * - * See technical notes for details: arXiv:2009.02888 * - * Contact Ping and Xuan @LANL for questions: * - * Xuan: xuanli@lanl.gov * - * Ping: cpwong@lanl.gov * - *---------------------------------------------------------------------*/ - -#ifndef MACRO_G4FSTEIC_C -#define MACRO_G4FSTEIC_C - -#include "GlobalVariables.C" - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, double zpos, double Rmin, - double Rmax, double tSilicon); -//-----------------------------------------------------------------------------------// -namespace Enable -{ - static bool FST = false; - bool FST_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4FST -{ - namespace SETTING - { - bool FSTV0 = false; - bool FSTV1 = false; - bool FSTV2 = false; - bool FSTV3 = false; - bool FSTV41 = false; - bool FSTV42 = false; - bool FSTV4 = false; - bool FSTV5 = false; - bool FST_TPC = false; - } // namespace SETTING -} // namespace G4FST - -//-----------------------------------------------------------------------------------// -void FST_Init() -{ - if ((G4FST::SETTING::FSTV0 ? 1 : 0) + - (G4FST::SETTING::FSTV1 ? 1 : 0) + - (G4FST::SETTING::FSTV2 ? 1 : 0) + - (G4FST::SETTING::FSTV3 ? 1 : 0) + - (G4FST::SETTING::FSTV4 ? 1 : 0) + - (G4FST::SETTING::FSTV41 ? 1 : 0) + - (G4FST::SETTING::FSTV42 ? 1 : 0) + - (G4FST::SETTING::FSTV5 ? 1 : 0) + - (G4FST::SETTING::FST_TPC ? 1 : 0) > - 1) - { - cout << "use only G4FST::SETTING::FSTV0=true "; - cout << "or G4FST::SETTING::FSTV1=true "; - cout << "or G4FST::SETTING::FSTV2=true "; - cout << "or G4FST::SETTING::FSTV3=true "; - cout << "or G4FST::SETTING::FSTV4=true "; - cout << "or G4FST::SETTING::FSTV41=true "; - cout << "or G4FST::SETTING::FSTV42=true "; - cout << "or G4FST::SETTING::FSTV5=true "; - cout << "or G4FST::SETTING::FST_TPC=true " << endl; - gSystem->Exit(1); - } - - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 45.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); -} -//-----------------------------------------------------------------------------------// -void FSTSetup(PHG4Reco *g4Reco, const double min_eta = 1.245) -{ - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - - //Design from Xuan Li @LANL - // Different FST version documented in arXiv:2009.0288 - if (G4FST::SETTING::FSTV1) - { // version 1 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); - } - else if (G4FST::SETTING::FSTV2) - { // version 2 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); - make_LANL_FST_station("FST_4", g4Reco, 270, 6.5, 45, 50 * um); - } - else if (G4FST::SETTING::FSTV3) - { // version 3 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); - } - else if (G4FST::SETTING::FSTV41) - { // version 4.1 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); - } - else if (G4FST::SETTING::FSTV42) - { // version 4.2 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 100 * um); - } - else if (G4FST::SETTING::FSTV4) - { // version 4 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 50 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 36, 50 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 50 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 50 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 50 * um); - make_LANL_FST_station("FST_5", g4Reco, 270, 15, 45, 50 * um); - } - else if (G4FST::SETTING::FSTV5) - { - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 25, 35 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 62.3, 4.5, 42, 35 * um); - make_LANL_FST_station("FST_2", g4Reco, 90, 6.5, 43, 35 * um); - make_LANL_FST_station("FST_3", g4Reco, 115, 8.9, 44, 85 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85 * um); - make_LANL_FST_station("FST_5", g4Reco, 300, 16.8, 45, 85 * um); //optional disk at further location - } - else if (G4FST::SETTING::FST_TPC) - { // tpc version (based on version 4) - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 17, 35 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 17, 35 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 17, 35 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 7.5, 17, 85 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 9.5, 45, 85 * um); - //make_LANL_FST_station("FST_5", g4Reco, 280, 16, 45, 50 * um); //optional disk at further location - } - else - { // Version 0 - make_LANL_FST_station("FST_0", g4Reco, 35, 4, 30, 100 * um); //cm - make_LANL_FST_station("FST_1", g4Reco, 53, 4.5, 35, 100 * um); - make_LANL_FST_station("FST_2", g4Reco, 77, 5, 36, 100 * um); - make_LANL_FST_station("FST_3", g4Reco, 101, 6, 38.5, 100 * um); - make_LANL_FST_station("FST_4", g4Reco, 125, 6.5, 45, 100 * um); - } -} -//-----------------------------------------------------------------------------------// -int make_LANL_FST_station(const string &name, PHG4Reco *g4Reco, - double zpos, double Rmin, double Rmax, double tSilicon) //silicon thickness -{ - const bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK; - // cout - // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " - // << name << endl; - - // always facing the interaction point - double polar_angle = 0; - if (zpos < 0) - { - zpos = -zpos; - polar_angle = M_PI; - } - - double min_polar_angle = atan2(Rmin, zpos); - double max_polar_angle = atan2(Rmax, zpos); - - if (max_polar_angle < min_polar_angle) - { - double t = max_polar_angle; - max_polar_angle = min_polar_angle; - min_polar_angle = t; - } - - PHG4SectorSubsystem *fst; - fst = new PHG4SectorSubsystem(name); - - fst->SuperDetector(name); - - fst->get_geometry().set_normal_polar_angle(polar_angle); - fst->get_geometry().set_normal_start(zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - fst->get_geometry().set_min_polar_angle(min_polar_angle); - fst->get_geometry().set_max_polar_angle(max_polar_angle); - fst->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::ConeEdge()); - fst->get_geometry().set_N_Sector(1); - fst->get_geometry().set_material("G4_AIR"); - fst->OverlapCheck(OverlapCheck); - - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - // build up layers - - fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100); - fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100); - fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100); - fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100); - fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100); - fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100); - fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100); - - g4Reco->registerSubsystem(fst); - return 0; -} - -#endif - -//-----------------------------------------------------------------------------------// diff --git a/common/G4_FwdJets.C b/common/G4_FwdJets.C deleted file mode 100644 index 998dffb6b..000000000 --- a/common/G4_FwdJets.C +++ /dev/null @@ -1,209 +0,0 @@ -#ifndef MACRO_G4FWDJETS_C -#define MACRO_G4FWDJETS_C - -// #include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4jets.so) -R__LOAD_LIBRARY(libg4eval.so) - -namespace Enable -{ - bool FWDJETS = false; - bool FWDJETS_EVAL = false; - int FWDJETS_VERBOSITY = 0; -} // namespace Enable - -void Jet_FwdRecoInit() {} - -void Jet_FwdReco() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_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.5), "AntiKt_Truth_r05"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Truth_r07"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Truth_r10"); - 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::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.5), "AntiKt_Tower_r05"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Tower_r07"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Tower_r10"); - 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::FEMC_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - 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.5), "AntiKt_Cluster_r05"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Cluster_r07"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Cluster_r10"); - clusterjetreco->set_algo_node("ANTIKT"); - clusterjetreco->set_input_node("CLUSTER"); - clusterjetreco->Verbosity(verbosity); - se->registerSubsystem(clusterjetreco); - - // tower jets - JetReco *towerjetrecofwd = new JetReco("TOWERJETRECOFWD"); - towerjetrecofwd->add_input(new TowerJetInput(Jet::FEMC_TOWER)); - towerjetrecofwd->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); - towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_TowerFwd_r05"); - towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_TowerFwd_r07"); - towerjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_TowerFwd_r10"); - towerjetrecofwd->set_algo_node("ANTIKT"); - towerjetrecofwd->set_input_node("TOWER"); - towerjetrecofwd->Verbosity(verbosity); - se->registerSubsystem(towerjetrecofwd); - - // cluster jets - JetReco *clusterjetrecofwd = new JetReco("CLUSTERJETRECOFWD"); - clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); - clusterjetrecofwd->add_input(new ClusterJetInput(Jet::FHCAL_CLUSTER)); - clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_ClusterFwd_r05"); - clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_ClusterFwd_r07"); - clusterjetrecofwd->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_ClusterFwd_r10"); - clusterjetrecofwd->set_algo_node("ANTIKT"); - clusterjetrecofwd->set_input_node("CLUSTER"); - clusterjetrecofwd->Verbosity(verbosity); - se->registerSubsystem(clusterjetrecofwd); - - - // // track jets - JetReco *trackjetreco = new JetReco("TRACKJETRECO"); - trackjetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Track_r05"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Track_r07"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 1.0), "AntiKt_Track_r10"); - trackjetreco->set_algo_node("ANTIKT"); - trackjetreco->set_input_node("TRACK"); - trackjetreco->Verbosity(verbosity); - se->registerSubsystem(trackjetreco); - - // // track jets - JetReco *fulljetreco = new JetReco("FULLJETRECO"); - fulljetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); - fulljetreco->add_input(new ClusterJetInput(Jet::FEMC_CLUSTER)); - fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Full_r05"); - fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Full_r07"); - fulljetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Full_r08"); - fulljetreco->set_algo_node("ANTIKT"); - fulljetreco->set_input_node("FULL"); - fulljetreco->Verbosity(verbosity); - se->registerSubsystem(fulljetreco); - - - return; -} - -void Jet_FwdEval(const std::string &outfilename = "g4fwdjets_eval.root") -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::FWDJETS_VERBOSITY); - Fun4AllServer *se = Fun4AllServer::instance(); - - JetEvaluator *evaltrk05 = new JetEvaluator("JETEVALUATORTRACK05","AntiKt_Track_r05", - "AntiKt_Truth_r05", "g4fwdjets_track_05_eval.root"); - evaltrk05->Verbosity(verbosity); - se->registerSubsystem(evaltrk05); - - JetEvaluator *evalfull05 = new JetEvaluator("JETEVALUATORFULL05","AntiKt_Full_r05", - "AntiKt_Truth_r05", "g4fwdjets_full_05_eval.root"); - evalfull05->Verbosity(verbosity); - se->registerSubsystem(evalfull05); - - JetEvaluator *evalt05 = new JetEvaluator("JETEVALUATORTOWER05","AntiKt_Tower_r05", - "AntiKt_Truth_r05", "g4fwdjets_tower_05_eval.root"); - evalt05->Verbosity(verbosity); - se->registerSubsystem(evalt05); - JetEvaluator *evalt07 = new JetEvaluator("JETEVALUATORTOWER07","AntiKt_Tower_r07", - "AntiKt_Truth_r07", "g4fwdjets_tower_07_eval.root"); - evalt07->Verbosity(verbosity); - se->registerSubsystem(evalt07); - JetEvaluator *evalt10 = new JetEvaluator("JETEVALUATORTOWER10","AntiKt_Tower_r10", - "AntiKt_Truth_r10", "g4fwdjets_tower_10_eval.root"); - evalt10->Verbosity(verbosity); - se->registerSubsystem(evalt10); - - JetEvaluator *evalc05 = new JetEvaluator("JETEVALUATORCLUSTER05", "AntiKt_Cluster_r05", - "AntiKt_Truth_r05", "g4fwdjets_cluster_05_eval.root"); - evalc05->Verbosity(verbosity); - se->registerSubsystem(evalc05); - - JetEvaluator *evalc07 = new JetEvaluator("JETEVALUATORCLUSTER07", "AntiKt_Cluster_r07", - "AntiKt_Truth_r07", "g4fwdjets_cluster_07_eval.root"); - evalc07->Verbosity(verbosity); - se->registerSubsystem(evalc07); - - JetEvaluator *evalc10 = new JetEvaluator("JETEVALUATORCLUSTER10", "AntiKt_Cluster_r10", - "AntiKt_Truth_r10", "g4fwdjets_cluster_10_eval.root"); - evalc10->Verbosity(verbosity); - se->registerSubsystem(evalc10); - - JetEvaluator *evaltfwd05 = new JetEvaluator("JETEVALUATORFWDTOWER05","AntiKt_TowerFwd_r05", - "AntiKt_Truth_r05", "g4fwdjets_TowerFwd_05_eval.root"); - evaltfwd05->Verbosity(verbosity); - se->registerSubsystem(evaltfwd05); - JetEvaluator *evaltfwd07 = new JetEvaluator("JETEVALUATORFWDTOWER07","AntiKt_TowerFwd_r07", - "AntiKt_Truth_r07", "g4fwdjets_TowerFwd_07_eval.root"); - evaltfwd07->Verbosity(verbosity); - se->registerSubsystem(evaltfwd07); - JetEvaluator *evaltfwd10 = new JetEvaluator("JETEVALUATORFWDTOWER10","AntiKt_TowerFwd_r10", - "AntiKt_Truth_r10", "g4fwdjets_TowerFwd_10_eval.root"); - evaltfwd10->Verbosity(verbosity); - se->registerSubsystem(evaltfwd10); - - JetEvaluator *evalcfwd05 = new JetEvaluator("JETEVALUATORFWDCLUSTER05", "AntiKt_ClusterFwd_r05", - "AntiKt_Truth_r05", "g4fwdjets_ClusterFwd_05_eval.root"); - evalcfwd05->Verbosity(verbosity); - se->registerSubsystem(evalcfwd05); - - JetEvaluator *evalcfwd07 = new JetEvaluator("JETEVALUATORFWDCLUSTER07", "AntiKt_ClusterFwd_r07", - "AntiKt_Truth_r07", "g4fwdjets_ClusterFwd_07_eval.root"); - evalcfwd07->Verbosity(verbosity); - se->registerSubsystem(evalcfwd07); - - JetEvaluator *evalcfwd10 = new JetEvaluator("JETEVALUATORFWDCLUSTER10", "AntiKt_ClusterFwd_r10", - "AntiKt_Truth_r10", "g4fwdjets_ClusterFwd_10_eval.root"); - evalcfwd10->Verbosity(verbosity); - se->registerSubsystem(evalcfwd10); - - // JetEvaluator *eval3 = new JetEvaluator("JETEVALUATOR3", - // "AntiKt_Full_r07", - // "AntiKt_Truth_r07", - // "g4fwdjets_full_07_eval.root"); - // eval3->Verbosity(verbosity); - // se->registerSubsystem(eval3); - - return; -} -#endif diff --git a/common/G4_GEM_EIC.C b/common/G4_GEM_EIC.C deleted file mode 100644 index 8a724e2bc..000000000 --- a/common/G4_GEM_EIC.C +++ /dev/null @@ -1,238 +0,0 @@ -#ifndef MACRO_G4GEMEIC_C -#define MACRO_G4GEMEIC_C - -#include - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -int make_GEM_station(string name, PHG4Reco *g4Reco, double zpos, double etamin, double etamax, const int N_Sector = 8); -void AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem); - -namespace Enable -{ - bool EGEM = false; - bool EGEM_FULL = true; - bool FGEM = false; - bool FGEM_ORIG = false; -} // namespace Enable - -void EGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 80.); - // extends only to -z - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -160.); -} - -void FGEM_Init() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 282.); -} - -void EGEMSetup(PHG4Reco *g4Reco) -{ - /* Careful with dimensions! If GEM station volumes overlap, e.g. with TPC volume, they will be - * drawn in event display but will NOT register any hits. - * - * Geometric constraints: - * TPC length = 211 cm --> from z = -105.5 to z = +105.5 - */ - float thickness = 3.; - if (Enable::EGEM_FULL){ - make_GEM_station("EGEM_0", g4Reco, -20.5 + thickness, -0.94, -1.95); - make_GEM_station("EGEM_1", g4Reco, -69.5 + thickness, -2.07, -3.21); - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); - } else { - make_GEM_station("EGEM_2", g4Reco, -137.0 + thickness, -1.4, -3.5); - make_GEM_station("EGEM_3", g4Reco, -160.0 + thickness, -1.5, -3.6); - } -} - -void FGEMSetup(PHG4Reco *g4Reco, const int N_Sector = 8, // - const double min_eta = 1.245 // -) -{ - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - if(Enable::FGEM_ORIG){ - make_GEM_station("FGEM_0", g4Reco, 17.5, 0.94, 1.95, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 66.5, 2.07, 3.20, N_Sector); - } - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - if(Enable::FGEM_ORIG){ - etamax = 3.3; - } - else{ - etamax = 2; - } - etamin = min_eta; - zpos = 134.0; - - gem = new PHG4SectorSubsystem(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(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(Enable::OVERLAPCHECK); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_3"; - etamax = 3.3; - etamin = min_eta; - zpos = 157.0; - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - zpos = zpos - (zpos * sin(tilt) + zpos * cos(tilt) * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax) - 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(etamax)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - 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(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(Enable::OVERLAPCHECK); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_4"; - etamax = 3.5; - etamin = min_eta; - zpos = 271.0; - gem = new PHG4SectorSubsystem(name); - - 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(Enable::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(Enable::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 = 0.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++) - { - ostringstream 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 = M_PI; - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name); - - 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(Enable::OVERLAPCHECK); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - return 0; -} -#endif diff --git a/common/G4_Mvtx_EIC.C b/common/G4_Mvtx_EIC.C deleted file mode 100644 index 2ecff30ba..000000000 --- a/common/G4_Mvtx_EIC.C +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef MACRO_G4MVTXEIC_C -#define MACRO_G4MVTXEIC_C - -#include - -#include -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4mvtx.so) - -namespace Enable -{ - bool MVTX = false; - bool MVTX_OVERLAPCHECK = 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 - vector N_staves = {18, 24, 30}; - vector nom_radius = {36.4, 48.1, 59.8}; -} // namespace G4MVTX - -void MvtxInit(int verbosity = 0) -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10. + 0.7); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); -} - -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); - - // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker - - PHG4EICMvtxSubsystem* mvtx = new PHG4EICMvtxSubsystem("MVTX"); - mvtx->Verbosity(verbosity); - - // H?kan Wennl?f : - // Without time-stamping layer: - // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves - // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18 - // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30 - // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16 - // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21 - - // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30}; - // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8}; - if (G4MVTX::N_staves.size() < G4MVTX::n_maps_layer) - { - cout << "vector N_staves too small: " << G4MVTX::N_staves.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; - gSystem->Exit(1); - } - if (G4MVTX::nom_radius.size() < G4MVTX::n_maps_layer) - { - cout << "vector nom_radius too small: " << G4MVTX::nom_radius.size() - << " needs to be at least of size " << G4MVTX::n_maps_layer << endl; - gSystem->Exit(1); - } - for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++) - { - mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem - mvtx->set_int_param(ilyr, "layer", ilyr); - mvtx->set_int_param(ilyr, "N_staves", G4MVTX::N_staves[ilyr]); - mvtx->set_double_param(ilyr, "layer_nominal_radius", G4MVTX::nom_radius[ilyr]); // mm - mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI); - mvtx->set_double_param(ilyr, "phi0", 0); - } - - mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml")); - mvtx->SetActive(1); - mvtx->OverlapCheck(maps_overlapcheck); - g4Reco->registerSubsystem(mvtx); - return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm -} -#endif diff --git a/common/G4_Pipe_EIC.C b/common/G4_Pipe_EIC.C deleted file mode 100644 index f828a9973..000000000 --- a/common/G4_Pipe_EIC.C +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef MACRO_G4PIPEEIC_C -#define MACRO_G4PIPEEIC_C - -#include - -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -// This creates the Enable Flag to be used in the main steering macro -namespace Enable -{ - bool PIPE = false; - bool PIPE_ABSORBER = false; - bool PIPE_OVERLAPCHECK = false; - int PIPE_VERBOSITY = 0; -} // namespace Enable - -namespace G4PIPE -{ - // Central pipe dimension - // Extracted via mechanical model: Detector chamber 3-20-20 - // directly implimenting the central Be section in G4 cylinder for max speed simulation in the detector region. - // The jointer lip structure of the pipe R = 3.2cm x L=5mm is ignored here - double be_pipe_radius = 3.1000; - double be_pipe_thickness = 3.1762 - be_pipe_radius; // 760 um for sPHENIX - double be_pipe_length_plus = 66.8; // +z beam pipe extend. - double be_pipe_length_neg = -79.8; // -z beam pipe extend. - bool use_forward_pipes = false; -} // namespace G4PIPE - -void PipeInit() -{ - if (G4PIPE::use_forward_pipes) - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 23.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 450.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -463.); - } - else - { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length_plus); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::be_pipe_length_neg); - } -} - -//! construct beam pipe -double Pipe(PHG4Reco* g4Reco, - double radius) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); - // process pipe extentions? - const bool do_pipe_hadron_forward_extension = G4PIPE::use_forward_pipes && true; - const bool do_pipe_electron_forward_extension = G4PIPE::use_forward_pipes && true; - - const double be_pipe_length = G4PIPE::be_pipe_length_plus - G4PIPE::be_pipe_length_neg; // pipe length - const double be_pipe_center = 0.5 * (G4PIPE::be_pipe_length_plus + G4PIPE::be_pipe_length_neg); - - if (radius > G4PIPE::be_pipe_radius) - { - cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; - gSystem->Exit(-1); - } - - // 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_double_param("place_z", be_pipe_center); - cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); - cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(OverlapCheck); - if (AbsorberActive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", G4PIPE::be_pipe_radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", be_pipe_length); - cyl->set_double_param("place_z", be_pipe_center); - cyl->set_string_param("material", "G4_Be"); - cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); - cyl->SuperDetector("PIPE"); - cyl->OverlapCheck(OverlapCheck); - if (AbsorberActive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius = G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness; - - radius += no_overlapp; - - if (do_pipe_electron_forward_extension) - { - PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("ElectronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector_chamber_3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName", "ElectronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(gdml); - } - - if (do_pipe_hadron_forward_extension) - { - PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("HadronForwardEnvelope"); - gdml->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + "/Beam/Detector_chamber_3-20-20.G4Import.gdml"); - gdml->set_string_param("TopVolName", "HadronForwardEnvelope"); - gdml->set_int_param("skip_DST_geometry_export", 1); // do not export extended beam pipe as it is not supported by TGeo and outside Kalman filter acceptance - gdml->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(gdml); - } - - return radius; -} -#endif diff --git a/common/G4_Piston.C b/common/G4_Piston.C deleted file mode 100644 index fa1afd322..000000000 --- a/common/G4_Piston.C +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef MACRO_G4PISTON_C -#define MACRO_G4PISTON_C - -#include - -#include - -#include -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PISTON = false; - bool PISTON_ABSORBER = false; - bool PISTON_OVERLAPCHECK = false; - int PISTON_VERBOSITY = 0; -} // namespace Enable - -namespace G4PISTON -{ - double zpos1 = 305. - 20.; // front of forward ECal/MPC - double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - double calorimeter_hole_diameter = 9.92331 * 2; // side length of the middle hole of MPC that -} // namespace G4PISTON - -void PistonInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PISTON::calorimeter_hole_diameter / 2.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, ((G4PISTON::zpos2 + G4PISTON::zpos1) / 2. + (G4PISTON::zpos2 - G4PISTON::zpos1) / 2.)); -} - -void Piston(PHG4Reco *g4Reco, - const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::PISTON_ABSORBER || absorberactive; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PISTON_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::PISTON_VERBOSITY); - - string name = "magpiston"; - const double zpos0 = G4PIPE::al_pipe_length + G4PIPE::be_pipe_length * 0.5; // first large GEM station - - const double beampipe_radius = G4PIPE::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 + (G4PISTON::zpos1 - zpos0) / 2; - // cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos - // << endl; - - PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); - magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); - magpiston->SetPlaceZ((G4PISTON::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)) * G4PISTON::zpos1); - magpiston->SetMaterial("G4_Fe"); - magpiston->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston); - - // PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name, 1); - // magpiston->SetZlength((G4PISTON::zpos1 - zpos0) / 2); - // magpiston->SetPlaceZ(pos); - // magpiston->Set_eta_range(eta_outter, eta_inner); - // magpiston->SetMaterial("G4_Fe"); - // magpiston->SuperDetector(name); - // 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); - if (AbsorberActive) magpiston->SetActive(); - magpiston->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston); - pos += ((G4PISTON::zpos1 - zpos0 - 10) / number_of_wteeth); - } - - // last piece connect to the field return - PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_double_param("length", G4PISTON::zpos2 - G4PISTON::zpos1); - magpiston2->set_double_param("place_z", (G4PISTON::zpos2 + G4PISTON::zpos1) / 2.); - magpiston2->set_double_param("radius", beampipe_radius); - magpiston2->set_double_param("thickness", G4PISTON::calorimeter_hole_diameter / 2. - beampipe_radius); - magpiston2->set_string_param("material", "G4_Fe"); - magpiston2->SuperDetector(name); - if (AbsorberActive) magpiston2->SetActive(); - magpiston2->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(magpiston2); - - return; -} -#endif diff --git a/common/G4_PlugDoor_EIC.C b/common/G4_PlugDoor_EIC.C deleted file mode 100644 index 98b626b89..000000000 --- a/common/G4_PlugDoor_EIC.C +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef MACRO_G4PLUGDOOREIC_C -#define MACRO_G4PLUGDOOREIC_C - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PLUGDOOR = false; - bool PLUGDOOR_ABSORBER = false; - bool PLUGDOOR_OVERLAPCHECK = 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.; -} // namespace G4PLUGDOOR - -void PlugDoorInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PLUGDOOR::place_z - G4PLUGDOOR::length / 2.); -} - -void PlugDoor(PHG4Reco *g4Reco) -{ - //---------------------------------------- - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; - const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; - - const string material("Steel_1006"); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); - 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); - g4Reco->registerSubsystem(flux_return_minus); - - return; -} -#endif diff --git a/common/G4_PlugDoor_fsPHENIX.C b/common/G4_PlugDoor_fsPHENIX.C deleted file mode 100644 index da4940960..000000000 --- a/common/G4_PlugDoor_fsPHENIX.C +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef MACRO_G4PLUGDOORFSPHENIX_C -#define MACRO_G4PLUGDOORFSPHENIX_C - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool PLUGDOOR = false; - bool PLUGDOOR_ABSORBER = false; - bool PLUGDOOR_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4PLUGDOOR -{ - double place_z = 335.9; - double length = 10.2; - double inner_radius = 2.1; - double thickness = 258.5; -} // namespace G4PLUGDOOR - -void PlugDoorInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::inner_radius + G4PLUGDOOR::thickness); - 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.)); -} - -void PlugDoor(PHG4Reco *g4Reco) -{ - //---------------------------------------- - // fsPHENIX forward flux return(s) - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; - bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; - - const string material("Steel_1006"); - - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_double_param("length", G4PLUGDOOR::length); - flux_return_plus->set_double_param("radius", G4PLUGDOOR::inner_radius); - flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); - 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); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_double_param("length", G4PLUGDOOR::length); - flux_return_minus->set_double_param("radius", G4PLUGDOOR::inner_radius); - flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); - 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); - g4Reco->registerSubsystem(flux_return_minus); - - return; -} -#endif diff --git a/common/G4_RICH.C b/common/G4_RICH.C deleted file mode 100644 index 172f83bee..000000000 --- a/common/G4_RICH.C +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \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 $ - */ -#ifndef MACRO_G4RICH_C -#define MACRO_G4RICH_C - -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -namespace Enable -{ - bool RICH = false; -} - -void RICHInit() -{ - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 135.); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 268.); -} - -//! 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.3, // - const double R_mirror_ref = 190, //cm // Reduced from 195 (2014 LOI) -> 190 to avoid overlap with FGEM4 (it seems to fit fine in the AutoCAD drawing- is the RICH longer in Geant4 than in the AutoCAD drawing?) - const double z_shift = 75, // cm - const double R_shift = 18.5, // cm - const double R_beampipe_front = 8, // clearance for EIC beam pipe flange - const double R_beampipe_back = 27 // clearance for EIC beam pipe flange -) -{ - /* 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()); - - rich->get_RICH_geometry().set_R_beam_pipe_front(R_beampipe_front * ePHENIXRICH::RICH_Geometry::Unit_cm()); - rich->get_RICH_geometry().set_R_beam_pipe_back(R_beampipe_back * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - rich->OverlapCheck(Enable::OVERLAPCHECK); - - /* Register RICH module */ - g4Reco->registerSubsystem(rich); -} -#endif diff --git a/common/G4_TPC_EIC.C b/common/G4_TPC_EIC.C deleted file mode 100644 index c4d0a54fd..000000000 --- a/common/G4_TPC_EIC.C +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef MACRO_G4TPCEIC_C -#define MACRO_G4TPCEIC_C - -#include - -#include - -#include - -#include - -#include - -#include - -#include -#include - -R__LOAD_LIBRARY(libg4eval.so) -R__LOAD_LIBRARY(libg4mvtx.so) -R__LOAD_LIBRARY(libg4tpc.so) - -namespace Enable -{ - bool TPC = false; - bool TPC_ENDCAP = false; - bool TPC_ABSORBER = false; - bool TPC_OVERLAPCHECK = false; -} // namespace Enable - -namespace G4TPC -{ - int n_tpc_layer_inner = 16; - double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol. - int tpc_layer_rphi_count_inner = 1152; - - int n_tpc_layer_mid = 16; - double tpc_layer_thick_mid = 1.25; - int tpc_layer_rphi_count_mid = 1536; - - int n_tpc_layer_outer = 16; - double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm - int tpc_layer_rphi_count_outer = 2304; - - double outer_radius = 78.; - double inner_cage_radius = 20.; - 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 - - string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc - -} // namespace G4TPC - -void TPCInit() -{ - // BlackHoleGeometry::max_radius set at the end of the TPC function - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4TPC::cage_length / 2.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4TPC::cage_length / 2.); -} - -//! 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, - const int absorberactive = 0, - int verbosity = 0) -{ - // time projection chamber layers -------------------------------------------- - - PHG4CylinderSubsystem* cyl; - - radius = G4TPC::inner_cage_radius; - - // inner field cage - cyl = new PHG4CylinderSubsystem("FIELDCAGE", G4MVTX::n_maps_layer); - cyl->set_double_param("radius", radius); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", "G4_KAPTON"); - cyl->set_double_param("thickness", G4TPC::cage_thickness); - cyl->SuperDetector("FIELDCAGE"); - cyl->Verbosity(0); - g4Reco->registerSubsystem(cyl); - - radius += G4TPC::cage_thickness; - - // double inner_readout_radius = radius; - // if (inner_readout_radius < radius) inner_readout_radius = radius; - // - // - - int n_tpc_layers[3] = {16, 16, 16}; - int tpc_layer_rphi_count[3] = {1152, 1536, 2304}; - - double tpc_region_thickness[3] = {20., 20., 18.}; - // Active layers of the TPC (inner layers) - int nlayer = G4MVTX::n_maps_layer; - for (int irange = 0; irange < 3; irange++) - { - double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer - for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++) - { - cyl = new PHG4CylinderSubsystem("TPC", nlayer); - cyl->set_double_param("radius", radius); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", G4TPC::tpcgas); - cyl->set_double_param("thickness", tpc_layer_thickness - 0.01); - cyl->SetActive(); - cyl->SuperDetector("TPC"); - g4Reco->registerSubsystem(cyl); - - radius += tpc_layer_thickness; - nlayer++; - } - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("FIELDCAGE", nlayer); - cyl->set_double_param("radius", radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4TPC::cage_length); - cyl->set_string_param("material", "G4_KAPTON"); - cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("FIELDCAGE"); - g4Reco->registerSubsystem(cyl); - - radius += G4TPC::cage_thickness; - - if (Enable::TPC_ENDCAP) - { - TPC_Endcaps(g4Reco); - } - // update now that we know the outer radius - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); - return radius; -} - -#endif diff --git a/common/G4_Tracking_EIC.C b/common/G4_Tracking_EIC.C deleted file mode 100644 index 0be72c655..000000000 --- a/common/G4_Tracking_EIC.C +++ /dev/null @@ -1,282 +0,0 @@ -#ifndef MACRO_G4TRACKINGEIC_C -#define MACRO_G4TRACKINGEIC_C - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#include - -#include - -R__LOAD_LIBRARY(libtrack_reco.so) -R__LOAD_LIBRARY(libg4trackfastsim.so) - -namespace Enable -{ - bool TRACKING = false; - bool TRACKING_EVAL = false; - int TRACKING_VERBOSITY = 0; -} // namespace Enable - -namespace G4TRACKING -{ - bool DISPLACED_VERTEX = false; - bool PROJECTION_EEMC = false; - bool PROJECTION_CEMC = false; - bool PROJECTION_FEMC = false; - bool PROJECTION_FHCAL = false; -} // namespace G4TRACKING - -//-----------------------------------------------------------------------------// -void TrackingInit() -{ - TRACKING::TrackNodeName = "TrackMap"; -} -//-----------------------------------------------------------------------------// -void Tracking_Reco() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(verbosity); - // kalman->Smearing(false); - if (G4TRACKING::DISPLACED_VERTEX) - { - // do not use truth vertex in the track fitting, - // which would lead to worse momentum resolution for prompt tracks - // but this allows displaced track analysis including DCA and vertex finding - kalman->set_use_vertex_in_fitting(false); - kalman->set_vertex_xy_resolution(0); // do not smear the vertex used in the built-in DCA calculation - kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation - kalman->enable_vertexing(true); // enable vertex finding and fitting - } - else - { - // constraint to a primary vertex and use it as part of the fitting level arm - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50e-4); - kalman->set_vertex_z_resolution(50e-4); - } - - kalman->set_sub_top_node_name("TRACKS"); - kalman->set_trackmap_out_name(TRACKING::TrackNodeName); - - //------------------------- - // Barrel - //------------------------- - if (Enable::BARREL) - { - double pitch = 20e-4 / sqrt(12); - - if (G4BARREL::SETTING::BARRELV5 || G4BARREL::SETTING::BARRELV6) - { - int nLayer1 = 3; //barrel 1 - int nLayer2 = 2; //barrel 2 - if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC - int nLayer[2] = {nLayer1, nLayer2}; - - for (int n = 0; n < 2; n++) - { - if (n == 1) pitch = 36.4e-4 / sqrt(12); - for (int i=0; i < nLayer[n]; i++) - { - kalman->add_phg4hits(Form("G4HIT_BARREL%d_%d", n, i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - pitch, // const float phires, - pitch, // const float lonres, - 0.95, // const float eff, - 0); // const float noise - } - } - } - else - { - int nLayer = 5; - if (G4BARREL::SETTING::BARRELV4) nLayer = 6; - for (int i=0; i < nLayer; i++) - { - kalman->add_phg4hits(Form("G4HIT_BARREL_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, *ignored in cylindrical detector* - pitch, // const float phires, - pitch, // const float lonres, - 0.95, // const float eff, - 0); // const float noise - } - } - } - //------------------------- - // MVTX - //------------------------- - if (Enable::MVTX) - { - // MAPS - kalman->add_phg4hits( - "G4HIT_MVTX", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 5e-4, // const float radres, - 5e-4, // const float phires, - 5e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // TPC - //------------------------- - if (Enable::TPC) - { - kalman->add_phg4hits( - "G4HIT_TPC", // const std::string& phg4hitsNames, - PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype, - 1, // const float radres, - 200e-4, // const float phires, - 500e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - //------------------------- - // EGEM - //------------------------- - if (Enable::EGEM) - { - // GEM, 70um azimuthal resolution, 1cm radial strips - for (int i = 0; i < 4; i++) - { - kalman->add_phg4hits( - Form("G4HIT_EGEM_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0 // const float noise - ); - } - } - //------------------------- - // FGEM - //------------------------- - if (Enable::FGEM || Enable::FGEM_ORIG) - { - int first_gem(0); - if (Enable::FGEM_ORIG) - { - first_gem = 0; - } - else - { - first_gem = 2; - } - // GEM2, 70um azimuthal resolution, 1cm radial strips - for (int i = first_gem; i < 5; i++) - { - kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - 1. / sqrt(12.), // const float radres, - 70e-4, // const float phires, - 100e-4, // const float lonres, - 1, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FST - //------------------------- - if (Enable::FST) - { - float pitch = 20e-4; - int nPlane = 5; - if (G4FST::SETTING::FSTV4 || G4FST::SETTING::FSTV5) - { - nPlane = 6; - } - - for (int i = 0; i < nPlane; i++) - { - if (i >= 3) pitch = 36.4e-4; - kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames, - PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype, - pitch, // const float radres, - pitch, // const float phires, - 50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector* - 1, // const float eff, - 0); // const float noise - } - } - //------------------------- - // FEMC - //------------------------- - // Saved track states (projections) - if (Enable::FEMC && G4TRACKING::PROJECTION_FEMC) - { - kalman->add_state_name("FEMC"); - } - - //------------------------- - // FHCAL - //------------------------- - if (Enable::FHCAL && G4TRACKING::PROJECTION_FHCAL) - { - kalman->add_state_name("FHCAL"); - } - //------------------------- - // CEMC - //------------------------- - if (Enable::CEMC && G4TRACKING::PROJECTION_CEMC) - { - kalman->add_state_name("CEMC"); - } - //------------------------- - // EEMC - //------------------------- - if (Enable::EEMC && G4TRACKING::PROJECTION_EEMC) - { - kalman->add_state_name("EEMC"); - } - - se->registerSubsystem(kalman); - return; -} - -//-----------------------------------------------------------------------------// - -void Tracking_Eval(const std::string &outputfile) -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // Fast Tracking evaluation - //---------------- - - PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval"); - fast_sim_eval->set_trackmapname(TRACKING::TrackNodeName); - fast_sim_eval->set_filename(outputfile); - fast_sim_eval->Verbosity(verbosity); - se->registerSubsystem(fast_sim_eval); -} -#endif diff --git a/common/G4_hFarFwdBeamLine_EIC.C b/common/G4_hFarFwdBeamLine_EIC.C deleted file mode 100644 index 0a5a84aeb..000000000 --- a/common/G4_hFarFwdBeamLine_EIC.C +++ /dev/null @@ -1,369 +0,0 @@ -#ifndef MACRO_G4HFARFWDBEAMLINE_EIC_C -#define MACRO_G4HFARFWDBEAMLINE_EIC_C - -#include - -#include -#include -#include -#include - -#include - -#include - -R__LOAD_LIBRARY(libg4detectors.so) - -// This creates the Enable Flag to be used in the main steering macro -namespace Enable -{ - bool HFARFWD_MAGNETS_IP6 = false; - bool HFARFWD_MAGNETS_IP8 = false; - bool HFARFWD_VIRTUAL_DETECTORS_IP8 = false; - bool HFARFWD_VIRTUAL_DETECTORS_IP6 = false; - bool HFARFWD_PIPE = false; - bool HFARFWD_OVERLAPCHECK = false; - int HFARFWD_VERBOSITY = 0; -} // namespace Enable - - -void hFarFwdBeamLineInit() -{ - - if (Enable::HFARFWD_MAGNETS_IP6 && Enable::HFARFWD_MAGNETS_IP8) - { - cout << "You cannot have magnets for both IP6 and IP8 ON at the same time" << endl; - gSystem->Exit(1); - } - - if (Enable::HFARFWD_MAGNETS_IP6) - { - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 4500.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, 0.); - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 180.0); - } - - if (Enable::HFARFWD_MAGNETS_IP8) - { - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 4800.); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -2050.); - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 150.0); - } -} - -void hFarFwdDefineMagnets(PHG4Reco* g4Reco){ - - bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); - - string magFile; - if(Enable::HFARFWD_MAGNETS_IP6) - magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip6_h_farFwdBeamLineMagnets.dat"; - else if(Enable::HFARFWD_MAGNETS_IP8) - magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/ip8_35mrad_h_farFwdBeamLineMagnets.dat"; - else{ - cout << " You have to enable either the IP6 or IP8 Magnet configuration to define magnets! "<Exit(1); - } - - // make magnet active volume if you want to study the hits - bool magnet_active=false; - int absorberactive = 0; - - // 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 << "coud 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 "<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/TMath::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",dipole_field_x); - bl->set_double_param("field_x",0.); - bl->set_double_param("fieldgradient",fieldgradient); - bl->set_string_param("magtype",magtype); - bl->set_double_param("length",length); - bl->set_double_param("place_x",x); - bl->set_double_param("place_y",y); - bl->set_double_param("place_z",z); - bl->set_double_param("rot_y",angle); - bl->set_double_param("inner_radius",inner_radius_zin); - bl->set_double_param("outer_radius", outer_magnet_diameter/2.); - bl->SetActive(magnet_active); - bl->BlackHole(); - if (absorberactive) - { - bl->SetAbsorberActive(); - } - 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 hFarFwdDefineDetectors(PHG4Reco* g4Reco){ - - if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP6 && Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) - { - cout << "You cannot have detectors enabled for both IP6 and IP8 ON at the same time" << endl; - gSystem->Exit(1); - } - - if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) { - cout << " IP8 h far forward detectors not defined right now. " <SuperDetector("ZDC"); - detZDC->set_double_param("place_x",96.24); - detZDC->set_double_param("place_y",0); - detZDC->set_double_param("place_z",3750); - detZDC->set_double_param("rot_y",-0.025*TMath::RadToDeg()); - detZDC->set_double_param("size_x",60); - detZDC->set_double_param("size_y",60); - detZDC->set_double_param("size_z",0.1); - detZDC->set_string_param("material","G4_Si"); - detZDC->SetActive(); - if(verbosity) - detZDC->Verbosity(verbosity); - g4Reco->registerSubsystem(detZDC); - - const int rpDetNr = 2; - const double rp_zCent[rpDetNr]={2600 ,2800}; - const double rp_xCent[rpDetNr]={84.49 ,93.59}; - for(int i=0;iSuperDetector("RomanPots"); - detRP->set_double_param("place_x",rp_xCent[i]); - detRP->set_double_param("place_y",0); - detRP->set_double_param("place_z",rp_zCent[i]); - detRP->set_double_param("rot_y",-0.025*TMath::RadToDeg()); - detRP->set_double_param("size_x",25); - detRP->set_double_param("size_y",10); - detRP->set_double_param("size_z",0.03); - detRP->set_string_param("material","G4_Si"); - detRP->SetActive(); - if(verbosity) - detRP->Verbosity(verbosity); - g4Reco->registerSubsystem(detRP); - } - - const int b0DetNr = 4; - const double b0Mag_zCent = 590; - const double b0Mag_zLen = 120; - for(int i=0;iSuperDetector("B0detectors"); - detB0->set_double_param("radius",0); - detB0->set_double_param("thickness",20); - detB0->set_double_param("length",0.1); - detB0->set_string_param("material","G4_Si"); - detB0->set_double_param("place_x",13.2); - detB0->set_double_param("place_y",0); - detB0->set_double_param("place_z", (b0Mag_zCent - b0Mag_zLen/2) + b0Mag_zLen/(b0DetNr-1) * i); - detB0->SetActive(true); - if(verbosity) - detB0->Verbosity(verbosity); - g4Reco->registerSubsystem(detB0); - } - - -} - - -void hFarFwdDefineBeamPipe(PHG4Reco* g4Reco){ - int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); - //exit window - PHG4CylinderSubsystem *exitWin = new PHG4CylinderSubsystem("exitWin",0); - exitWin->set_double_param("radius" ,3.2); - exitWin->set_double_param("thickness",11.8); - exitWin->set_double_param("length" ,0.15); - exitWin->set_double_param("rot_y" ,-0.025*TMath::RadToDeg()); - exitWin->set_string_param("material" ,"G4_STAINLESS-STEEL"); - exitWin->set_double_param("place_x" ,12.5); - exitWin->set_double_param("place_y" ,0); - exitWin->set_double_param("place_z" ,500); - exitWin->SetActive(false); - g4Reco->registerSubsystem(exitWin); - - //B0 magnet pipe - PHG4CylinderSubsystem *pipeB0 = new PHG4CylinderSubsystem("beamPipeB0",0); - pipeB0->set_double_param("radius",2.8); - pipeB0->set_double_param("thickness",0.25); - pipeB0->set_double_param("length",195); - pipeB0->set_double_param("rot_y",-0.025*TMath::RadToDeg()); - pipeB0->set_string_param("material","G4_Al"); - pipeB0->set_double_param("place_x",14.748); - pipeB0->set_double_param("place_y",0); - pipeB0->set_double_param("place_z",590); - pipeB0->SetActive(false); - g4Reco->registerSubsystem(pipeB0); - - //Quad pipes - const int nSecQ = 5; //B0apf, Q1apf, Q1bpf, Q2pf, B1pf - const string nm [nSecQ]={"B0apf", "Q1apf", "Q1bpf", "Q2pf", "B1pf"}; - const double qlen[nSecQ]={160 , 150 , 220 , 440 , 330 }; - const double qir [nSecQ]={4 , 5.1 , 7 , 12 , 12.2 }; - const double qor [nSecQ]={4.1 , 5.2 , 7.2 , 12.2 , 12.4 }; - const double qrot[nSecQ]={25 , 19.5 , 15 , 15 , 34 };//mrad - const double qxC [nSecQ]={19.8 , 24.47 , 30.05 , 39.5 , 48 }; - const double qyC [nSecQ]={0 , 0 , 0 , 0 , 0 }; - const double qzC [nSecQ]={770 , 922.8 , 1106.3 , 1416.7, 1806.7}; - for(int i=0;iset_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]/1000*TMath::RadToDeg()); - pipe->set_string_param("material","G4_Al"); - pipe->set_double_param("place_x",qxC[i]); - pipe->set_double_param("place_y",qyC[i]); - pipe->set_double_param("place_z",qzC[i]); - pipe->SetActive(false); - g4Reco->registerSubsystem(pipe); - } - - //Electron pipe - PHG4CylinderSubsystem *pipeElectron = new PHG4CylinderSubsystem("beamPipeElectron",0); - pipeElectron->set_double_param("radius",1); - pipeElectron->set_double_param("thickness",1); - pipeElectron->set_double_param("length",3000); - pipeElectron->set_double_param("rot_y",-0.025*TMath::RadToDeg()); - pipeElectron->set_string_param("material","G4_Al"); - pipeElectron->set_double_param("place_x",0); - pipeElectron->set_double_param("place_y",0); - pipeElectron->set_double_param("place_z",2000); - pipeElectron->SetActive(false); - //g4Reco->registerSubsystem(pipeElectron); - - //ZDC pipe - PHG4CylinderSubsystem *pipeZDC = new PHG4CylinderSubsystem("beamPipeZDC",0); - pipeZDC->set_double_param("radius",16.5); - pipeZDC->set_double_param("thickness",0.1); - pipeZDC->set_double_param("length",170); - pipeZDC->set_double_param("rot_y",-0.025*TMath::RadToDeg()); - pipeZDC->set_string_param("material","G4_Al"); - pipeZDC->set_double_param("place_x",59); - pipeZDC->set_double_param("place_y",0); - pipeZDC->set_double_param("place_z",2041.59); - pipeZDC->SetActive(false); - g4Reco->registerSubsystem(pipeZDC); - - //Roman Pot pipe - const int nSec = 2; - const double len[nSec]={850,1150 }; - const double ir1[nSec]={17 , 17 }; - const double or1[nSec]={17.1,17.1}; - const double ir2[nSec]={17 , 7 }; - const double or2[nSec]={17.1, 7.1}; - const double xC[nSec] ={83 , 130}; - const double yC[nSec] ={0 , 0}; - const double zC[nSec] ={2550,3550}; - for(int i=0;iset_string_param("material","G4_STAINLESS-STEEL"); - pipe->set_double_param("place_x",xC[i]); - pipe->set_double_param("place_y",yC[i]); - pipe->set_double_param("place_z",zC[i]); - pipe->set_double_param("length",len[i]/2); - 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]); - pipe->set_double_param("rot_y",-0.027*TMath::RadToDeg()); - g4Reco->registerSubsystem(pipe); - } -} - - -#endif diff --git a/detectors/EICDetector/DisplayOn.C b/detectors/EICDetector/DisplayOn.C deleted file mode 100644 index 028620802..000000000 --- a/detectors/EICDetector/DisplayOn.C +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef MACRO_DISPLAYON_C -#define MACRO_DISPLAYON_C - -#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 -// 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.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; -} -// 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; -} -#endif diff --git a/detectors/EICDetector/Fun4All_G4_EICDetector.C b/detectors/EICDetector/Fun4All_G4_EICDetector.C deleted file mode 100644 index 853028a74..000000000 --- a/detectors/EICDetector/Fun4All_G4_EICDetector.C +++ /dev/null @@ -1,574 +0,0 @@ -#ifndef MACRO_FUN4ALLG4EICDETECTOR_C -#define MACRO_FUN4ALLG4EICDETECTOR_C - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) - -int Fun4All_G4_EICDetector( - 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 = "G4EICDetector.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 = ".") -{ - //--------------- - // Fun4All server - //--------------- - 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 initial seed - // which will produce identical results so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //=============== - // 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 - // - //Input::READHITS = true; - INPUTREADHITS::filename[0] = inputFile; - // if you use a filelist - // INPUTREADHITS::listfile[0] = inputFile; - - // Or: - // Use one or more particle generators - // It is run if Input:: is set to true - // all other options only play a role if it is active - // In case embedding into a production output, please double check your G4Setup_EICDetector.C and G4_*.C consistent with those in the production macro folder - // Input::EMBED = true; - INPUTEMBED::filename[0] = embed_input_file; - // if you use a filelist - //INPUTEMBED::listfile[0] = embed_input_file; - - // Use Pythia 8 - // Input::PYTHIA8 = true; - - // Use Pythia 6 - // Input::PYTHIA6 = true; - - // Use Sartre - // Input::SARTRE = true; - - // Simple multi particle generator in eta/phi/pt ranges - Input::SIMPLE = true; - // Input::SIMPLE_NUMBER = 2; // if you need 2 of them - // Input::SIMPLE_VERBOSITY = 1; - - // Particle gun (same particles in always the same direction) - // Input::GUN = true; - // Input::GUN_NUMBER = 3; // if you need 3 of them - // Input::GUN_VERBOSITY = 0; - - // Upsilon generator - // Input::UPSILON = true; - // Input::UPSILON_NUMBER = 3; // if you need 3 of them - // Input::UPSILON_VERBOSITY = 0; - - // And/Or read generated particles from file - - // eic-smear output - // Input::READEIC = true; - INPUTREADEIC::filename = inputFile; - - // HepMC2 files - // Input::HEPMC = true; - Input::VERBOSITY = 0; - INPUTHEPMC::filename = inputFile; - - //----------------- - // Initialize the selected Input/Event generation - //----------------- - 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) - { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); - 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::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); - INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); - } - INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-3, 3); - INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); - } - // 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("mu", 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) - { - INPUTGENERATOR::Pythia6->set_config_file(string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6_ep.cfg"); - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTGENERATOR::Pythia6); - } - // pythia8 - if (Input::PYTHIA8) - { - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTGENERATOR::Pythia8); - } - // Sartre - if (Input::SARTRE) - { - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTGENERATOR::Sartre); - } - - //-------------- - // Set Input Manager specific options - //-------------- - // can only be set after InputInit() is called - - if (Input::HEPMC) - { - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTMANAGER::HepMCInputManager); - // optional overriding beam parameters - //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 30, 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(2); - } - - // register all input generators with Fun4All - InputRegister(); - - // Reads event generators in EIC smear files, which is registered in InputRegister - if (Input::READEIC) - { - //! apply EIC beam parameter following EIC CDR - Input::ApplyEICBeamParameter(INPUTGENERATOR::EICFileReader); - } - - // set up production relatedstuff - // Enable::PRODUCTION = true; - - //====================== - // Write the DST - //====================== - - Enable::DSTOUT = false; - DstOut::OutputDir = outdir; - DstOut::OutputFile = outputFile; - Enable::DSTOUT_COMPRESS = false; // Compress DST files - - //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 subsystems - if implemented) - // Enable::ABSORBER = true; - // Enable::OVERLAPCHECK = true; - // Enable::VERBOSITY = 1; - - // Enable::BBC = true; - Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation - - // whether to simulate the Be section of the beam pipe - Enable::PIPE = true; - // EIC beam pipe extension beyond the Be-section: - G4PIPE::use_forward_pipes = false; - //EIC hadron far forward magnets and detectors. IP6 and IP8 are incompatible (pick either or); - Enable::HFARFWD_MAGNETS_IP6=true; - Enable::HFARFWD_VIRTUAL_DETECTORS_IP6=true; - Enable::HFARFWD_MAGNETS_IP8=false; - Enable::HFARFWD_VIRTUAL_DETECTORS_IP8=false; - - // gems - Enable::EGEM = true; - Enable::FGEM = true; - Enable::FGEM_ORIG = false; //5 forward gems; cannot be used with FST - // barrel tracker - Enable::BARREL = false; - //G4BARREL::SETTING::BARRELV6=true; - // fst - Enable::FST = true; - G4FST::SETTING::FST_TPC = true; - // mvtx/tpc tracker - Enable::MVTX = true; - Enable::TPC = true; - // Enable::TPC_ENDCAP = true; - - Enable::TRACKING = true; - Enable::TRACKING_EVAL = Enable::TRACKING && true; - G4TRACKING::DISPLACED_VERTEX = false; // this option exclude vertex in the track fitting and use RAVE to reconstruct primary and 2ndary vertexes - // projections to calorimeters - G4TRACKING::PROJECTION_EEMC = false; - G4TRACKING::PROJECTION_CEMC = false; - G4TRACKING::PROJECTION_FEMC = false; - G4TRACKING::PROJECTION_FHCAL = false; - - Enable::CEMC = true; - // 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::HCALIN = true; - // 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::MAGNET = true; - - Enable::HCALOUT = true; - // 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; - - // EICDetector geometry - barrel - Enable::DIRC = true; - - // EICDetector geometry - 'hadron' direction - Enable::RICH = true; - Enable::AEROGEL = true; - - Enable::FEMC = true; - // Enable::FEMC_ABSORBER = true; - Enable::FEMC_TOWER = Enable::FEMC && true; - Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - Enable::FEMC_EVAL = Enable::FEMC_CLUSTER && true; - - Enable::FHCAL = true; - // Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_TOWER = Enable::FHCAL && true; - Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; - Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; - - // EICDetector geometry - 'electron' direction - Enable::EEMC = true; - Enable::EEMC_TOWER = Enable::EEMC && true; - Enable::EEMC_CLUSTER = Enable::EEMC_TOWER && true; - Enable::EEMC_EVAL = Enable::EEMC_CLUSTER && true; - - Enable::PLUGDOOR = true; - - // Other options - Enable::GLOBAL_RECO = true; - Enable::GLOBAL_FASTSIM = true; - - Enable::CALOTRIGGER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; - - // Select only one jet reconstruction- they currently use the same - // output collections on the node tree! - Enable::JETS = true; - Enable::JETS_EVAL = Enable::JETS && true; - - Enable::FWDJETS = true; - Enable::FWDJETS_EVAL = Enable::FWDJETS && 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) - Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; - - // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits - //BlackHoleGeometry::visible = true; - - //Enable::USER = true; - - //--------------- - // 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 - //--------------- - - // 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.4 / 1.5; // 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 "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 (!Input::READHITS) - { - G4Setup(); - } - - //------------------ - // Detector Division - //------------------ - - if (Enable::BBC || Enable::BBCFAKE) Bbc_Reco(); - - 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(); - - //----------------------------- - // e, h direction Calorimeter towering and clustering - //----------------------------- - - if (Enable::FEMC_TOWER) FEMC_Towers(); - if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - - if (Enable::FHCAL_TOWER) FHCAL_Towers(); - if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - - if (Enable::EEMC_TOWER) EEMC_Towers(); - if (Enable::EEMC_CLUSTER) EEMC_Clusters(); - - if (Enable::DSTOUT_COMPRESS) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (Enable::TRACKING) Tracking_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - 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::FWDJETS) Jet_FwdReco(); - - 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::DSTREADER) G4DSTreader_EICDetector(outputroot + "_DSTReader.root"); - - //---------------------- - // Simulation evaluation - //---------------------- - if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4tracking_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::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); - - if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); - - if (Enable::EEMC_EVAL) EEMC_Eval(outputroot + "_g4eemc_eval.root"); - - if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); - - if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "_g4fwdjet_eval.root"); - - if (Enable::USER) UserAnalysisInit(); - - //-------------- - // Set up Input Managers - //-------------- - - InputManagers(); - - //-------------- - // Set up Output Manager - //-------------- - if (Enable::PRODUCTION) - { - Production_CreateOutputDir(); - } - - if (Enable::DSTOUT) - { - string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); - 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; - } - // if we use a negative number of events we go back to the command line here - if (nEvents < 0) - { - return 0; - } - // if we run any of the particle generators and use 0 it'll run forever - if (nEvents == 0 && !Input::READHITS && !Input::HEPMC && !Input::READEIC) - { - 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); - - //----- - // 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/EICDetector/G4Setup_EICDetector.C b/detectors/EICDetector/G4Setup_EICDetector.C deleted file mode 100644 index eb4d042ad..000000000 --- a/detectors/EICDetector/G4Setup_EICDetector.C +++ /dev/null @@ -1,296 +0,0 @@ -#ifndef MACRO_G4SETUPEICDETECTOR_C -#define MACRO_G4SETUPEICDETECTOR_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 - -R__LOAD_LIBRARY(libg4decayer.so) -R__LOAD_LIBRARY(libg4detectors.so) - -void G4Init() -{ - // First some check for subsystems which do not go together - - if (Enable::TPC && Enable::FST && !G4FST::SETTING::FST_TPC) - { - cout << "FST setup cannot fit in the TPC" << endl; - gSystem->Exit(1); - } - else if (Enable::MVTX && Enable::BARREL) - { - cout << "MVTX and BARREL cannot be enabled together" << endl; - gSystem->Exit(1); - } - else if (Enable::TPC && Enable::BARREL && !G4BARREL::SETTING::BARRELV6) { - cout << "Barrel setup cannot fit in the TPC" << endl; - gSystem->Exit(1); - } - - if(Enable::FGEM_ORIG && Enable::FST) - { - cout << "FST cannot be enabled with 5 FGEM setup" << endl; - gSystem->Exit(1); - } - - if(Enable::FGEM_ORIG && Enable::FST) - { - cout << "FST cannot be enabled with 5 FGEM setup" << endl; - gSystem->Exit(1); - } - - // load detector/material macros and execute Init() function - if (Enable::PIPE) PipeInit(); - if (Enable::HFARFWD_MAGNETS_IP6 || Enable::HFARFWD_MAGNETS_IP8) hFarFwdBeamLineInit(); - if (Enable::PLUGDOOR) PlugDoorInit(); - if (Enable::EGEM) EGEM_Init(); - if (Enable::FGEM || Enable::FGEM_ORIG) FGEM_Init(); - if (Enable::FST) FST_Init(); - if (Enable::BARREL) BarrelInit(); - if (Enable::MVTX) MvtxInit(); - if (Enable::TPC) TPCInit(); - if (Enable::TRACKING) TrackingInit(); - if (Enable::BBC) BbcInit(); - if (Enable::CEMC) CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - if (Enable::HCALIN) HCalInnerInit(1); - if (Enable::MAGNET) MagnetInit(); - MagnetFieldInit(); // We want the field - even if the magnet volume is disabled - if (Enable::HCALOUT) HCalOuterInit(); - if (Enable::FEMC) FEMCInit(); - if (Enable::FHCAL) FHCALInit(); - if (Enable::EEMC) EEMCInit(); - if (Enable::DIRC) DIRCInit(); - if (Enable::RICH) RICHInit(); - if (Enable::AEROGEL) AerogelInit(); - if (Enable::USER) UserInit(); - if (Enable::BLACKHOLE) BlackHoleInit(); -} - -int G4Setup() -{ - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco *g4Reco = new PHG4Reco(); - - WorldInit(g4Reco); - - 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 (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("sPHENIX.root") != string::npos) - { - 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::HFARFWD_MAGNETS_IP6 || Enable::HFARFWD_MAGNETS_IP8) hFarFwdDefineMagnets(g4Reco); - if (Enable::HFARFWD_VIRTUAL_DETECTORS_IP6 || Enable::HFARFWD_VIRTUAL_DETECTORS_IP8) hFarFwdDefineDetectors(g4Reco); - if (Enable::EGEM) EGEMSetup(g4Reco); - if (Enable::FGEM || Enable::FGEM_ORIG) FGEMSetup(g4Reco); - if (Enable::FST) FSTSetup(g4Reco); - if (Enable::BARREL) Barrel(g4Reco, radius); - if (Enable::MVTX) radius = Mvtx(g4Reco, radius); - if (Enable::TPC) radius = TPC(g4Reco, radius); - if (Enable::BBC) Bbc(g4Reco); - if (Enable::CEMC) radius = CEmc(g4Reco, radius); - 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::FEMC) FEMCSetup(g4Reco); - if (Enable::FHCAL) FHCALSetup(g4Reco); - if (Enable::EEMC) EEMCSetup(g4Reco); - - //---------------------------------------- - // PID - - if (Enable::DIRC) DIRCSetup(g4Reco); - if (Enable::RICH) RICHSetup(g4Reco); - if (Enable::AEROGEL) AerogelSetup(g4Reco); - - //---------------------------------------- - // sPHENIX forward flux return door - if (Enable::PLUGDOOR) PlugDoor(g4Reco); - - if (Enable::USER) UserDetector(g4Reco); - - //---------------------------------------- - // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions - 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() -{ - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_ZDC"); - compress->AddHitContainer("G4HIT_RomanPots"); - compress->AddHitContainer("G4HIT_B0detector"); - compress->AddHitContainer("G4HIT_FIELDCAGE"); - 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_ZDC"); - out->StripNode("G4HIT_RomanPots"); - out->StripNode("G4HIT_B0detectors"); - 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"); - } -} -#endif diff --git a/detectors/EICDetector/init_gui_vis.mac b/detectors/EICDetector/init_gui_vis.mac deleted file mode 100644 index 8aca21396..000000000 --- a/detectors/EICDetector/init_gui_vis.mac +++ /dev/null @@ -1,20 +0,0 @@ -# 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/detectors/EICDetector/vis.mac b/detectors/EICDetector/vis.mac deleted file mode 100644 index caba6e883..000000000 --- a/detectors/EICDetector/vis.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 OGL 1200x900-0+0 -# increase display limit for more complex detectors -/vis/ogl/set/displayListLimit 500000 -/vis/viewer/set/viewpointThetaPhi 240 -40 -/vis/viewer/addCutawayPlane 0 0 0 m 0 -1 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 2 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/detectors/fsPHENIX/DisplayOn.C b/detectors/fsPHENIX/DisplayOn.C deleted file mode 100644 index 028620802..000000000 --- a/detectors/fsPHENIX/DisplayOn.C +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef MACRO_DISPLAYON_C -#define MACRO_DISPLAYON_C - -#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 -// 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.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; -} -// 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; -} -#endif diff --git a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C b/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C deleted file mode 100644 index 9ec82f326..000000000 --- a/detectors/fsPHENIX/Fun4All_G4_fsPHENIX.C +++ /dev/null @@ -1,572 +0,0 @@ -#ifndef MACRO_FUN4ALLG4FSPHENIX_C -#define MACRO_FUN4ALLG4FSPHENIX_C - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -R__LOAD_LIBRARY(libfun4all.so) - -// If using the default embedding file results in a error, try -// TFile *f1 = TFile::Open("http://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root") -// if it returns a certificate error, something like -// Error in : can not open file with davix: Failure (Neon): Server certificate verification failed: bad certificate chain after 3 attempts (6) -// add the line -// Davix.GSI.CACheck: n -// to your .rootrc - -int Fun4All_G4_fsPHENIX( - const int nEvents = 2, - const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", - const string &outputFile = "G4fsPHENIX.root", - const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/fsPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", - const int skip = 0, - const string &outdir = ".") -{ - //--------------- - // Fun4All server - //--------------- - - 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 initial seed - // which will produce identical results so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //=============== - // Input options - //=============== - // verbosity setting (applies to all input managers) - Input::VERBOSITY = 0; - // 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 = false; - 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 = 2; // 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; - - // Upsilon generator - // Input::UPSILON = true; - // Input::UPSILON_NUMBER = 3; // 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 - //----------------- - 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) - { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); - 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::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); - INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.); - } - INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 3); - INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.5, 50.); - } - // 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("mu", 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); - 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(); - - // 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 = false; - - //====================== - // What to run - //====================== - // Global options (enabled for all enables subsystems - if implemented) - // Enable::ABSORBER = true; - // Enable::OVERLAPCHECK = true; - // Enable::VERBOSITY = 1; - - // Enable::BBC = true; - Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation - - Enable::PIPE = true; - Enable::PIPE_ABSORBER = true; - // Enable::PIPE_OVERLAPCHECK = true; - - // central tracking - Enable::MVTX = true; - Enable::MVTX_CELL = Enable::MVTX && true; - Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; - - Enable::INTT = true; - Enable::INTT_CELL = Enable::INTT && true; - Enable::INTT_CLUSTER = Enable::INTT_CELL && true; - - Enable::TPC = true; - // Enable::TPC_ABSORBER = true; - Enable::TPC_CELL = Enable::TPC && true; - Enable::TPC_CLUSTER = Enable::TPC_CELL && true; - - Enable::TRACKING_TRACK = Enable::TPC_CELL && Enable::INTT_CELL && Enable::MVTX_CELL && true; - Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; - - // central calorimeters, which is a detailed simulation and slow to run - Enable::CEMC = true; - // 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::HCALIN = true; - // 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::MAGNET = true; - // Enable::MAGNET_ABSORBER = true; - - Enable::HCALOUT = true; - // 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::GLOBAL_RECO = true; - // Enable::GLOBAL_FASTSIM = true; - - Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && true; - - Enable::JETS = true; - Enable::JETS_EVAL = Enable::JETS && true; - - Enable::FWDJETS = true; - Enable::FWDJETS_EVAL = Enable::FWDJETS && true; - - // fsPHENIX geometry - - Enable::FGEM = true; - Enable::FGEM_TRACK = Enable::FGEM && Enable::MVTX && true; - Enable::FGEM_EVAL = Enable::FGEM_TRACK && true; - - Enable::FEMC = true; - Enable::FEMC_ABSORBER = true; - Enable::FEMC_TOWER = Enable::FEMC && true; - Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - - Enable::FHCAL = true; - Enable::FHCAL_ABSORBER = true; - Enable::FHCAL_TOWER = Enable::FHCAL && true; - Enable::FHCAL_CLUSTER = Enable::FHCAL_TOWER && true; - Enable::FHCAL_EVAL = Enable::FHCAL_CLUSTER && true; - - // Enable::PISTON = true; - Enable::PISTON_ABSORBER = true; - Enable::PISTON_OVERLAPCHECK = false; - - Enable::PLUGDOOR = true; - // Enable::PLUGDOOR_ABSORBER = true; - Enable::PLUGDOOR_OVERLAPCHECK = false; - - // new settings using Enable namespace in GlobalVariables.C - Enable::BLACKHOLE = true; - //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits - // BlackHoleGeometry::visible = true; - - // run user provided code (from local G4_User.C) - //Enable::USER = true; - - //--------------- - // 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 - //--------------- - - // 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.4 / 1.5; // 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(); - - if (!Input::READHITS) - { - //--------------------- - // Set up G4 only if we do not read hits - //--------------------- - 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::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 (Enable::FEMC_TOWER) FEMC_Towers(); - if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - - if (Enable::FHCAL_TOWER) FHCAL_Towers(); - if (Enable::FHCAL_CLUSTER) FHCAL_Clusters(); - - if (Enable::DSTOUT_COMPRESS) ShowerCompress(); - - //-------------- - // 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::TRACKING_TRACK) - { - Tracking_Reco(); - } - - //-------------- - // FGEM tracking - //-------------- - - if (Enable::FGEM_TRACK) FGEM_FastSim_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::FWDJETS) Jet_FwdReco(); - - //---------------------- - // 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 + "g4tracking_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::FEMC_EVAL) FEMC_Eval(outputroot + "g4femc_eval.root"); - - if (Enable::FHCAL_EVAL) FHCAL_Eval(outputroot + "_g4fhcal_eval.root"); - - if (Enable::JETS_EVAL) Jet_Eval(outputroot + "g4jet_eval.root"); - - if (Enable::FWDJETS_EVAL) Jet_FwdEval(outputroot + "g4fwdjet_eval.root"); - - if (Enable::FGEM_EVAL) FGEM_FastSim_Eval(outputroot + "g4tracking_fgem_eval.root"); - - if (Enable::DSTREADER) G4DSTreader_fsPHENIX(outputroot + "_DSTReader.root"); - - if (Enable::USER) UserAnalysisInit(); - - //-------------- - // Set up Input Managers - //-------------- - - InputManagers(); - - //-------------- - // Set up Output Managers - //-------------- - if (Enable::PRODUCTION) - { - Production_CreateOutputDir(); - } - - if (Enable::DSTOUT) - { - string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); - 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; - } - - // 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->skip(skip); - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - if (Enable::PRODUCTION) - { - Production_MoveOutput(); - } - gSystem->Exit(0); - return 0; -} - -void G4Cmd(const char *cmd) -{ - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->ApplyCommand(cmd); -} -#endif diff --git a/detectors/fsPHENIX/G4Setup_fsPHENIX.C b/detectors/fsPHENIX/G4Setup_fsPHENIX.C deleted file mode 100644 index 79c32f6a7..000000000 --- a/detectors/fsPHENIX/G4Setup_fsPHENIX.C +++ /dev/null @@ -1,294 +0,0 @@ -#ifndef MACRO_G4SETUPFSPHENIX_C -#define MACRO_G4SETUPFSPHENIX_C - -#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 ShowerCompress(int verbosity = 0); -void DstCompress(Fun4AllDstOutputManager *out); - -void RunLoadTest() {} - -void G4Init() -{ - // 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::BBC) BbcInit(); - if (Enable::CEMC) CEmcInit(); - if (Enable::HCALIN) HCalInnerInit(); - if (Enable::MAGNET) MagnetInit(); -// We want the field - even if the magnet volume is disabled - MagnetFieldInit(); - if (Enable::HCALOUT) HCalOuterInit(); - if (Enable::FGEM) FGEM_Init(); - if (Enable::FEMC) FEMCInit(); - if (Enable::FHCAL) FHCALInit(); - if (Enable::PISTON) PistonInit(); - if (Enable::PLUGDOOR) PlugDoorInit(); - if (Enable::USER) UserInit(); - if (Enable::BLACKHOLE) BlackHoleInit(); -} - -int G4Setup() -{ - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco *g4Reco = new PHG4Reco(); - g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST - WorldInit(g4Reco); - g4Reco->set_rapidity_coverage(1.1); // according to drawings - 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("sPHENIX.root") != string::npos) - { - 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); - - double radius = 0.; - - //---------------------------------------- - // PIPE - 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); - } - - //---------------------------------------- - // BBC - - if (Enable::BBC) Bbc(g4Reco); - - //---------------------------------------- - // CEMC - // - if (Enable::CEMC) - { - radius = CEmc(g4Reco, radius, 8); - } - - //---------------------------------------- - // HCALIN - - if (Enable::HCALIN) - { - radius = HCalInner(g4Reco, radius, 4); - } - - //---------------------------------------- - // MAGNET - - if (Enable::MAGNET) - { - radius = Magnet(g4Reco, radius); - } - - //---------------------------------------- - // HCALOUT - - if (Enable::HCALOUT) - { - radius = HCalOuter(g4Reco, radius, 4); - } - - //---------------------------------------- - // Forward tracking - - if (Enable::FGEM) - { - FGEMSetup(g4Reco); - } - - //---------------------------------------- - // FEMC - - if (Enable::FEMC) - { - FEMCSetup(g4Reco); - } - //---------------------------------------- - // FHCAL - - if (Enable::FHCAL) - { - FHCALSetup(g4Reco); - } - if (Enable::PISTON) - { - Piston(g4Reco); - } - - if (Enable::PLUGDOOR) - { - PlugDoor(g4Reco); - } - - if (Enable::USER) - { - UserDetector(g4Reco); - } - - 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->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"); - } -} -#endif diff --git a/detectors/fsPHENIX/init_gui_vis.mac b/detectors/fsPHENIX/init_gui_vis.mac deleted file mode 100644 index 8aca21396..000000000 --- a/detectors/fsPHENIX/init_gui_vis.mac +++ /dev/null @@ -1,20 +0,0 @@ -# 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/detectors/fsPHENIX/vis.mac b/detectors/fsPHENIX/vis.mac deleted file mode 100644 index 47db266aa..000000000 --- a/detectors/fsPHENIX/vis.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 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 -# 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 2 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. From 80cfdfba7d7d1751dd6219f0624341c5e9b76bfd Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 20 Apr 2021 21:06:54 -0400 Subject: [PATCH 1010/1222] remove FEMC from sPHENIX setup --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 12 ------------ detectors/sPHENIX/G4Setup_sPHENIX.C | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index fca7c2a67..47cd18a9d 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -312,13 +312,6 @@ int Fun4All_G4_sPHENIX( Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER and Enable::QA && true; - // forward EMC - //Enable::FEMC = true; - Enable::FEMC_ABSORBER = true; - Enable::FEMC_TOWER = Enable::FEMC && true; - Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true; - Enable::FEMC_EVAL = Enable::FEMC_CLUSTER and Enable::QA && true; - Enable::EPD = false; //! forward flux return plug door. Out of acceptance and off by default. @@ -426,9 +419,6 @@ int Fun4All_G4_sPHENIX( // if enabled, do topoClustering early, upstream of any possible jet reconstruction if (Enable::TOPOCLUSTER) TopoClusterReco(); - if (Enable::FEMC_TOWER) FEMC_Towers(); - if (Enable::FEMC_CLUSTER) FEMC_Clusters(); - //-------------- // SVTX tracking //-------------- @@ -500,8 +490,6 @@ int Fun4All_G4_sPHENIX( if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); - if (Enable::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root"); - if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 654690cff..1fe397b4f 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -62,7 +61,6 @@ void G4Init() MagnetFieldInit(); // We want the field - even if the magnet volume is disabled if (Enable::HCALOUT) HCalOuterInit(); if (Enable::PLUGDOOR) PlugDoorInit(); - if (Enable::FEMC) FEMCInit(); if (Enable::EPD) EPDInit(); if (Enable::USER) UserInit(); if (Enable::BLACKHOLE) BlackHoleInit(); @@ -121,7 +119,6 @@ int G4Setup() if (Enable::MAGNET) radius = Magnet(g4Reco, radius); if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); if (Enable::PLUGDOOR) PlugDoor(g4Reco); - if (Enable::FEMC) FEMCSetup(g4Reco); if (Enable::EPD) EPD(g4Reco); if (Enable::USER) UserDetector(g4Reco); @@ -174,12 +171,6 @@ void ShowerCompress(int verbosity = 0) 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->AddCellContainer("G4CELL_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); se->registerSubsystem(compress); return; @@ -208,9 +199,6 @@ void DstCompress(Fun4AllDstOutputManager *out) out->StripNode("G4CELL_CEMC"); out->StripNode("G4CELL_HCALIN"); out->StripNode("G4CELL_HCALOUT"); - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4CELL_FEMC"); } } #endif From 294375439c43dfabe89d7bed098d90ba70f147bb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 22 Apr 2021 16:10:29 -0400 Subject: [PATCH 1011/1222] fix typo HCALIN -> HCALOUT --- common/G4_HcalOut_ref.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 1b9d146dd..55809ac1f 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -189,7 +189,7 @@ void HCALOuter_Towers() // 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) + if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) { TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALOUT); } From ae2a49292bcf711e4286436cf13da610e51da1e3 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 28 Apr 2021 22:01:00 -0400 Subject: [PATCH 1012/1222] Simplifying tracking macro. Setting up switches to allow mix and match of truth and reconstruction for vertex and seeding. --- common/G4_Tracking.C | 71 ++++++-------------------------------------- 1 file changed, 9 insertions(+), 62 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 4af6aa55c..f36acc703 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -82,8 +81,8 @@ namespace G4TRACKING // PHActsTracks // convert SvtxTracks to Acts tracks // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks + bool use_acts_silicon_seeding = true; // if true runs acts silicon seeding bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_tpc_seed_vertex_assoc = true; // Possible variations - these are normally false bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker @@ -91,19 +90,11 @@ namespace G4TRACKING bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_silicon_seeding = true; // if true runs acts silicon seeding bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing - bool use_phinit_vertexing = false && !use_acts_init_vertexing; // false for using smeared truth vertex, set to true to get initial vertex from MVTX hits using PHInitZVertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting - bool use_primary_vertex = false; // refit Genfit tracks (only) with primary vertex included - adds second node to node tree, adds second evaluator, outputs separate ntuples - bool use_acts_evaluator = false; // Turn to true for an acts evaluator which outputs acts specific information in a tuple - int init_vertexing_min_zvtx_tracks = 2; // PHInitZvertexing parameter for reducing spurious vertices, use 2 for Pythia8 events, 5 for large multiplicity events - //default seed is PHTpcTracker - // This is the setup we have been using before PHInitZVertexing was implemented - smeared truth vertex for a single collision per event. Make it the default for now. + // 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: - // This is the setup that uses PHInitZvertexing to find initial vertices, and allows for multiple collisions per event - //std::string vmethod("avr-smoothing:1-minweight:0.5-primcut:9-seccut:9"); // seems to handle multi-vertex events. } // namespace G4TRACKING @@ -221,18 +212,6 @@ void Tracking_Reco() } #endif } - else if (G4TRACKING::use_phinit_vertexing) - { - // get the initial vertex for track fitting from the MVTX hits - PHInitZVertexing* init_zvtx = new PHInitZVertexing(7, 7, "PHInitZVertexing"); - int seed_layer[7] = {0, 1, 2, 3, 4, 5, 6}; - init_zvtx->set_seeding_layer(seed_layer, 7); - // this is the minimum number of associated MVTX triplets for a vertex to be accepted as a candidate. - // Suggest to use 2 for Pythia8 and 5 for Au+Au (to reduce spurious vertices). - init_zvtx->set_min_zvtx_tracks(G4TRACKING::init_vertexing_min_zvtx_tracks); - init_zvtx->Verbosity(verbosity); - se->registerSubsystem(init_zvtx); - } else { // We cheat to get the initial vertex for the full track reconstruction case @@ -307,15 +286,11 @@ void Tracking_Reco() se->registerSubsystem(seeder); } } - - if(G4TRACKING::use_tpc_seed_vertex_assoc) - { - // This does not care which seeder is used - PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); - vtxassoc->Verbosity(0); - se->registerSubsystem(vtxassoc); - } - + // This does not care which seeder is used + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); + // Genfit track propagation and final fitting (starts from TPC track seeds) //================================================= if (G4TRACKING::use_Genfit) @@ -347,11 +322,13 @@ void Tracking_Reco() PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); kalman->Verbosity(verbosity); + /* if (G4TRACKING::use_primary_vertex) { kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true } + */ kalman->set_vertexing_method(G4TRACKING::vmethod); kalman->set_use_truth_vertex(false); @@ -393,8 +370,6 @@ void Tracking_Reco() // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding PHSiliconTpcTrackMatching* silicon_match = new PHSiliconTpcTrackMatching(); silicon_match->Verbosity(verbosity); - if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_tpc_seed_vertex_assoc) - silicon_match->set_seeder(false); // module defaults to CASeeding, for PHTpcTracker seeding use false here ONLY when not using PHTpcTrackSeedVertexAssoc. silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); @@ -538,34 +513,6 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - if (!G4TRACKING::use_Genfit && !G4TRACKING::SC_CALIBMODE) - { -#if __cplusplus >= 201703L - if (G4TRACKING::use_acts_evaluator) - { - ActsEvaluator* actsEval = new ActsEvaluator(outputfile + "_acts.root", eval); - actsEval->Verbosity(verbosity); - actsEval->setEvalCKF(false); - se->registerSubsystem(actsEval); - } -#endif - } - - if (G4TRACKING::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", outputfile + "_primary_eval.root", "PrimaryTrackMap", G4MVTX::n_maps_layer, G4INTT::n_intt_layer, G4TPC::n_gas_layer); - 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(verbosity); - se->registerSubsystem(evalp); - } - return; } From 21be5565e8895a80ba9805763bc59b95a1022494 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 28 Apr 2021 22:02:34 -0400 Subject: [PATCH 1013/1222] More changes. --- common/G4_Tracking.C | 419 +++++++++++++++++++++---------------------- 1 file changed, 201 insertions(+), 218 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f36acc703..8aef54743 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -72,27 +71,28 @@ namespace G4TRACKING //===================================== // The normal (default) Acts tracking chain is: - // PHTruthVertexing // event vertex - // PHCASeeding // TPC track seeds - // PHSiliconTruthTrackSeeding // make silicon layer track stubs - // PHSiliconTpcTrackMatching // match TPC track seeds to silicon layers track stubs + // PHActsSiliconSeeding // make silicon track seeds + // PHActsInitialVertexing // event vertex from silicon track stubs + // PHCASeeding // TPC track seeds + // PHSiliconTpcTrackMatching // match TPC track seeds to silicon track seeds // PHMicromegasTpcTrackMatching // associate Micromagas clusters with TPC track stubs - // PHActsSourceLinks // convert TrkrClusters to Acts measurements // PHActsTracks // convert SvtxTracks to Acts tracks // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks + // Final vertexing - bool use_acts_silicon_seeding = true; // if true runs acts silicon seeding bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing // Possible variations - these are normally false 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_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 in stead of rec o TPC seeding + //bool use_truth_track_seeding = false; // use true to run with truth track seeding ***** WORKS FOR GENFIT ONLY bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only - bool use_truth_track_seeding = false; // false for normal track seeding, use true to run with truth track seeding instead ***** WORKS FOR GENFIT ONLY bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing - bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting + bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting // 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: @@ -184,245 +184,233 @@ void Tracking_Reco() // Tracking //------------ - // Initial vertex finding - //================================= - if(G4TRACKING::use_acts_silicon_seeding && !G4TRACKING::use_Genfit) + // Assemble silicon clusters into track stubs + if(G4TRACKING::use_truth_silicon_seeding) { - #if __cplusplus >= 201703L + // 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(10); + 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->Verbosity(0); se->registerSubsystem(silicon_Seeding); + } + + // Initial vertex finding + //================================= + if(G4TRACKING::use_acts_init_vertexing) + { - if(G4TRACKING::use_acts_init_vertexing) - { - - PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); - init_vtx->Verbosity(verbosity); - init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); - init_vtx->setSvtxVertexMapName("SvtxVertexMap"); - se->registerSubsystem(init_vtx); - } - else - { - PHTruthVertexing *init_vtx = new PHTruthVertexing(); - init_vtx->Verbosity(verbosity); - init_vtx->set_acts_silicon(true); - se->registerSubsystem(init_vtx); - } - #endif + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); + init_vtx->Verbosity(10); + init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); + init_vtx->setSvtxVertexMapName("SvtxVertexMap"); + se->registerSubsystem(init_vtx); } else - { - // We cheat to get the initial vertex for the full track reconstruction case - PHInitVertexing* init_vtx = new PHTruthVertexing("PHTruthVertexing"); - init_vtx->Verbosity(verbosity); - se->registerSubsystem(init_vtx); - - } - - // Truth track seeding and propagation in one module - // ==================================== - if (G4TRACKING::use_truth_track_seeding) - { - std::cout << "Using truth track seeding " << std::endl; - - // For each truth particle, create a track and associate clusters with it using truth information - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeeding"); - pat_rec->Verbosity(verbosity); - se->registerSubsystem(pat_rec); - } - - // TPC track seeding (finds all clusters in TPC for tracks) - //======================================= - if (!G4TRACKING::use_truth_track_seeding) - { - 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); + PHTruthVertexing *init_vtx = new PHTruthVertexing(); + init_vtx->Verbosity(verbosity); + init_vtx->set_acts_silicon(true); + se->registerSubsystem(init_vtx); } - else if(G4TRACKING::use_hybrid_seeding && !G4TRACKING::use_PHTpcTracker_seeding) + + // TPC track seeding (finds all clusters in TPC for tracks) + //============================================ + if(G4TRACKING::use_truth_tpc_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(0); - se->registerSubsystem(hseeder); + // 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(10); + 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 + else { - 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 << " Since config doesn't make sense, reverting to default..." << std::endl; - } - 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 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(0); + se->registerSubsystem(hseeder); + } + else + { + 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 << " Since config doesn't make sense, reverting to default..." << std::endl; + } + 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); + } } - } + // This does not care which seeder is used PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); vtxassoc->Verbosity(0); se->registerSubsystem(vtxassoc); + // Genfit track propagation and final fitting (starts from TPC track seeds) - //================================================= + // Ignores Silicon track seeds, silicon association is by track propagation + //======================================================== if (G4TRACKING::use_Genfit) - { - if (!G4TRACKING::use_truth_track_seeding) { + std::cout << " Using PHGenFitTrkProp " << std::endl; - + // Association of TPC track seeds with 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); + 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; - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - /* - - if (G4TRACKING::use_primary_vertex) - { - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true + { + // 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; + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + + se->registerSubsystem(kalman); } - */ - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - } - + // Acts tracking chain (starts from TPC track seeds) //=================================== - if (!G4TRACKING::use_truth_track_seeding && !G4TRACKING::use_Genfit) - { - std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; - - // 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 + if (!G4TRACKING::use_Genfit) { - 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 - - // use truth information to assemble silicon clusters into track stubs for now - if(!G4TRACKING::use_acts_silicon_seeding) + std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + + // Silicon cluster matching to TPC track seeds + if (G4TRACKING::use_truth_si_matching) { - PHSiliconTruthTrackSeeding* silicon_seeding = new PHSiliconTruthTrackSeeding(); - silicon_seeding->Verbosity(verbosity); - se->registerSubsystem(silicon_seeding); - + 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); } - - // 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); + { + 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 //================================= @@ -430,8 +418,6 @@ void Tracking_Reco() { std::cout << " Using Acts track fitting " << std::endl; -#if __cplusplus >= 201703L - PHActsTrkFitter* actsFit = new PHActsTrkFitter("PHActsFirstTrkFitter"); actsFit->Verbosity(verbosity); actsFit->doTimeAnalysis(false); @@ -457,9 +443,6 @@ void Tracking_Reco() actsFit2->doTimeAnalysis(false); actsFit2->fitSiliconMMs(false); se->registerSubsystem(actsFit2); - - -#endif } // Final vertex finding and fitting with RAVE From 54c76ffb46f1b83a2a8d2097a8b41d658bcdcb01 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 29 Apr 2021 16:28:41 -0400 Subject: [PATCH 1014/1222] Major reorganization of tracking macro. Still testing it .... --- common/G4_Tracking.C | 465 +++++++++++++++++++++++++++---------------- 1 file changed, 296 insertions(+), 169 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 8aef54743..9b9a782e7 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -80,18 +80,25 @@ namespace G4TRACKING // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks // Final vertexing - bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_acts_init_vertexing = false; // if true runs acts initial vertex finder, false runs truth vertexing // Possible variations - these are normally false - 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_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 in stead of rec o TPC seeding - //bool use_truth_track_seeding = false; // use true to run with truth track seeding ***** WORKS FOR GENFIT ONLY - bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only - bool use_Genfit = false; // if false, acts KF is run on proto tracks assembled above, if true, use Genfit track propagation and fitting - + //==================================== + //Fittting + bool use_genfit = true; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting + + // Initial vertexing + bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool use_truth_init_vertexing = false; // if true runs truth vertexing, if false runs acts initial vertex finder + + // Seeding + 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_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 + bool use_full_truth_track_seeding = false; // makes track seeds using truth info, used for both Acts and Genfit + + // Final vertexing bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting // 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: @@ -138,16 +145,26 @@ void TrackingInit() G4TRACKING::SC_CALIBMODE = (G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) && G4TRACKING::SC_CALIBMODE; // Genfit does final vertexing, Acts does not - if (G4TRACKING::use_Genfit) - G4TRACKING::g4eval_use_initial_vertex = false; + //if (G4TRACKING::use_genfit) + //G4TRACKING::g4eval_use_initial_vertex = false; // For now the TpcSpaceChargeCorrection module only works with the GenFit tracking chain - if (G4TPC::ENABLE_CORRECTIONS && !G4TRACKING::use_Genfit) + 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); @@ -184,14 +201,21 @@ void Tracking_Reco() // Tracking //------------ + //==================== + // Initial vertex finding + // Common to all sections + //===================== + // 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(10); + pat_rec->Verbosity(0); 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); @@ -204,139 +228,98 @@ void Tracking_Reco() silicon_Seeding->Verbosity(0); se->registerSubsystem(silicon_Seeding); } - + // Initial vertex finding //================================= - if(G4TRACKING::use_acts_init_vertexing) - { - - PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); - init_vtx->Verbosity(10); - init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); - init_vtx->setSvtxVertexMapName("SvtxVertexMap"); - se->registerSubsystem(init_vtx); - } - else + if(G4TRACKING::use_truth_init_vertexing) { PHTruthVertexing *init_vtx = new PHTruthVertexing(); init_vtx->Verbosity(verbosity); init_vtx->set_acts_silicon(true); - se->registerSubsystem(init_vtx); - } - - // 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(10); - 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); + se->registerSubsystem(init_vtx); } else { - std::cout << "Using normal TPC track seeding " << std::endl; - - // TPC track seeding from data - if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) + PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); + init_vtx->Verbosity(0); + init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); + init_vtx->setSvtxVertexMapName("SvtxVertexMap"); + se->registerSubsystem(init_vtx); + } + + //========================================================= + // 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) { - std::cout << " Using PHTpcTracker track seeding " << std::endl; + // 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(0); + 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); - 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(0); - se->registerSubsystem(hseeder); + se->registerSubsystem(pat_rec); } else { - if(G4TRACKING::use_hybrid_seeding && G4TRACKING::use_PHTpcTracker_seeding) + std::cout << "Using normal TPC track seeding " << std::endl; + + // TPC track seeding from data + if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) { - std::cerr << "***WARNING: MULTIPLE SEEDER OPTIONS SELECTED!***" << std::endl; - std::cerr << " Current config selects both PHTpcTracker and PHHybridSeeding." << std::endl; - std::cerr << " Since config doesn't make sense, reverting to default..." << std::endl; + 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(0); + 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 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); } - } - - // This does not care which seeder is used - PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); - vtxassoc->Verbosity(0); - se->registerSubsystem(vtxassoc); - - // Genfit track propagation and final fitting (starts from TPC track seeds) - // Ignores Silicon track seeds, silicon association is by track propagation - //======================================================== - if (G4TRACKING::use_Genfit) - { - - std::cout << " Using PHGenFitTrkProp " << std::endl; - - // Association of TPC track seeds with 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; - - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); - kalman->Verbosity(verbosity); - kalman->set_vertexing_method(G4TRACKING::vmethod); - kalman->set_use_truth_vertex(false); - - se->registerSubsystem(kalman); - } - - // Acts tracking chain (starts from TPC track seeds) - //=================================== - if (!G4TRACKING::use_Genfit) - { - std::cout << " Using normal Acts matching chain for silicon and MM's " << std::endl; + // Associate TPC track stubs with silicon and Micromegas + //============================================= + + // This does not care which seeder is used + PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); + vtxassoc->Verbosity(0); + se->registerSubsystem(vtxassoc); // Silicon cluster matching to TPC track seeds if (G4TRACKING::use_truth_si_matching) @@ -410,60 +393,203 @@ void Tracking_Reco() 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 - //================================= - if (!G4TRACKING::use_Genfit) - { - 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); + // 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 + PHTpcResiduals* residuals = new PHTpcResiduals(); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } + + + PHActsVertexFinder *finder = new PHActsVertexFinder(); + finder->Verbosity(verbosity); + se->registerSubsystem(finder); + + PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); + actsFit2->Verbosity(verbosity); + actsFit2->doTimeAnalysis(false); + actsFit2->fitSiliconMMs(false); + se->registerSubsystem(actsFit2); + } - if (G4TRACKING::SC_CALIBMODE) + //========================================================= + // Section 2: Full truth track finding with Acts final fitting + //========================================================= + if( !G4TRACKING::use_genfit && G4TRACKING::use_full_truth_track_seeding) { - /// run tpc residual determination with silicon+MM track fit - PHTpcResiduals* residuals = new PHTpcResiduals(); - residuals->Verbosity(verbosity); - se->registerSubsystem(residuals); + 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(0); + pat_rec->set_track_map_name("SvtxTrackMap"); + se->registerSubsystem(pat_rec); + + // 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 + PHTpcResiduals* residuals = new PHTpcResiduals(); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } + + + PHActsVertexFinder *finder = new PHActsVertexFinder(); + finder->Verbosity(verbosity); + se->registerSubsystem(finder); + + PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); + actsFit2->Verbosity(verbosity); + actsFit2->doTimeAnalysis(false); + actsFit2->fitSiliconMMs(false); + se->registerSubsystem(actsFit2); + } + + //========================================================= + // 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 + // 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(0); + pat_rec->set_track_map_name("SvtxTrackMap"); + se->registerSubsystem(pat_rec); + } + else + { + // need TPC track seeds to give to GenfitTrkProp - PHActsVertexFinder *finder = new PHActsVertexFinder(); - finder->Verbosity(verbosity); - se->registerSubsystem(finder); - - PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); - actsFit2->Verbosity(verbosity); - actsFit2->doTimeAnalysis(false); - actsFit2->fitSiliconMMs(false); - se->registerSubsystem(actsFit2); - } + // 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(0); + 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 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(0); + 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; + + PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + kalman->Verbosity(verbosity); + kalman->set_vertexing_method(G4TRACKING::vmethod); + kalman->set_use_truth_vertex(false); + se->registerSubsystem(kalman); + } + // 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); - } - + { + 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; } @@ -492,6 +618,7 @@ void Tracking_Eval(const std::string& outputfile) eval->do_gpoint_eval(false); 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->Verbosity(verbosity); se->registerSubsystem(eval); @@ -530,7 +657,7 @@ void Tracking_QA() // Acts Kalman Filter vertex finder //================================= - if (!G4TRACKING::use_Genfit) + if (!G4TRACKING::use_genfit) { #if __cplusplus >= 201703L From c4893d4bf56f8571f576b1566a613778a55ad850 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 29 Apr 2021 22:53:35 -0400 Subject: [PATCH 1015/1222] Tidied up, added comments. --- common/G4_Tracking.C | 100 +++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9b9a782e7..4dfd8c36e 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -74,32 +74,34 @@ namespace G4TRACKING // PHActsSiliconSeeding // make silicon track seeds // PHActsInitialVertexing // event vertex from silicon track stubs // 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 Micromagas clusters with TPC track stubs - // PHActsTracks // convert SvtxTracks to Acts tracks - // PHActsTrkFitter // Kalman fitter makes final fit to assembled tracks - // Final vertexing - + // PHMicromegasTpcTrackMatching // associate Micromegas clusters with TPC track stubs + // PHActsTrkFitter (1) // Kalman fitter makes fit to assembled tracks + // PHActsVertexFinder // final vertexing using fitted Acts tracks + // PHActsTrkFitter (2) // Kalman fitter makes final fit to tracks (improves DCA resolution using final vertex) // Possible variations - these are normally false //==================================== //Fittting - bool use_genfit = true; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting + bool use_genfit = false; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting // Initial vertexing bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_truth_init_vertexing = false; // if true runs truth vertexing, if false runs acts initial vertex finder - // Seeding + // 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_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 + + // 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 bool use_full_truth_track_seeding = false; // makes track seeds using truth info, used for both Acts and Genfit - // Final vertexing - bool use_rave_vertexing = true; // Use Rave to find and fit for vertex after track fitting + // Rave final vertexing + 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: @@ -144,10 +146,6 @@ void TrackingInit() // 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; - // Genfit does final vertexing, Acts does not - //if (G4TRACKING::use_genfit) - //G4TRACKING::g4eval_use_initial_vertex = false; - // For now the TpcSpaceChargeCorrection module only works with the GenFit tracking chain if (G4TPC::ENABLE_CORRECTIONS && !G4TRACKING::use_genfit) { @@ -197,25 +195,26 @@ void Tracking_Reco() Fun4AllServer* se = Fun4AllServer::instance(); - //------------- + //------------------------------------------------------- // Tracking - //------------ + // Sections 1, 2 and 3 are alternatives to each other + //-------------------------------------------------------- + //==================== - // Initial vertex finding // Common to all sections + // Initial vertex finding //===================== - // Assemble silicon clusters into track stubs - // (needed for initial vertex finding) - //================================== + // 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(0); + 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); @@ -225,7 +224,7 @@ void Tracking_Reco() else { PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); - silicon_Seeding->Verbosity(0); + silicon_Seeding->Verbosity(verbosity); se->registerSubsystem(silicon_Seeding); } @@ -241,15 +240,15 @@ void Tracking_Reco() else { PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); - init_vtx->Verbosity(0); + init_vtx->Verbosity(verbosity); init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); init_vtx->setSvtxVertexMapName("SvtxVertexMap"); se->registerSubsystem(init_vtx); } - //========================================================= + //================================================ // 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) @@ -259,7 +258,7 @@ void Tracking_Reco() // 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(0); + 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); @@ -295,7 +294,7 @@ void Tracking_Reco() hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) hseeder->setMinTrackSize(10,5); // (iter1, iter2) hseeder->setNThreads(1); - hseeder->Verbosity(0); + hseeder->Verbosity(verbosity); se->registerSubsystem(hseeder); } else @@ -317,8 +316,9 @@ void Tracking_Reco() //============================================= // 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 PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); - vtxassoc->Verbosity(0); + vtxassoc->Verbosity(verbosity); se->registerSubsystem(vtxassoc); // Silicon cluster matching to TPC track seeds @@ -437,12 +437,12 @@ void Tracking_Reco() // 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(0); + pat_rec->Verbosity(verbosity); pat_rec->set_track_map_name("SvtxTrackMap"); se->registerSubsystem(pat_rec); - // Final fitting of tracks using Acts Kalman Filter - //===================================== + // Fitting of tracks using Acts Kalman Filter + //================================== std::cout << " Using Acts track fitting " << std::endl; @@ -460,8 +460,7 @@ void Tracking_Reco() residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } - - + PHActsVertexFinder *finder = new PHActsVertexFinder(); finder->Verbosity(verbosity); se->registerSubsystem(finder); @@ -471,9 +470,7 @@ void Tracking_Reco() actsFit2->doTimeAnalysis(false); actsFit2->fitSiliconMMs(false); se->registerSubsystem(actsFit2); - } - //========================================================= // Section 3: Genfit track propagation and final fitting @@ -488,10 +485,10 @@ void Tracking_Reco() 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 - // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // 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(0); + pat_rec->Verbosity(verbosity); pat_rec->set_track_map_name("SvtxTrackMap"); se->registerSubsystem(pat_rec); } @@ -523,7 +520,7 @@ void Tracking_Reco() hseeder->setSearchAngle(M_PI/8.,M_PI/8.); // radians (iter1, iter2) hseeder->setMinTrackSize(10,5); // (iter1, iter2) hseeder->setNThreads(1); - hseeder->Verbosity(0); + hseeder->Verbosity(verbosity); se->registerSubsystem(hseeder); } else @@ -542,14 +539,14 @@ void Tracking_Reco() std::cout << " Using PHGenFitTrkProp " << std::endl; - // Association of TPC track seeds with silicon layers and Micromegas layers + // 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(0); + track_prop->Verbosity(verbosity); se->registerSubsystem(track_prop); for (int i = 0; i < G4INTT::n_intt_layer; i++) { @@ -569,9 +566,14 @@ void Tracking_Reco() kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); } - + + + //================================== + // Common to all sections + //================================== + // Final vertex finding and fitting with RAVE - //================================= + //================================== if (G4TRACKING::use_rave_vertexing) { PHRaveVertexing* rave = new PHRaveVertexing(); @@ -580,12 +582,10 @@ void Tracking_Reco() rave->set_svtxvertexmaprefit_node_name("SvtxVertexMapRave"); rave->Verbosity(verbosity); se->registerSubsystem(rave); - } - - - //------------------ + } + // Track Projections - //------------------ + //=============== PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); @@ -596,7 +596,7 @@ void Tracking_Reco() void Tracking_Eval(const std::string& outputfile) { int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - + //--------------- // Fun4All server //--------------- From 21ede0518c28f584c91afcfea81e91dc30593f4a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 30 Apr 2021 01:22:34 -0400 Subject: [PATCH 1016/1222] More comments. --- common/G4_Tracking.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 4dfd8c36e..6b694fdb5 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -98,9 +98,10 @@ namespace G4TRACKING 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 - // Rave final vertexing + // 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: @@ -198,9 +199,11 @@ void Tracking_Reco() //------------------------------------------------------- // 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 // Initial vertex finding From 26b3cccda1816ceb4c7ce710dbea54889cfc428b Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Fri, 30 Apr 2021 11:14:57 -0400 Subject: [PATCH 1017/1222] Tidy up. --- common/G4_Tracking.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 6b694fdb5..87a9e9c0d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -196,13 +196,13 @@ void Tracking_Reco() 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 From a781fb16fb02481739114a67a852c13edcc3ca05 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 4 May 2021 20:13:23 -0400 Subject: [PATCH 1018/1222] add calibrations subdir --- calibrations/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 calibrations/README.md 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) From e72d022fe9cdd901a39b232e69c33ff70787aaea Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 5 May 2021 12:28:12 -0400 Subject: [PATCH 1019/1222] fix vertex eval --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 87a9e9c0d..d2e3e77f3 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -87,7 +87,7 @@ namespace G4TRACKING bool use_genfit = false; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting // Initial vertexing - bool g4eval_use_initial_vertex = false; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit bool use_truth_init_vertexing = false; // if true runs truth vertexing, if false runs acts initial vertex finder // TPC seeding options From 0844277533982707938a0aaff8eafed94d633ae2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 5 May 2021 20:17:50 -0400 Subject: [PATCH 1020/1222] start differentiating between calorimeter absorber and support structures --- common/G4_HcalIn_ref.C | 3 ++- common/GlobalVariables.C | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 908852d16..5d1e3e1a2 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -41,6 +41,7 @@ namespace Enable bool HCALIN_CLUSTER = false; bool HCALIN_EVAL = false; bool HCALIN_QA = false; + bool HCALIN_SUPPORT = false; int HCALIN_VERBOSITY = 0; } // namespace Enable @@ -174,7 +175,7 @@ double HCalInner(PHG4Reco *g4Reco, //! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin void HCalInner_SupportRing(PHG4Reco *g4Reco) { - bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER; + bool AbsorberActive = Enable::SUPPORT || Enable::HCALIN_SUPPORT; const double z_ring1 = (2025 + 2050) / 2. / 10.; const double innerradius_sphenix = 116.; diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 0a5b1efff..b3576c325 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -27,10 +27,11 @@ namespace DstOut // Global settings affecting multiple subsystems namespace Enable { - bool OVERLAPCHECK = false; bool ABSORBER = false; bool DSTOUT = false; bool DSTOUT_COMPRESS = false; + bool OVERLAPCHECK = false; + bool SUPPORT = false; int VERBOSITY = 0; } // namespace Enable From d676328235cac18ceb711527db2b4328c7d32aeb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 6 May 2021 22:24:26 -0400 Subject: [PATCH 1021/1222] use sampling fration from electron sims for no digitization --- common/G4_HcalIn_ref.C | 3 ++- common/G4_HcalOut_ref.C | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 5d1e3e1a2..f0537e0e9 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -267,7 +267,8 @@ void HCALInner_Towers() TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) { - TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALIN); + // 0.176 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.176); } else { diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 55809ac1f..7bf8f6ed3 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -191,7 +191,8 @@ void HCALOuter_Towers() TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) { - TowerCalibration->set_calib_const_GeV_ADC(1. / visible_sample_fraction_HCALOUT); + // 0.033 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.033); } else { From dd91273efd47b78558bc541039fbd8f5d170cf2c Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 11 May 2021 14:45:23 -0400 Subject: [PATCH 1022/1222] remove acts evaluator header --- common/G4_Tracking.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index d2e3e77f3..6c728702c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -29,7 +29,6 @@ #include #if __cplusplus >= 201703L -#include #include #include #include From 1a757005e4589240302216a01e39b18f690ea6ae Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 12 May 2021 11:36:20 -0400 Subject: [PATCH 1023/1222] remove other headers --- common/G4_Tracking.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 6c728702c..6a34ed22f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -30,9 +30,7 @@ #if __cplusplus >= 201703L #include -#include #include -#include #include #include #include From 3a0d0f428ac32998b2fc1b522934e56ac09a9a76 Mon Sep 17 00:00:00 2001 From: cdean-github <59485912+cdean-github@users.noreply.github.com> Date: Fri, 21 May 2021 11:18:50 -0600 Subject: [PATCH 1024/1222] Updated KFParticle macro (#413) KFParticle_sPHENIX updates have removed functions with fixed-length arrays in favor of functions with vectors. The KFParticle macro had to be updated to match this. At the same time, I switche the decay topology declarations from individual functions to decay descriptors --- common/G4_KFParticle.C | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 206b77e1a..58722ce14 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -48,15 +48,12 @@ void KFParticle_Upsilon_Reco() kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + std::string decayDescriptor = motherName + " -> e^+ e^-"; + kfparticle->setDecayDescriptor(decayDescriptor); + kfparticle->setContainerName(motherName); kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - std::pair daughterList[99]; - kfparticle->setNumberOfTracks(2); - daughterList[0] = make_pair("electron", +1); - daughterList[1] = make_pair("electron", -1); - kfparticle->getChargeConjugate(false); - kfparticle->setDaughters(daughterList); kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(0); // Upsilon decays are prompt, tracks are more likely to point to vertex kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -64,7 +61,6 @@ void KFParticle_Upsilon_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMotherName(motherName); kfparticle->setMinimumMass(7); kfparticle->setMaximumMass(11); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); @@ -91,15 +87,12 @@ void KFParticle_D0_Reco() kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + std::string decayDescriptor = "[" + motherName + " -> K^- pi^+]cc"; + kfparticle->setDecayDescriptor(decayDescriptor); + kfparticle->setContainerName(motherName); kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - std::pair daughterList[99]; - kfparticle->setNumberOfTracks(2); - daughterList[0] = make_pair("kaon", -1); - daughterList[1] = make_pair("pion", +1); - kfparticle->getChargeConjugate(true); - kfparticle->setDaughters(daughterList); kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -107,7 +100,6 @@ void KFParticle_D0_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMotherName(motherName); kfparticle->setMinimumMass(1.750); kfparticle->setMaximumMass(1.950); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); @@ -134,16 +126,12 @@ void KFParticle_Lambdac_Reco() kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + std::string decayDescriptor = "[" + motherName + " -> proton^+ K^- pi^+]cc"; + kfparticle->setDecayDescriptor(decayDescriptor); + kfparticle->setContainerName(motherName); kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - std::pair daughterList[99]; - kfparticle->setNumberOfTracks(3); - daughterList[0] = make_pair("proton", +1); - daughterList[1] = make_pair("kaon", -1); - daughterList[2] = make_pair("pion", +1); - kfparticle->getChargeConjugate(true); - kfparticle->setDaughters(daughterList); kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -151,7 +139,6 @@ void KFParticle_Lambdac_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMotherName(motherName); kfparticle->setMinimumMass(2.150); kfparticle->setMaximumMass(2.400); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); From 001f6189231b6be741e6a381d734c098392256b0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 22 May 2021 15:22:32 -0400 Subject: [PATCH 1025/1222] use sampling fraction for RawTowerDigitizer::kNo_digitization --- common/G4_CEmc_Spacal.C | 49 ++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 56d8d3c00..7bb255692 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -372,29 +372,41 @@ void CEMC_Towers() 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::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); + 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) { - 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/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); + 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); + 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 { @@ -403,6 +415,7 @@ void CEMC_Towers() gSystem->Exit(-1); return; } + se->registerSubsystem(TowerCalibration); return; } From c32aeaf404b885d42fa82e00db08dbcf39dcd42e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 3 Jun 2021 17:39:57 -0400 Subject: [PATCH 1026/1222] - load libtpccalib.so - set proper path to include PHTpcResidulals (it is now in tpccalib) --- common/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 6a34ed22f..2f6d61b14 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -34,7 +34,7 @@ #include #include #include -#include +#include #endif #include @@ -47,6 +47,7 @@ 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) From 46e25c671bcd0957f01a5c689a4450b11f0ca96b Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 7 Jun 2021 14:24:26 -0400 Subject: [PATCH 1027/1222] - added a global string to be able to set the Space Charge reconstruction matrices output filename - added a global flag for MakeActsGeom::add_fake_surfaces - added GenFit support for SC_CALIBMODE --- common/G4_Tracking.C | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2f6d61b14..c2fef10dc 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -28,14 +28,14 @@ #include #include -#if __cplusplus >= 201703L #include #include #include #include #include + +#include #include -#endif #include @@ -64,6 +64,7 @@ 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 //===================================== @@ -92,6 +93,9 @@ namespace G4TRACKING 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) + // 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 @@ -171,6 +175,7 @@ void TrackingInit() 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 && @@ -410,8 +415,9 @@ void Tracking_Reco() if (G4TRACKING::SC_CALIBMODE) { /// run tpc residual determination with silicon+MM track fit - PHTpcResiduals* residuals = new PHTpcResiduals(); - residuals->Verbosity(verbosity); + auto residuals = new PHTpcResiduals; + residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } @@ -561,14 +567,31 @@ void Tracking_Reco() std::cout << " Using Genfit track fitting " << std::endl; - PHGenFitTrkFitter* kalman = new PHGenFitTrkFitter(); + auto kalman = new PHGenFitTrkFitter; kalman->Verbosity(verbosity); kalman->set_vertexing_method(G4TRACKING::vmethod); kalman->set_use_truth_vertex(false); se->registerSubsystem(kalman); + + // 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 ); } + } + + 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 //================================== From 03a393749e863bdf2c3039aeb4a482f944a64004 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 8 Jun 2021 23:23:58 -0400 Subject: [PATCH 1028/1222] Also pass output root file name to PHTpcResiduals when running in truth tracking mode --- common/G4_Tracking.C | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index c2fef10dc..d3f07c887 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -416,8 +416,8 @@ void Tracking_Reco() { /// run tpc residual determination with silicon+MM track fit auto residuals = new PHTpcResiduals; - residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); - residuals->Verbosity(verbosity); + residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } @@ -463,8 +463,9 @@ void Tracking_Reco() if (G4TRACKING::SC_CALIBMODE) { /// run tpc residual determination with silicon+MM track fit - PHTpcResiduals* residuals = new PHTpcResiduals(); - residuals->Verbosity(verbosity); + auto residuals = new PHTpcResiduals; + residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); + residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } @@ -571,7 +572,6 @@ void Tracking_Reco() kalman->Verbosity(verbosity); kalman->set_vertexing_method(G4TRACKING::vmethod); kalman->set_use_truth_vertex(false); - se->registerSubsystem(kalman); // in space charge calibration mode, disable the tpc if( G4TRACKING::SC_CALIBMODE ) @@ -582,6 +582,8 @@ void Tracking_Reco() for( int layer = 39; layer < 55; ++layer ) { kalman->disable_layer( layer ); } } + se->registerSubsystem(kalman); + if( G4TRACKING::SC_CALIBMODE ) { // Genfit based Tpc space charge Reconstruction From 58d6eaacc96566334ae601a3c49a7803661b995a Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 9 Jun 2021 13:49:18 -0400 Subject: [PATCH 1029/1222] Add PHTrackCleaner to normal Acts tracking chain. --- common/G4_Tracking.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index d3f07c887..df6e8d917 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -421,6 +422,10 @@ void Tracking_Reco() se->registerSubsystem(residuals); } + // Choose the best silicon matched track for each TPC track seed + PHTrackCleaner *cleaner= new PHTrackCleaner(); + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); PHActsVertexFinder *finder = new PHActsVertexFinder(); finder->Verbosity(verbosity); From b7eaf7f6314dfc7b725824ff43288959e3433326 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 17 Jun 2021 17:12:01 -0400 Subject: [PATCH 1030/1222] Added propagator to CA seeding --- common/G4_Tracking.C | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index df6e8d917..0e3b7040c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -93,6 +94,7 @@ namespace G4TRACKING // 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; @@ -313,9 +315,28 @@ void Tracking_Reco() seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) - seeder->SetMinHitsPerCluster(2); - seeder->SetMinClustersPerTrack(20); + 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) + { + PHTpcTrackSeedVertexAssoc* vtxassoc2 = new PHTpcTrackSeedVertexAssoc("PrePropagatorPHTpcTrackSeedVertexAssoc"); + 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); + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } } } From 1baabf05bc6ec60b0f60ecad3f711b805b300331 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 17 Jun 2021 17:22:00 -0400 Subject: [PATCH 1031/1222] Fixed formatting issue --- common/G4_Tracking.C | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0e3b7040c..08bdb4d12 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -317,26 +317,26 @@ void Tracking_Reco() 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); + else seeder->SetMinClustersPerTrack(20); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); se->registerSubsystem(seeder); - if(G4TRACKING::use_propagator) - { - PHTpcTrackSeedVertexAssoc* vtxassoc2 = new PHTpcTrackSeedVertexAssoc("PrePropagatorPHTpcTrackSeedVertexAssoc"); - 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); - cprop->useConstBField(false); - cprop->useFixedClusterError(true); - cprop->set_max_window(5.); - cprop->Verbosity(verbosity); - se->registerSubsystem(cprop); - } + if(G4TRACKING::use_propagator) + { + PHTpcTrackSeedVertexAssoc* vtxassoc2 = new PHTpcTrackSeedVertexAssoc("PrePropagatorPHTpcTrackSeedVertexAssoc"); + 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); + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } } } From d30d5329a51c4718993e30445a032ed5d360bbe5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 1 Jul 2021 18:10:56 -0400 Subject: [PATCH 1032/1222] implement selection of 3d fieldmap --- detectors/sPHENIX/G4Setup_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 1fe397b4f..5fff95659 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -88,7 +88,7 @@ int G4Setup() if (stringline.fail()) { // conversion to double fails -> we have a string - if (G4MAGNET::magfield.find("sPHENIX.root") != string::npos) + if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos) { g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); } From 6e2185dc20e651f0dbd7a2de3a9bc72cab3ff4f7 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 4 Jul 2021 11:17:24 -0400 Subject: [PATCH 1033/1222] enable epd by default --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 47cd18a9d..a244a07fe 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -312,7 +312,7 @@ int Fun4All_G4_sPHENIX( Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER and Enable::QA && true; - Enable::EPD = false; + Enable::EPD = true; //! forward flux return plug door. Out of acceptance and off by default. //Enable::PLUGDOOR = true; From 8c583314bd0f9886b3ec4eee055aa3791d35a501 Mon Sep 17 00:00:00 2001 From: Shuonli Date: Sun, 11 Jul 2021 23:49:13 -0400 Subject: [PATCH 1034/1222] added ZDC --- common/G4_ZDC.C | 147 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 common/G4_ZDC.C diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C new file mode 100644 index 000000000..c3f15392c --- /dev/null +++ b/common/G4_ZDC.C @@ -0,0 +1,147 @@ +#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(libg4zdcdetector.so) +R__LOAD_LIBRARY(libg4eval.so) + +namespace Enable +{ + bool ZDC = false; + bool ZDC_ABSORBER = false; + bool ZDC_CELL = false; + bool ZDC_TOWER = false; + bool ZDC_CLUSTER = false; + bool ZDC_EVAL = false; + bool ZDC_OVERLAPCHECK = false; + int ZDC_VERBOSITY = 0; +} + +namespace G4ZDC +{ + + double Gz0 = 1900.; + double outer_radius = 180.; + string calibfile = "/sphenix/u/shuhang98/build/ZDC/source/towerMap_ZDC.txt"; +} +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; + + Fun4AllServer *se = Fun4AllServer::instance(); + + + + PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC"); + + //ostringstream mapping_zdc; + + + //mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; + //mapping_zdc << G4ZDC::calibfile; + + //femc->SetTowerMappingFile(mapping_femc.str()); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + g4Reco->registerSubsystem(zdc); + //cout << mapping_zdc.str() << endl; +} + +void ZDC_Cells() +{ + return; +} + +void ZDC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + ostringstream mapping_zdc; + // mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; + mapping_zdc << 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.str()); + + 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); + + + + 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 / 0.010); // sampling fraction = 0.010 + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + +} + +void ZDC_Clusters() +{ + + return; +} + +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.c_str()); + eval->set_do_cluster_eval(false); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif From cb1aa5bb2dc74ac1f10dd299071406863186915e Mon Sep 17 00:00:00 2001 From: Shuonli Date: Mon, 12 Jul 2021 01:02:32 -0400 Subject: [PATCH 1035/1222] clean up --- common/G4_ZDC.C | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index c3f15392c..02664e1ac 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -6,9 +6,6 @@ #include #include -//#include -//#include - #include #include @@ -27,7 +24,6 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) -//R__LOAD_LIBRARY(libg4zdcdetector.so) R__LOAD_LIBRARY(libg4eval.so) namespace Enable @@ -68,13 +64,6 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC"); - //ostringstream mapping_zdc; - - - //mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; - //mapping_zdc << G4ZDC::calibfile; - - //femc->SetTowerMappingFile(mapping_femc.str()); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); @@ -120,7 +109,7 @@ void ZDC_Towers() TowerCalibration->TowerType(0); TowerCalibration->Verbosity(verbosity); TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1.0 / 0.010); // sampling fraction = 0.010 + TowerCalibration->set_calib_const_GeV_ADC(1.0 / 0.008); // sampling fraction = 0.008 TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); From 429b286280d96cb97551de972088b5a908b15021 Mon Sep 17 00:00:00 2001 From: Shuonli Date: Mon, 12 Jul 2021 09:50:51 -0400 Subject: [PATCH 1036/1222] corrected blackhole radius, moved the tower map --- common/G4_ZDC.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index 02664e1ac..31feeb4ec 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -42,8 +42,8 @@ namespace G4ZDC { double Gz0 = 1900.; - double outer_radius = 180.; - string calibfile = "/sphenix/u/shuhang98/build/ZDC/source/towerMap_ZDC.txt"; + double outer_radius = 18.; + string calibfile = "/ForwardEcal/mapping/towerMap_ZDC.txt"; } void ZDCInit() { @@ -83,8 +83,8 @@ void ZDC_Towers() Fun4AllServer *se = Fun4AllServer::instance(); ostringstream mapping_zdc; - // mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; - mapping_zdc << G4ZDC::calibfile; + mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; + //mapping_zdc << G4ZDC::calibfile; RawTowerBuilderByHitIndex *tower_ZDC = new RawTowerBuilderByHitIndex("TowerBuilder_ZDC"); tower_ZDC->Detector("ZDC"); From e4ab73bfdd4021138a002e13b563d4edda827794 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 29 Jul 2021 12:55:21 -0400 Subject: [PATCH 1037/1222] default to primaries --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 08bdb4d12..162d39b32 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -672,6 +672,7 @@ void Tracking_Eval(const std::string& outputfile) 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); From 847896ae7f9efe76283df74e4778c5ce3445d089 Mon Sep 17 00:00:00 2001 From: Shuonli Date: Thu, 5 Aug 2021 21:01:57 -0400 Subject: [PATCH 1038/1222] correct file path --- common/G4_ZDC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index 31feeb4ec..d127dbcbd 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -43,7 +43,7 @@ namespace G4ZDC double Gz0 = 1900.; double outer_radius = 18.; - string calibfile = "/ForwardEcal/mapping/towerMap_ZDC.txt"; + string calibfile = "/ZDC/mapping/towerMap_ZDC.txt"; } void ZDCInit() { @@ -109,7 +109,7 @@ void ZDC_Towers() TowerCalibration->TowerType(0); TowerCalibration->Verbosity(verbosity); TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1.0 / 0.008); // sampling fraction = 0.008 + TowerCalibration->set_calib_const_GeV_ADC(1.0); TowerCalibration->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration); From 1cd9373258a0ab9f8e0cfea3ba1586787822dfee Mon Sep 17 00:00:00 2001 From: Shuonli Date: Sun, 8 Aug 2021 23:00:53 -0400 Subject: [PATCH 1039/1222] added D0 DX magnets and Beam pipes near by ZDCs --- common/G4_hFarFwdBeamLine_sPHENIX.C | 285 ++++++++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 common/G4_hFarFwdBeamLine_sPHENIX.C diff --git a/common/G4_hFarFwdBeamLine_sPHENIX.C b/common/G4_hFarFwdBeamLine_sPHENIX.C new file mode 100644 index 000000000..b0aec080d --- /dev/null +++ b/common/G4_hFarFwdBeamLine_sPHENIX.C @@ -0,0 +1,285 @@ +#ifndef MACRO_G4HFARFWDBEAMLINE_SPHENIX_C +#define MACRO_G4HFARFWDBEAMLINE_SPHENIX_C + +#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 HFARFWD_MAGNETS = false; + + bool HFARFWD_OVERLAPCHECK = false; + int HFARFWD_VERBOSITY = 0; + +} // namespace Enable + +namespace hFarFwdBeamLine +{ + double starting_z = -3000.; //cm as center-forward interface + double enclosure_z_max = NAN; + double enclosure_r_max = NAN; + double enclosure_center = NAN; + + PHG4CylinderSubsystem *hFarFwdBeamLineEnclosure(nullptr); + + BeamLineMagnetSubsystem *B0Magnet = (nullptr); +} // namespace hFarFwdBeamLine + +void hFarFwdBeamLineInit() +{ + + hFarFwdBeamLine::enclosure_z_max = 3000.; + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, hFarFwdBeamLine::starting_z); + hFarFwdBeamLine::enclosure_r_max = 200.; + + hFarFwdBeamLine::enclosure_center = 0.5 * (hFarFwdBeamLine::starting_z + hFarFwdBeamLine::enclosure_z_max); + + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, hFarFwdBeamLine::enclosure_z_max); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, hFarFwdBeamLine::enclosure_r_max); +} + +void hFarFwdDefineMagnets(PHG4Reco *g4Reco) +{ + bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + + hFarFwdBeamLine::hFarFwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("place_z", hFarFwdBeamLine::enclosure_center); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("radius", 0); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("thickness", hFarFwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("length", hFarFwdBeamLine::enclosure_z_max - hFarFwdBeamLine::starting_z); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + + string magFile; + // magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; + magFile = "/sphenix/u/shuhang98/macros/detectors/sPHENIX/D0DXMagnets.dat"; + // make magnet active volume if you want to study the hits + bool magnet_active = false; + int absorberactive = 0; + + // 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 << "coud 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 / TMath::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. + bl->set_double_param("place_z", z - hFarFwdBeamLine::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->SetActive(magnet_active); + bl->BlackHole(); + bl->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + if (absorberactive) + { + bl->SetAbsorberActive(); + } + bl->OverlapCheck(overlapCheck); + bl->SuperDetector("BEAMLINEMAGNET"); + if (verbosity) + bl->Verbosity(verbosity); + g4Reco->registerSubsystem(bl); + + // rag the B0 magnet + if (imagnet == 0) + hFarFwdBeamLine::B0Magnet = bl; + } + imagnet++; + if (fabs(z) + length > biggest_z) + { + biggest_z = fabs(z) + length; + } + } + } + } + infile.close(); + } +} + +void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + + + const int ntube = 10; + const string nm[ntube] = {"B00", "B01", "B10", "B11", "B20", "B21", "B30", "B31", "B32", "B33"}; + const double qlen[ntube] = {207.88, 207.88, 115.79, 115.79, 217.16,217.16, 183, 183, 183, 183}; + 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.82, -12.82, 12.82, -12.82}; + const double qyC[ntube] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double qzC[ntube] = {850.14, -850.14, 1475.935, -1475.935, 1642.4, -1642.4, 1843.2, 1843.2, -1843.2, -1843.2}; + for (int i = 0; i < ntube; i++) + { + PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(Form("beamPipe%s", nm[i].c_str()), 0); + 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]); + pipe->set_double_param("place_z", qzC[i]); + pipe->SetActive(false); + // pipe->SetActive(true); + 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] = {1384.25, -1384.25}; + for (int i = 0; i < nSec; i++) + { + PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); + 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]); + pipe->set_double_param("place_z", zC[i]); + 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]); + pipe->set_double_param("rot_y", AngleFlip(-0.047 * TMath::RadToDeg())); + g4Reco->registerSubsystem(pipe); + } +} + + +float PosFlip(float pos){ + return pos; +}; +float AngleFlip(float angle){ + return angle; +}; +float MagFieldFlip(float Bfield){ + return Bfield; +}; + +#endif From 35a5887cd535a8dd0941de863ebd22bb2a23a136 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 12 Aug 2021 09:34:58 -0400 Subject: [PATCH 1040/1222] test single tracks --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 162d39b32..f1229dea2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -234,6 +234,7 @@ void Tracking_Reco() { PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->fieldMapName(G4MAGNET::magfield); se->registerSubsystem(silicon_Seeding); } From bf52ed37d732ad221087cd2ef9d811efc7e584a1 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 12 Aug 2021 09:49:42 -0400 Subject: [PATCH 1041/1222] update map name --- common/G4_Magnet.C | 2 +- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 970cdc301..53d703769 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -32,7 +32,7 @@ void MagnetFieldInit() } if (G4MAGNET::magfield.empty()) { - G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); } } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index a244a07fe..6c77b57e5 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -360,8 +360,8 @@ int Fun4All_G4_sPHENIX( //--------------- // 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.4 / 1.5; // make consistent with expected Babar field strength of 1.4T + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT"))+ string("/Field/Map/sphenix3dbigmapxyz.root"); // default map from the calibration database + G4MAGNET::magfield_rescale = -1.; // make consistent with expected Babar field strength of 1.4T //--------------- // Pythia Decayer From 9a0813ced79b4509922e79ade9257027cc59e4e2 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 3 Aug 2021 14:02:08 -0400 Subject: [PATCH 1042/1222] - added flags to control generating TPC lasers G4Hit - updated tpc_cells to included the relevant subsysreco --- common/G4_TPC.C | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 234d6fca7..54eb56274 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -7,7 +7,9 @@ #include #include +#include #include +#include #include #include #include @@ -58,11 +60,6 @@ namespace G4TPC bool ENABLE_TIME_ORDERED_DISTORTIONS = false; std::string time_ordered_distortion_filename = "/gpfs/mnt/gpfs02/sphenix/user/klest/TimeOrderedDistortions.root"; -// unsigned int distortion_coordinates = -// PHG4TpcElectronDrift::COORD_PHI| -// PHG4TpcElectronDrift::COORD_R| -// PHG4TpcElectronDrift::COORD_Z; - // distortion corrections bool ENABLE_CORRECTIONS = false; auto correction_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; @@ -71,6 +68,12 @@ namespace G4TPC TpcSpaceChargeCorrection::COORD_R| TpcSpaceChargeCorrection::COORD_Z; + // enable central membrane g4hits generation + bool ENABLE_CENTRAL_MEMBRANE_HITS = false; + + // enable direct laser g4hits generation + bool ENABLE_DIRECT_LASER_HITS = false; + } // namespace G4TPC void TPCInit() @@ -156,16 +159,38 @@ void TPC_Cells() int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); Fun4AllServer* 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( 18, 0*deg_to_rad, 90*deg_to_rad ); + directLaser->SetDirectLaserAuto( true ); + se->registerSubsystem(directLaser); + } + //========================= // setup Tpc readout for filling cells // g4tpc/PHG4TpcElectronDrift uses // g4tpc/PHG4TpcPadPlaneReadout //========================= - PHG4TpcPadPlane* padplane = new PHG4TpcPadPlaneReadout(); + auto padplane = new PHG4TpcPadPlaneReadout; padplane->Verbosity(verbosity); - PHG4TpcElectronDrift* edrift = new PHG4TpcElectronDrift(); + auto edrift = new PHG4TpcElectronDrift; edrift->Detector("TPC"); edrift->Verbosity(verbosity); if( G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) From bf3ff1e1960e80ece03a35ae0851933640d5df8d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 18 Aug 2021 12:29:34 -0400 Subject: [PATCH 1043/1222] fix ivf --- common/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f1229dea2..a220821ab 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -253,6 +253,7 @@ void Tracking_Reco() init_vtx->Verbosity(verbosity); init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); init_vtx->setSvtxVertexMapName("SvtxVertexMap"); + init_vtx->magFieldName(G4MAGNET::magfield); se->registerSubsystem(init_vtx); } @@ -336,7 +337,7 @@ void Tracking_Reco() cprop->useFixedClusterError(true); cprop->set_max_window(5.); cprop->Verbosity(verbosity); - se->registerSubsystem(cprop); + se->registerSubsystem(cprop); } } } From 0671d1cd73b0a5562d6a21936e664bd481280a0d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 25 Aug 2021 10:07:49 -0400 Subject: [PATCH 1044/1222] update fvf --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index a220821ab..891443e99 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -452,6 +452,7 @@ void Tracking_Reco() PHActsVertexFinder *finder = new PHActsVertexFinder(); finder->Verbosity(verbosity); + finder->setFieldMap(G4MAGNET::magfield); se->registerSubsystem(finder); PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); From 5414f4a68678f877ef15be662420f8d6fd98c73f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 25 Aug 2021 15:33:38 -0400 Subject: [PATCH 1045/1222] macros to run without rescale --- common/G4_Tracking.C | 8 ++++++-- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 891443e99..251efcec5 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -313,7 +313,9 @@ void Tracking_Reco() 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->set_field_dir(-1*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) @@ -332,7 +334,9 @@ void Tracking_Reco() std::cout << " Using PHSimpleKFProp propagator " << std::endl; PHSimpleKFProp* cprop = new PHSimpleKFProp("PHSimpleKFProp"); - cprop->set_field_dir(G4MAGNET::magfield_rescale); + 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.); diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 6c77b57e5..8c0674e10 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -361,7 +361,7 @@ int Fun4All_G4_sPHENIX( // 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/sphenix3dbigmapxyz.root"); // default map from the calibration database - G4MAGNET::magfield_rescale = -1.; // make consistent with expected Babar field strength of 1.4T + G4MAGNET::magfield_rescale = 1.; // make consistent with expected Babar field strength of 1.4T //--------------- // Pythia Decayer From 4a1dcf58a6354c3dae0f172a40e900d3193c52d5 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 25 Aug 2021 15:40:31 -0400 Subject: [PATCH 1046/1222] fix errant minus --- common/G4_Tracking.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 251efcec5..13e693004 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -313,7 +313,7 @@ void Tracking_Reco() std::cout << " Using PHCASeeding track seeding " << std::endl; auto seeder = new PHCASeeding("PHCASeeding"); - seeder->set_field_dir(-1*G4MAGNET::magfield_rescale); // to get charge sign right + 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); From b6e70f0ad1e2db18be178654e123bad5c9b7c115 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Wed, 8 Sep 2021 15:04:12 -0400 Subject: [PATCH 1047/1222] Updated MVTX sim for alignment --- common/G4_Mvtx.C | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 561d0c35f..d888d615a 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -55,6 +55,12 @@ namespace G4MVTX double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // 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, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); @@ -194,13 +200,16 @@ double Mvtx(PHG4Reco* g4Reco, double radius, 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); From b78b2208ba6245f1475bba48a0e659ee3492cac1 Mon Sep 17 00:00:00 2001 From: Shuonli Date: Thu, 9 Sep 2021 18:39:33 -0400 Subject: [PATCH 1048/1222] build ZDC one at a time. seperated foward and backward mother volume --- common/G4_ZDC.C | 37 ++++++- common/G4_hFarFwdBeamLine_sPHENIX.C | 149 ++++++++++++++++++++++++---- 2 files changed, 165 insertions(+), 21 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index d127dbcbd..d108c26a9 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -6,6 +6,9 @@ #include #include +//#include +//#include + #include #include @@ -24,6 +27,7 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) +//R__LOAD_LIBRARY(libg4zdcdetector.so) R__LOAD_LIBRARY(libg4eval.so) namespace Enable @@ -42,8 +46,8 @@ namespace G4ZDC { double Gz0 = 1900.; - double outer_radius = 18.; - string calibfile = "/ZDC/mapping/towerMap_ZDC.txt"; + double outer_radius = 180.; + //string calibfile = "/sphenix/u/shuhang98/build/ZDC/source/towerMap_ZDC.txt"; } void ZDCInit() { @@ -63,13 +67,22 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC"); + zdc -> set_int_param("fzdc", 1); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + g4Reco->registerSubsystem(zdc); + + zdc = new PHG4ZDCSubsystem("ZDC", 1); + zdc -> set_int_param("bzdc", 1); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); g4Reco->registerSubsystem(zdc); - //cout << mapping_zdc.str() << endl; + } void ZDC_Cells() @@ -101,6 +114,13 @@ void ZDC_Towers() 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); @@ -109,10 +129,19 @@ void ZDC_Towers() TowerCalibration->TowerType(0); TowerCalibration->Verbosity(verbosity); TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1.0); + 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_Clusters() diff --git a/common/G4_hFarFwdBeamLine_sPHENIX.C b/common/G4_hFarFwdBeamLine_sPHENIX.C index b0aec080d..d86a4d23b 100644 --- a/common/G4_hFarFwdBeamLine_sPHENIX.C +++ b/common/G4_hFarFwdBeamLine_sPHENIX.C @@ -8,11 +8,16 @@ #include #include + +#include + +#include + #include #include -R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4detectors.so) float PosFlip(float pos); float AngleFlip(float angle); @@ -30,12 +35,15 @@ namespace Enable namespace hFarFwdBeamLine { - double starting_z = -3000.; //cm as center-forward interface + double starting_z = 700; //cm as center-forward interface double enclosure_z_max = NAN; double enclosure_r_max = NAN; double enclosure_center = NAN; + double ZDCPlaceZ = 1843.0; + PHG4CylinderSubsystem *hFarFwdBeamLineEnclosure(nullptr); + PHG4CylinderSubsystem *hFarBwdBeamLineEnclosure(nullptr); BeamLineMagnetSubsystem *B0Magnet = (nullptr); } // namespace hFarFwdBeamLine @@ -57,7 +65,7 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) { bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); - + hFarFwdBeamLine::hFarFwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("place_z", hFarFwdBeamLine::enclosure_center); hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("radius", 0); @@ -69,10 +77,22 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) if (verbosity) hFarFwdBeamLine::hFarFwdBeamLineEnclosure->Verbosity(verbosity); g4Reco->registerSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + + hFarFwdBeamLine::hFarBwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("place_z", - hFarFwdBeamLine::enclosure_center); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("radius", 0); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("thickness", hFarFwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("length", hFarFwdBeamLine::enclosure_z_max - hFarFwdBeamLine::starting_z); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) + hFarFwdBeamLine::hFarBwdBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); string magFile; - // magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; - magFile = "/sphenix/u/shuhang98/macros/detectors/sPHENIX/D0DXMagnets.dat"; + magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; + // magFile = "/sphenix/u/shuhang98/macros/detectors/sPHENIX/D0DXMagnets.dat"; // make magnet active volume if you want to study the hits bool magnet_active = false; int absorberactive = 0; @@ -177,8 +197,14 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) 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. - bl->set_double_param("place_z", z - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. - bl->set_double_param("field_global_position_x", PosFlip(x));// abs. position to world for field manager + if(z > 0) + { + bl->set_double_param("place_z", z - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + } + else{ + bl->set_double_param("place_z", z + hFarFwdBeamLine::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)); @@ -187,9 +213,16 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) bl->set_double_param("outer_radius", outer_magnet_diameter / 2.); bl->SetActive(magnet_active); bl->BlackHole(); - bl->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); - if (absorberactive) - { + if(z > 0) + { + bl->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + } + else + { + bl->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + } + if (absorberactive) + { bl->SetAbsorberActive(); } bl->OverlapCheck(overlapCheck); @@ -216,18 +249,19 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) { + bool OverlapCheck = Enable::OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); const int ntube = 10; const string nm[ntube] = {"B00", "B01", "B10", "B11", "B20", "B21", "B30", "B31", "B32", "B33"}; - const double qlen[ntube] = {207.88, 207.88, 115.79, 115.79, 217.16,217.16, 183, 183, 183, 183}; + 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.82, -12.82, 12.82, -12.82}; + 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] = {850.14, -850.14, 1475.935, -1475.935, 1642.4, -1642.4, 1843.2, 1843.2, -1843.2, -1843.2}; + 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++) { PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(Form("beamPipe%s", nm[i].c_str()), 0); @@ -238,39 +272,120 @@ void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) 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]); - pipe->set_double_param("place_z", qzC[i]); + if(qzC[i] > 0) + { + pipe->set_double_param("place_z", qzC[i] - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + } + else + { + pipe->set_double_param("place_z", qzC[i] + hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + } + //pipe->set_double_param("place_z", qzC[i]); pipe->SetActive(false); + if(qzC[i] > 0) + { + pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + } + + pipe->OverlapCheck(OverlapCheck); // pipe->SetActive(true); g4Reco->registerSubsystem(pipe); + /* + PHG4CylinderSubsystem *pipev = new PHG4CylinderSubsystem(Form("beamPipevacuum%s", nm[i].c_str()), 0); + pipev->set_double_param("radius", 0); + pipev->set_double_param("thickness", qir[i]); + pipev->set_double_param("length", qlen[i]); + pipev->set_double_param("rot_y", qrot[i]); + pipev->set_string_param("material", "G4_Galactic"); + pipev->set_double_param("place_x", PosFlip(qxC[i])); + pipev->set_double_param("place_y", qyC[i]); + pipev->set_double_param("place_z", qzC[i]); + pipev->SetActive(false); + pipev->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(pipev); + */ } //Roman Pot pipe const int nSec = 2; - const double len[nSec] = {20.87, 20.87}; + const double len[nSec] = {41.74, 41.74}; 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] = {1384.25, -1384.25}; + const double zC[nSec] = {1394.25, -1394.25}; for (int i = 0; i < nSec; i++) { PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); 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]); - pipe->set_double_param("place_z", zC[i]); + pipe->set_double_param("place_y", qyC[i]); + if(zC[i] > 0) + { + pipe->set_double_param("place_z", zC[i] - hFarFwdBeamLine::enclosure_center); + } + else + { + pipe->set_double_param("place_z", zC[i] + hFarFwdBeamLine::enclosure_center); + } + // pipe->set_double_param("place_z", zC[i]); 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]); pipe->set_double_param("rot_y", AngleFlip(-0.047 * TMath::RadToDeg())); + if(zC[i] > 0) + { + pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + } + // pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + pipe->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(pipe); + } } +void fbZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::ZDC_ABSORBER || (absorberactive > 0); + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::ZDC_OVERLAPCHECK; + + + cout<<"constructing fzdc"< set_int_param("fzdc", 1); + zdc -> set_double_param("z", hFarFwdBeamLine::ZDCPlaceZ - hFarFwdBeamLine::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + zdc->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); + + + zdc = new PHG4ZDCSubsystem("ZDC", 1); + zdc -> set_int_param("bzdc", 1); + zdc -> set_double_param("z", hFarFwdBeamLine::ZDCPlaceZ - hFarFwdBeamLine::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + zdc->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); + +} float PosFlip(float pos){ return pos; From f6e0ae632a4d395c5b68e0da3965fde7c78f5013 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Sat, 11 Sep 2021 12:17:03 -0400 Subject: [PATCH 1049/1222] Add ghost rejection module. --- common/G4_Tracking.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 13e693004..61b87c92d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -355,6 +356,11 @@ void Tracking_Reco() 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) { From 249ddd0271c7cde7503c45652c1930891e095968 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 14 Sep 2021 12:17:00 -0400 Subject: [PATCH 1050/1222] Revert "Updated MVTX sim for alignment" --- common/G4_Mvtx.C | 9 --------- 1 file changed, 9 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index d888d615a..561d0c35f 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -55,12 +55,6 @@ namespace G4MVTX double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // 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, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); @@ -200,16 +194,13 @@ double Mvtx(PHG4Reco* g4Reco, double radius, 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); From 56ce5aef15373b1c087e5844690b5127bbc491fd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 14 Sep 2021 13:42:03 -0400 Subject: [PATCH 1051/1222] Revert "Revert "Updated MVTX sim for alignment"" --- common/G4_Mvtx.C | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 561d0c35f..d888d615a 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -55,6 +55,12 @@ namespace G4MVTX double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // 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, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); @@ -194,13 +200,16 @@ double Mvtx(PHG4Reco* g4Reco, double radius, 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); From 18a87ed4ca3dc7398e8a54324f552395357942e1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 15 Sep 2021 15:27:16 -0400 Subject: [PATCH 1052/1222] make macros work with Fun4All macro --- common/G4_ZDC.C | 9 +++------ common/G4_hFarFwdBeamLine_sPHENIX.C | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index d108c26a9..beafe6059 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -27,7 +27,6 @@ R__LOAD_LIBRARY(libcalo_reco.so) R__LOAD_LIBRARY(libg4calo.so) R__LOAD_LIBRARY(libg4detectors.so) -//R__LOAD_LIBRARY(libg4zdcdetector.so) R__LOAD_LIBRARY(libg4eval.so) namespace Enable @@ -47,7 +46,7 @@ namespace G4ZDC double Gz0 = 1900.; double outer_radius = 180.; - //string calibfile = "/sphenix/u/shuhang98/build/ZDC/source/towerMap_ZDC.txt"; + string calibfile = "ZDC/mapping/towerMap_ZDC.txt"; } void ZDCInit() { @@ -95,14 +94,12 @@ void ZDC_Towers() int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); - ostringstream mapping_zdc; - mapping_zdc << getenv("CALIBRATIONROOT") << G4ZDC::calibfile; - //mapping_zdc << G4ZDC::calibfile; + 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.str()); + tower_ZDC->GeometryTableFile(mapping_zdc); se->registerSubsystem(tower_ZDC); diff --git a/common/G4_hFarFwdBeamLine_sPHENIX.C b/common/G4_hFarFwdBeamLine_sPHENIX.C index d86a4d23b..9c9350686 100644 --- a/common/G4_hFarFwdBeamLine_sPHENIX.C +++ b/common/G4_hFarFwdBeamLine_sPHENIX.C @@ -3,6 +3,8 @@ #include +#include + #include #include #include From 1d7c0eb092c7cc1bab6ba85d9151fdd6595b59c9 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 17 Sep 2021 09:46:55 -0400 Subject: [PATCH 1053/1222] rename G4_hFarFwdBeamLine_sPHENIX.C to G4_BeamLine.C --- common/{G4_hFarFwdBeamLine_sPHENIX.C => G4_BeamLine.C} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename common/{G4_hFarFwdBeamLine_sPHENIX.C => G4_BeamLine.C} (100%) diff --git a/common/G4_hFarFwdBeamLine_sPHENIX.C b/common/G4_BeamLine.C similarity index 100% rename from common/G4_hFarFwdBeamLine_sPHENIX.C rename to common/G4_BeamLine.C From 75d4bcab89bcfe4186c398fae9147ea18593927d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 17 Sep 2021 09:47:56 -0400 Subject: [PATCH 1054/1222] rename toe BeamLine consistently --- common/G4_BeamLine.C | 153 ++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 97 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index 9c9350686..efc97b370 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -1,10 +1,8 @@ -#ifndef MACRO_G4HFARFWDBEAMLINE_SPHENIX_C -#define MACRO_G4HFARFWDBEAMLINE_SPHENIX_C +#ifndef MACRO_G4BEAMLINE_C +#define MACRO_G4BEAMLINE_C #include -#include - #include #include #include @@ -28,73 +26,70 @@ float MagFieldFlip(float Bfield); // This creates the Enable Flag to be used in the main steering macro namespace Enable { - bool HFARFWD_MAGNETS = false; + bool BEAMLINE = false; - bool HFARFWD_OVERLAPCHECK = false; - int HFARFWD_VERBOSITY = 0; + bool BEAMLINE_OVERLAPCHECK = false; + int BEAMLINE_VERBOSITY = 0; } // namespace Enable -namespace hFarFwdBeamLine +namespace BeamLine { double starting_z = 700; //cm as center-forward interface double enclosure_z_max = NAN; double enclosure_r_max = NAN; double enclosure_center = NAN; - double ZDCPlaceZ = 1843.0; - PHG4CylinderSubsystem *hFarFwdBeamLineEnclosure(nullptr); - PHG4CylinderSubsystem *hFarBwdBeamLineEnclosure(nullptr); + PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); + PHG4CylinderSubsystem *BackwardBeamLineEnclosure(nullptr); - BeamLineMagnetSubsystem *B0Magnet = (nullptr); -} // namespace hFarFwdBeamLine +} // namespace BeamLine -void hFarFwdBeamLineInit() +void BeamLineInit() { - hFarFwdBeamLine::enclosure_z_max = 3000.; - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, hFarFwdBeamLine::starting_z); - hFarFwdBeamLine::enclosure_r_max = 200.; + BeamLine::enclosure_z_max = 3000.; + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, BeamLine::starting_z); + BeamLine::enclosure_r_max = 200.; - hFarFwdBeamLine::enclosure_center = 0.5 * (hFarFwdBeamLine::starting_z + hFarFwdBeamLine::enclosure_z_max); + BeamLine::enclosure_center = 0.5 * (BeamLine::starting_z + BeamLine::enclosure_z_max); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, hFarFwdBeamLine::enclosure_z_max); - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, hFarFwdBeamLine::enclosure_r_max); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BeamLine::enclosure_z_max); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BeamLine::enclosure_r_max); } -void hFarFwdDefineMagnets(PHG4Reco *g4Reco) +void BeamLineDefineMagnets(PHG4Reco *g4Reco) { - bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + bool overlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("place_z", hFarFwdBeamLine::enclosure_center); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("radius", 0); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("thickness", hFarFwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("length", hFarFwdBeamLine::enclosure_z_max - hFarFwdBeamLine::starting_z); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_string_param("material", "G4_Galactic"); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_color(.5, .5, .5, 0.2); - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->OverlapCheck(overlapCheck); + BeamLine::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); + BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center); + BeamLine::ForwardBeamLineEnclosure->set_double_param("radius", 0); + BeamLine::ForwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + BeamLine::ForwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); + BeamLine::ForwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + BeamLine::ForwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + BeamLine::ForwardBeamLineEnclosure->OverlapCheck(overlapCheck); if (verbosity) - hFarFwdBeamLine::hFarFwdBeamLineEnclosure->Verbosity(verbosity); - g4Reco->registerSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + BeamLine::ForwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(BeamLine::ForwardBeamLineEnclosure); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("place_z", - hFarFwdBeamLine::enclosure_center); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("radius", 0); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("thickness", hFarFwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_double_param("length", hFarFwdBeamLine::enclosure_z_max - hFarFwdBeamLine::starting_z); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_string_param("material", "G4_Galactic"); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->set_color(.5, .5, .5, 0.2); - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->OverlapCheck(overlapCheck); + BeamLine::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); + BeamLine::BackwardBeamLineEnclosure->set_double_param("place_z", - BeamLine::enclosure_center); + BeamLine::BackwardBeamLineEnclosure->set_double_param("radius", 0); + BeamLine::BackwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + BeamLine::BackwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); + BeamLine::BackwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + BeamLine::BackwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + BeamLine::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); if (verbosity) - hFarFwdBeamLine::hFarBwdBeamLineEnclosure->Verbosity(verbosity); - g4Reco->registerSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + BeamLine::BackwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(BeamLine::BackwardBeamLineEnclosure); string magFile; magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; - // magFile = "/sphenix/u/shuhang98/macros/detectors/sPHENIX/D0DXMagnets.dat"; // make magnet active volume if you want to study the hits bool magnet_active = false; int absorberactive = 0; @@ -186,7 +181,7 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) length *= 100.; inner_radius_zin *= 100.; outer_magnet_diameter *= 100.; - angle = (angle / TMath::Pi() * 180.) / 1000.; // given in mrad + angle = (angle / M_PI * 180.) / 1000.; // given in mrad //------------------------ @@ -201,10 +196,10 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) bl->set_double_param("place_y", y);// relative position to mother vol. if(z > 0) { - bl->set_double_param("place_z", z - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + bl->set_double_param("place_z", z - BeamLine::enclosure_center);// relative position to mother vol. } else{ - bl->set_double_param("place_z", z + hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + bl->set_double_param("place_z", z + BeamLine::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 @@ -217,11 +212,11 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) bl->BlackHole(); if(z > 0) { - bl->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + bl->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); } else { - bl->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + bl->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); } if (absorberactive) { @@ -229,13 +224,9 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) } bl->OverlapCheck(overlapCheck); bl->SuperDetector("BEAMLINEMAGNET"); - if (verbosity) - bl->Verbosity(verbosity); + if (verbosity) bl->Verbosity(verbosity); g4Reco->registerSubsystem(bl); - // rag the B0 magnet - if (imagnet == 0) - hFarFwdBeamLine::B0Magnet = bl; } imagnet++; if (fabs(z) + length > biggest_z) @@ -249,10 +240,10 @@ void hFarFwdDefineMagnets(PHG4Reco *g4Reco) } } -void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) +void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { bool OverlapCheck = Enable::OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); const int ntube = 10; @@ -276,21 +267,21 @@ void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) pipe->set_double_param("place_y", qyC[i]); if(qzC[i] > 0) { - pipe->set_double_param("place_z", qzC[i] - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + pipe->set_double_param("place_z", qzC[i] - BeamLine::enclosure_center);// relative position to mother vol. } else { - pipe->set_double_param("place_z", qzC[i] + hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + pipe->set_double_param("place_z", qzC[i] + BeamLine::enclosure_center);// relative position to mother vol. } //pipe->set_double_param("place_z", qzC[i]); pipe->SetActive(false); if(qzC[i] > 0) { - pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); } else { - pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); } pipe->OverlapCheck(OverlapCheck); @@ -328,14 +319,13 @@ void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) 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]); - pipe->set_double_param("place_y", qyC[i]); if(zC[i] > 0) { - pipe->set_double_param("place_z", zC[i] - hFarFwdBeamLine::enclosure_center); + pipe->set_double_param("place_z", zC[i] - BeamLine::enclosure_center); } else { - pipe->set_double_param("place_z", zC[i] + hFarFwdBeamLine::enclosure_center); + pipe->set_double_param("place_z", zC[i] + BeamLine::enclosure_center); } // pipe->set_double_param("place_z", zC[i]); pipe->set_double_param("length", len[i]); @@ -343,51 +333,20 @@ void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) pipe->set_double_param("rmin2", ir2[i]); pipe->set_double_param("rmax1", or1[i]); pipe->set_double_param("rmax2", or2[i]); - pipe->set_double_param("rot_y", AngleFlip(-0.047 * TMath::RadToDeg())); + pipe->set_double_param("rot_y", AngleFlip(-0.047 * 180./M_PI)); if(zC[i] > 0) { - pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); } else { - pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); + pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); } - // pipe->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); pipe->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(pipe); } } -void fbZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::ZDC_ABSORBER || (absorberactive > 0); - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::ZDC_OVERLAPCHECK; - - - cout<<"constructing fzdc"< set_int_param("fzdc", 1); - zdc -> set_double_param("z", hFarFwdBeamLine::ZDCPlaceZ - hFarFwdBeamLine::enclosure_center); - zdc->OverlapCheck(OverlapCheck); - zdc->SetActive(); - zdc->SuperDetector("ZDC"); - if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); - zdc->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); - g4Reco->registerSubsystem(zdc); - - - zdc = new PHG4ZDCSubsystem("ZDC", 1); - zdc -> set_int_param("bzdc", 1); - zdc -> set_double_param("z", hFarFwdBeamLine::ZDCPlaceZ - hFarFwdBeamLine::enclosure_center); - zdc->OverlapCheck(OverlapCheck); - zdc->SetActive(); - zdc->SuperDetector("ZDC"); - if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); - zdc->SetMotherSubsystem(hFarFwdBeamLine::hFarBwdBeamLineEnclosure); - g4Reco->registerSubsystem(zdc); - -} float PosFlip(float pos){ return pos; From 8c22216d259107f88ba552ca34aa6de0f57788e0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 17 Sep 2021 09:48:42 -0400 Subject: [PATCH 1055/1222] add BeamLine mother volumes --- common/G4_ZDC.C | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index beafe6059..6be38626c 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -3,12 +3,11 @@ #include +#include + #include #include -//#include -//#include - #include #include @@ -47,7 +46,10 @@ namespace G4ZDC double Gz0 = 1900.; double outer_radius = 180.; string calibfile = "ZDC/mapping/towerMap_ZDC.txt"; + double ZDCPlaceZ = 1843.0; + } + void ZDCInit() { BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4ZDC::outer_radius); @@ -67,28 +69,27 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC"); zdc -> set_int_param("fzdc", 1); + zdc -> set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + zdc->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); zdc = new PHG4ZDCSubsystem("ZDC", 1); zdc -> set_int_param("bzdc", 1); + zdc -> set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + zdc->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); } -void ZDC_Cells() -{ - return; -} - void ZDC_Towers() { int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); From fc182e8baf2eed712cff0702870d911c56306c8e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 17 Sep 2021 09:52:51 -0400 Subject: [PATCH 1056/1222] clang-format --- common/G4_BeamLine.C | 154 +++++++++++++++++++++---------------------- common/G4_ZDC.C | 42 ++++-------- 2 files changed, 88 insertions(+), 108 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index efc97b370..f546a0da3 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -8,7 +8,6 @@ #include #include - #include #include @@ -17,7 +16,7 @@ #include -R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4detectors.so) float PosFlip(float pos); float AngleFlip(float angle); @@ -27,10 +26,10 @@ float MagFieldFlip(float Bfield); namespace Enable { bool BEAMLINE = false; - + bool BEAMLINE_OVERLAPCHECK = false; int BEAMLINE_VERBOSITY = 0; - + } // namespace Enable namespace BeamLine @@ -40,7 +39,6 @@ namespace BeamLine double enclosure_r_max = NAN; double enclosure_center = NAN; - PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); PHG4CylinderSubsystem *BackwardBeamLineEnclosure(nullptr); @@ -48,13 +46,12 @@ namespace BeamLine void BeamLineInit() { - BeamLine::enclosure_z_max = 3000.; BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, BeamLine::starting_z); BeamLine::enclosure_r_max = 200.; - + BeamLine::enclosure_center = 0.5 * (BeamLine::starting_z + BeamLine::enclosure_z_max); - + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BeamLine::enclosure_z_max); BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BeamLine::enclosure_r_max); } @@ -63,7 +60,7 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) { bool overlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); - + BeamLine::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center); BeamLine::ForwardBeamLineEnclosure->set_double_param("radius", 0); @@ -75,9 +72,9 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) if (verbosity) BeamLine::ForwardBeamLineEnclosure->Verbosity(verbosity); g4Reco->registerSubsystem(BeamLine::ForwardBeamLineEnclosure); - + BeamLine::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); - BeamLine::BackwardBeamLineEnclosure->set_double_param("place_z", - BeamLine::enclosure_center); + BeamLine::BackwardBeamLineEnclosure->set_double_param("place_z", -BeamLine::enclosure_center); BeamLine::BackwardBeamLineEnclosure->set_double_param("radius", 0); BeamLine::BackwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius BeamLine::BackwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); @@ -86,7 +83,7 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) BeamLine::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); if (verbosity) BeamLine::BackwardBeamLineEnclosure->Verbosity(verbosity); - g4Reco->registerSubsystem(BeamLine::BackwardBeamLineEnclosure); + g4Reco->registerSubsystem(BeamLine::BackwardBeamLineEnclosure); string magFile; magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; @@ -125,12 +122,12 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) double fieldgradient; if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient)) { - cout << "coud not decode " << line << endl; + cout << "could not decode " << line << endl; gSystem->Exit(1); } else { - //------------------------ + //------------------------ string magtype; if (inner_radius_zin != inner_radius_zout) @@ -183,8 +180,8 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) 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); @@ -192,41 +189,41 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) 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 - BeamLine::enclosure_center);// relative position to mother vol. - } - else{ - bl->set_double_param("place_z", z + BeamLine::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("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 - BeamLine::enclosure_center); // relative position to mother vol. + } + else + { + bl->set_double_param("place_z", z + BeamLine::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("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->SetActive(magnet_active); bl->BlackHole(); - if(z > 0) - { - bl->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); - } - else - { - bl->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); - } - if (absorberactive) - { + if (z > 0) + { + bl->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); + } + else + { + bl->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + } + if (absorberactive) + { bl->SetAbsorberActive(); } bl->OverlapCheck(overlapCheck); bl->SuperDetector("BEAMLINEMAGNET"); if (verbosity) bl->Verbosity(verbosity); g4Reco->registerSubsystem(bl); - } imagnet++; if (fabs(z) + length > biggest_z) @@ -244,14 +241,13 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { bool OverlapCheck = Enable::OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); - - const int ntube = 10; + 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 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 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}; @@ -265,25 +261,25 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) 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] - BeamLine::enclosure_center);// relative position to mother vol. - } + if (qzC[i] > 0) + { + pipe->set_double_param("place_z", qzC[i] - BeamLine::enclosure_center); // relative position to mother vol. + } else - { - pipe->set_double_param("place_z", qzC[i] + BeamLine::enclosure_center);// relative position to mother vol. - } + { + pipe->set_double_param("place_z", qzC[i] + BeamLine::enclosure_center); // relative position to mother vol. + } //pipe->set_double_param("place_z", qzC[i]); pipe->SetActive(false); - if(qzC[i] > 0) - { - pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); - } + if (qzC[i] > 0) + { + pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); + } else - { - pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); - } - + { + pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + } + pipe->OverlapCheck(OverlapCheck); // pipe->SetActive(true); g4Reco->registerSubsystem(pipe); @@ -319,42 +315,44 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) 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] - BeamLine::enclosure_center); - } + if (zC[i] > 0) + { + pipe->set_double_param("place_z", zC[i] - BeamLine::enclosure_center); + } else - { - pipe->set_double_param("place_z", zC[i] + BeamLine::enclosure_center); - } + { + pipe->set_double_param("place_z", zC[i] + BeamLine::enclosure_center); + } // pipe->set_double_param("place_z", zC[i]); 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]); - pipe->set_double_param("rot_y", AngleFlip(-0.047 * 180./M_PI)); - if(zC[i] > 0) - { - pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); - } + pipe->set_double_param("rot_y", AngleFlip(-0.047 * 180. / M_PI)); + if (zC[i] > 0) + { + pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); + } else - { - pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); - } + { + pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + } pipe->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(pipe); - } } -float PosFlip(float pos){ +float PosFlip(float pos) +{ return pos; }; -float AngleFlip(float angle){ +float AngleFlip(float angle) +{ return angle; }; -float MagFieldFlip(float Bfield){ +float MagFieldFlip(float Bfield) +{ return Bfield; }; diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index 6be38626c..267d6b9d9 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -16,10 +16,11 @@ #include +#include + #include #include #include -#include #include @@ -32,30 +33,26 @@ namespace Enable { bool ZDC = false; bool ZDC_ABSORBER = false; - bool ZDC_CELL = false; bool ZDC_TOWER = false; - bool ZDC_CLUSTER = 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; + 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); - + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4ZDC::Gz0); } void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) @@ -65,11 +62,9 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC"); - zdc -> set_int_param("fzdc", 1); - zdc -> set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); + zdc->set_int_param("fzdc", 1); + zdc->set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); @@ -77,17 +72,15 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) zdc->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); - zdc = new PHG4ZDCSubsystem("ZDC", 1); - zdc -> set_int_param("bzdc", 1); - zdc -> set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); + zdc->set_int_param("bzdc", 1); + zdc->set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); zdc->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); - } void ZDC_Towers() @@ -104,8 +97,6 @@ void ZDC_Towers() se->registerSubsystem(tower_ZDC); - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("ZDCRawTowerDigitizer"); TowerDigitizer->Detector("ZDC"); TowerDigitizer->TowerType(0); @@ -120,8 +111,6 @@ void ZDC_Towers() TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); se->registerSubsystem(TowerDigitizer1); - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("ZDCRawTowerCalibration"); TowerCalibration->Detector("ZDC"); TowerCalibration->TowerType(0); @@ -139,13 +128,6 @@ void ZDC_Towers() TowerCalibration1->set_calib_const_GeV_ADC(1.0); TowerCalibration1->set_pedstal_ADC(0); se->registerSubsystem(TowerCalibration1); - -} - -void ZDC_Clusters() -{ - - return; } void ZDC_Eval(std::string outputfile) @@ -153,8 +135,8 @@ 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.c_str()); - eval->set_do_cluster_eval(false); + CaloEvaluator *eval = new CaloEvaluator("ZDCEVALUATOR", "ZDC", outputfile); + eval->set_do_cluster_eval(false); eval->Verbosity(verbosity); se->registerSubsystem(eval); From e4e243cf2351aab089765a3172ddf00f45843dbf Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 17 Sep 2021 09:55:11 -0400 Subject: [PATCH 1057/1222] use M_PI instead of TMath::Pi() --- common/G4_CEmc_Spacal.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 7bb255692..ad7cccbda 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -297,7 +297,7 @@ void CEMC_Cells() { // 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->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); } se->registerSubsystem(cemc_cells); } From 4d8beec82001c272db3b04ce056903379ec3ca4c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 21 Sep 2021 19:36:47 -0400 Subject: [PATCH 1058/1222] make the macro load standalone (via #include <>) --- common/G4_Bbc.C | 2 ++ common/G4_CEmc_Albedo.C | 2 ++ common/G4_DSTReader.C | 1 + common/G4_EPD.C | 2 ++ common/G4_HIJetReco.C | 2 ++ common/G4_KFParticle.C | 1 + common/G4_ParticleFlow.C | 1 + 7 files changed, 11 insertions(+) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index f0082fa26..509a285b0 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -1,6 +1,8 @@ #ifndef MACRO_G4BBC_C #define MACRO_G4BBC_C +#include + #include #include diff --git a/common/G4_CEmc_Albedo.C b/common/G4_CEmc_Albedo.C index bd067be75..0614e4ee3 100644 --- a/common/G4_CEmc_Albedo.C +++ b/common/G4_CEmc_Albedo.C @@ -5,6 +5,8 @@ #include +#include + namespace Enable { bool CEMCALBEDO = false; diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C index a279d5fdb..66e009d7d 100644 --- a/common/G4_DSTReader.C +++ b/common/G4_DSTReader.C @@ -3,6 +3,7 @@ #include +#include #include #include #include diff --git a/common/G4_EPD.C b/common/G4_EPD.C index 9f031c173..da19a9af3 100644 --- a/common/G4_EPD.C +++ b/common/G4_EPD.C @@ -1,6 +1,8 @@ #ifndef COMMON_G4EPD_C #define COMMON_G4EPD_C +#include + #include #include diff --git a/common/G4_HIJetReco.C b/common/G4_HIJetReco.C index 89b321ce5..a71d208cb 100644 --- a/common/G4_HIJetReco.C +++ b/common/G4_HIJetReco.C @@ -1,6 +1,8 @@ #ifndef MACRO_G4HIJETRECO_C #define MACRO_G4HIJETRECO_C +#include + #include #include #include diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 58722ce14..86a116c4d 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -3,6 +3,7 @@ #include +#define HomogeneousField #include #include diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C index 01aed3357..c54b4086e 100644 --- a/common/G4_ParticleFlow.C +++ b/common/G4_ParticleFlow.C @@ -4,6 +4,7 @@ #include #include +#include #include #include From a54cd9363ac463ea5a390d2d1754f23c7f8f9782 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 21 Sep 2021 20:00:15 -0400 Subject: [PATCH 1059/1222] rename and fix up G4_hFarFwdBeamLine_sPHENIX.C -> G4_BeamLine.C --- common/G4_BeamLine.C | 80 +++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index f546a0da3..5854a7030 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -26,7 +26,8 @@ float MagFieldFlip(float Bfield); namespace Enable { bool BEAMLINE = false; - + bool BEAMLINE_ABSORBER = false; + bool BEAMLINE_BLACKHOLE = false; bool BEAMLINE_OVERLAPCHECK = false; int BEAMLINE_VERBOSITY = 0; @@ -35,10 +36,11 @@ namespace Enable namespace BeamLine { double starting_z = 700; //cm as center-forward interface - double enclosure_z_max = NAN; - double enclosure_r_max = NAN; - double enclosure_center = NAN; - + double enclosure_z_max = 3000.; + double enclosure_r_max = 30.; // This is intentionally made large 25cm radius + double enclosure_center = 0.5 * (starting_z + enclosure_z_max); + int pipe_id_offset = 100; + int roman_pot_pipe_id_offset = 200; PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); PHG4CylinderSubsystem *BackwardBeamLineEnclosure(nullptr); @@ -46,12 +48,7 @@ namespace BeamLine void BeamLineInit() { - BeamLine::enclosure_z_max = 3000.; BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, BeamLine::starting_z); - BeamLine::enclosure_r_max = 200.; - - BeamLine::enclosure_center = 0.5 * (BeamLine::starting_z + BeamLine::enclosure_z_max); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BeamLine::enclosure_z_max); BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BeamLine::enclosure_r_max); } @@ -59,21 +56,22 @@ void BeamLineInit() 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); BeamLine::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center); BeamLine::ForwardBeamLineEnclosure->set_double_param("radius", 0); - BeamLine::ForwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + BeamLine::ForwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); BeamLine::ForwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); BeamLine::ForwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); BeamLine::ForwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); BeamLine::ForwardBeamLineEnclosure->OverlapCheck(overlapCheck); - if (verbosity) - BeamLine::ForwardBeamLineEnclosure->Verbosity(verbosity); + if (verbosity) BeamLine::ForwardBeamLineEnclosure->Verbosity(verbosity); g4Reco->registerSubsystem(BeamLine::ForwardBeamLineEnclosure); - BeamLine::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); + BeamLine::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("BackwardBeamLineEnclosure"); BeamLine::BackwardBeamLineEnclosure->set_double_param("place_z", -BeamLine::enclosure_center); BeamLine::BackwardBeamLineEnclosure->set_double_param("radius", 0); BeamLine::BackwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius @@ -81,15 +79,11 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) BeamLine::BackwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); BeamLine::BackwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); BeamLine::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); - if (verbosity) - BeamLine::BackwardBeamLineEnclosure->Verbosity(verbosity); + if (verbosity) BeamLine::BackwardBeamLineEnclosure->Verbosity(verbosity); g4Reco->registerSubsystem(BeamLine::BackwardBeamLineEnclosure); string magFile; magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; - // make magnet active volume if you want to study the hits - bool magnet_active = false; - int absorberactive = 0; // if you insert numbers it only displays those magnets, do not comment out the set declaration set magnetlist; @@ -100,7 +94,9 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) if (infile.is_open()) { double biggest_z = 0.; - int imagnet = 0; + // start with 1 so we do not end up with id=0 since we distinguish between pos and neg + // pos is inside the magnet (beam pipe), negative is the magnet volume + int imagnet = 1; std::string line; while (std::getline(infile, line)) { @@ -206,8 +202,9 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) 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->SetActive(magnet_active); - bl->BlackHole(); + bl->SetActive(AbsorberActive); + bl->SetAbsorberActive(AbsorberActive); + if (Enable::BEAMLINE_BLACKHOLE) bl->BlackHole(); // turn magnets into black holes if (z > 0) { bl->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); @@ -216,10 +213,6 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) { bl->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); } - if (absorberactive) - { - bl->SetAbsorberActive(); - } bl->OverlapCheck(overlapCheck); bl->SuperDetector("BEAMLINEMAGNET"); if (verbosity) bl->Verbosity(verbosity); @@ -239,7 +232,8 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { - bool OverlapCheck = Enable::OVERLAPCHECK; + 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; @@ -253,7 +247,8 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) 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++) { - PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(Form("beamPipe%s", nm[i].c_str()), 0); + string name = "beamPipe" + nm[i]; + PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(name, BeamLine::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]); @@ -269,8 +264,8 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { pipe->set_double_param("place_z", qzC[i] + BeamLine::enclosure_center); // relative position to mother vol. } - //pipe->set_double_param("place_z", qzC[i]); - pipe->SetActive(false); + if (AbsorberActive) pipe->SetActive(); + pipe->SuperDetector("PIPE"); if (qzC[i] > 0) { pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); @@ -281,27 +276,12 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) } pipe->OverlapCheck(OverlapCheck); - // pipe->SetActive(true); g4Reco->registerSubsystem(pipe); - /* - PHG4CylinderSubsystem *pipev = new PHG4CylinderSubsystem(Form("beamPipevacuum%s", nm[i].c_str()), 0); - pipev->set_double_param("radius", 0); - pipev->set_double_param("thickness", qir[i]); - pipev->set_double_param("length", qlen[i]); - pipev->set_double_param("rot_y", qrot[i]); - pipev->set_string_param("material", "G4_Galactic"); - pipev->set_double_param("place_x", PosFlip(qxC[i])); - pipev->set_double_param("place_y", qyC[i]); - pipev->set_double_param("place_z", qzC[i]); - pipev->SetActive(false); - pipev->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(pipev); - */ } //Roman Pot pipe const int nSec = 2; - const double len[nSec] = {41.74, 41.74}; + 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}; @@ -311,7 +291,9 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) const double zC[nSec] = {1394.25, -1394.25}; for (int i = 0; i < nSec; i++) { - PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); + string name = "beamPipeRP" + to_string(i); + // PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); + PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(name, BeamLine::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]); @@ -323,13 +305,11 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { pipe->set_double_param("place_z", zC[i] + BeamLine::enclosure_center); } - // pipe->set_double_param("place_z", zC[i]); 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]); - pipe->set_double_param("rot_y", AngleFlip(-0.047 * 180. / M_PI)); if (zC[i] > 0) { pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); @@ -338,6 +318,8 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) { pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); } + if (AbsorberActive) pipe->SetActive(); + pipe->SuperDetector("PIPE"); pipe->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(pipe); } From 04118fc226fda4c903f732d895a252904703443c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 21 Sep 2021 20:04:18 -0400 Subject: [PATCH 1060/1222] add beamline magnets and zdc --- detectors/sPHENIX/G4Setup_sPHENIX.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 5fff95659..36d0d3230 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include @@ -62,6 +64,14 @@ void G4Init() 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(); } @@ -120,6 +130,15 @@ int G4Setup() 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); From 4b616b0625c121ba46b7cd2337eb821996f60133 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 22 Sep 2021 09:17:42 -0400 Subject: [PATCH 1061/1222] Add macro that runs tracking chain vertex agnostic --- common/G4_Tracking.C | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 61b87c92d..2bdf4131d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -24,13 +24,13 @@ #include #include #include -#include +#include #include #include #include #include #include - +#include #include #include #include @@ -90,7 +90,7 @@ namespace G4TRACKING // Initial vertexing bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_truth_init_vertexing = false; // if true runs truth vertexing, if false runs acts initial vertex finder + bool use_truth_init_vertexing = true; // if true runs truth vertexing, if false runs acts initial vertex finder // TPC seeding options bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker @@ -245,8 +245,10 @@ void Tracking_Reco() { PHTruthVertexing *init_vtx = new PHTruthVertexing(); init_vtx->Verbosity(verbosity); - init_vtx->set_acts_silicon(true); - se->registerSubsystem(init_vtx); + std::string trackmapname = "SvtxSiliconTrackMap"; + init_vtx->associate_tracks(true); + init_vtx->set_track_map_name(trackmapname); + //se->registerSubsystem(init_vtx); } else { @@ -329,7 +331,7 @@ void Tracking_Reco() if(G4TRACKING::use_propagator) { - PHTpcTrackSeedVertexAssoc* vtxassoc2 = new PHTpcTrackSeedVertexAssoc("PrePropagatorPHTpcTrackSeedVertexAssoc"); + PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); vtxassoc2->Verbosity(verbosity); se->registerSubsystem(vtxassoc2); @@ -352,7 +354,7 @@ void Tracking_Reco() // 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 - PHTpcTrackSeedVertexAssoc *vtxassoc = new PHTpcTrackSeedVertexAssoc(); + PHTpcTrackSeedCircleFit *vtxassoc = new PHTpcTrackSeedCircleFit(); vtxassoc->Verbosity(verbosity); se->registerSubsystem(vtxassoc); @@ -446,30 +448,30 @@ void Tracking_Reco() actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); se->registerSubsystem(actsFit); - if (G4TRACKING::SC_CALIBMODE) + 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); + 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); - PHActsVertexFinder *finder = new PHActsVertexFinder(); - finder->Verbosity(verbosity); - finder->setFieldMap(G4MAGNET::magfield); - se->registerSubsystem(finder); - - PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); - actsFit2->Verbosity(verbosity); - actsFit2->doTimeAnalysis(false); - actsFit2->fitSiliconMMs(false); - se->registerSubsystem(actsFit2); + PHTruthVertexing *vtxing = new PHTruthVertexing(); + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); + + PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); + vtxProp->Verbosity(1); + se->registerSubsystem(vtxProp); + } //========================================================= From 558e2cb219340b556abd03dc9547c564bb23c522 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 22 Sep 2021 10:16:02 -0400 Subject: [PATCH 1062/1222] Clean up tracking macro --- common/G4_Tracking.C | 48 ++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2bdf4131d..73fccf8e2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -90,7 +90,7 @@ namespace G4TRACKING // Initial vertexing bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_truth_init_vertexing = true; // if true runs truth vertexing, if false runs acts initial vertex finder + bool use_truth_vertexing = true; // if true runs truth vertexing, if false runs acts initial vertex finder // TPC seeding options bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker @@ -213,7 +213,7 @@ void Tracking_Reco() //==================== // Common to all sections - // Initial vertex finding + // Silicon seeding //===================== // Assemble silicon clusters into track stubs - needed for initial vertex finding @@ -239,27 +239,6 @@ void Tracking_Reco() se->registerSubsystem(silicon_Seeding); } - // Initial vertex finding - //================================= - if(G4TRACKING::use_truth_init_vertexing) - { - PHTruthVertexing *init_vtx = new PHTruthVertexing(); - init_vtx->Verbosity(verbosity); - std::string trackmapname = "SvtxSiliconTrackMap"; - init_vtx->associate_tracks(true); - init_vtx->set_track_map_name(trackmapname); - //se->registerSubsystem(init_vtx); - } - else - { - PHActsInitialVertexFinder* init_vtx = new PHActsInitialVertexFinder(); - init_vtx->Verbosity(verbosity); - init_vtx->setSvtxTrackMapName("SvtxSiliconTrackMap"); - init_vtx->setSvtxVertexMapName("SvtxVertexMap"); - init_vtx->magFieldName(G4MAGNET::magfield); - se->registerSubsystem(init_vtx); - } - //================================================ // Section 1: Acts chain of track propagation and final fitting //================================================ @@ -461,13 +440,24 @@ void Tracking_Reco() PHTrackCleaner *cleaner= new PHTrackCleaner(); cleaner->Verbosity(verbosity); se->registerSubsystem(cleaner); - - PHTruthVertexing *vtxing = new PHTruthVertexing(); - vtxing->associate_tracks(true); - std::string trackmapnamef = "SvtxTrackMap"; - vtxing->set_track_map_name(trackmapnamef); - se->registerSubsystem(vtxing); + 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 + { + PHActsVertexFinder *finder = new PHActsVertexFinder(); + finder->Verbosity(verbosity); + finder->setFieldMap(G4MAGNET::magfield); + se->registerSubsystem(finder); + } + + /// Propagate track positions to the vertex position PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); vtxProp->Verbosity(1); se->registerSubsystem(vtxProp); From 98dc480a2f1932db699e2d7ebff410b2facd1f40 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 23 Sep 2021 13:16:21 -0400 Subject: [PATCH 1063/1222] Add new vertxing module --- common/G4_Tracking.C | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 73fccf8e2..870a08aa4 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -74,23 +74,21 @@ namespace G4TRACKING // The normal (default) Acts tracking chain is: // PHActsSiliconSeeding // make silicon track seeds - // PHActsInitialVertexing // event vertex from silicon track stubs // 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 - // PHActsVertexFinder // final vertexing using fitted Acts tracks - // PHActsTrkFitter (2) // Kalman fitter makes final fit to tracks (improves DCA resolution using final vertex) + // PHSimpleVertexFinder // final vertexing using fitted Acts tracks + // PHActsVertexPropagator // propagates track parameters to vertex position to get final dca - // Possible variations - these are normally false + // Possible variations //==================================== //Fittting bool use_genfit = false; // if false, acts KF is run on proto tracks. If true, use Genfit track propagation and fitting - // Initial vertexing + // Vertexing bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - bool use_truth_vertexing = true; // if true runs truth vertexing, if false runs acts initial vertex finder // TPC seeding options bool use_PHTpcTracker_seeding = false; // false for using the default PHCASeeding to get TPC track seeds, true to use PHTpcTracker @@ -106,6 +104,7 @@ namespace G4TRACKING 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 @@ -451,15 +450,14 @@ void Tracking_Reco() } else { - PHActsVertexFinder *finder = new PHActsVertexFinder(); - finder->Verbosity(verbosity); - finder->setFieldMap(G4MAGNET::magfield); - se->registerSubsystem(finder); + PHSimpleVertexFinder *vtxfinder = new PHSimpleVertexFinder(); + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); } /// Propagate track positions to the vertex position PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); - vtxProp->Verbosity(1); + vtxProp->Verbosity(verbosity); se->registerSubsystem(vtxProp); } @@ -500,7 +498,7 @@ void Tracking_Reco() se->registerSubsystem(residuals); } - PHActsVertexFinder *finder = new PHActsVertexFinder(); + PHSimpleVertexFinder *finder = new PHSimpleVertexFinder(); finder->Verbosity(verbosity); se->registerSubsystem(finder); @@ -719,10 +717,6 @@ void Tracking_QA() { #if __cplusplus >= 201703L - // PHActsVertexFinder* vtxer = new PHActsVertexFinder(); - // vtxer->Verbosity(verbosity); - // se->registerSubsystem(vtxer); - QAG4SimulationVertex* qav = new QAG4SimulationVertex(); // qav->addEmbeddingID(2); qav->Verbosity(verbosity); From 098854240e96b4b8eb8c60fe4e14bac9e395ff4f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 23 Sep 2021 14:50:32 -0400 Subject: [PATCH 1064/1222] add gpoint eval by default --- common/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 870a08aa4..53cff2ae2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -670,7 +670,8 @@ void Tracking_Eval(const std::string& outputfile) 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(false); + 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); From 383a39438ce994f563558a0b52079baf74f7428d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Sep 2021 16:27:00 -0400 Subject: [PATCH 1065/1222] fix dimensions to vacuum enclosure reaches ends of sPHENIX beam pipe --- common/G4_BeamLine.C | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index 5854a7030..594cf575e 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -3,13 +3,13 @@ #include +#include + #include #include #include #include - #include - #include #include @@ -35,10 +35,11 @@ namespace Enable namespace BeamLine { - double starting_z = 700; //cm as center-forward interface - double enclosure_z_max = 3000.; - double enclosure_r_max = 30.; // This is intentionally made large 25cm radius + double starting_z = G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length; + double enclosure_z_max = 2000. + (700-starting_z); + double enclosure_r_max = 30.; // 30cm radius to cover magnets double enclosure_center = 0.5 * (starting_z + enclosure_z_max); + int pipe_id_offset = 100; int roman_pot_pipe_id_offset = 200; PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); @@ -48,7 +49,7 @@ namespace BeamLine void BeamLineInit() { - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, BeamLine::starting_z); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -BeamLine::enclosure_z_max); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BeamLine::enclosure_z_max); BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BeamLine::enclosure_r_max); } @@ -61,7 +62,7 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); BeamLine::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); - BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center); + BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center ); BeamLine::ForwardBeamLineEnclosure->set_double_param("radius", 0); BeamLine::ForwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); BeamLine::ForwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); @@ -94,9 +95,7 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) if (infile.is_open()) { double biggest_z = 0.; - // start with 1 so we do not end up with id=0 since we distinguish between pos and neg - // pos is inside the magnet (beam pipe), negative is the magnet volume - int imagnet = 1; + int imagnet = 0; std::string line; while (std::getline(infile, line)) { @@ -292,7 +291,6 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) for (int i = 0; i < nSec; i++) { string name = "beamPipeRP" + to_string(i); - // PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(name, BeamLine::roman_pot_pipe_id_offset + i); pipe->set_string_param("material", "G4_STAINLESS-STEEL"); pipe->set_double_param("place_x", PosFlip(xC[i])); From b2d6a7037d1ab3e2646518944500c046d311f622 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Sep 2021 16:28:01 -0400 Subject: [PATCH 1066/1222] set north/south in zdc subsystem ctor, add support flag --- common/G4_ZDC.C | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index 267d6b9d9..1511025df 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -8,9 +8,9 @@ #include #include -#include - #include +#include +#include #include @@ -33,6 +33,7 @@ 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; @@ -60,25 +61,29 @@ 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"); - zdc->set_int_param("fzdc", 1); - zdc->set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); + PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC",PHG4ZDCDefs::NORTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); zdc->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); - zdc = new PHG4ZDCSubsystem("ZDC", 1); - zdc->set_int_param("bzdc", 1); - zdc->set_double_param("z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); + zdc = new PHG4ZDCSubsystem("ZDC", PHG4ZDCDefs::SOUTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); zdc->OverlapCheck(OverlapCheck); zdc->SetActive(); zdc->SuperDetector("ZDC"); if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); zdc->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); } @@ -94,7 +99,6 @@ void ZDC_Towers() 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"); From ba2a9deb737ba0f2b1f00841693835ff44a0047e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Sep 2021 16:40:41 -0400 Subject: [PATCH 1067/1222] add zdc for Fun4All macro --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8c0674e10..1cf720254 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -314,6 +314,16 @@ int Fun4All_G4_sPHENIX( 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; From 7892fa524a19cb135b2b8a2310ecb0c9c3a8bb8a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Sep 2021 20:58:14 -0400 Subject: [PATCH 1068/1222] extend pipe beyond epd --- common/G4_Pipe.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 75e7f8b00..d503510d6 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -31,7 +31,7 @@ namespace G4PIPE double al_pipe_cone_length = 8.56; double al_pipe_ext_radius = 2.5005; - double al_pipe_ext_length = 60.0; // extension beyond conical part + double al_pipe_ext_length = 90.0; // extension beyond conical part } // namespace G4PIPE void PipeInit() From 3f4c1ec18f7e92b95e325367b403e45c4c951088 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Sep 2021 20:58:32 -0400 Subject: [PATCH 1069/1222] extend pipe beyond epd --- common/G4_BeamLine.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index 594cf575e..f2ab9967b 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -36,7 +36,7 @@ namespace Enable namespace BeamLine { double starting_z = G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length; - double enclosure_z_max = 2000. + (700-starting_z); + 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); From ead252b5950a56e4b704446b009cbcd4056cbcc5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 24 Sep 2021 13:53:12 -0400 Subject: [PATCH 1070/1222] set surrounding black hole dimensions --- common/G4_EPD.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/G4_EPD.C b/common/G4_EPD.C index da19a9af3..d1c05b160 100644 --- a/common/G4_EPD.C +++ b/common/G4_EPD.C @@ -12,10 +12,17 @@ R__LOAD_LIBRARY(libg4epd.so) namespace Enable { bool EPD = false; + bool EPD_SUPPORT = false; bool EPD_OVERLAPCHECK = false; } // namespace Enable -void EPDInit() {} +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) { From 6b21bcc25d1b987a53a09dfe6b65d9082bcf2a44 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 24 Sep 2021 15:53:43 -0400 Subject: [PATCH 1071/1222] shorten beampipe a bit to avoid overlap with forward enclosure --- common/G4_Pipe.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index d503510d6..6e8b87e97 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -31,7 +31,7 @@ namespace G4PIPE double al_pipe_cone_length = 8.56; double al_pipe_ext_radius = 2.5005; - double al_pipe_ext_length = 90.0; // extension beyond conical part + double al_pipe_ext_length = 89.9; // extension beyond conical part } // namespace G4PIPE void PipeInit() From ca1a201db3829eb109a85f4a3470aea8a2491f86 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sun, 26 Sep 2021 16:14:33 -0400 Subject: [PATCH 1072/1222] set epd to active --- common/G4_EPD.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_EPD.C b/common/G4_EPD.C index d1c05b160..52c6d7839 100644 --- a/common/G4_EPD.C +++ b/common/G4_EPD.C @@ -32,6 +32,7 @@ void EPD(PHG4Reco* g4Reco) epd->SuperDetector("EPD"); epd->OverlapCheck(overlap_check); + epd->SetActive(); g4Reco->registerSubsystem(epd); } From d8ff69d60a03e548939f2b22eb5b500b6a89c7ab Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 27 Sep 2021 16:20:01 -0400 Subject: [PATCH 1073/1222] Swap to Acts track projection module --- common/G4_Tracking.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 53cff2ae2..0a9e1fcb9 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -641,7 +642,7 @@ void Tracking_Reco() // Track Projections //=============== - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + PHActsTrackProjection *projection = new PHActsTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); From 85701a2ca3e132581b274a0e1500365496c83597 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 28 Sep 2021 13:51:43 -0400 Subject: [PATCH 1074/1222] remove IVF --- common/G4_Tracking.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0a9e1fcb9..626116a2a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -34,7 +34,6 @@ #include #include #include -#include #include #include From d76e9ae032c7008bda2f7c6fd49d5226b7614a34 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Sep 2021 17:25:28 -0400 Subject: [PATCH 1075/1222] Revert "Remove Acts IVF" --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 626116a2a..0a9e1fcb9 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -34,6 +34,7 @@ #include #include #include +#include #include #include From ea3a229f1309eedc13f3200e00842b136211080c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 28 Sep 2021 17:26:04 -0400 Subject: [PATCH 1076/1222] Revert "Swap to Acts track projection module" --- common/G4_Tracking.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0a9e1fcb9..53cff2ae2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -642,7 +641,7 @@ void Tracking_Reco() // Track Projections //=============== - PHActsTrackProjection *projection = new PHActsTrackProjection(); + PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); From d47b2395330312e63d23c53881850c26fc16d125 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 Oct 2021 10:36:27 -0400 Subject: [PATCH 1077/1222] remove obsolete PHActsInitialVertexFinder.h include --- common/G4_Tracking.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 53cff2ae2..8e33949b9 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -34,7 +34,6 @@ #include #include #include -#include #include #include From e36a3cec4c8874b7ef71f3dfc453759945f22030 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 1 Oct 2021 15:43:01 -0400 Subject: [PATCH 1078/1222] Remove second track fit which is obsolete --- common/G4_Tracking.C | 5 ----- 1 file changed, 5 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 8e33949b9..fda93b33b 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -501,11 +501,6 @@ void Tracking_Reco() finder->Verbosity(verbosity); se->registerSubsystem(finder); - PHActsTrkFitter* actsFit2 = new PHActsTrkFitter("PHActsSecondTrKFitter"); - actsFit2->Verbosity(verbosity); - actsFit2->doTimeAnalysis(false); - actsFit2->fitSiliconMMs(false); - se->registerSubsystem(actsFit2); } //========================================================= From 79da1df86059b4feaeec20a2a52d676db245ec71 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 5 Oct 2021 12:20:21 -0400 Subject: [PATCH 1079/1222] fix overlap between extended beam pipe and forward vacuum envelopes --- common/G4_BeamLine.C | 4 +++- common/G4_Pipe.C | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index f2ab9967b..27ac21729 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -35,7 +35,9 @@ namespace Enable namespace BeamLine { - double starting_z = G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length; +// 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::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length + 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); diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 6e8b87e97..f1c2cac59 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -31,7 +31,7 @@ namespace G4PIPE double al_pipe_cone_length = 8.56; double al_pipe_ext_radius = 2.5005; - double al_pipe_ext_length = 89.9; // extension beyond conical part + double al_pipe_ext_length = 90.; // extension beyond conical part } // namespace G4PIPE void PipeInit() @@ -146,7 +146,7 @@ double Pipe(PHG4Reco* g4Reco, double radius) /* north aluminum pipe (extension) */ cyl = new PHG4CylinderSubsystem("N_AL_PIPE_EXT", 7); - cyl->set_double_param("place_z", ext_position + no_overlapp); + cyl->set_double_param("place_z", ext_position); cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4PIPE::al_pipe_ext_length); @@ -171,7 +171,7 @@ double Pipe(PHG4Reco* g4Reco, double radius) /* south aluminum pipe (extension) */ cyl = new PHG4CylinderSubsystem("S_AL_PIPE_EXT", 9); - cyl->set_double_param("place_z", -ext_position - no_overlapp); + cyl->set_double_param("place_z", -ext_position); cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); cyl->set_int_param("lengthviarapidity", 0); cyl->set_double_param("length", G4PIPE::al_pipe_ext_length); From c73dc8152d20b51274f0076ae5fb8a5b8b9b0fd4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 5 Oct 2021 12:20:58 -0400 Subject: [PATCH 1080/1222] Add overlap check command to displaycmd() --- detectors/sPHENIX/DisplayOn.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/detectors/sPHENIX/DisplayOn.C b/detectors/sPHENIX/DisplayOn.C index f458a1c4b..c2d112523 100644 --- a/detectors/sPHENIX/DisplayOn.C +++ b/detectors/sPHENIX/DisplayOn.C @@ -59,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; } From 79020c2cf06f2a7530e7318390288c9de891317c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 11 Oct 2021 17:22:20 -0400 Subject: [PATCH 1081/1222] fix black hole dimensions --- common/G4_Mvtx.C | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index d888d615a..8aeac1848 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -63,11 +63,9 @@ namespace G4MVTXAlignment void MvtxInit() { - //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, (PHG4MvtxDefs::mvtxdat[G4MVTX::n_maps_layer - 1][PHG4MvtxDefs::kRmd]) / 10. + G4MVTX::radius_offset); - //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 16.); BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::service_barrel_radius); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start)); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -17.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1 * (G4MVTX::service_barrel_length - G4MVTX::service_barrel_start + 5.)); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 25.); } double calculateArea(double inner_radius, double outer_radius) //Calculate the area of a disk From 98e2d16c7634dc4d7a7e4ca7619eda835639b25f Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 12 Oct 2021 11:18:48 -0400 Subject: [PATCH 1082/1222] * Add genfit version of tracking macro to maintain old macro * Clean up tracking macro to reflect current track reco status --- common/G4_Tracking.C | 333 +++------------- common/G4_Tracking_Genfit.C | 735 ++++++++++++++++++++++++++++++++++++ 2 files changed, 793 insertions(+), 275 deletions(-) create mode 100644 common/G4_Tracking_Genfit.C diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index fda93b33b..a2dca4712 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -17,10 +17,7 @@ #include #include #include -#include -#include #include -#include #include #include #include @@ -39,10 +36,6 @@ #include #include -#include - -#include - #include #include #include @@ -50,7 +43,6 @@ 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 @@ -68,36 +60,13 @@ namespace G4TRACKING 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) + // 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 @@ -151,69 +120,26 @@ void TrackingInit() // 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 + + /// Build 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) @@ -238,9 +164,9 @@ void Tracking_Reco() } //================================================ - // Section 1: Acts chain of track propagation and final fitting + // Section 1: Reco chain of track propagation and final fitting //================================================ - if(!G4TRACKING::use_genfit && !G4TRACKING::use_full_truth_track_seeding) + if(!G4TRACKING::use_full_truth_track_seeding) { // TPC track seeding (finds all clusters in TPC for tracks) //============================================ @@ -258,79 +184,39 @@ void Tracking_Reco() } else { - std::cout << "Using normal TPC 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); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); + vtxassoc2->Verbosity(verbosity); + se->registerSubsystem(vtxassoc2); - // TPC track seeding from data - if (G4TRACKING::use_PHTpcTracker_seeding && !G4TRACKING::use_hybrid_seeding) - { - std::cout << " Using PHTpcTracker track seeding " << 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); - 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); @@ -420,7 +306,6 @@ void Tracking_Reco() 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); @@ -464,7 +349,7 @@ void Tracking_Reco() //========================================================= // Section 2: Full truth track finding with Acts final fitting //========================================================= - if( !G4TRACKING::use_genfit && G4TRACKING::use_full_truth_track_seeding) + else if(G4TRACKING::use_full_truth_track_seeding) { std::cout << " Using full truth track seeding for Acts" << std::endl; @@ -492,130 +377,33 @@ void Tracking_Reco() { /// run tpc residual determination with silicon+MM track fit auto residuals = new PHTpcResiduals; - residuals->setOutputfile( G4TRACKING::SC_ROOTOUTPUT_FILENAME ); - residuals->Verbosity(verbosity); + 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) + if(G4TRACKING::use_truth_vertexing) { - 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); + PHTruthVertexing *vtxing = new PHTruthVertexing(); + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); } else { - // need TPC track seeds to give to GenfitTrkProp + PHSimpleVertexFinder *vtxfinder = new PHSimpleVertexFinder(); + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); + } - // 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); - } + /// Propagate track positions to the vertex position + PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); + vtxProp->Verbosity(verbosity); + se->registerSubsystem(vtxProp); - 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 @@ -632,7 +420,7 @@ void Tracking_Reco() rave->Verbosity(verbosity); se->registerSubsystem(rave); } - + // Track Projections //=============== PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); @@ -668,7 +456,6 @@ void Tracking_Eval(const std::string& outputfile) 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); @@ -708,17 +495,13 @@ void Tracking_QA() // 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 - } + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); + + if (Input::UPSILON) { 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 From f3f41286d8d7214125d2c78f3dd138d5d3a9ae5f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 15 Oct 2021 14:08:43 -0400 Subject: [PATCH 1083/1222] replace back of plugdoor by black hole to speed up showers, sadly 2cm does not reproduce backsplash --- common/G4_PlugDoor.C | 135 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 113 insertions(+), 22 deletions(-) diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C index d45cbf928..824eea785 100644 --- a/common/G4_PlugDoor.C +++ b/common/G4_PlugDoor.C @@ -14,6 +14,7 @@ namespace Enable bool PLUGDOOR = false; bool PLUGDOOR_ABSORBER = false; bool PLUGDOOR_OVERLAPCHECK = false; + bool PLUGDOOR_BLACKHOLE = false; } // namespace Enable namespace G4PLUGDOOR @@ -27,6 +28,7 @@ namespace G4PLUGDOOR double length = z_2 - z_1; double place_z = (z_1 + z_2) / 2.; + double thickness = 2.; // 2 cm thick } // namespace G4PLUGDOOR void PlugDoorInit() @@ -34,35 +36,124 @@ 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; - const bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; const string material("Steel_1006"); - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); - 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); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); - 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); - g4Reco->registerSubsystem(flux_return_minus); + 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); + 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); + 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(); + 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); + 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); + 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(); + 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); + 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); + g4Reco->registerSubsystem(flux_return_minus); + } return; } From adb093f509e663efd0bc30d9bd67e3cda32efdd8 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 18 Oct 2021 18:05:35 -0400 Subject: [PATCH 1084/1222] rename BeamLine namespace to G4BEAMLINE in line with others --- common/G4_BeamLine.C | 79 ++++++++++++++++++++++---------------------- common/G4_ZDC.C | 8 ++--- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index 27ac21729..6ec922f57 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -33,7 +33,7 @@ namespace Enable } // namespace Enable -namespace BeamLine +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 @@ -41,7 +41,7 @@ namespace BeamLine 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); @@ -51,9 +51,9 @@ namespace BeamLine void BeamLineInit() { - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -BeamLine::enclosure_z_max); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, BeamLine::enclosure_z_max); - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, BeamLine::enclosure_r_max); + 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) @@ -63,27 +63,27 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); - BeamLine::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); - BeamLine::ForwardBeamLineEnclosure->set_double_param("place_z", BeamLine::enclosure_center ); - BeamLine::ForwardBeamLineEnclosure->set_double_param("radius", 0); - BeamLine::ForwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); - BeamLine::ForwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); - BeamLine::ForwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); - BeamLine::ForwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); - BeamLine::ForwardBeamLineEnclosure->OverlapCheck(overlapCheck); - if (verbosity) BeamLine::ForwardBeamLineEnclosure->Verbosity(verbosity); - g4Reco->registerSubsystem(BeamLine::ForwardBeamLineEnclosure); + 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); - BeamLine::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("BackwardBeamLineEnclosure"); - BeamLine::BackwardBeamLineEnclosure->set_double_param("place_z", -BeamLine::enclosure_center); - BeamLine::BackwardBeamLineEnclosure->set_double_param("radius", 0); - BeamLine::BackwardBeamLineEnclosure->set_double_param("thickness", BeamLine::enclosure_r_max); // This is intentionally made large 25cm radius - BeamLine::BackwardBeamLineEnclosure->set_double_param("length", BeamLine::enclosure_z_max - BeamLine::starting_z); - BeamLine::BackwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); - BeamLine::BackwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); - BeamLine::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); - if (verbosity) BeamLine::BackwardBeamLineEnclosure->Verbosity(verbosity); - g4Reco->registerSubsystem(BeamLine::BackwardBeamLineEnclosure); + 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"; @@ -190,11 +190,11 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) bl->set_double_param("place_y", y); // relative position to mother vol. if (z > 0) { - bl->set_double_param("place_z", z - BeamLine::enclosure_center); // relative position to mother vol. + bl->set_double_param("place_z", z - G4BEAMLINE::enclosure_center); // relative position to mother vol. } else { - bl->set_double_param("place_z", z + BeamLine::enclosure_center); // relative position to mother vol. + 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 @@ -203,16 +203,17 @@ void BeamLineDefineMagnets(PHG4Reco *g4Reco) 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(BeamLine::ForwardBeamLineEnclosure); + bl->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); } else { - bl->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + bl->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); } bl->OverlapCheck(overlapCheck); bl->SuperDetector("BEAMLINEMAGNET"); @@ -249,7 +250,7 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) for (int i = 0; i < ntube; i++) { string name = "beamPipe" + nm[i]; - PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(name, BeamLine::pipe_id_offset + 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]); @@ -259,21 +260,21 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) pipe->set_double_param("place_y", qyC[i]); if (qzC[i] > 0) { - pipe->set_double_param("place_z", qzC[i] - BeamLine::enclosure_center); // relative position to mother vol. + 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] + BeamLine::enclosure_center); // relative position to mother vol. + 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(BeamLine::ForwardBeamLineEnclosure); + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); } else { - pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); } pipe->OverlapCheck(OverlapCheck); @@ -293,17 +294,17 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) for (int i = 0; i < nSec; i++) { string name = "beamPipeRP" + to_string(i); - PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(name, BeamLine::roman_pot_pipe_id_offset + 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] - BeamLine::enclosure_center); + pipe->set_double_param("place_z", zC[i] - G4BEAMLINE::enclosure_center); } else { - pipe->set_double_param("place_z", zC[i] + BeamLine::enclosure_center); + 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]); @@ -312,11 +313,11 @@ void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) pipe->set_double_param("rmax2", or2[i]); if (zC[i] > 0) { - pipe->SetMotherSubsystem(BeamLine::ForwardBeamLineEnclosure); + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); } else { - pipe->SetMotherSubsystem(BeamLine::BackwardBeamLineEnclosure); + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); } if (AbsorberActive) pipe->SetActive(); pipe->SuperDetector("PIPE"); diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C index 1511025df..abbae7c21 100644 --- a/common/G4_ZDC.C +++ b/common/G4_ZDC.C @@ -67,24 +67,24 @@ void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC",PHG4ZDCDefs::NORTH); // place zdc in beam enclosure - zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - BeamLine::enclosure_center); + 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(BeamLine::ForwardBeamLineEnclosure); + 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 - BeamLine::enclosure_center); + 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(BeamLine::BackwardBeamLineEnclosure); + zdc->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); g4Reco->registerSubsystem(zdc); } From 4d39d1749a7b23029bb4297e3837d86e1bd8fc70 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 19 Oct 2021 15:45:32 -0400 Subject: [PATCH 1085/1222] set all plugdoor components to same color --- common/G4_PlugDoor.C | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C index 824eea785..c0f9170c3 100644 --- a/common/G4_PlugDoor.C +++ b/common/G4_PlugDoor.C @@ -9,6 +9,8 @@ R__LOAD_LIBRARY(libg4detectors.so) +void common_color(PHG4CylinderSubsystem *subsys); + namespace Enable { bool PLUGDOOR = false; @@ -67,6 +69,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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); @@ -78,6 +81,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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 @@ -92,6 +96,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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); @@ -103,6 +108,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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); @@ -114,6 +120,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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 @@ -128,6 +135,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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 @@ -141,6 +149,7 @@ void PlugDoor(PHG4Reco *g4Reco) 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); @@ -152,9 +161,15 @@ void PlugDoor(PHG4Reco *g4Reco) 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 From f08d6875e64692278839d8a8548395b1d3a44bbc Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 21 Oct 2021 00:00:37 -0400 Subject: [PATCH 1086/1222] reordering includes helps - no idea why --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 1cf720254..8142490f6 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -3,6 +3,10 @@ #include +// leave this here - there is a weird library interaction +// if G4_KFParticle.C gets included after G4Setup_sPHENIX.C +#include + #include #include #include @@ -12,7 +16,6 @@ #include #include #include -#include #include #include #include From db9f6917d1f35e348715073ee40ae5a2e6dc6dc6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 21 Oct 2021 07:40:27 -0400 Subject: [PATCH 1087/1222] Revert "reordering includes helps - no idea why" --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8142490f6..1cf720254 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -3,10 +3,6 @@ #include -// leave this here - there is a weird library interaction -// if G4_KFParticle.C gets included after G4Setup_sPHENIX.C -#include - #include #include #include @@ -16,6 +12,7 @@ #include #include #include +#include #include #include #include From 1f266681516ed08b4a6d128dbc85bceb30c07b0f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 Oct 2021 21:16:30 -0400 Subject: [PATCH 1088/1222] Add support structure hist to bbc --- common/G4_Bbc.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 509a285b0..6f4826743 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -17,6 +17,7 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { bool BBC = false; + bool BBC_SUPPORT = false; bool BBCFAKE = false; int BBC_VERBOSITY = 0; } // namespace Enable @@ -45,10 +46,16 @@ void BbcInit() void Bbc(PHG4Reco* g4Reco) { + bool SupportActive = Enable::SUPPORT || Enable::BBC_SUPPORT; if (Enable::BBC) { PHG4BbcSubsystem* bbc = new PHG4BbcSubsystem("BBC"); bbc->SuperDetector("BBC"); + bbc->SetActive(); + if (SupportActive) + { + bbc->SetSupportActive(SupportActive); + } g4Reco->registerSubsystem(bbc); } return; From 695380e9bf998894bab7f4fa9699d76756d86213 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 25 Oct 2021 21:41:19 -0400 Subject: [PATCH 1089/1222] add Enable:::BBC_SUPPORT (commented out) --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 1 + 1 file changed, 1 insertion(+) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 1cf720254..de0a25104 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -251,6 +251,7 @@ int Fun4All_G4_sPHENIX( // 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; From b3923b38a88d9388c40d375ad3c119aefdae702c Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 26 Oct 2021 10:20:47 -0400 Subject: [PATCH 1090/1222] Added updated service barrel --- common/G4_Mvtx.C | 138 +----------------- common/G4_TrackingService.C | 211 ++++++++++++++++++++++++++++ detectors/sPHENIX/G4Setup_sPHENIX.C | 3 + 3 files changed, 217 insertions(+), 135 deletions(-) create mode 100644 common/G4_TrackingService.C diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 8aeac1848..225595eb6 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -32,7 +32,6 @@ namespace Enable bool MVTX_CLUSTER = false; bool MVTX_QA = false; bool MVTX_ABSORBER = false; - bool MVTX_SERVICE = true; int MVTX_VERBOSITY = 0; } // namespace Enable @@ -41,18 +40,6 @@ 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 - - double single_stave_service_copper_area = 0.0677; //Cross-sectional area of copper for 1 stave [cm^2] - double single_stave_service_water_area = 0.0098; //Cross-sectional area of water for 1 stave [cm^2] - double single_stave_service_plastic_area = 0.4303; //Cross-sectional area of plastic for 1 stave [cm^2] - - const int n_service_layers = 1; //Number of service cable service_layers to generate - double service_layer_start_radius[] = {8.5}; //Inner radius of where the cables begin [cm] - int n_staves_service_layer[] = {48}; //Number of staves associated to each service layer - - double service_barrel_radius = 10.75; // [cm] From final design review - double service_barrel_start = -35; //[cm] Approx. - double service_barrel_length = 150; // [cm] length of service barrel ~(to patch panel) } // namespace G4MVTX namespace G4MVTXAlignment @@ -63,127 +50,9 @@ namespace G4MVTXAlignment void MvtxInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MVTX::service_barrel_radius); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -1 * (G4MVTX::service_barrel_length - G4MVTX::service_barrel_start + 5.)); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 25.); -} - -double calculateArea(double inner_radius, double outer_radius) //Calculate the area of a disk -{ - return M_PI * (std::pow(outer_radius, 2) - std::pow(inner_radius, 2)); -} - -double calculateOR(double inner_radius, double area) //Calculate the outer radius of a disk, knowing the inner radius and the area -{ - return std::sqrt(area / M_PI + std::pow(inner_radius, 2)); -} - -void calculateMaterialBoundaries(int& service_layer_ID, double& outer_copper_radius, double& outer_water_radius, double& outer_plastic_radius) //Calculate where the transition between each material occurs -{ - outer_copper_radius = calculateOR(G4MVTX::service_layer_start_radius[service_layer_ID], G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_copper_area); - outer_water_radius = calculateOR(outer_copper_radius, G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_water_area); - outer_plastic_radius = calculateOR(outer_water_radius, G4MVTX::n_staves_service_layer[service_layer_ID] * G4MVTX::single_stave_service_plastic_area); -} - -double MVTXService(PHG4Reco* g4Reco, double radius) -{ - // Note, cables are all south - // Setup service_layers - bool AbsorberActive = Enable::ABSORBER || Enable::MVTX_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; - int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); - - double copper_OR[G4MVTX::n_service_layers], water_OR[G4MVTX::n_service_layers], plastic_OR[G4MVTX::n_service_layers]; //Objects for material outer radii - int subsystem_service_layer = 0; - std::string copper_name, water_name, plastic_name; - PHG4CylinderSubsystem* cyl; - - for (int i = 0; i < G4MVTX::n_service_layers; ++i) //Build a service_layer of copper, then water, then plastic - { - calculateMaterialBoundaries(i, copper_OR[i], water_OR[i], plastic_OR[i]); - - copper_name = "MVTX_Service_copper_service_layer_" + std::to_string(i); - water_name = "MVTX_Service_water_service_layer_" + std::to_string(i); - plastic_name = "MVTX_Service_plastic_service_layer_" + std::to_string(i); - - cyl = new PHG4CylinderSubsystem(copper_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", G4MVTX::service_layer_start_radius[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTX::service_barrel_length); - cyl->set_string_param("material", "G4_Cu"); - cyl->set_double_param("thickness", copper_OR[i] - G4MVTX::service_layer_start_radius[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_service_layer += 1; - - cyl = new PHG4CylinderSubsystem(water_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", copper_OR[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTX::service_barrel_length); - cyl->set_string_param("material", "G4_WATER"); - cyl->set_double_param("thickness", water_OR[i] - copper_OR[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_service_layer += 1; - - cyl = new PHG4CylinderSubsystem(plastic_name, subsystem_service_layer); - cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", water_OR[i]); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTX::service_barrel_length); - cyl->set_string_param("material", "G4_POLYETHYLENE"); - cyl->set_double_param("thickness", plastic_OR[i] - water_OR[i]); - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - subsystem_service_layer += 1; - } - - cyl = new PHG4CylinderSubsystem("MVTX_Service_shell_service_layer", subsystem_service_layer); - cyl->set_double_param("place_z", -1 * (G4MVTX::service_barrel_length + G4MVTX::service_barrel_start) - no_overlapp); - cyl->set_double_param("radius", G4MVTX::service_barrel_radius); - cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4MVTX::service_barrel_length); - cyl->set_string_param("material", "PEEK"); //Service barrel is carbon fibre (peek?) - cyl->set_double_param("thickness", 0.1); //Service barrel is 1mm thick - cyl->SuperDetector("MVTXSERVICE"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - - radius = G4MVTX::service_barrel_radius; - - if (verbosity > 0) - { - cout << "=========================== MVTX Service Barrel =============================" << endl; - cout << " MVTX Service Material Description:" << endl; - - cout << " Single stave copper area = " << G4MVTX::single_stave_service_copper_area << " cm^2" << endl; - cout << " Single stave water area = " << G4MVTX::single_stave_service_water_area << " cm^2" << endl; - cout << " Single stave plastic area = " << G4MVTX::single_stave_service_plastic_area << " cm^2" << endl; - - for (int j = 0; j < G4MVTX::n_service_layers; ++j) - { - cout << " service_layer " << j << " starts at " << G4MVTX::service_layer_start_radius[j] << " cm" << endl; - cout << " service_layer " << j << " services " << G4MVTX::n_staves_service_layer[j] << " staves" << endl; - } - - cout << " Service barrel radius = " << G4MVTX::service_barrel_radius << " cm" << endl; - cout << " Service barrel start = " << G4MVTX::service_barrel_start << " cm" << endl; - cout << " Service barrel length = " << G4MVTX::service_barrel_length << " cm" << endl; - cout << "===============================================================================" << endl; - } - - radius += no_overlapp; - - return radius; + //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 5); + //BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -20); + //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 25.); } double Mvtx(PHG4Reco* g4Reco, double radius, @@ -212,7 +81,6 @@ double Mvtx(PHG4Reco* g4Reco, double radius, mvtx->OverlapCheck(maps_overlapcheck); g4Reco->registerSubsystem(mvtx); radius += G4MVTX::radius_offset; - if (Enable::MVTX_SERVICE) radius += MVTXService(g4Reco, radius); return radius; } diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C new file mode 100644 index 000000000..f85d3bade --- /dev/null +++ b/common/G4_TrackingService.C @@ -0,0 +1,211 @@ +#ifndef MACRO_G4TrackingService_C +#define MACRO_G4TrackingService_C + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include + +//sPHENIX Tracking Services + +using namespace std; + +class ServiceProperties +{ + public: + ServiceProperties(); + + explicit ServiceProperties(const string &name, + const double &rad_len_aluminum, + const double &rad_len_carbon, + const double &z_south, + const double &z_north, + const double &r_south, + const double &r_north); + + virtual ~ServiceProperties(){}; + + const string get_name(); + const double get_rad_len_aluminum(); + const double get_rad_len_carbon(); + const double get_z_south(); + const double get_z_north(); + const double get_r_south(); + const double get_r_north(); + + private: + const string m_name = "service"; + const double m_rad_len_aluminum = 0.0; + const double m_rad_len_carbon = 0.0; + const double m_z_south = 0.0; + const double m_z_north = 0.0; + const double m_r_south = 0.0; + const double m_r_north = 0.0; +}; + +ServiceProperties::ServiceProperties(const string &name, + const double &rad_len_aluminum, + const double &rad_len_carbon, + const double &z_south, + const double &z_north, + const double &r_south, + const double &r_north) + : m_name(name) + , m_rad_len_aluminum(rad_len_aluminum) + , m_rad_len_carbon(rad_len_carbon) + , m_z_south(z_south) + , m_z_north(z_north) + , m_r_south(r_south) + , m_r_north(r_north) +{} + +const string ServiceProperties::get_name() { return m_name; } +const double ServiceProperties::get_rad_len_aluminum() { return m_rad_len_aluminum; } +const double ServiceProperties::get_rad_len_carbon() { return m_rad_len_carbon; } +const double ServiceProperties::get_z_south() { return m_z_south; } +const double ServiceProperties::get_z_north() { return m_z_north; } +const double ServiceProperties::get_r_south() { return m_r_south; } +const double ServiceProperties::get_r_north() { return m_r_north; } + +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 + const int nMaterials = 2; + pair materials[nMaterials] = { make_pair("G4_Al", 8.897) + , make_pair("PEEK", 30.00) }; + + double GlobalOffset = -15.0; + double ShellThickness = 0.436; //Thickness in cm + double LayerThickness = 0.1; // + double ShellLength = 121.24; //Length of cylinder in cm + int subsysID = 0; +} // namespace G4TrackingService + +vector get_thickness(ServiceProperties *object) +{ + vector thickness = {(object->get_rad_len_aluminum()/100)*G4TrackingService::materials[0].second + ,(object->get_rad_len_carbon()/100)*G4TrackingService::materials[1].second}; + return thickness; +} + +void TrackingServiceInit() +{ +} + +double TrackingServiceCone(ServiceProperties *object, PHG4Reco* g4Reco, double 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; + + double innerRadiusSouth = object->get_r_south(); + double innerRadiusNorth = object->get_r_north(); + double length = abs(object->get_z_north() - object->get_z_south()); + vector thickness = get_thickness(object); + + for (int i = 0; i < G4TrackingService::nMaterials; ++i) + { + if (thickness[i] == 0) continue; + cone = new PHG4ConeSubsystem(object->get_name(), G4TrackingService::subsysID); + cone->Verbosity(verbosity); + cone->SetR1(innerRadiusSouth, innerRadiusSouth + thickness[i]); + cone->SetR2(innerRadiusNorth, innerRadiusNorth + thickness[i]); + cone->SetPlaceZ(object->get_z_south() + length/2 + G4TrackingService::GlobalOffset); + cone->SetZlength(length/2); + cone->SetMaterial(G4TrackingService::materials[i].first); + cone->SuperDetector("TrackingService"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + ++G4TrackingService::subsysID; + innerRadiusSouth += thickness[i]; + innerRadiusNorth += thickness[i]; + } + radius = max(innerRadiusSouth, innerRadiusNorth); + + return radius; +} + +double TrackingServiceCylinder(ServiceProperties *object, PHG4Reco* g4Reco, double 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; + + double innerRadius = object->get_r_south(); + double length = abs(object->get_z_north() - object->get_z_south()); + vector thickness = get_thickness(object); + + for (int i = 0; i < G4TrackingService::nMaterials; ++i) + { + if (thickness[i] == 0) continue; + cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); + cyl->Verbosity(verbosity); + cyl->set_double_param("place_z", object->get_z_south() + length/2 + G4TrackingService::GlobalOffset); + cyl->set_double_param("radius", innerRadius); + cyl->set_double_param("length", length); + cyl->set_string_param("material", G4TrackingService::materials[i].first); + cyl->set_double_param("thickness", thickness[i]); + cyl->SuperDetector("TrackingService"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + ++G4TrackingService::subsysID; + innerRadius += thickness[i]; + } + radius = innerRadius; + + return radius; +} + +double TrackingService(PHG4Reco* g4Reco, double radius) +{ + vector cylinders, cones; + + double shellX0 = 100*G4TrackingService::ShellThickness/G4TrackingService::materials[4].second; + double layerX0 = 100*G4TrackingService::LayerThickness/G4TrackingService::materials[4].second; + double shellOffset = 18.679; + + cylinders.push_back(new ServiceProperties("MVTXServiceBarrel", 0, shellX0, -1.*(G4TrackingService::ShellLength + shellOffset), -1.*shellOffset , 10.33, 0)); + + cylinders.push_back(new ServiceProperties("L0_1", 0, layerX0, -18.680, -16.579, 5.050, 0)); + cones.push_back(new ServiceProperties("L0_2", 0, layerX0, -16.579, -9.186, 5.050, 2.997)); + cylinders.push_back(new ServiceProperties("L0_3", 0, layerX0, -9.186, 0, 2.997, 0)); + + cylinders.push_back(new ServiceProperties("L1_1", 0, layerX0, -17.970, -15.851, 7.338, 0)); + cones.push_back(new ServiceProperties("L1_2", 9/16, 0, 0.42/16, 0.32/16, layerX0, -15.851, -8.938, 7.338, 3.799)); + cylinders.push_back(new ServiceProperties("L1_3", 9/16, 0, 0.42/16, 0.32/16, layerX0, -8.938, 0, 3.799, 0)); + + cylinders.push_back(new ServiceProperties("L2_1", 0, layerX0, -22.300, -15.206, 9.650, 0)); + cones.push_back(new ServiceProperties("L2_2", 0, layerX0, -15.206, -8.538, 9.650, 4.574)); + cylinders.push_back(new ServiceProperties("L2_3", 0, layerX0, -8.538, 0, 4.574, 0)); + + + for (ServiceProperties *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + for (ServiceProperties *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + + return radius; +} + +#endif diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 36d0d3230..937363e81 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ void G4Init() // load detector/material macros and execute Init() function if (Enable::PIPE) PipeInit(); + if (Enable::TrackingService) TrackingServiceInit(); if (Enable::MVTX) MvtxInit(); if (Enable::INTT) InttInit(); if (Enable::TPC) TPCInit(); @@ -118,6 +120,7 @@ int G4Setup() double radius = 0.; if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::TrackingService) TrackingService(g4Reco, radius); if (Enable::MVTX) radius = Mvtx(g4Reco, radius); if (Enable::INTT) radius = Intt(g4Reco, radius); if (Enable::TPC) radius = TPC(g4Reco, radius); From 1dae5762b7c1a2d80207bafe596e5772f0d63509 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 26 Oct 2021 12:29:54 -0400 Subject: [PATCH 1091/1222] Added basica cable class --- common/G4_TrackingService.C | 271 ++++++++++++++++++++++++++++-------- 1 file changed, 212 insertions(+), 59 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index f85d3bade..1c8534421 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -19,62 +19,131 @@ using namespace std; -class ServiceProperties +class ServiceStructure { public: - ServiceProperties(); + ServiceStructure(); - explicit ServiceProperties(const string &name, - const double &rad_len_aluminum, - const double &rad_len_carbon, - const double &z_south, - const double &z_north, - const double &r_south, - const double &r_north); + explicit ServiceStructure(const string &name, + const double &rad_len_aluminum, + const double &rad_len_carbon, + const double &zSouth, + const double &zNorth, + const double &rSouth, + const double &rNorth); - virtual ~ServiceProperties(){}; + virtual ~ServiceStructure(){}; const string get_name(); const double get_rad_len_aluminum(); const double get_rad_len_carbon(); - const double get_z_south(); - const double get_z_north(); - const double get_r_south(); - const double get_r_north(); + const double get_zSouth(); + const double get_zNorth(); + const double get_rSouth(); + const double get_rNorth(); private: const string m_name = "service"; const double m_rad_len_aluminum = 0.0; const double m_rad_len_carbon = 0.0; - const double m_z_south = 0.0; - const double m_z_north = 0.0; - const double m_r_south = 0.0; - const double m_r_north = 0.0; + const double m_zSouth = 0.0; + const double m_zNorth = 0.0; + const double m_rSouth = 0.0; + const double m_rNorth = 0.0; }; -ServiceProperties::ServiceProperties(const string &name, - const double &rad_len_aluminum, - const double &rad_len_carbon, - const double &z_south, - const double &z_north, - const double &r_south, - const double &r_north) +ServiceStructure::ServiceStructure(const string &name, + const double &rad_len_aluminum, + const double &rad_len_carbon, + const double &zSouth, + const double &zNorth, + const double &rSouth, + const double &rNorth) : m_name(name) , m_rad_len_aluminum(rad_len_aluminum) , m_rad_len_carbon(rad_len_carbon) - , m_z_south(z_south) - , m_z_north(z_north) - , m_r_south(r_south) - , m_r_north(r_north) + , m_zSouth(zSouth) + , m_zNorth(zNorth) + , m_rSouth(rSouth) + , m_rNorth(rNorth) {} -const string ServiceProperties::get_name() { return m_name; } -const double ServiceProperties::get_rad_len_aluminum() { return m_rad_len_aluminum; } -const double ServiceProperties::get_rad_len_carbon() { return m_rad_len_carbon; } -const double ServiceProperties::get_z_south() { return m_z_south; } -const double ServiceProperties::get_z_north() { return m_z_north; } -const double ServiceProperties::get_r_south() { return m_r_south; } -const double ServiceProperties::get_r_north() { return m_r_north; } +const string ServiceStructure::get_name() { return m_name; } +const double ServiceStructure::get_rad_len_aluminum() { return m_rad_len_aluminum; } +const double ServiceStructure::get_rad_len_carbon() { return m_rad_len_carbon; } +const double ServiceStructure::get_zSouth() { return m_zSouth; } +const double ServiceStructure::get_zNorth() { return m_zNorth; } +const double ServiceStructure::get_rSouth() { return m_rSouth; } +const double ServiceStructure::get_rNorth() { return m_rNorth; } + +class Cable +{ + public: + Cable(); + + explicit Cable(const string &name, + const string &coreMaterial, + const double &coreRadius, + const double &sheathRadius, + const double &xSouth, const double &xNorth, + const double &ySouth, const double &yNorth, + const double &zSouth, const double &zNorth); + + virtual ~Cable(){}; + + const string get_name(); + const string get_coreMaterial(); + const double get_coreRadius(); + const double get_sheathRadius(); + const double get_xSouth(); + const double get_xNorth(); + const double get_ySouth(); + const double get_yNorth(); + const double get_zSouth(); + const double get_zNorth(); + + private: + const string m_name = "cable"; + const string m_coreMaterial = "G4_Cu"; + const double m_coreRadius = 1; + const double m_sheathRadius = 2; + const double m_xSouth = 0.; + const double m_xNorth = 1.; + const double m_ySouth = 0.; + const double m_yNorth = 1.; + const double m_zSouth = 0.; + const double m_zNorth = 1.; +}; + +Cable::Cable(const string &name, + const string &coreMaterial, + const double &coreRadius, + const double &sheathRadius, + const double &xSouth, const double &xNorth, + const double &ySouth, const double &yNorth, + const double &zSouth, const double &zNorth) + : m_name(name) + , m_coreMaterial(coreMaterial) + , m_coreRadius(coreRadius) + , m_sheathRadius(sheathRadius) + , m_xSouth(xSouth) + , m_xNorth(xNorth) + , m_ySouth(ySouth) + , m_yNorth(yNorth) + , m_zSouth(zSouth) + , m_zNorth(zNorth) +{} + +const string Cable::get_name() { return m_name; } +const string Cable::get_coreMaterial() { return m_coreMaterial; } +const double Cable::get_coreRadius() { return m_coreRadius; } +const double Cable::get_sheathRadius() { return m_sheathRadius; } +const double Cable::get_xSouth() { return m_xSouth; } +const double Cable::get_xNorth() { return m_xNorth; } +const double Cable::get_ySouth() { return m_ySouth; } +const double Cable::get_yNorth() { return m_yNorth; } +const double Cable::get_zSouth() { return m_zSouth; } +const double Cable::get_zNorth() { return m_zNorth; } namespace Enable { @@ -98,7 +167,7 @@ namespace G4TrackingService int subsysID = 0; } // namespace G4TrackingService -vector get_thickness(ServiceProperties *object) +vector get_thickness(ServiceStructure *object) { vector thickness = {(object->get_rad_len_aluminum()/100)*G4TrackingService::materials[0].second ,(object->get_rad_len_carbon()/100)*G4TrackingService::materials[1].second}; @@ -109,7 +178,7 @@ void TrackingServiceInit() { } -double TrackingServiceCone(ServiceProperties *object, PHG4Reco* g4Reco, double radius) +double TrackingServiceCone(ServiceStructure *object, PHG4Reco* g4Reco, double radius) { bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; @@ -117,9 +186,9 @@ double TrackingServiceCone(ServiceProperties *object, PHG4Reco* g4Reco, double r PHG4ConeSubsystem* cone; - double innerRadiusSouth = object->get_r_south(); - double innerRadiusNorth = object->get_r_north(); - double length = abs(object->get_z_north() - object->get_z_south()); + double innerRadiusSouth = object->get_rSouth(); + double innerRadiusNorth = object->get_rNorth(); + double length = abs(object->get_zNorth() - object->get_zSouth()); vector thickness = get_thickness(object); for (int i = 0; i < G4TrackingService::nMaterials; ++i) @@ -129,7 +198,7 @@ double TrackingServiceCone(ServiceProperties *object, PHG4Reco* g4Reco, double r cone->Verbosity(verbosity); cone->SetR1(innerRadiusSouth, innerRadiusSouth + thickness[i]); cone->SetR2(innerRadiusNorth, innerRadiusNorth + thickness[i]); - cone->SetPlaceZ(object->get_z_south() + length/2 + G4TrackingService::GlobalOffset); + cone->SetPlaceZ(object->get_zSouth() + length/2 + G4TrackingService::GlobalOffset); cone->SetZlength(length/2); cone->SetMaterial(G4TrackingService::materials[i].first); cone->SuperDetector("TrackingService"); @@ -145,7 +214,7 @@ double TrackingServiceCone(ServiceProperties *object, PHG4Reco* g4Reco, double r return radius; } -double TrackingServiceCylinder(ServiceProperties *object, PHG4Reco* g4Reco, double radius) +double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco* g4Reco, double radius) { bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; @@ -153,8 +222,8 @@ double TrackingServiceCylinder(ServiceProperties *object, PHG4Reco* g4Reco, doub PHG4CylinderSubsystem* cyl; - double innerRadius = object->get_r_south(); - double length = abs(object->get_z_north() - object->get_z_south()); + double innerRadius = object->get_rSouth(); + double length = abs(object->get_zNorth() - object->get_zSouth()); vector thickness = get_thickness(object); for (int i = 0; i < G4TrackingService::nMaterials; ++i) @@ -162,7 +231,7 @@ double TrackingServiceCylinder(ServiceProperties *object, PHG4Reco* g4Reco, doub if (thickness[i] == 0) continue; cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); cyl->Verbosity(verbosity); - cyl->set_double_param("place_z", object->get_z_south() + length/2 + G4TrackingService::GlobalOffset); + cyl->set_double_param("place_z", object->get_zSouth() + length/2 + G4TrackingService::GlobalOffset); cyl->set_double_param("radius", innerRadius); cyl->set_double_param("length", length); cyl->set_string_param("material", G4TrackingService::materials[i].first); @@ -179,33 +248,117 @@ double TrackingServiceCylinder(ServiceProperties *object, PHG4Reco* g4Reco, doub return radius; } +double CreateCable(Cable *object, PHG4Reco* g4Reco, double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; + int verbosity = max(Enable::VERBOSITY, Enable::TrackingService_VERBOSITY); + + string cableMaterials[2] = { object->get_coreMaterial(), "G4_POLYETHYLENE" }; + double IR[2] = { 0, object->get_coreRadius() }; + double OR[2] = { object->get_coreRadius(), object->get_sheathRadius() }; + + double length = abs(object->get_zNorth() - object->get_zSouth()); + double setX = (object->get_xSouth() + object->get_xNorth())/2; + double setY = (object->get_ySouth() + object->get_yNorth())/2; + double setZ = (object->get_zSouth() + object->get_zNorth())/2; + + double radToDeg = 180.0/M_PI; + double rotX = tan((object->get_yNorth() - object->get_ySouth())/(object->get_zNorth() - object->get_zSouth()))*radToDeg; + double rotY = tan((object->get_xNorth() - object->get_xSouth())/(object->get_zNorth() - object->get_zSouth()))*radToDeg; + double rotZ = tan((object->get_xNorth() - object->get_xSouth())/(object->get_yNorth() - object->get_ySouth()))*radToDeg; + + PHG4CylinderSubsystem* cyl; + for (int i = 0; i < 2; ++i) + { + cyl = new PHG4CylinderSubsystem(object->get_name(), i); + cyl->Verbosity(verbosity); + cyl->set_string_param("material", cableMaterials[i]); + cyl->set_double_param("length", length); + cyl->set_double_param("radius", IR[i]); + cyl->set_double_param("thickness", OR[i]); + cyl->set_double_param("place_x", setX); + cyl->set_double_param("place_y", setY); + cyl->set_double_param("place_z", setZ); + cyl->set_double_param("rot_x", rotX); + cyl->set_double_param("rot_y", rotY); + cyl->set_double_param("rot_z", rotZ); + cyl->SuperDetector("TrackingService"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + ++G4TrackingService::subsysID; + } + return OR[1]; +} + +double CreateCableBundle(string superName, PHG4Reco* g4Reco, double radius, + double x1, double x2, double y1, double y2, double z1, double z2) +{ + //Set up basic MVTX cable bundle (24 Samtex cables, 1 power cable, 2 cooling cables) + double samtecCoreRadius = 0.1275; + double samtecSheathRadius = 0.05; + double coolingCoreRadius = 0.056; + double coolingSheathRadius = 0.08; //? + + + //Samtec cables (we use 24 as there are 12 twinax) + for (unsigned int row = 0; row < 2; ++row) + { + for (unsigned int col = 0; col < 12; ++ col) + { + Cable *cable = new Cable(superName + "_samtec", "G4_Cu", samtecCoreRadius, samtecSheathRadius, + x1 + -1*(col + 1)*samtecSheathRadius, x2 + -1*(col + 1)*samtecSheathRadius, + y1 + -1*(row + 1)*samtecSheathRadius, y2 + -1*(row + 1)*samtecSheathRadius, + z1, z2); + radius += CreateCable(cable, g4Reco, radius); + } + } + + //Cooling Cables + for (unsigned int nCool = 0; nCool < 2; ++nCool) + { + Cable *cable = new Cable(superName + "_cooling", "G4_WATER", coolingCoreRadius, coolingSheathRadius, + x1 + (nCool + 1)*coolingSheathRadius, x2 + (nCool + 1)*coolingSheathRadius, + y1 + (nCool + 1)*coolingSheathRadius, y2 + (nCool + 1)*coolingSheathRadius, + z1, z2); + radius += CreateCable(cable, g4Reco, radius); + } + + //Power Cables + return radius; +} + double TrackingService(PHG4Reco* g4Reco, double radius) { - vector cylinders, cones; + vector cylinders, cones; double shellX0 = 100*G4TrackingService::ShellThickness/G4TrackingService::materials[4].second; double layerX0 = 100*G4TrackingService::LayerThickness/G4TrackingService::materials[4].second; double shellOffset = 18.679; - cylinders.push_back(new ServiceProperties("MVTXServiceBarrel", 0, shellX0, -1.*(G4TrackingService::ShellLength + shellOffset), -1.*shellOffset , 10.33, 0)); + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, shellX0, -1.*(G4TrackingService::ShellLength + shellOffset), -1.*shellOffset , 10.33, 0)); - cylinders.push_back(new ServiceProperties("L0_1", 0, layerX0, -18.680, -16.579, 5.050, 0)); - cones.push_back(new ServiceProperties("L0_2", 0, layerX0, -16.579, -9.186, 5.050, 2.997)); - cylinders.push_back(new ServiceProperties("L0_3", 0, layerX0, -9.186, 0, 2.997, 0)); + cylinders.push_back(new ServiceStructure("L0_1", 0, layerX0, -18.680, -16.579, 5.050, 0)); + cones.push_back(new ServiceStructure("L0_2", 0, layerX0, -16.579, -9.186, 5.050, 2.997)); + cylinders.push_back(new ServiceStructure("L0_3", 0, layerX0, -9.186, 0, 2.997, 0)); - cylinders.push_back(new ServiceProperties("L1_1", 0, layerX0, -17.970, -15.851, 7.338, 0)); - cones.push_back(new ServiceProperties("L1_2", 9/16, 0, 0.42/16, 0.32/16, layerX0, -15.851, -8.938, 7.338, 3.799)); - cylinders.push_back(new ServiceProperties("L1_3", 9/16, 0, 0.42/16, 0.32/16, layerX0, -8.938, 0, 3.799, 0)); + cylinders.push_back(new ServiceStructure("L1_1", 0, layerX0, -17.970, -15.851, 7.338, 0)); + cones.push_back(new ServiceStructure("L1_2", 0, layerX0, -15.851, -8.938, 7.338, 3.799)); + cylinders.push_back(new ServiceStructure("L1_3", 0, layerX0, -8.938, 0, 3.799, 0)); - cylinders.push_back(new ServiceProperties("L2_1", 0, layerX0, -22.300, -15.206, 9.650, 0)); - cones.push_back(new ServiceProperties("L2_2", 0, layerX0, -15.206, -8.538, 9.650, 4.574)); - cylinders.push_back(new ServiceProperties("L2_3", 0, layerX0, -8.538, 0, 4.574, 0)); + cylinders.push_back(new ServiceStructure("L2_1", 0, layerX0, -22.300, -15.206, 9.650, 0)); + cones.push_back(new ServiceStructure("L2_2", 0, layerX0, -15.206, -8.538, 9.650, 4.574)); + cylinders.push_back(new ServiceStructure("L2_3", 0, layerX0, -8.538, 0, 4.574, 0)); - for (ServiceProperties *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); - for (ServiceProperties *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + + radius += CreateCableBundle("Test", g4Reco, radius, 0, 0, 0, 0, 0, 10); return radius; } #endif + From 7caa5905e53b88328cf6178d0eda9d26e011115a Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 26 Oct 2021 13:57:34 -0400 Subject: [PATCH 1092/1222] Updated cables --- common/G4_TrackingService.C | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 1c8534421..8fe134aa2 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -271,7 +271,7 @@ double CreateCable(Cable *object, PHG4Reco* g4Reco, double radius) PHG4CylinderSubsystem* cyl; for (int i = 0; i < 2; ++i) { - cyl = new PHG4CylinderSubsystem(object->get_name(), i); + cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); cyl->Verbosity(verbosity); cyl->set_string_param("material", cableMaterials[i]); cyl->set_double_param("length", length); @@ -295,7 +295,7 @@ double CreateCable(Cable *object, PHG4Reco* g4Reco, double radius) double CreateCableBundle(string superName, PHG4Reco* g4Reco, double radius, double x1, double x2, double y1, double y2, double z1, double z2) { - //Set up basic MVTX cable bundle (24 Samtex cables, 1 power cable, 2 cooling cables) + //Set up basic MVTX cable bundle (24 Samtec cables, 1 power cable, 2 cooling cables) double samtecCoreRadius = 0.1275; double samtecSheathRadius = 0.05; double coolingCoreRadius = 0.056; @@ -303,24 +303,28 @@ double CreateCableBundle(string superName, PHG4Reco* g4Reco, double radius, //Samtec cables (we use 24 as there are 12 twinax) - for (unsigned int row = 0; row < 2; ++row) + unsigned int nSamtecWires = 24; + unsigned int nRows = 2; + unsigned int nCols = nSamtecWires/nRows; + for (unsigned int iRow = 0; iRow < 2; ++iRow) { - for (unsigned int col = 0; col < 12; ++ col) + for (unsigned int iCol = 0; iCol < 12; ++ iCol) { - Cable *cable = new Cable(superName + "_samtec", "G4_Cu", samtecCoreRadius, samtecSheathRadius, - x1 + -1*(col + 1)*samtecSheathRadius, x2 + -1*(col + 1)*samtecSheathRadius, - y1 + -1*(row + 1)*samtecSheathRadius, y2 + -1*(row + 1)*samtecSheathRadius, + Cable *cable = new Cable(format("{}_samtec_{}_{}", superName, iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, + x1 + -1*(iCol + 1)*samtecSheathRadius, x2 + -1*(iCol + 1)*samtecSheathRadius, + y1 + -1*(iRow + 1)*samtecSheathRadius, y2 + -1*(iRow + 1)*samtecSheathRadius, z1, z2); radius += CreateCable(cable, g4Reco, radius); } } //Cooling Cables - for (unsigned int nCool = 0; nCool < 2; ++nCool) + unsigned int nCool = 2; + for (unsigned int iCool = 0; iCool < nCool; ++iCool) { - Cable *cable = new Cable(superName + "_cooling", "G4_WATER", coolingCoreRadius, coolingSheathRadius, - x1 + (nCool + 1)*coolingSheathRadius, x2 + (nCool + 1)*coolingSheathRadius, - y1 + (nCool + 1)*coolingSheathRadius, y2 + (nCool + 1)*coolingSheathRadius, + Cable *cable = new Cable(format("{}_cooling_{}", superName, iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, + x1 + (iCool + 1)*coolingSheathRadius, x2 + (iCool + 1)*coolingSheathRadius, + y1 + (iCool + 1)*coolingSheathRadius, y2 + (iCool + 1)*coolingSheathRadius, z1, z2); radius += CreateCable(cable, g4Reco, radius); } @@ -333,8 +337,8 @@ double TrackingService(PHG4Reco* g4Reco, double radius) { vector cylinders, cones; - double shellX0 = 100*G4TrackingService::ShellThickness/G4TrackingService::materials[4].second; - double layerX0 = 100*G4TrackingService::LayerThickness/G4TrackingService::materials[4].second; + double shellX0 = 100*G4TrackingService::ShellThickness/G4TrackingService::materials[1].second; + double layerX0 = 100*G4TrackingService::LayerThickness/G4TrackingService::materials[1].second; double shellOffset = 18.679; cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, shellX0, -1.*(G4TrackingService::ShellLength + shellOffset), -1.*shellOffset , 10.33, 0)); From e34fc5fa8f177230a27aa266d131b0e1a125354f Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 26 Oct 2021 17:52:01 -0400 Subject: [PATCH 1093/1222] Updated cabling --- common/G4_TrackingService.C | 340 +++++++++++++++++++++--------------- 1 file changed, 198 insertions(+), 142 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 8fe134aa2..fc9d160b2 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -13,6 +13,10 @@ #include #include +#include +#include +#include +#include #include //sPHENIX Tracking Services @@ -21,56 +25,57 @@ using namespace std; class ServiceStructure { - public: - ServiceStructure(); - - explicit ServiceStructure(const string &name, - const double &rad_len_aluminum, - const double &rad_len_carbon, - const double &zSouth, - const double &zNorth, - const double &rSouth, - const double &rNorth); - - virtual ~ServiceStructure(){}; - - const string get_name(); - const double get_rad_len_aluminum(); - const double get_rad_len_carbon(); - const double get_zSouth(); - const double get_zNorth(); - const double get_rSouth(); - const double get_rNorth(); - - private: - const string m_name = "service"; - const double m_rad_len_aluminum = 0.0; - const double m_rad_len_carbon = 0.0; - const double m_zSouth = 0.0; - const double m_zNorth = 0.0; - const double m_rSouth = 0.0; - const double m_rNorth = 0.0; + public: + ServiceStructure(); + + explicit ServiceStructure(const string &name, + const double &thickness_aluminum, + const double &thickness_carbon, + const double &zSouth, + const double &zNorth, + const double &rSouth, + const double &rNorth); + + virtual ~ServiceStructure(){}; + + const string get_name(); + const double get_thickness_aluminum(); + const double get_thickness_carbon(); + const double get_zSouth(); + const double get_zNorth(); + const double get_rSouth(); + const double get_rNorth(); + + private: + const string m_name = "service"; + const double m_thickness_aluminum = 0.0; + const double m_thickness_carbon = 0.0; + const double m_zSouth = 0.0; + const double m_zNorth = 0.0; + const double m_rSouth = 0.0; + const double m_rNorth = 0.0; }; ServiceStructure::ServiceStructure(const string &name, - const double &rad_len_aluminum, - const double &rad_len_carbon, + const double &thickness_aluminum, + const double &thickness_carbon, const double &zSouth, const double &zNorth, const double &rSouth, const double &rNorth) : m_name(name) - , m_rad_len_aluminum(rad_len_aluminum) - , m_rad_len_carbon(rad_len_carbon) + , m_thickness_aluminum(thickness_aluminum) + , 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 double ServiceStructure::get_rad_len_aluminum() { return m_rad_len_aluminum; } -const double ServiceStructure::get_rad_len_carbon() { return m_rad_len_carbon; } +const double ServiceStructure::get_thickness_aluminum() { return m_thickness_aluminum; } +const double ServiceStructure::get_thickness_carbon() { return m_thickness_carbon; } const double ServiceStructure::get_zSouth() { return m_zSouth; } const double ServiceStructure::get_zNorth() { return m_zNorth; } const double ServiceStructure::get_rSouth() { return m_rSouth; } @@ -78,41 +83,41 @@ const double ServiceStructure::get_rNorth() { return m_rNorth; } class Cable { - public: - Cable(); - - explicit Cable(const string &name, - const string &coreMaterial, - const double &coreRadius, - const double &sheathRadius, - const double &xSouth, const double &xNorth, - const double &ySouth, const double &yNorth, - const double &zSouth, const double &zNorth); - - virtual ~Cable(){}; - - const string get_name(); - const string get_coreMaterial(); - const double get_coreRadius(); - const double get_sheathRadius(); - const double get_xSouth(); - const double get_xNorth(); - const double get_ySouth(); - const double get_yNorth(); - const double get_zSouth(); - const double get_zNorth(); - - private: - const string m_name = "cable"; - const string m_coreMaterial = "G4_Cu"; - const double m_coreRadius = 1; - const double m_sheathRadius = 2; - const double m_xSouth = 0.; - const double m_xNorth = 1.; - const double m_ySouth = 0.; - const double m_yNorth = 1.; - const double m_zSouth = 0.; - const double m_zNorth = 1.; + public: + Cable(); + + explicit Cable(const string &name, + const string &coreMaterial, + const double &coreRadius, + const double &sheathRadius, + const double &xSouth, const double &xNorth, + const double &ySouth, const double &yNorth, + const double &zSouth, const double &zNorth); + + virtual ~Cable(){}; + + const string get_name(); + const string get_coreMaterial(); + const double get_coreRadius(); + const double get_sheathRadius(); + const double get_xSouth(); + const double get_xNorth(); + const double get_ySouth(); + const double get_yNorth(); + const double get_zSouth(); + const double get_zNorth(); + + private: + const string m_name = "cable"; + const string m_coreMaterial = "G4_Cu"; + const double m_coreRadius = 1; + const double m_sheathRadius = 2; + const double m_xSouth = 0.; + const double m_xNorth = 1.; + const double m_ySouth = 0.; + const double m_yNorth = 1.; + const double m_zSouth = 0.; + const double m_zNorth = 1.; }; Cable::Cable(const string &name, @@ -132,7 +137,8 @@ Cable::Cable(const string &name, , m_yNorth(yNorth) , m_zSouth(zSouth) , m_zNorth(zNorth) -{} +{ +} const string Cable::get_name() { return m_name; } const string Cable::get_coreMaterial() { return m_coreMaterial; } @@ -155,22 +161,20 @@ namespace Enable } // namespace Enable namespace G4TrackingService -{ //List materials and radiation length in cm +{ //List materials and radiation length in cm const int nMaterials = 2; - pair materials[nMaterials] = { make_pair("G4_Al", 8.897) - , make_pair("PEEK", 30.00) }; - + string materials[nMaterials] = {"G4_Al", "PEEK"}; + double GlobalOffset = -15.0; - double ShellThickness = 0.436; //Thickness in cm - double LayerThickness = 0.1; // - double ShellLength = 121.24; //Length of cylinder in cm + double ShellThickness = 0.436; //Thickness in cm + double LayerThickness = 0.1; // + double ShellLength = 121.24; //Length of cylinder in cm int subsysID = 0; } // namespace G4TrackingService vector get_thickness(ServiceStructure *object) { - vector thickness = {(object->get_rad_len_aluminum()/100)*G4TrackingService::materials[0].second - ,(object->get_rad_len_carbon()/100)*G4TrackingService::materials[1].second}; + vector thickness = {object->get_thickness_aluminum(), object->get_thickness_carbon()}; return thickness; } @@ -178,13 +182,13 @@ void TrackingServiceInit() { } -double TrackingServiceCone(ServiceStructure *object, PHG4Reco* g4Reco, double radius) +double TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, double 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; + PHG4ConeSubsystem *cone; double innerRadiusSouth = object->get_rSouth(); double innerRadiusNorth = object->get_rNorth(); @@ -198,9 +202,9 @@ double TrackingServiceCone(ServiceStructure *object, PHG4Reco* g4Reco, double ra cone->Verbosity(verbosity); cone->SetR1(innerRadiusSouth, innerRadiusSouth + thickness[i]); cone->SetR2(innerRadiusNorth, innerRadiusNorth + thickness[i]); - cone->SetPlaceZ(object->get_zSouth() + length/2 + G4TrackingService::GlobalOffset); - cone->SetZlength(length/2); - cone->SetMaterial(G4TrackingService::materials[i].first); + cone->SetPlaceZ(object->get_zSouth() + length / 2 + G4TrackingService::GlobalOffset); + cone->SetZlength(length / 2); + cone->SetMaterial(G4TrackingService::materials[i]); cone->SuperDetector("TrackingService"); if (AbsorberActive) cone->SetActive(); cone->OverlapCheck(OverlapCheck); @@ -214,13 +218,13 @@ double TrackingServiceCone(ServiceStructure *object, PHG4Reco* g4Reco, double ra return radius; } -double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco* g4Reco, double radius) +double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, double 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; + PHG4CylinderSubsystem *cyl; double innerRadius = object->get_rSouth(); double length = abs(object->get_zNorth() - object->get_zSouth()); @@ -231,10 +235,10 @@ double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco* g4Reco, doubl if (thickness[i] == 0) continue; cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); cyl->Verbosity(verbosity); - cyl->set_double_param("place_z", object->get_zSouth() + length/2 + G4TrackingService::GlobalOffset); + cyl->set_double_param("place_z", object->get_zSouth() + length / 2 + G4TrackingService::GlobalOffset); cyl->set_double_param("radius", innerRadius); cyl->set_double_param("length", length); - cyl->set_string_param("material", G4TrackingService::materials[i].first); + cyl->set_string_param("material", G4TrackingService::materials[i]); cyl->set_double_param("thickness", thickness[i]); cyl->SuperDetector("TrackingService"); if (AbsorberActive) cyl->SetActive(); @@ -248,27 +252,27 @@ double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco* g4Reco, doubl return radius; } -double CreateCable(Cable *object, PHG4Reco* g4Reco, double radius) +double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) { bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; int verbosity = max(Enable::VERBOSITY, Enable::TrackingService_VERBOSITY); - string cableMaterials[2] = { object->get_coreMaterial(), "G4_POLYETHYLENE" }; - double IR[2] = { 0, object->get_coreRadius() }; - double OR[2] = { object->get_coreRadius(), object->get_sheathRadius() }; + string cableMaterials[2] = {object->get_coreMaterial(), "G4_POLYETHYLENE"}; + double IR[2] = {0, object->get_coreRadius()}; + double OR[2] = {object->get_coreRadius(), object->get_sheathRadius()}; double length = abs(object->get_zNorth() - object->get_zSouth()); - double setX = (object->get_xSouth() + object->get_xNorth())/2; - double setY = (object->get_ySouth() + object->get_yNorth())/2; - double setZ = (object->get_zSouth() + object->get_zNorth())/2; - - double radToDeg = 180.0/M_PI; - double rotX = tan((object->get_yNorth() - object->get_ySouth())/(object->get_zNorth() - object->get_zSouth()))*radToDeg; - double rotY = tan((object->get_xNorth() - object->get_xSouth())/(object->get_zNorth() - object->get_zSouth()))*radToDeg; - double rotZ = tan((object->get_xNorth() - object->get_xSouth())/(object->get_yNorth() - object->get_ySouth()))*radToDeg; - - PHG4CylinderSubsystem* cyl; + double setX = (object->get_xSouth() + object->get_xNorth()) / 2; + double setY = (object->get_ySouth() + object->get_yNorth()) / 2; + double setZ = (object->get_zSouth() + object->get_zNorth()) / 2; + + double radToDeg = 180.0 / M_PI; + double rotX = tan((object->get_yNorth() - object->get_ySouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; + double rotY = tan((object->get_xNorth() - object->get_xSouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; + double rotZ = tan((object->get_xNorth() - object->get_xSouth()) / (object->get_yNorth() - object->get_ySouth())) * radToDeg; + + PHG4CylinderSubsystem *cyl; for (int i = 0; i < 2; ++i) { cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); @@ -292,77 +296,129 @@ double CreateCable(Cable *object, PHG4Reco* g4Reco, double radius) return OR[1]; } -double CreateCableBundle(string superName, PHG4Reco* g4Reco, double radius, +double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, + bool enableSignal, bool enableCooling, bool enablePower, double x1, double x2, double y1, double y2, double z1, double z2) { //Set up basic MVTX cable bundle (24 Samtec cables, 1 power cable, 2 cooling cables) double samtecCoreRadius = 0.1275; double samtecSheathRadius = 0.05; double coolingCoreRadius = 0.056; - double coolingSheathRadius = 0.08; //? - + double coolingSheathRadius = 0.08; //? + double powerLargeCoreRadius = 0.069; + double powerLargeSheathRadius = 0.158; + double powerMediumCoreRadius = 0.033; + double powerMediumSheathRadius = 0.073; + double powerSmallCoreRadius = 0.028; + double powerSmallSheathRadius = 0.028; //Samtec cables (we use 24 as there are 12 twinax) - unsigned int nSamtecWires = 24; - unsigned int nRows = 2; - unsigned int nCols = nSamtecWires/nRows; - for (unsigned int iRow = 0; iRow < 2; ++iRow) + if (enableSignal) { - for (unsigned int iCol = 0; iCol < 12; ++ iCol) + unsigned int nSamtecWires = 24; + unsigned int nRow = 2; + unsigned int nCol = nSamtecWires / nRow; + for (unsigned int iRow = 0; iRow < nRow; ++iRow) { - Cable *cable = new Cable(format("{}_samtec_{}_{}", superName, iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, - x1 + -1*(iCol + 1)*samtecSheathRadius, x2 + -1*(iCol + 1)*samtecSheathRadius, - y1 + -1*(iRow + 1)*samtecSheathRadius, y2 + -1*(iRow + 1)*samtecSheathRadius, - z1, z2); - radius += CreateCable(cable, g4Reco, radius); + for (unsigned int iCol = 0; iCol < nCol; ++iCol) + { + Cable *cable = new Cable(format("{}_samtec_{}_{}", superName, iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, + x1 + (iCol + 1) * samtecSheathRadius * 2, x2 + (iCol + 1) * samtecSheathRadius * 2, + y1 + -1 * (iRow + 1) * samtecSheathRadius * 2, y2 + -1 * (iRow + 1) * samtecSheathRadius * 2, + z1, z2); + radius += CreateCable(cable, g4Reco, radius); + } } } //Cooling Cables - unsigned int nCool = 2; - for (unsigned int iCool = 0; iCool < nCool; ++iCool) + if (enableCooling) { - Cable *cable = new Cable(format("{}_cooling_{}", superName, iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, - x1 + (iCool + 1)*coolingSheathRadius, x2 + (iCool + 1)*coolingSheathRadius, - y1 + (iCool + 1)*coolingSheathRadius, y2 + (iCool + 1)*coolingSheathRadius, - z1, z2); - radius += CreateCable(cable, g4Reco, radius); + unsigned int nCool = 2; + for (unsigned int iCool = 0; iCool < nCool; ++iCool) + { + Cable *cable = new Cable(format("{}_cooling_{}", superName, iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, + x1 + (iCool + 1) * coolingSheathRadius * 2, x2 + (iCool + 1) * coolingSheathRadius * 2, + y1 + (iCool + 1) * coolingSheathRadius * 2, y2 + (iCool + 1) * coolingSheathRadius * 2, + z1, z2); + radius += CreateCable(cable, g4Reco, radius); + } } //Power Cables + if (enablePower) + { + typedef pair < pair, pair PowerCableParameters; + vector powerCables; + + powerCables.push_back(make_pair(make_pair(format("{}_digiReturn", superName), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_digiSupply", superName), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_anaReturn", superName), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_anaSupply", superName), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_digiSense", superName), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_anaSense", superName), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_bias", superName), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(format("{}_ground", superName), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); + + for (PowerCableParameters &powerCable : powerCables) + { + double coreRad, sheathRad; + string cableType = powerCable.first.second; + switch (cableType) + { + case "Small": + coreRad = powerSmallCoreRadius; + sheathRad = powerSmallSheathRadius; + break; + case "Medium": + coreRad = powerMediumCoreRadius; + sheathRad = powerMediumSheathRadius; + break; + case "Large": + coreRad = powerLargeCoreRadius; + sheathRad = powerLargeSheathRadius; + break; + default: + coreRad = powerSmallCoreRadius; + sheathRad = powerSmallSheathRadius; + } + + Cable *cable = new Cable(powerCable.first.first, "G4_Cu", coreRad, sheathRad, + x1 + powerCable.second.first, x2 + powerCable.second.first, + y1 + powerCable.second.second, y2 + powerCable.second.second, z1, z2); + + radius += CreateCable(cable, g4Reco, radius); + } + } return radius; } -double TrackingService(PHG4Reco* g4Reco, double radius) +double TrackingService(PHG4Reco *g4Reco, double radius) { - vector cylinders, cones; + vector cylinders, cones; - double shellX0 = 100*G4TrackingService::ShellThickness/G4TrackingService::materials[1].second; - double layerX0 = 100*G4TrackingService::LayerThickness/G4TrackingService::materials[1].second; double shellOffset = 18.679; - cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, shellX0, -1.*(G4TrackingService::ShellLength + shellOffset), -1.*shellOffset , 10.33, 0)); + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, G4TrackingService::ShellThickness, -1. * (G4TrackingService::ShellLength + shellOffset), -1. * shellOffset, 10.33, 0)); - cylinders.push_back(new ServiceStructure("L0_1", 0, layerX0, -18.680, -16.579, 5.050, 0)); - cones.push_back(new ServiceStructure("L0_2", 0, layerX0, -16.579, -9.186, 5.050, 2.997)); - cylinders.push_back(new ServiceStructure("L0_3", 0, layerX0, -9.186, 0, 2.997, 0)); + cylinders.push_back(new ServiceStructure("L0_1", 0, G4TrackingService::LayerThickness, -18.680, -16.579, 5.050, 0)); + cones.push_back(new ServiceStructure("L0_2", 0, G4TrackingService::LayerThickness, -16.579, -9.186, 5.050, 2.997)); + cylinders.push_back(new ServiceStructure("L0_3", 0, G4TrackingService::LayerThickness, -9.186, 0, 2.997, 0)); - cylinders.push_back(new ServiceStructure("L1_1", 0, layerX0, -17.970, -15.851, 7.338, 0)); - cones.push_back(new ServiceStructure("L1_2", 0, layerX0, -15.851, -8.938, 7.338, 3.799)); - cylinders.push_back(new ServiceStructure("L1_3", 0, layerX0, -8.938, 0, 3.799, 0)); + cylinders.push_back(new ServiceStructure("L1_1", 0, G4TrackingService::LayerThickness, -17.970, -15.851, 7.338, 0)); + cones.push_back(new ServiceStructure("L1_2", 0, G4TrackingService::LayerThickness, -15.851, -8.938, 7.338, 3.799)); + cylinders.push_back(new ServiceStructure("L1_3", 0, G4TrackingService::LayerThickness, -8.938, 0, 3.799, 0)); - cylinders.push_back(new ServiceStructure("L2_1", 0, layerX0, -22.300, -15.206, 9.650, 0)); - cones.push_back(new ServiceStructure("L2_2", 0, layerX0, -15.206, -8.538, 9.650, 4.574)); - cylinders.push_back(new ServiceStructure("L2_3", 0, layerX0, -8.538, 0, 4.574, 0)); - + cylinders.push_back(new ServiceStructure("L2_1", 0, G4TrackingService::LayerThickness, -22.300, -15.206, 9.650, 0)); + cones.push_back(new ServiceStructure("L2_2", 0, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); + cylinders.push_back(new ServiceStructure("L2_3", 0, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 0)); - //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); - radius += CreateCableBundle("Test", g4Reco, radius, 0, 0, 0, 0, 0, 10); + radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, 0, 0, 0, 0, 0, 100); return radius; } #endif - From edb4404ace5bf70250b7c21ba954c6b3a40b0b23 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 26 Oct 2021 18:50:19 -0400 Subject: [PATCH 1094/1222] Cabling --- common/G4_TrackingService.C | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index fc9d160b2..0af0d3ec3 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -12,11 +12,10 @@ #include +#include #include -#include #include #include -#include #include //sPHENIX Tracking Services @@ -322,7 +321,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, { for (unsigned int iCol = 0; iCol < nCol; ++iCol) { - Cable *cable = new Cable(format("{}_samtec_{}_{}", superName, iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, + Cable *cable = new Cable(boost::format("%1%_samtec_%2%_%3%") % superName % iRow % iCol, "G4_Cu", samtecCoreRadius, samtecSheathRadius, x1 + (iCol + 1) * samtecSheathRadius * 2, x2 + (iCol + 1) * samtecSheathRadius * 2, y1 + -1 * (iRow + 1) * samtecSheathRadius * 2, y2 + -1 * (iRow + 1) * samtecSheathRadius * 2, z1, z2); @@ -337,7 +336,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, unsigned int nCool = 2; for (unsigned int iCool = 0; iCool < nCool; ++iCool) { - Cable *cable = new Cable(format("{}_cooling_{}", superName, iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, + Cable *cable = new Cable(boost::format("%1%_cooling_%2%") % superName % iCool, "G4_WATER", coolingCoreRadius, coolingSheathRadius, x1 + (iCool + 1) * coolingSheathRadius * 2, x2 + (iCool + 1) * coolingSheathRadius * 2, y1 + (iCool + 1) * coolingSheathRadius * 2, y2 + (iCool + 1) * coolingSheathRadius * 2, z1, z2); @@ -351,14 +350,14 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, typedef pair < pair, pair PowerCableParameters; vector powerCables; - powerCables.push_back(make_pair(make_pair(format("{}_digiReturn", superName), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_digiSupply", superName), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_anaReturn", superName), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_anaSupply", superName), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_digiSense", superName), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_anaSense", superName), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_bias", superName), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(format("{}_ground", superName), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiReturn") % superName, "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiSupply") % superName, "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaReturn") % superName, "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaSupply") % superName, "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiSense", superName, "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaSense") % superName, "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_bias") % superName, "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::format("%1%_ground") % superName, "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); for (PowerCableParameters &powerCable : powerCables) { From 6032031d89c25431d30ba6a7850b7358098b9848 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Wed, 27 Oct 2021 16:41:48 -0400 Subject: [PATCH 1095/1222] Cable updates --- common/G4_TrackingService.C | 60 ++++++++++++++------------ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 35 +++++++-------- 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 0af0d3ec3..26422b09b 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -161,13 +161,15 @@ namespace Enable namespace G4TrackingService { //List materials and radiation length in cm - const int nMaterials = 2; - string materials[nMaterials] = {"G4_Al", "PEEK"}; + string materials[] = {"G4_Al", "PEEK"}; + const int nMaterials = sizeof(materials)/sizeof(materials[0]); double GlobalOffset = -15.0; - double ShellThickness = 0.436; //Thickness in cm + double BarrelOffset = 18.679; + double BarrelRadius = 10.33; //Inner radious of service barrel + double BarrelThickness = 0.436; //Thickness in cm + double BarrelLength = 121.24; //Length of cylinder in cm double LayerThickness = 0.1; // - double ShellLength = 121.24; //Length of cylinder in cm int subsysID = 0; } // namespace G4TrackingService @@ -179,6 +181,12 @@ vector get_thickness(ServiceStructure *object) void TrackingServiceInit() { + double serviceRad = G4TrackingService::BarrelRadius + G4TrackingService::BarrelThickness; + double serviceMinZ = G4TrackingService::GlobalOffset - G4TrackingService::BarrelOffset - G4TrackingService::BarrelLength; + double serviceMaxZ = G4TrackingService::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); } double TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, double radius) @@ -321,7 +329,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, { for (unsigned int iCol = 0; iCol < nCol; ++iCol) { - Cable *cable = new Cable(boost::format("%1%_samtec_%2%_%3%") % superName % iRow % iCol, "G4_Cu", samtecCoreRadius, samtecSheathRadius, + Cable *cable = new Cable(boost::str(boost::format("%1%_samtec_%2%_%3%") % superName % iRow % iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, x1 + (iCol + 1) * samtecSheathRadius * 2, x2 + (iCol + 1) * samtecSheathRadius * 2, y1 + -1 * (iRow + 1) * samtecSheathRadius * 2, y2 + -1 * (iRow + 1) * samtecSheathRadius * 2, z1, z2); @@ -336,7 +344,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, unsigned int nCool = 2; for (unsigned int iCool = 0; iCool < nCool; ++iCool) { - Cable *cable = new Cable(boost::format("%1%_cooling_%2%") % superName % iCool, "G4_WATER", coolingCoreRadius, coolingSheathRadius, + Cable *cable = new Cable(boost::str(boost::format("%1%_cooling_%2%") % superName % iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, x1 + (iCool + 1) * coolingSheathRadius * 2, x2 + (iCool + 1) * coolingSheathRadius * 2, y1 + (iCool + 1) * coolingSheathRadius * 2, y2 + (iCool + 1) * coolingSheathRadius * 2, z1, z2); @@ -347,39 +355,36 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, //Power Cables if (enablePower) { - typedef pair < pair, pair PowerCableParameters; + typedef pair, pair> PowerCableParameters; vector powerCables; - powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiReturn") % superName, "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiSupply") % superName, "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaReturn") % superName, "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaSupply") % superName, "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_digiSense", superName, "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_anaSense") % superName, "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_bias") % superName, "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::format("%1%_ground") % superName, "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiReturn") % superName), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiSupply") % superName), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaReturn") % superName), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaSupply") % superName), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiSense") % superName), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaSense") % superName), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_bias") % superName), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_ground") % superName), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); for (PowerCableParameters &powerCable : powerCables) { double coreRad, sheathRad; string cableType = powerCable.first.second; - switch (cableType) + if (cableType == "Small") { - case "Small": coreRad = powerSmallCoreRadius; sheathRad = powerSmallSheathRadius; - break; - case "Medium": + } + else if (cableType == "Medium") + { coreRad = powerMediumCoreRadius; sheathRad = powerMediumSheathRadius; - break; - case "Large": + } + else + { coreRad = powerLargeCoreRadius; sheathRad = powerLargeSheathRadius; - break; - default: - coreRad = powerSmallCoreRadius; - sheathRad = powerSmallSheathRadius; } Cable *cable = new Cable(powerCable.first.first, "G4_Cu", coreRad, sheathRad, @@ -389,6 +394,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, radius += CreateCable(cable, g4Reco, radius); } } + return radius; } @@ -396,9 +402,9 @@ double TrackingService(PHG4Reco *g4Reco, double radius) { vector cylinders, cones; - double shellOffset = 18.679; - cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, G4TrackingService::ShellThickness, -1. * (G4TrackingService::ShellLength + shellOffset), -1. * shellOffset, 10.33, 0)); + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, G4TrackingService::BarrelThickness, -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), + -1. * G4TrackingService::BarrelOffset, G4TrackingService::BarrelRadius, 0)); cylinders.push_back(new ServiceStructure("L0_1", 0, G4TrackingService::LayerThickness, -18.680, -16.579, 5.050, 0)); cones.push_back(new ServiceStructure("L0_2", 0, G4TrackingService::LayerThickness, -16.579, -9.186, 5.050, 2.997)); diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 1cf720254..0244902dd 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -12,7 +12,7 @@ #include #include #include -#include +//#include #include #include #include @@ -243,7 +243,7 @@ int Fun4All_G4_sPHENIX( //====================== // QA, main switch - Enable::QA = true; + Enable::QA = false; // Global options (enabled for all enables subsystems - if implemented) // Enable::ABSORBER = true; @@ -253,21 +253,22 @@ int Fun4All_G4_sPHENIX( // Enable::BBC = true; Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation - Enable::PIPE = true; + Enable::PIPE = false; Enable::PIPE_ABSORBER = true; // central tracking - Enable::MVTX = true; + Enable::MVTX = false; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; + Enable::TrackingService = true; - Enable::INTT = true; + Enable::INTT = false; Enable::INTT_CELL = Enable::INTT && true; Enable::INTT_CLUSTER = Enable::INTT_CELL && true; Enable::INTT_QA = Enable::INTT_CLUSTER and Enable::QA && true; - Enable::TPC = true; + Enable::TPC = false; Enable::TPC_ABSORBER = true; Enable::TPC_CELL = Enable::TPC && true; Enable::TPC_CLUSTER = Enable::TPC_CELL && true; @@ -277,7 +278,7 @@ int Fun4All_G4_sPHENIX( Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; - Enable::TRACKING_TRACK = true; + Enable::TRACKING_TRACK = false; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; Enable::TRACKING_QA = Enable::TRACKING_TRACK and Enable::QA && true; @@ -285,7 +286,7 @@ int Fun4All_G4_sPHENIX( // into the tracking, cannot run together with CEMC // Enable::CEMCALBEDO = true; - Enable::CEMC = true; + Enable::CEMC = false; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; Enable::CEMC_TOWER = Enable::CEMC_CELL && true; @@ -293,7 +294,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; Enable::CEMC_QA = Enable::CEMC_CLUSTER and Enable::QA && true; - Enable::HCALIN = true; + Enable::HCALIN = false; Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -301,10 +302,10 @@ int Fun4All_G4_sPHENIX( Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; Enable::HCALIN_QA = Enable::HCALIN_CLUSTER and Enable::QA && true; - Enable::MAGNET = true; + Enable::MAGNET = false; Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = true; + Enable::HCALOUT = false; Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; @@ -315,10 +316,10 @@ int Fun4All_G4_sPHENIX( Enable::EPD = true; - Enable::BEAMLINE = true; + Enable::BEAMLINE = false; // 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 = false; // Enable::ZDC_ABSORBER = true; // Enable::ZDC_SUPPORT = true; Enable::ZDC_TOWER = Enable::ZDC && true; @@ -326,7 +327,7 @@ int Fun4All_G4_sPHENIX( //! forward flux return plug door. Out of acceptance and off by default. //Enable::PLUGDOOR = true; - Enable::PLUGDOOR_ABSORBER = true; + Enable::PLUGDOOR_ABSORBER = false; Enable::GLOBAL_RECO = true; //Enable::GLOBAL_FASTSIM = true; @@ -337,7 +338,7 @@ int Fun4All_G4_sPHENIX( Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; - Enable::JETS = true; + Enable::JETS = false; Enable::JETS_EVAL = Enable::JETS && true; Enable::JETS_QA = Enable::JETS and Enable::QA && true; @@ -509,8 +510,8 @@ int Fun4All_G4_sPHENIX( //====================== // Run KFParticle on evt //====================== - if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); - if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); + //if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + //if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); //if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco(); //---------------------- From 8c4550459bd37fd0737ebe6786c60ac68e2e2544 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 28 Oct 2021 12:29:47 -0400 Subject: [PATCH 1096/1222] Added rotations to cable bundles --- common/G4_TrackingService.C | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 26422b09b..729a8b9c1 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -275,9 +275,9 @@ double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) double setZ = (object->get_zSouth() + object->get_zNorth()) / 2; double radToDeg = 180.0 / M_PI; - double rotX = tan((object->get_yNorth() - object->get_ySouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; - double rotY = tan((object->get_xNorth() - object->get_xSouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; - double rotZ = tan((object->get_xNorth() - object->get_xSouth()) / (object->get_yNorth() - object->get_ySouth())) * radToDeg; + double rotX = atan((object->get_yNorth() - object->get_ySouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; + double rotY = atan((object->get_xNorth() - object->get_xSouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; + double rotZ = atan((object->get_xNorth() - object->get_xSouth()) / (object->get_yNorth() - object->get_ySouth())) * radToDeg; PHG4CylinderSubsystem *cyl; for (int i = 0; i < 2; ++i) @@ -305,7 +305,7 @@ double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, bool enableSignal, bool enableCooling, bool enablePower, - double x1, double x2, double y1, double y2, double z1, double z2) + double x1, double x2, double y1, double y2, double z1, double z2, double theta) { //Set up basic MVTX cable bundle (24 Samtec cables, 1 power cable, 2 cooling cables) double samtecCoreRadius = 0.1275; @@ -330,8 +330,8 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, for (unsigned int iCol = 0; iCol < nCol; ++iCol) { Cable *cable = new Cable(boost::str(boost::format("%1%_samtec_%2%_%3%") % superName % iRow % iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, - x1 + (iCol + 1) * samtecSheathRadius * 2, x2 + (iCol + 1) * samtecSheathRadius * 2, - y1 + -1 * (iRow + 1) * samtecSheathRadius * 2, y2 + -1 * (iRow + 1) * samtecSheathRadius * 2, + (x1 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), (x2 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), + (y1 + -1 * (iRow + 1) * samtecSheathRadius * 2)*sin(theta), (y2 + -1 * (iRow + 1) * samtecSheathRadius * 2)*sin(theta), z1, z2); radius += CreateCable(cable, g4Reco, radius); } @@ -345,8 +345,8 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, for (unsigned int iCool = 0; iCool < nCool; ++iCool) { Cable *cable = new Cable(boost::str(boost::format("%1%_cooling_%2%") % superName % iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, - x1 + (iCool + 1) * coolingSheathRadius * 2, x2 + (iCool + 1) * coolingSheathRadius * 2, - y1 + (iCool + 1) * coolingSheathRadius * 2, y2 + (iCool + 1) * coolingSheathRadius * 2, + (x1 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), (x2 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), + (y1 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), (y2 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), z1, z2); radius += CreateCable(cable, g4Reco, radius); } @@ -388,8 +388,8 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, } Cable *cable = new Cable(powerCable.first.first, "G4_Cu", coreRad, sheathRad, - x1 + powerCable.second.first, x2 + powerCable.second.first, - y1 + powerCable.second.second, y2 + powerCable.second.second, z1, z2); + (x1 + powerCable.second.first)*cos(theta), (x2 + powerCable.second.first)*cos(theta), + (y1 + powerCable.second.second)*sin(theta), (y2 + powerCable.second.second)*sin(theta), z1, z2); radius += CreateCable(cable, g4Reco, radius); } @@ -421,7 +421,11 @@ double TrackingService(PHG4Reco *g4Reco, double radius) //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); - radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, 0, 0, 0, 0, 0, 100); + int nSets = 4 + for (unsigned int i = 0; i < nSets; ++i) + { + radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, 0, 0, 0, 0, 0, 100, 360.*i/nSets); + } return radius; } From d1cf225118c566936162421d12a516f724069ea2 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 28 Oct 2021 12:43:01 -0400 Subject: [PATCH 1097/1222] Added rotations to cable bundles --- common/G4_TrackingService.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 729a8b9c1..26700632a 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -424,7 +424,10 @@ double TrackingService(PHG4Reco *g4Reco, double radius) int nSets = 4 for (unsigned int i = 0; i < nSets; ++i) { - radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, 0, 0, 0, 0, 0, 100, 360.*i/nSets); + double theta = 360.*i/nSets; + double r = 10; + radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), 0, 100, theta); + radius += CreateCableBundle("Test2", g4Reco, radius, true, true, true, r*cos(theta), (r+10)*cos(theta), r*sin(theta), (r+10)*sin(theta), -50, 0, theta); } return radius; From 020d0d32f4d509a23f4a9f6b300277a79266a4dd Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 28 Oct 2021 13:22:15 -0400 Subject: [PATCH 1098/1222] More realistic cables --- common/G4_TrackingService.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 26700632a..eeb9b9a69 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -418,16 +418,16 @@ double TrackingService(PHG4Reco *g4Reco, double radius) cones.push_back(new ServiceStructure("L2_2", 0, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); cylinders.push_back(new ServiceStructure("L2_3", 0, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 0)); - //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); - //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); - int nSets = 4 + int nSets = 48; for (unsigned int i = 0; i < nSets; ++i) { double theta = 360.*i/nSets; - double r = 10; - radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), 0, 100, theta); - radius += CreateCableBundle("Test2", g4Reco, radius, true, true, true, r*cos(theta), (r+10)*cos(theta), r*sin(theta), (r+10)*sin(theta), -50, 0, theta); + double r = G4TrackingService::BarrelRadius - 1.; + radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); + radius += CreateCableBundle("Test2", g4Reco, radius, true, true, true, r*cos(theta), (r-4)*cos(theta), r*sin(theta), (r-4)*sin(theta), -1. * G4TrackingService::BarrelOffset - 5, -1. * G4TrackingService::BarrelOffset, theta); } return radius; From a4b2ec0121edf7763b63ef295fa341e8ed2f7a83 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 28 Oct 2021 13:31:07 -0400 Subject: [PATCH 1099/1222] Added rotations to cable bundles --- common/G4_TrackingService.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index eeb9b9a69..ea345240f 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -426,8 +426,8 @@ double TrackingService(PHG4Reco *g4Reco, double radius) { double theta = 360.*i/nSets; double r = G4TrackingService::BarrelRadius - 1.; - radius += CreateCableBundle("Test", g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); - radius += CreateCableBundle("Test2", g4Reco, radius, true, true, true, r*cos(theta), (r-4)*cos(theta), r*sin(theta), (r-4)*sin(theta), -1. * G4TrackingService::BarrelOffset - 5, -1. * G4TrackingService::BarrelOffset, theta); + radius += CreateCableBundle(Form("Test_%d", i), g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); + radius += CreateCableBundle(Form("Test2_%d", i), g4Reco, radius, true, true, true, r*cos(theta), (r-4)*cos(theta), r*sin(theta), (r-4)*sin(theta), -1. * G4TrackingService::BarrelOffset - 5, -1. * G4TrackingService::BarrelOffset, theta); } return radius; From a9f6c737dc24fd53a8ccf53436c8ca279255652a Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 28 Oct 2021 16:21:57 -0400 Subject: [PATCH 1100/1222] Patching cables --- common/G4_TrackingService.C | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index ea345240f..de7ae59d7 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -272,7 +272,7 @@ double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) double length = abs(object->get_zNorth() - object->get_zSouth()); double setX = (object->get_xSouth() + object->get_xNorth()) / 2; double setY = (object->get_ySouth() + object->get_yNorth()) / 2; - double setZ = (object->get_zSouth() + object->get_zNorth()) / 2; + double setZ = (object->get_zSouth() + object->get_zNorth()) / 2 + G4TrackingService::GlobalOffset; double radToDeg = 180.0 / M_PI; double rotX = atan((object->get_yNorth() - object->get_ySouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; @@ -294,7 +294,7 @@ double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) cyl->set_double_param("rot_x", rotX); cyl->set_double_param("rot_y", rotY); cyl->set_double_param("rot_z", rotZ); - cyl->SuperDetector("TrackingService"); + cyl->SuperDetector("TrackingCable"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); @@ -308,7 +308,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, double x1, double x2, double y1, double y2, double z1, double z2, double theta) { //Set up basic MVTX cable bundle (24 Samtec cables, 1 power cable, 2 cooling cables) - double samtecCoreRadius = 0.1275; + double samtecCoreRadius = 0.01275; double samtecSheathRadius = 0.05; double coolingCoreRadius = 0.056; double coolingSheathRadius = 0.08; //? @@ -317,7 +317,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, double powerMediumCoreRadius = 0.033; double powerMediumSheathRadius = 0.073; double powerSmallCoreRadius = 0.028; - double powerSmallSheathRadius = 0.028; + double powerSmallSheathRadius = 0.058; //Samtec cables (we use 24 as there are 12 twinax) if (enableSignal) @@ -329,9 +329,9 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, { for (unsigned int iCol = 0; iCol < nCol; ++iCol) { - Cable *cable = new Cable(boost::str(boost::format("%1%_samtec_%2%_%3%") % superName % iRow % iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, + Cable *cable = new Cable(Form("%s_samtec_%d_%d", superName.c_str(), iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, (x1 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), (x2 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), - (y1 + -1 * (iRow + 1) * samtecSheathRadius * 2)*sin(theta), (y2 + -1 * (iRow + 1) * samtecSheathRadius * 2)*sin(theta), + (y1 - (iRow + 1) * samtecSheathRadius * 2)*sin(theta), (y2 - (iRow + 1) * samtecSheathRadius * 2)*sin(theta), z1, z2); radius += CreateCable(cable, g4Reco, radius); } @@ -344,7 +344,7 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, unsigned int nCool = 2; for (unsigned int iCool = 0; iCool < nCool; ++iCool) { - Cable *cable = new Cable(boost::str(boost::format("%1%_cooling_%2%") % superName % iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, + Cable *cable = new Cable(Form("%s_cooling_%d", superName.c_str(), iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, (x1 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), (x2 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), (y1 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), (y2 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), z1, z2); @@ -358,14 +358,14 @@ double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, typedef pair, pair> PowerCableParameters; vector powerCables; - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiReturn") % superName), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiSupply") % superName), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaReturn") % superName), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaSupply") % superName), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_digiSense") % superName), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_anaSense") % superName), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_bias") % superName), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(boost::str(boost::format("%1%_ground") % superName), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_digiReturn", superName.c_str()), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_digiSupply", superName.c_str()), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_anaReturn", superName.c_str()), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_anaSupply", superName.c_str()), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_digiSense", superName.c_str()), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_anaSense", superName.c_str()), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_bias", superName.c_str()), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); + powerCables.push_back(make_pair(make_pair(Form("%s_ground", superName.c_str()), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); for (PowerCableParameters &powerCable : powerCables) { @@ -402,7 +402,6 @@ double TrackingService(PHG4Reco *g4Reco, double radius) { vector cylinders, cones; - cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, G4TrackingService::BarrelThickness, -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset, G4TrackingService::BarrelRadius, 0)); @@ -418,15 +417,15 @@ double TrackingService(PHG4Reco *g4Reco, double radius) cones.push_back(new ServiceStructure("L2_2", 0, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); cylinders.push_back(new ServiceStructure("L2_3", 0, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 0)); - for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); - for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); + //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); - int nSets = 48; + int nSets = 1; for (unsigned int i = 0; i < nSets; ++i) { double theta = 360.*i/nSets; double r = G4TrackingService::BarrelRadius - 1.; - radius += CreateCableBundle(Form("Test_%d", i), g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); + //radius += CreateCableBundle(Form("Test_%d", i), g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); radius += CreateCableBundle(Form("Test2_%d", i), g4Reco, radius, true, true, true, r*cos(theta), (r-4)*cos(theta), r*sin(theta), (r-4)*sin(theta), -1. * G4TrackingService::BarrelOffset - 5, -1. * G4TrackingService::BarrelOffset, theta); } From bfead76b4cc62298a9a39f65d0ab458a8a51c2fd Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 8 Nov 2021 16:02:18 -0500 Subject: [PATCH 1101/1222] R__LOAD_LIBRARY libraries before include files, seems to fix the container behavior, cleanup of pre-c++17 checks --- common/G4_Tracking.C | 601 ++++++++++++++++++++----------------------- 1 file changed, 283 insertions(+), 318 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index a2dca4712..c3ef058f3 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -1,49 +1,49 @@ #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 -#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(libqa_modules.so) +#include namespace Enable { @@ -56,9 +56,9 @@ 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 + 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 // Vertexing bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit @@ -67,15 +67,15 @@ namespace G4TRACKING bool add_fake_surfaces = true; // 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_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 + 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 + 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: @@ -83,44 +83,14 @@ 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; + G4TRACKING::SC_CALIBMODE = (G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS) && G4TRACKING::SC_CALIBMODE; - /// Build the Acts geometry Fun4AllServer* se = Fun4AllServer::instance(); int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); @@ -130,9 +100,8 @@ void TrackingInit() geom->Verbosity(verbosity); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); - geom->add_fake_surfaces( G4TRACKING::add_fake_surfaces ); + geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); se->registerSubsystem(geom); - } void Tracking_Reco() @@ -142,268 +111,266 @@ void Tracking_Reco() // Assemble silicon clusters into track stubs - needed for initial vertex finding //============================================================ - if(G4TRACKING::use_truth_silicon_seeding) + 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: Reco chain of track propagation and final fitting + //================================================ + if (!G4TRACKING::use_full_truth_track_seeding) + { + // TPC track seeding (finds all clusters in TPC for tracks) + //============================================ + if (G4TRACKING::use_truth_tpc_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"); + // 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("SvtxSiliconTrackMap"); - pat_rec->set_min_layer(0); - pat_rec->set_max_layer( G4MVTX::n_maps_layer + G4INTT::n_intt_layer); - + 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 + else { - PHActsSiliconSeeding* silicon_Seeding = new PHActsSiliconSeeding(); - silicon_Seeding->Verbosity(verbosity); - silicon_Seeding->fieldMapName(G4MAGNET::magfield); - se->registerSubsystem(silicon_Seeding); + 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); + + PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); + vtxassoc2->Verbosity(verbosity); + se->registerSubsystem(vtxassoc2); + + 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); } - - //================================================ - // Section 1: Reco chain of track propagation and final fitting - //================================================ - if(!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 - { - 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); - - PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); - vtxassoc2->Verbosity(verbosity); - se->registerSubsystem(vtxassoc2); - - 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 - //============================================= - - 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); - /// 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); + // Associate TPC track stubs with silicon and Micromegas + //============================================= + + 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; - //========================================================= - // Section 2: Full truth track finding with Acts final fitting - //========================================================= - else if(G4TRACKING::use_full_truth_track_seeding) + // 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 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); - + 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) - { - /// 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); - } - - 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); - } + { + // 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 - { - PHSimpleVertexFinder *vtxfinder = new PHSimpleVertexFinder(); - vtxfinder->Verbosity(verbosity); - se->registerSubsystem(vtxfinder); - } + { + // 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); + /// 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); + } - /// Propagate track positions to the vertex position - PHActsVertexPropagator *vtxProp = new PHActsVertexPropagator(); - vtxProp->Verbosity(verbosity); - se->registerSubsystem(vtxProp); + // 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 + //========================================================= + else if (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); + } + + 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); + } //================================== // Common to all sections @@ -412,28 +379,28 @@ void Tracking_Reco() // 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); - } - + { + 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 //--------------- @@ -456,8 +423,8 @@ void Tracking_Eval(const std::string& outputfile) eval->do_vtx_eval_light(true); eval->do_eval_light(true); eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); - 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->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); @@ -500,8 +467,6 @@ void Tracking_QA() qav->Verbosity(verbosity); qav->setVertexMapName("SvtxVertexMapActs"); se->registerSubsystem(qav); - - if (Input::UPSILON) { From 4c64bc765b1cadd65eace972064f4507eefa841e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 9 Nov 2021 12:49:36 -0500 Subject: [PATCH 1102/1222] - Added the possibility to scale drift velocity at the clustering stage - Added direct laser reconstruction module and relevant configuration flags - disable cluster cleaner when running direct lasers --- common/G4_TPC.C | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 54eb56274..bd1378fe9 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -22,6 +22,8 @@ #include #include #include +#include + #include #include @@ -53,6 +55,9 @@ namespace G4TPC int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double tpc_outer_radius = 77. + 2.; + // TPC drift velocity scale + double drift_velocity_scale = 1.0; + // distortions bool ENABLE_STATIC_DISTORTIONS = false; auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; @@ -74,6 +79,13 @@ namespace G4TPC // enable direct laser g4hits generation bool ENABLE_DIRECT_LASER_HITS = false; + // save histograms + bool DIRECT_LASER_SAVEHISTOGRAMS = false; + + // 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() @@ -157,7 +169,7 @@ double TPC(PHG4Reco* g4Reco, void TPC_Cells() { int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); + auto se = Fun4AllServer::instance(); // central membrane G4Hit generation if( G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS ) @@ -176,7 +188,7 @@ void TPC_Cells() /* 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( 18, 0*deg_to_rad, 90*deg_to_rad ); + directLaser->SetThetaStepping( 17, 5*deg_to_rad, 90*deg_to_rad ); directLaser->SetDirectLaserAuto( true ); se->registerSubsystem(directLaser); } @@ -247,13 +259,18 @@ void TPC_Clustering() // For the Tpc //========== auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); tpcclusterizer->Verbosity(verbosity); se->registerSubsystem(tpcclusterizer); - auto tpcclustercleaner = new TpcClusterCleaner; - tpcclustercleaner->Verbosity(verbosity); - se->registerSubsystem(tpcclustercleaner); - + + if( !G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); + } + // space charge correction if( G4TPC::ENABLE_CORRECTIONS ) { @@ -263,6 +280,16 @@ void TPC_Clustering() se->registerSubsystem(tpcSpaceChargeCorrection); } + // 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); + } + } From 8558a469cf930f27ee127c1e14b060ab19647b20 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 9 Nov 2021 13:15:34 -0500 Subject: [PATCH 1103/1222] - added the possibility to not use TPOT for SC calibration mode - added flags to specify PHTpcResiduals histogram output file and whether those should be saved - added TpcDeltaZCorrection module --- common/G4_Tracking.C | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index c3ef058f3..325b74e8a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -29,6 +29,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include +#include #include #include #include @@ -57,8 +58,11 @@ namespace G4TRACKING { // Space Charge calibration flag bool SC_CALIBMODE = true; // 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 @@ -196,6 +200,9 @@ void Tracking_Reco() ghosts->Verbosity(verbosity); se->registerSubsystem(ghosts); + // correct for particle propagation in TPC + se->registerSubsystem(new PHTpcDeltaZCorrection); + // Silicon cluster matching to TPC track seeds if (G4TRACKING::use_truth_si_matching) { @@ -278,6 +285,7 @@ void Tracking_Reco() actsFit->Verbosity(verbosity); /// If running with distortions, fit only the silicon+MMs first actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); se->registerSubsystem(actsFit); if (G4TRACKING::SC_CALIBMODE) @@ -285,6 +293,9 @@ void Tracking_Reco() /// run tpc residual determination with silicon+MM track fit 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); } @@ -330,6 +341,9 @@ void Tracking_Reco() pat_rec->set_track_map_name("SvtxTrackMap"); se->registerSubsystem(pat_rec); + // correct for particle propagation in TPC + se->registerSubsystem(new PHTpcDeltaZCorrection); + // Fitting of tracks using Acts Kalman Filter //================================== @@ -346,7 +360,10 @@ void Tracking_Reco() { /// run tpc residual determination with silicon+MM track fit auto residuals = new PHTpcResiduals; - residuals->setOutputfile(G4TRACKING::SC_ROOTOUTPUT_FILENAME); + 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); } From aa37643cb148633daa51b1c55d7dd39b11a043cb Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 17 Nov 2021 15:32:57 -0500 Subject: [PATCH 1104/1222] update TPC Distortion Correction code --- common/G4_TPC.C | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index bd1378fe9..429a1984a 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -21,7 +21,8 @@ #include #include -#include +#include + #include #include @@ -68,10 +69,6 @@ namespace G4TPC // distortion corrections bool ENABLE_CORRECTIONS = false; auto correction_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; - unsigned int correction_coordinates = - TpcSpaceChargeCorrection::COORD_PHI| - TpcSpaceChargeCorrection::COORD_R| - TpcSpaceChargeCorrection::COORD_Z; // enable central membrane g4hits generation bool ENABLE_CENTRAL_MEMBRANE_HITS = false; @@ -274,10 +271,9 @@ void TPC_Clustering() // space charge correction if( G4TPC::ENABLE_CORRECTIONS ) { - auto tpcSpaceChargeCorrection = new TpcSpaceChargeCorrection; - tpcSpaceChargeCorrection->set_distortion_filename( G4TPC::correction_filename ); - tpcSpaceChargeCorrection->set_coordinates( G4TPC::correction_coordinates ); - se->registerSubsystem(tpcSpaceChargeCorrection); + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); } // direct laser reconstruction From 52687aab793e8ad2bbefedf92810bb3db899d2ad Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 18 Nov 2021 13:35:26 -0500 Subject: [PATCH 1105/1222] include what you use --- common/G4_Tracking.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index c3ef058f3..2f9b95fa3 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -23,7 +23,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include -#include #include #include #include From f821f23b47aee8aadbb4a25283989f67627405b5 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 23 Nov 2021 12:01:12 -0500 Subject: [PATCH 1106/1222] Added HF QA settings --- common/G4_KFParticle.C | 133 +++++++++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 32 deletions(-) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 86a116c4d..68a3f0771 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -5,6 +5,7 @@ #define HomogeneousField #include +#include #include @@ -22,6 +23,26 @@ namespace Enable std::string KFPARTICLE_VERTEXMAP = "SvtxVertexMap"; } // namespace Enable +namespace KFParticle +{ + bool runQA = false; + + bool runUpsilonReco = false; + std::string UpsilonName = "Upsilon"; + std::string UpsilonDecayDescriptor = UpsilonName + " -> e^+ e^-"; + std::pair UpsilonMassRange(8, 11); + + bool runD0Reco = false; + std::string D0Name = "D0"; + std::string D0DecayDescriptor = "[" + D0Name + " -> K^- pi^+]cc"; + std::pair D0MassRange(1.75, 1.95); + + bool runLambdacReco = false; + std::string LambdacName = "Lambdac"; + std::string LambdacDecayDescriptor = "[" + motherName + " -> proton^+ K^- pi^+]cc"; + std::pair LambdacMassRange(2.15, 2.45); +} //namesppace KFParticle + namespace KFParticleBaseCut { float minTrackPT = 0.5; // GeV @@ -32,29 +53,21 @@ namespace KFParticleBaseCut float minMotherPT = 0; // GeV } // namespace KFParticleBaseCut -void KFParticleInit() {} //I guess this line isnt needed - void KFParticle_Upsilon_Reco() { int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); Fun4AllServer *se = Fun4AllServer::instance(); - std::string motherName = "Upsilon"; - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + 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); - std::string decayDescriptor = motherName + " -> e^+ e^-"; - kfparticle->setDecayDescriptor(decayDescriptor); - - kfparticle->setContainerName(motherName); - kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(0); // Upsilon decays are prompt, tracks are more likely to point to vertex kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -62,11 +75,14 @@ void KFParticle_Upsilon_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(7); - kfparticle->setMaximumMass(11); + kfparticle->setMinimumMass(UpsilonMassRange.first); + kfparticle->setMaximumMass(UpsilonMassRange.second); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); kfparticle->constrainToPrimaryVertex(false); + kfparticle->setContainerName(KFParticle::UpsilonName); + kfparticle->setOutputName("KFParticleOutput_" + KFParticle::UpsilonName + "_reconstruction.root"); + se->registerSubsystem(kfparticle); return; @@ -79,21 +95,15 @@ void KFParticle_D0_Reco() Fun4AllServer *se = Fun4AllServer::instance(); - std::string motherName = "D0"; - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + 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); - std::string decayDescriptor = "[" + motherName + " -> K^- pi^+]cc"; - kfparticle->setDecayDescriptor(decayDescriptor); - - kfparticle->setContainerName(motherName); - kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -101,11 +111,14 @@ void KFParticle_D0_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(1.750); - kfparticle->setMaximumMass(1.950); + kfparticle->setMinimumMass(D0MassRange.first); + kfparticle->setMaximumMass(D0MassRange.second); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); kfparticle->constrainToPrimaryVertex(false); + kfparticle->setContainerName(KFParticle::D0Name); + kfparticle->setOutputName("KFParticleOutput_" + KFParticle::D0Name + "_reconstruction.root"); + se->registerSubsystem(kfparticle); return; @@ -118,21 +131,15 @@ void KFParticle_Lambdac_Reco() Fun4AllServer *se = Fun4AllServer::instance(); - std::string motherName = "Lambdac"; - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + motherName + "_Reco"); + 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); - std::string decayDescriptor = "[" + motherName + " -> proton^+ K^- pi^+]cc"; - kfparticle->setDecayDescriptor(decayDescriptor); - - kfparticle->setContainerName(motherName); - kfparticle->setOutputName("KFParticleOutput_" + motherName + "_reconstruction.root"); - kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); @@ -140,15 +147,77 @@ void KFParticle_Lambdac_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(2.150); - kfparticle->setMaximumMass(2.400); + kfparticle->setMinimumMass(LambdacMassRange.first); + kfparticle->setMaximumMass(LambdacMassRange.second); kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); kfparticle->constrainToPrimaryVertex(false); + kfparticle->setContainerName(KFParticle::LambdacName); + kfparticle->setOutputName("KFParticleOutput_" + KFParticle::LambdacName + "_reconstruction.root"); + se->registerSubsystem(kfparticle); 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->saveDST(true); + UpsilonFinder->allowPi0(true); + UpsilonFinder->allowPhotons(true); + se->registerSubsystem(UpsilonFinder); + + QAG4SimulationKFParticle *UpsilonQA = new QAG4SimulationKFParticle("QA_" + KFParticle::UpsilonName, + KFParticle::UpsilonName, + UpsilonMassRange.first, + UpsilonMassRange.second); + se->registerSubsystem(UpsilonQA); + } + + if (KFParticle::runD0Reco) + { + DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFParticle::D0Name); + D0Finder->Verbosity(verbosity); + D0Finder->setDecayDescriptor(KFParticle::D0DecayDescriptor); + D0Finder->saveDST(true); + D0Finder->allowPi0(true); + D0Finder->allowPhotons(true); + se->registerSubsystem(D0Finder); + + QAG4SimulationKFParticle *D0QA = new QAG4SimulationKFParticle("QA_" + KFParticle::D0Name, + KFParticle::D0Name, + D0MassRange.first, + D0MassRange.second); + se->registerSubsystem(D0QA); + } + + if (KFParticle::runLambdacReco) + { + DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFParticle::LambdacName); + LambdacFinder->Verbosity(verbosity); + LambdacFinder->setDecayDescriptor(KFParticle::LambdacDecayDescriptor); + LambdacFinder->saveDST(true); + LambdacFinder->allowPi0(true); + LambdacFinder->allowPhotons(true); + se->registerSubsystem(LambdacFinder); + + QAG4SimulationKFParticle *LambdacQA = new QAG4SimulationKFParticle("QA_" + KFParticle::LambdacName, + KFParticle::LambdacName, + LambdacMassRange.first, + LambdacMassRange.second); + se->registerSubsystem(LambdacQA); + } + + return; +} #endif From 9c9b21ec0db71b96342fb8fdbb0ffa68aa9e6b6c Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 23 Nov 2021 12:14:36 -0500 Subject: [PATCH 1107/1222] Some HF QA improvements --- common/G4_KFParticle.C | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 68a3f0771..4a5091fcc 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -25,7 +25,7 @@ namespace Enable namespace KFParticle { - bool runQA = false; + bool QA = false; bool runUpsilonReco = false; std::string UpsilonName = "Upsilon"; @@ -85,6 +85,8 @@ void KFParticle_Upsilon_Reco() se->registerSubsystem(kfparticle); + KFParticle::runUpsilonReco = true; + return; } @@ -121,6 +123,8 @@ void KFParticle_D0_Reco() se->registerSubsystem(kfparticle); + KFParticle::runD0Reco = true; + return; } @@ -157,6 +161,8 @@ void KFParticle_Lambdac_Reco() se->registerSubsystem(kfparticle); + KFParticle::runLambdacReco = true; + return; } From 4cd48778ca5ed8eed3321e923b7435e369261502 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 23 Nov 2021 13:28:15 -0500 Subject: [PATCH 1108/1222] Added MVTX service macro --- common/G4_TrackingService.C | 273 +++++------------------------------- 1 file changed, 35 insertions(+), 238 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index de7ae59d7..8fba7dda9 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -28,7 +28,9 @@ class ServiceStructure ServiceStructure(); explicit ServiceStructure(const string &name, - const double &thickness_aluminum, + const double &thickness_copper, + const double &thickness_water, + const double &thickness_plastic, const double &thickness_carbon, const double &zSouth, const double &zNorth, @@ -38,7 +40,9 @@ class ServiceStructure virtual ~ServiceStructure(){}; const string get_name(); - const double get_thickness_aluminum(); + const double get_thickness_copper(); + const double get_thickness_water(); + const double get_thickness_plastic(); const double get_thickness_carbon(); const double get_zSouth(); const double get_zNorth(); @@ -47,7 +51,9 @@ class ServiceStructure private: const string m_name = "service"; - const double m_thickness_aluminum = 0.0; + const double m_thickness_copper = 0.0; + const double m_thickness_water = 0.0; + const double m_thickness_plastic = 0.0; const double m_thickness_carbon = 0.0; const double m_zSouth = 0.0; const double m_zNorth = 0.0; @@ -56,14 +62,18 @@ class ServiceStructure }; ServiceStructure::ServiceStructure(const string &name, - const double &thickness_aluminum, + const double &thickness_copper, + const double &thickness_water, + const double &thickness_plastic, const double &thickness_carbon, const double &zSouth, const double &zNorth, const double &rSouth, const double &rNorth) : m_name(name) - , m_thickness_aluminum(thickness_aluminum) + , 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) @@ -73,83 +83,15 @@ ServiceStructure::ServiceStructure(const string &name, } const string ServiceStructure::get_name() { return m_name; } -const double ServiceStructure::get_thickness_aluminum() { return m_thickness_aluminum; } +const double ServiceStructure::get_thickness_copper() { return m_thickness_copper; } +const double ServiceStructure::get_thickness_water() { return m_thickness_water; } +const double ServiceStructure::get_thickness_plastic() { return m_thickness_plastic; } const double ServiceStructure::get_thickness_carbon() { return m_thickness_carbon; } const double ServiceStructure::get_zSouth() { return m_zSouth; } const double ServiceStructure::get_zNorth() { return m_zNorth; } const double ServiceStructure::get_rSouth() { return m_rSouth; } const double ServiceStructure::get_rNorth() { return m_rNorth; } -class Cable -{ - public: - Cable(); - - explicit Cable(const string &name, - const string &coreMaterial, - const double &coreRadius, - const double &sheathRadius, - const double &xSouth, const double &xNorth, - const double &ySouth, const double &yNorth, - const double &zSouth, const double &zNorth); - - virtual ~Cable(){}; - - const string get_name(); - const string get_coreMaterial(); - const double get_coreRadius(); - const double get_sheathRadius(); - const double get_xSouth(); - const double get_xNorth(); - const double get_ySouth(); - const double get_yNorth(); - const double get_zSouth(); - const double get_zNorth(); - - private: - const string m_name = "cable"; - const string m_coreMaterial = "G4_Cu"; - const double m_coreRadius = 1; - const double m_sheathRadius = 2; - const double m_xSouth = 0.; - const double m_xNorth = 1.; - const double m_ySouth = 0.; - const double m_yNorth = 1.; - const double m_zSouth = 0.; - const double m_zNorth = 1.; -}; - -Cable::Cable(const string &name, - const string &coreMaterial, - const double &coreRadius, - const double &sheathRadius, - const double &xSouth, const double &xNorth, - const double &ySouth, const double &yNorth, - const double &zSouth, const double &zNorth) - : m_name(name) - , m_coreMaterial(coreMaterial) - , m_coreRadius(coreRadius) - , m_sheathRadius(sheathRadius) - , m_xSouth(xSouth) - , m_xNorth(xNorth) - , m_ySouth(ySouth) - , m_yNorth(yNorth) - , m_zSouth(zSouth) - , m_zNorth(zNorth) -{ -} - -const string Cable::get_name() { return m_name; } -const string Cable::get_coreMaterial() { return m_coreMaterial; } -const double Cable::get_coreRadius() { return m_coreRadius; } -const double Cable::get_sheathRadius() { return m_sheathRadius; } -const double Cable::get_xSouth() { return m_xSouth; } -const double Cable::get_xNorth() { return m_xNorth; } -const double Cable::get_ySouth() { return m_ySouth; } -const double Cable::get_yNorth() { return m_yNorth; } -const double Cable::get_zSouth() { return m_zSouth; } -const double Cable::get_zNorth() { return m_zNorth; } - namespace Enable { bool TrackingService = false; @@ -161,7 +103,7 @@ namespace Enable namespace G4TrackingService { //List materials and radiation length in cm - string materials[] = {"G4_Al", "PEEK"}; + string materials[] = {"G4_Cu", "G4_WATER", "G4_POLYETHYLENE", "PEEK"}; const int nMaterials = sizeof(materials)/sizeof(materials[0]); double GlobalOffset = -15.0; @@ -175,7 +117,10 @@ namespace G4TrackingService vector get_thickness(ServiceStructure *object) { - vector thickness = {object->get_thickness_aluminum(), object->get_thickness_carbon()}; + vector thickness = { object->get_thickness_copper() + , object->get_thickness_water() + , object->get_thickness_plastic() + , object->get_thickness_carbon()}; return thickness; } @@ -259,175 +204,27 @@ double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, doubl return radius; } -double CreateCable(Cable *object, PHG4Reco *g4Reco, double radius) -{ - bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; - bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; - int verbosity = max(Enable::VERBOSITY, Enable::TrackingService_VERBOSITY); - - string cableMaterials[2] = {object->get_coreMaterial(), "G4_POLYETHYLENE"}; - double IR[2] = {0, object->get_coreRadius()}; - double OR[2] = {object->get_coreRadius(), object->get_sheathRadius()}; - - double length = abs(object->get_zNorth() - object->get_zSouth()); - double setX = (object->get_xSouth() + object->get_xNorth()) / 2; - double setY = (object->get_ySouth() + object->get_yNorth()) / 2; - double setZ = (object->get_zSouth() + object->get_zNorth()) / 2 + G4TrackingService::GlobalOffset; - - double radToDeg = 180.0 / M_PI; - double rotX = atan((object->get_yNorth() - object->get_ySouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; - double rotY = atan((object->get_xNorth() - object->get_xSouth()) / (object->get_zNorth() - object->get_zSouth())) * radToDeg; - double rotZ = atan((object->get_xNorth() - object->get_xSouth()) / (object->get_yNorth() - object->get_ySouth())) * radToDeg; - - PHG4CylinderSubsystem *cyl; - for (int i = 0; i < 2; ++i) - { - cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); - cyl->Verbosity(verbosity); - cyl->set_string_param("material", cableMaterials[i]); - cyl->set_double_param("length", length); - cyl->set_double_param("radius", IR[i]); - cyl->set_double_param("thickness", OR[i]); - cyl->set_double_param("place_x", setX); - cyl->set_double_param("place_y", setY); - cyl->set_double_param("place_z", setZ); - cyl->set_double_param("rot_x", rotX); - cyl->set_double_param("rot_y", rotY); - cyl->set_double_param("rot_z", rotZ); - cyl->SuperDetector("TrackingCable"); - if (AbsorberActive) cyl->SetActive(); - cyl->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cyl); - ++G4TrackingService::subsysID; - } - return OR[1]; -} - -double CreateCableBundle(string superName, PHG4Reco *g4Reco, double radius, - bool enableSignal, bool enableCooling, bool enablePower, - double x1, double x2, double y1, double y2, double z1, double z2, double theta) -{ - //Set up basic MVTX cable bundle (24 Samtec cables, 1 power cable, 2 cooling cables) - double samtecCoreRadius = 0.01275; - double samtecSheathRadius = 0.05; - double coolingCoreRadius = 0.056; - double coolingSheathRadius = 0.08; //? - double powerLargeCoreRadius = 0.069; - double powerLargeSheathRadius = 0.158; - double powerMediumCoreRadius = 0.033; - double powerMediumSheathRadius = 0.073; - double powerSmallCoreRadius = 0.028; - double powerSmallSheathRadius = 0.058; - - //Samtec cables (we use 24 as there are 12 twinax) - if (enableSignal) - { - unsigned int nSamtecWires = 24; - unsigned int nRow = 2; - unsigned int nCol = nSamtecWires / nRow; - for (unsigned int iRow = 0; iRow < nRow; ++iRow) - { - for (unsigned int iCol = 0; iCol < nCol; ++iCol) - { - Cable *cable = new Cable(Form("%s_samtec_%d_%d", superName.c_str(), iRow, iCol), "G4_Cu", samtecCoreRadius, samtecSheathRadius, - (x1 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), (x2 + (iCol + 1) * samtecSheathRadius * 2)*cos(theta), - (y1 - (iRow + 1) * samtecSheathRadius * 2)*sin(theta), (y2 - (iRow + 1) * samtecSheathRadius * 2)*sin(theta), - z1, z2); - radius += CreateCable(cable, g4Reco, radius); - } - } - } - - //Cooling Cables - if (enableCooling) - { - unsigned int nCool = 2; - for (unsigned int iCool = 0; iCool < nCool; ++iCool) - { - Cable *cable = new Cable(Form("%s_cooling_%d", superName.c_str(), iCool), "G4_WATER", coolingCoreRadius, coolingSheathRadius, - (x1 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), (x2 + (iCool + 1) * coolingSheathRadius * 2)*cos(theta), - (y1 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), (y2 + (iCool + 1) * coolingSheathRadius * 2)*sin(theta), - z1, z2); - radius += CreateCable(cable, g4Reco, radius); - } - } - - //Power Cables - if (enablePower) - { - typedef pair, pair> PowerCableParameters; - vector powerCables; - - powerCables.push_back(make_pair(make_pair(Form("%s_digiReturn", superName.c_str()), "Large"), make_pair(-1 * powerLargeSheathRadius, -1 * powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_digiSupply", superName.c_str()), "Large"), make_pair(-3 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_anaReturn", superName.c_str()), "Medium"), make_pair(-1 * (powerMediumSheathRadius + 2 * powerLargeSheathRadius), -2 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_anaSupply", superName.c_str()), "Medium"), make_pair(-1 * (3 * powerMediumSheathRadius + 2 * powerLargeSheathRadius), -1 * powerMediumSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_digiSense", superName.c_str()), "Small"), make_pair(-1 * (2 * powerMediumSheathRadius + 4 * powerLargeSheathRadius), powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_anaSense", superName.c_str()), "Small"), make_pair(-4 * powerLargeSheathRadius, 2 * powerSmallSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_bias", superName.c_str()), "Small"), make_pair(-2 * powerLargeSheathRadius, powerLargeSheathRadius))); - powerCables.push_back(make_pair(make_pair(Form("%s_ground", superName.c_str()), "Small"), make_pair(-1 * powerLargeSheathRadius, powerSmallSheathRadius))); - - for (PowerCableParameters &powerCable : powerCables) - { - double coreRad, sheathRad; - string cableType = powerCable.first.second; - if (cableType == "Small") - { - coreRad = powerSmallCoreRadius; - sheathRad = powerSmallSheathRadius; - } - else if (cableType == "Medium") - { - coreRad = powerMediumCoreRadius; - sheathRad = powerMediumSheathRadius; - } - else - { - coreRad = powerLargeCoreRadius; - sheathRad = powerLargeSheathRadius; - } - - Cable *cable = new Cable(powerCable.first.first, "G4_Cu", coreRad, sheathRad, - (x1 + powerCable.second.first)*cos(theta), (x2 + powerCable.second.first)*cos(theta), - (y1 + powerCable.second.second)*sin(theta), (y2 + powerCable.second.second)*sin(theta), z1, z2); - - radius += CreateCable(cable, g4Reco, radius); - } - } - - return radius; -} - double TrackingService(PHG4Reco *g4Reco, double radius) { vector cylinders, cones; - cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0, G4TrackingService::BarrelThickness, -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), + cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0.049946, 0.00724494, 0.313467, G4TrackingService::BarrelThickness, -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset, G4TrackingService::BarrelRadius, 0)); - cylinders.push_back(new ServiceStructure("L0_1", 0, G4TrackingService::LayerThickness, -18.680, -16.579, 5.050, 0)); - cones.push_back(new ServiceStructure("L0_2", 0, G4TrackingService::LayerThickness, -16.579, -9.186, 5.050, 2.997)); - cylinders.push_back(new ServiceStructure("L0_3", 0, G4TrackingService::LayerThickness, -9.186, 0, 2.997, 0)); + cylinders.push_back(new ServiceStructure("L0_1", 0.00463332, 0., 0.0662175, G4TrackingService::LayerThickness, -18.680, -16.579, 5.050, 0)); + cones.push_back(new ServiceStructure("L0_2", 0.006, 0., 0.088, G4TrackingService::LayerThickness, -16.579, -9.186, 5.050, 2.997)); + cylinders.push_back(new ServiceStructure("L0_3", 0.00780066, 0., 0.11028, G4TrackingService::LayerThickness, -9.186, 0, 2.997, 0)); - cylinders.push_back(new ServiceStructure("L1_1", 0, G4TrackingService::LayerThickness, -17.970, -15.851, 7.338, 0)); - cones.push_back(new ServiceStructure("L1_2", 0, G4TrackingService::LayerThickness, -15.851, -8.938, 7.338, 3.799)); - cylinders.push_back(new ServiceStructure("L1_3", 0, G4TrackingService::LayerThickness, -8.938, 0, 3.799, 0)); + cylinders.push_back(new ServiceStructure("L1_1", 0.00425224, 0., 0.0609067, G4TrackingService::LayerThickness, -17.970, -15.851, 7.338, 0)); + cones.push_back(new ServiceStructure("L1_2", 0.006, 0., 0.085, G4TrackingService::LayerThickness, -15.851, -8.938, 7.338, 3.799)); + cylinders.push_back(new ServiceStructure("L1_3", 0.00820698, 0., 0.116351, G4TrackingService::LayerThickness, -8.938, 0, 3.799, 0)); - cylinders.push_back(new ServiceStructure("L2_1", 0, G4TrackingService::LayerThickness, -22.300, -15.206, 9.650, 0)); - cones.push_back(new ServiceStructure("L2_2", 0, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); - cylinders.push_back(new ServiceStructure("L2_3", 0, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 0)); + cylinders.push_back(new ServiceStructure("L2_1", 0.00404216, 0., 0.0579591, G4TrackingService::LayerThickness, -22.300, -15.206, 9.650, 0)); + cones.push_back(new ServiceStructure("L2_2", 0.0062, 0., 0.09, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); + cylinders.push_back(new ServiceStructure("L2_3", 0.0085218, 0., 0.121045, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 0)); - //for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); - //for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); - - int nSets = 1; - for (unsigned int i = 0; i < nSets; ++i) - { - double theta = 360.*i/nSets; - double r = G4TrackingService::BarrelRadius - 1.; - //radius += CreateCableBundle(Form("Test_%d", i), g4Reco, radius, true, true, true, r*cos(theta), r*cos(theta), r*sin(theta), r*sin(theta), -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), -1. * G4TrackingService::BarrelOffset - 5., theta); - radius += CreateCableBundle(Form("Test2_%d", i), g4Reco, radius, true, true, true, r*cos(theta), (r-4)*cos(theta), r*sin(theta), (r-4)*sin(theta), -1. * G4TrackingService::BarrelOffset - 5, -1. * G4TrackingService::BarrelOffset, theta); - } + for (ServiceStructure *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius); + for (ServiceStructure *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius); return radius; } From 9ef2633d89ddabbf75e0d181853191e3bc2b48cf Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 23 Nov 2021 15:56:41 -0500 Subject: [PATCH 1109/1222] Reverted F4A --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 31 +++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index f57e99c9c..20c74b010 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -236,14 +236,14 @@ int Fun4All_G4_sPHENIX( // Enable::DSTREADER = true; // turn the display on (default off) - Enable::DISPLAY = false; + // Enable::DISPLAY = true; //====================== // What to run //====================== // QA, main switch - Enable::QA = false; + Enable::QA = true; // Global options (enabled for all enables subsystems - if implemented) // Enable::ABSORBER = true; @@ -254,22 +254,22 @@ int Fun4All_G4_sPHENIX( // 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 = false; + Enable::PIPE = true; Enable::PIPE_ABSORBER = true; // central tracking - Enable::MVTX = false; + Enable::MVTX = true; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; Enable::TrackingService = true; - Enable::INTT = false; + Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; Enable::INTT_CLUSTER = Enable::INTT_CELL && true; Enable::INTT_QA = Enable::INTT_CLUSTER and Enable::QA && true; - Enable::TPC = false; + Enable::TPC = true; Enable::TPC_ABSORBER = true; Enable::TPC_CELL = Enable::TPC && true; Enable::TPC_CLUSTER = Enable::TPC_CELL && true; @@ -279,7 +279,7 @@ int Fun4All_G4_sPHENIX( Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; - Enable::TRACKING_TRACK = false; + Enable::TRACKING_TRACK = true; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; Enable::TRACKING_QA = Enable::TRACKING_TRACK and Enable::QA && true; @@ -287,7 +287,7 @@ int Fun4All_G4_sPHENIX( // into the tracking, cannot run together with CEMC // Enable::CEMCALBEDO = true; - Enable::CEMC = false; + Enable::CEMC = true; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; Enable::CEMC_TOWER = Enable::CEMC_CELL && true; @@ -295,7 +295,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; Enable::CEMC_QA = Enable::CEMC_CLUSTER and Enable::QA && true; - Enable::HCALIN = false; + Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -303,10 +303,10 @@ int Fun4All_G4_sPHENIX( Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; Enable::HCALIN_QA = Enable::HCALIN_CLUSTER and Enable::QA && true; - Enable::MAGNET = false; + Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = false; + Enable::HCALOUT = true; Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; @@ -316,11 +316,10 @@ int Fun4All_G4_sPHENIX( Enable::EPD = true; - - Enable::BEAMLINE = false; + 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 = false; + Enable::ZDC = true; // Enable::ZDC_ABSORBER = true; // Enable::ZDC_SUPPORT = true; Enable::ZDC_TOWER = Enable::ZDC && true; @@ -328,7 +327,7 @@ int Fun4All_G4_sPHENIX( //! forward flux return plug door. Out of acceptance and off by default. //Enable::PLUGDOOR = true; - Enable::PLUGDOOR_ABSORBER = false; + Enable::PLUGDOOR_ABSORBER = true; Enable::GLOBAL_RECO = true; //Enable::GLOBAL_FASTSIM = true; @@ -339,7 +338,7 @@ int Fun4All_G4_sPHENIX( Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; - Enable::JETS = false; + Enable::JETS = true; Enable::JETS_EVAL = Enable::JETS && true; Enable::JETS_QA = Enable::JETS and Enable::QA && true; From c60763123297aad014e7928f333799724e9feace Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 23 Nov 2021 15:59:42 -0500 Subject: [PATCH 1110/1222] Added trigger option for QA --- common/G4_KFParticle.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 4a5091fcc..7fb4544d0 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -31,16 +31,19 @@ namespace KFParticle 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 = "[" + motherName + " -> proton^+ K^- pi^+]cc"; std::pair LambdacMassRange(2.15, 2.45); + bool LambdacTrigger = false; } //namesppace KFParticle namespace KFParticleBaseCut @@ -177,6 +180,7 @@ void KFParticle_QA() 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); @@ -194,6 +198,7 @@ void KFParticle_QA() 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); @@ -211,6 +216,7 @@ void KFParticle_QA() 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); From 8ab3cab33cd5dd76ae1e62c087fcc675b121221b Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 29 Nov 2021 17:01:55 -0500 Subject: [PATCH 1111/1222] removed unused include --- common/G4_Tracking.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ff4c10682..9b6960dfe 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -37,7 +37,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include -#include #include #include From d1f6b8479edd0e65248c0da3f6dbad217d8a3007 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 30 Nov 2021 13:33:51 -0500 Subject: [PATCH 1112/1222] added cluster mover --- common/G4_Tracking.C | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9b6960dfe..9f9cf4591 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -28,6 +28,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include +#include #include #include #include @@ -189,15 +190,22 @@ void Tracking_Reco() // Associate TPC track stubs with silicon and Micromegas //============================================= - PHTpcTrackSeedCircleFit* vtxassoc = new PHTpcTrackSeedCircleFit(); + /* + * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks + * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles + * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER + */ + if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); + + auto vtxassoc = new PHTpcTrackSeedCircleFit; vtxassoc->Verbosity(verbosity); se->registerSubsystem(vtxassoc); // Choose the best duplicate TPC track seed - PHGhostRejection* ghosts = new PHGhostRejection(); + auto ghosts = new PHGhostRejection; ghosts->Verbosity(verbosity); se->registerSubsystem(ghosts); - + // correct for particle propagation in TPC se->registerSubsystem(new PHTpcDeltaZCorrection); From 11dc111fd1ca9e7b3fbd19b1c0a9cc628c78bd2f Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 30 Nov 2021 14:35:50 -0500 Subject: [PATCH 1113/1222] also add cluster mover in truth track finding path --- common/G4_Tracking.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9f9cf4591..f7516d9aa 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -347,6 +347,13 @@ void Tracking_Reco() pat_rec->set_track_map_name("SvtxTrackMap"); se->registerSubsystem(pat_rec); + /* + * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks + * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles + * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER + */ + if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); + // correct for particle propagation in TPC se->registerSubsystem(new PHTpcDeltaZCorrection); From 4dbef0711db134eabf28a177f17076818a4c5a10 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 30 Nov 2021 14:37:55 -0500 Subject: [PATCH 1114/1222] set SC_CALIBMODE to false by default makes it independent G4TPC::ENABLE_STATIC_DISTORTIONS --- common/G4_Tracking.C | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f7516d9aa..30dd97d40 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -56,7 +56,7 @@ namespace Enable namespace G4TRACKING { // Space Charge calibration flag - bool SC_CALIBMODE = true; // this is anded with G4TPC::ENABLE_DISTORTIONS in TrackingInit() + 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 @@ -91,9 +91,6 @@ void TrackingInit() 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; - /// Build the Acts geometry Fun4AllServer* se = Fun4AllServer::instance(); int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); From 3a246bcd27631b73dfa10b8daa46a27b188f5bf2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 1 Dec 2021 13:45:41 -0500 Subject: [PATCH 1115/1222] adjust the outer radius for envelope to new supports --- common/G4_Intt.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 5458d0d2c..9321977cd 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -60,7 +60,7 @@ namespace G4INTT void InttInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 16.85 + 0.6); // rail radius + rail outer radius + 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 From 7de8bf5cb276b082d0457ce76c7655abd80cdbd3 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 1 Dec 2021 15:55:09 -0500 Subject: [PATCH 1116/1222] enable micromegas by default. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 20c74b010..8d3823ed8 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -275,7 +275,7 @@ int Fun4All_G4_sPHENIX( Enable::TPC_CLUSTER = Enable::TPC_CELL && true; Enable::TPC_QA = Enable::TPC_CLUSTER and Enable::QA && true; - //Enable::MICROMEGAS = true; + Enable::MICROMEGAS = true; Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; From 83c27b3f331aeab82409853746dbc49da0f72554 Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Thu, 2 Dec 2021 09:31:17 -0500 Subject: [PATCH 1117/1222] added overlapcheck --- common/G4_Bbc.C | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 6f4826743..c91b5d173 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -16,10 +16,10 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - bool BBC = false; - bool BBC_SUPPORT = false; - bool BBCFAKE = false; - int BBC_VERBOSITY = 0; + bool BBC = true; // Actual BBC detector + bool BBC_SUPPORT = true; // BBC Supports + bool BBCFAKE = false; // Just generate fake bbc vtx, t0 + int BBC_VERBOSITY = 0; } // namespace Enable namespace G4BBC @@ -51,6 +51,7 @@ void Bbc(PHG4Reco* g4Reco) { PHG4BbcSubsystem* bbc = new PHG4BbcSubsystem("BBC"); bbc->SuperDetector("BBC"); + bbc->OverlapCheck( Enable::OVERLAPCHECK ); bbc->SetActive(); if (SupportActive) { From b3e67e3c1279fb02f381abc590e05565339f1c5c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 3 Dec 2021 09:00:03 -0500 Subject: [PATCH 1118/1222] Update G4_Bbc.C The default for all Enable options should be false so we don't change the behavior of existing Fun4All macros --- common/G4_Bbc.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index c91b5d173..4d9ac1f06 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -16,8 +16,8 @@ R__LOAD_LIBRARY(libg4detectors.so) namespace Enable { - bool BBC = true; // Actual BBC detector - bool BBC_SUPPORT = true; // BBC Supports + 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 From fe585cae0f81fbc9b5b02461aaebdf1625aeb2fa Mon Sep 17 00:00:00 2001 From: dvperepelitsa Date: Tue, 7 Dec 2021 12:38:27 -0500 Subject: [PATCH 1119/1222] Macro hooks for calibrated centrality determination in production --- common/G4_Centrality.C | 36 ++++++++++++++++++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 12 +++++++++ 2 files changed, 48 insertions(+) create mode 100644 common/G4_Centrality.C diff --git a/common/G4_Centrality.C b/common/G4_Centrality.C new file mode 100644 index 000000000..cc895bfd1 --- /dev/null +++ b/common/G4_Centrality.C @@ -0,0 +1,36 @@ +#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); + cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/")); + se->registerSubsystem( cent ); + + return; +} +#endif diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8d3823ed8..7aa1befbd 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -351,6 +352,8 @@ int Fun4All_G4_sPHENIX( Enable::TOPOCLUSTER = false && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; // particle flow jet reconstruction - needs topoClusters! Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + // centrality reconstruction + Enable::CENTRALITY = true; // new settings using Enable namespace in GlobalVariables.C Enable::BLACKHOLE = true; @@ -464,6 +467,15 @@ int Fun4All_G4_sPHENIX( Global_FastSim(); } + //----------------- + // Centrality Determination + //----------------- + + if (Enable::CENTRALITY) + { + Centrality(); + } + //----------------- // Calo Trigger Simulation //----------------- From f230b1de1a27643aca29e5f9c3caf9b971b6527e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 10 Dec 2021 15:26:54 -0500 Subject: [PATCH 1120/1222] - Allow to configure micromegas radius position from calling macro - increase micromegas radius to leave room for TPC supporting rods --- common/G4_Micromegas.C | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index efaa860e4..8428ea1bd 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -40,6 +40,10 @@ namespace G4MICROMEGAS }; Config CONFIG = CONFIG_BASELINE; + + // radius at which micromegas layers are installed + double mm_radius = 85; + } // namespace G4MICROMEGAS void MicromegasInit() @@ -68,7 +72,7 @@ void Micromegas(PHG4Reco* g4Reco) auto mm = new PHG4MicromegasSubsystem("MICROMEGAS", mm_layer); mm->SetActive(); mm->set_double_param("mm_length", 220); - mm->set_double_param("mm_radius", 82); + mm->set_double_param("mm_radius", G4MICROMEGAS::mm_radius); g4Reco->registerSubsystem(mm); } @@ -79,7 +83,6 @@ void Micromegas_Cells() auto reco = new PHG4MicromegasHitReco; reco->Verbosity(0); - static constexpr double radius = 82; static constexpr double length = 210; static constexpr int nsectors = 12; static constexpr double tile_length = 50; @@ -92,7 +95,7 @@ void Micromegas_Cells() // one tile at mid rapidity in front of TPC sector std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MINIMAL" << std::endl; static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); - reco->set_tiles({{{phi0, 0, tile_width / radius, tile_length}}}); + reco->set_tiles({{{phi0, 0, tile_width/CylinderGeomMicromegas::reference_radius, tile_length}}}); break; } @@ -103,7 +106,7 @@ void Micromegas_Cells() MicromegasTile::List tiles; for (int i = 0; i < nsectors; ++i) { - tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width / radius, tile_length); + tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width/CylinderGeomMicromegas::reference_radius, tile_length); } reco->set_tiles(tiles); break; @@ -118,7 +121,7 @@ void Micromegas_Cells() static constexpr int ntiles = 4; for (int i = 0; i < ntiles; ++i) { - tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles - 0.5), tile_width / radius, tile_length); + tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); } reco->set_tiles(tiles); break; @@ -134,7 +137,7 @@ void Micromegas_Cells() static constexpr int ntiles_z = 4; for (int i = 0; i < ntiles_z; ++i) { - tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles_z - 0.5), tile_width / radius, tile_length); + tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles_z - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); } // for the other sectors we put two tiles on either side of the central membrane @@ -142,8 +145,8 @@ void Micromegas_Cells() for (int i = 1; i < nsectors; ++i) { const double phi = phi0 + 2.*M_PI*i/nsectors; - tiles.emplace_back( phi, length*(1.5/4-0.5) - zoffset, tile_width/radius, tile_length ); - tiles.emplace_back( phi, length*(2.5/4-0.5) + zoffset, tile_width/radius, tile_length ); + tiles.emplace_back( phi, length*(1.5/4-0.5) - zoffset, tile_width/CylinderGeomMicromegas::reference_radius, tile_length ); + tiles.emplace_back( phi, length*(2.5/4-0.5) + zoffset, tile_width/CylinderGeomMicromegas::reference_radius, tile_length ); } reco->set_tiles(tiles); break; @@ -161,7 +164,7 @@ void Micromegas_Cells() const double phi = 2. * M_PI * (0.5 + iphi) / nsectors; for (int iz = 0; iz < ntiles_z; ++iz) { - tiles.emplace_back(phi, length * ((0.5 + iz) / ntiles_z - 0.5), tile_width / radius, tile_length); + tiles.emplace_back(phi, length * ((0.5 + iz) / ntiles_z - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); } } reco->set_tiles(tiles); From 40352bcf61eff75e517867d5340ce5b8194d2b80 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 14 Dec 2021 13:57:41 -0500 Subject: [PATCH 1121/1222] added overlap check --- common/G4_Micromegas.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 8428ea1bd..f5ec3043f 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -70,6 +70,7 @@ 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(); mm->set_double_param("mm_length", 220); mm->set_double_param("mm_radius", G4MICROMEGAS::mm_radius); From 0514f94811fb154b50fa648aacae437e069fa58b Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 14 Dec 2021 18:07:06 -0500 Subject: [PATCH 1122/1222] Added CYSS to MVTX --- common/G4_TrackingService.C | 196 ++++++++++++++----------- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 +- 2 files changed, 114 insertions(+), 86 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 8fba7dda9..cad5254f7 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -28,48 +28,48 @@ class ServiceStructure ServiceStructure(); explicit ServiceStructure(const string &name, - const double &thickness_copper, - const double &thickness_water, - const double &thickness_plastic, - const double &thickness_carbon, - const double &zSouth, - const double &zNorth, - const double &rSouth, - const double &rNorth); + 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 double get_thickness_copper(); - const double get_thickness_water(); - const double get_thickness_plastic(); - const double get_thickness_carbon(); - const double get_zSouth(); - const double get_zNorth(); - const double get_rSouth(); - const double get_rNorth(); + 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 double m_thickness_copper = 0.0; - const double m_thickness_water = 0.0; - const double m_thickness_plastic = 0.0; - const double m_thickness_carbon = 0.0; - const double m_zSouth = 0.0; - const double m_zNorth = 0.0; - const double m_rSouth = 0.0; - const double m_rNorth = 0.0; + 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 double &thickness_copper, - const double &thickness_water, - const double &thickness_plastic, - const double &thickness_carbon, - const double &zSouth, - const double &zNorth, - const double &rSouth, - const double &rNorth) + 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) @@ -83,14 +83,14 @@ ServiceStructure::ServiceStructure(const string &name, } const string ServiceStructure::get_name() { return m_name; } -const double ServiceStructure::get_thickness_copper() { return m_thickness_copper; } -const double ServiceStructure::get_thickness_water() { return m_thickness_water; } -const double ServiceStructure::get_thickness_plastic() { return m_thickness_plastic; } -const double ServiceStructure::get_thickness_carbon() { return m_thickness_carbon; } -const double ServiceStructure::get_zSouth() { return m_zSouth; } -const double ServiceStructure::get_zNorth() { return m_zNorth; } -const double ServiceStructure::get_rSouth() { return m_rSouth; } -const double ServiceStructure::get_rNorth() { return m_rNorth; } +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 { @@ -106,18 +106,23 @@ namespace G4TrackingService string materials[] = {"G4_Cu", "G4_WATER", "G4_POLYETHYLENE", "PEEK"}; const int nMaterials = sizeof(materials)/sizeof(materials[0]); - double GlobalOffset = -15.0; - double BarrelOffset = 18.679; - double BarrelRadius = 10.33; //Inner radious of service barrel - double BarrelThickness = 0.436; //Thickness in cm - double BarrelLength = 121.24; //Length of cylinder in cm - double LayerThickness = 0.1; // + 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 -vector get_thickness(ServiceStructure *object) +using namespace G4TrackingService; + +vector get_thickness(ServiceStructure *object) { - vector thickness = { object->get_thickness_copper() + vector thickness = { object->get_thickness_copper() , object->get_thickness_water() , object->get_thickness_plastic() , object->get_thickness_carbon()}; @@ -126,15 +131,15 @@ vector get_thickness(ServiceStructure *object) void TrackingServiceInit() { - double serviceRad = G4TrackingService::BarrelRadius + G4TrackingService::BarrelThickness; - double serviceMinZ = G4TrackingService::GlobalOffset - G4TrackingService::BarrelOffset - G4TrackingService::BarrelLength; - double serviceMaxZ = G4TrackingService::GlobalOffset; + 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); } -double TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, double radius) +float TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, float radius) { bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; @@ -142,35 +147,36 @@ double TrackingServiceCone(ServiceStructure *object, PHG4Reco *g4Reco, double ra PHG4ConeSubsystem *cone; - double innerRadiusSouth = object->get_rSouth(); - double innerRadiusNorth = object->get_rNorth(); - double length = abs(object->get_zNorth() - object->get_zSouth()); - vector thickness = get_thickness(object); + 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 < G4TrackingService::nMaterials; ++i) + for (int i = 0; i < nMaterials; ++i) { if (thickness[i] == 0) continue; - cone = new PHG4ConeSubsystem(object->get_name(), G4TrackingService::subsysID); + 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 + G4TrackingService::GlobalOffset); + cone->SetPlaceZ(object->get_zSouth() + length / 2 + GlobalOffset); cone->SetZlength(length / 2); - cone->SetMaterial(G4TrackingService::materials[i]); + 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); - ++G4TrackingService::subsysID; - innerRadiusSouth += thickness[i]; - innerRadiusNorth += thickness[i]; + ++subsysID; + innerRadiusSouth += thickness[i] + 5e-7; + innerRadiusNorth += thickness[i] + 5e-7; } radius = max(innerRadiusSouth, innerRadiusNorth); return radius; } -double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, double radius) +float TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, float radius) { bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER; bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TrackingService_OVERLAPCHECK; @@ -178,50 +184,70 @@ double TrackingServiceCylinder(ServiceStructure *object, PHG4Reco *g4Reco, doubl PHG4CylinderSubsystem *cyl; - double innerRadius = object->get_rSouth(); - double length = abs(object->get_zNorth() - object->get_zSouth()); - vector thickness = get_thickness(object); + float innerRadius = object->get_rSouth(); + float length = abs(object->get_zNorth() - object->get_zSouth()); + vector thickness = get_thickness(object); - for (int i = 0; i < G4TrackingService::nMaterials; ++i) + for (int i = 0; i < nMaterials; ++i) { if (thickness[i] == 0) continue; - cyl = new PHG4CylinderSubsystem(object->get_name(), G4TrackingService::subsysID); + cyl = new PHG4CylinderSubsystem(object->get_name(), subsysID); cyl->Verbosity(verbosity); - cyl->set_double_param("place_z", object->get_zSouth() + length / 2 + G4TrackingService::GlobalOffset); + 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", G4TrackingService::materials[i]); + 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); - ++G4TrackingService::subsysID; - innerRadius += thickness[i]; + ++subsysID; + innerRadius += thickness[i] + 5e-7; } radius = innerRadius; return radius; } -double TrackingService(PHG4Reco *g4Reco, double radius) +float TrackingService(PHG4Reco *g4Reco, float radius) { vector cylinders, cones; - cylinders.push_back(new ServiceStructure("MVTXServiceBarrel", 0.049946, 0.00724494, 0.313467, G4TrackingService::BarrelThickness, -1. * (G4TrackingService::BarrelLength + G4TrackingService::BarrelOffset), - -1. * G4TrackingService::BarrelOffset, G4TrackingService::BarrelRadius, 0)); + //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)); - cylinders.push_back(new ServiceStructure("L0_1", 0.00463332, 0., 0.0662175, G4TrackingService::LayerThickness, -18.680, -16.579, 5.050, 0)); - cones.push_back(new ServiceStructure("L0_2", 0.006, 0., 0.088, G4TrackingService::LayerThickness, -16.579, -9.186, 5.050, 2.997)); - cylinders.push_back(new ServiceStructure("L0_3", 0.00780066, 0., 0.11028, G4TrackingService::LayerThickness, -9.186, 0, 2.997, 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("L1_1", 0.00425224, 0., 0.0609067, G4TrackingService::LayerThickness, -17.970, -15.851, 7.338, 0)); - cones.push_back(new ServiceStructure("L1_2", 0.006, 0., 0.085, G4TrackingService::LayerThickness, -15.851, -8.938, 7.338, 3.799)); - cylinders.push_back(new ServiceStructure("L1_3", 0.00820698, 0., 0.116351, G4TrackingService::LayerThickness, -8.938, 0, 3.799, 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("L2_1", 0.00404216, 0., 0.0579591, G4TrackingService::LayerThickness, -22.300, -15.206, 9.650, 0)); - cones.push_back(new ServiceStructure("L2_2", 0.0062, 0., 0.09, G4TrackingService::LayerThickness, -15.206, -8.538, 9.650, 4.574)); - cylinders.push_back(new ServiceStructure("L2_3", 0.0085218, 0., 0.121045, G4TrackingService::LayerThickness, -8.538, 0, 4.574, 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); diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 8d3823ed8..c51063419 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -236,7 +236,7 @@ int Fun4All_G4_sPHENIX( // Enable::DSTREADER = true; // turn the display on (default off) - // Enable::DISPLAY = true; + //Enable::DISPLAY = true; //====================== // What to run @@ -259,10 +259,12 @@ int Fun4All_G4_sPHENIX( // central tracking Enable::MVTX = true; + Enable::MVTX_OVERLAPCHECK = true; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; Enable::TrackingService = true; + Enable::TrackingService_OVERLAPCHECK = true; Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; From c17b53c8565a703d8602c73a96592a35126e2879 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 14 Dec 2021 18:10:28 -0500 Subject: [PATCH 1123/1222] Removed overlap check enables --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index c51063419..5a505e690 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -259,12 +259,10 @@ int Fun4All_G4_sPHENIX( // central tracking Enable::MVTX = true; - Enable::MVTX_OVERLAPCHECK = true; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; Enable::TrackingService = true; - Enable::TrackingService_OVERLAPCHECK = true; Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; From a99e8edabbf3875245c108491c236973e92ca115 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Thu, 16 Dec 2021 16:45:27 -0500 Subject: [PATCH 1124/1222] Fixed KFParticle clash between macros and compiled class --- common/G4_KFParticle.C | 97 +++++++++++++------------- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 7 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 7fb4544d0..2f9b5d0ee 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -6,6 +6,7 @@ #define HomogeneousField #include #include +#include #include @@ -23,7 +24,7 @@ namespace Enable std::string KFPARTICLE_VERTEXMAP = "SvtxVertexMap"; } // namespace Enable -namespace KFParticle +namespace KFPARTICLE { bool QA = false; @@ -41,10 +42,10 @@ namespace KFParticle bool runLambdacReco = false; std::string LambdacName = "Lambdac"; - std::string LambdacDecayDescriptor = "[" + motherName + " -> proton^+ K^- pi^+]cc"; + std::string LambdacDecayDescriptor = "[" + LambdacName + " -> proton^+ K^- pi^+]cc"; std::pair LambdacMassRange(2.15, 2.45); bool LambdacTrigger = false; -} //namesppace KFParticle +} //namesppace KFPARTICLE namespace KFParticleBaseCut { @@ -62,9 +63,9 @@ void KFParticle_Upsilon_Reco() Fun4AllServer *se = Fun4AllServer::instance(); - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFParticle::UpsilonName + "_Reco"); + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::UpsilonName + "_Reco"); kfparticle->Verbosity(verbosity); - kfparticle->setDecayDescriptor(KFParticle::UpsilonDecayDescriptor); + kfparticle->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor); kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); @@ -78,17 +79,17 @@ void KFParticle_Upsilon_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(UpsilonMassRange.first); - kfparticle->setMaximumMass(UpsilonMassRange.second); + 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"); + kfparticle->setContainerName(KFPARTICLE::UpsilonName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::UpsilonName + "_reconstruction.root"); se->registerSubsystem(kfparticle); - KFParticle::runUpsilonReco = true; + KFPARTICLE::runUpsilonReco = true; return; } @@ -100,9 +101,9 @@ void KFParticle_D0_Reco() Fun4AllServer *se = Fun4AllServer::instance(); - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFParticle::D0Name + "_Reco"); + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::D0Name + "_Reco"); kfparticle->Verbosity(verbosity); - kfparticle->setDecayDescriptor(KFParticle::D0DecayDescriptor); + kfparticle->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor); kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); @@ -116,17 +117,17 @@ void KFParticle_D0_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(D0MassRange.first); - kfparticle->setMaximumMass(D0MassRange.second); + 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"); + kfparticle->setContainerName(KFPARTICLE::D0Name); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::D0Name + "_reconstruction.root"); se->registerSubsystem(kfparticle); - KFParticle::runD0Reco = true; + KFPARTICLE::runD0Reco = true; return; } @@ -138,9 +139,9 @@ void KFParticle_Lambdac_Reco() Fun4AllServer *se = Fun4AllServer::instance(); - KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFParticle::LambdacName + "_Reco"); + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::LambdacName + "_Reco"); kfparticle->Verbosity(verbosity); - kfparticle->setDecayDescriptor(KFParticle::LambdacDecayDescriptor); + kfparticle->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor); kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); @@ -154,17 +155,17 @@ void KFParticle_Lambdac_Reco() kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); - kfparticle->setMinimumMass(LambdacMassRange.first); - kfparticle->setMaximumMass(LambdacMassRange.second); + 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"); + kfparticle->setContainerName(KFPARTICLE::LambdacName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::LambdacName + "_reconstruction.root"); se->registerSubsystem(kfparticle); - KFParticle::runLambdacReco = true; + KFPARTICLE::runLambdacReco = true; return; } @@ -175,57 +176,57 @@ void KFParticle_QA() Fun4AllServer *se = Fun4AllServer::instance(); - if (KFParticle::runUpsilonReco) + if (KFPARTICLE::runUpsilonReco) { - DecayFinder *UpsilonFinder = new DecayFinder("DecayFinder_" + KFParticle::UpsilonName); + DecayFinder *UpsilonFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::UpsilonName); UpsilonFinder->Verbosity(verbosity); - UpsilonFinder->setDecayDescriptor(KFParticle::UpsilonDecayDescriptor); - UpsilonFinder->triggerOnDecay(KFParticle::UpsilonTrigger); + 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, - UpsilonMassRange.first, - UpsilonMassRange.second); + QAG4SimulationKFParticle *UpsilonQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonMassRange.first, + KFPARTICLE::UpsilonMassRange.second); se->registerSubsystem(UpsilonQA); } - if (KFParticle::runD0Reco) + if (KFPARTICLE::runD0Reco) { - DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFParticle::D0Name); + DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFPARTICLE::D0Name); D0Finder->Verbosity(verbosity); - D0Finder->setDecayDescriptor(KFParticle::D0DecayDescriptor); - D0Finder->triggerOnDecay(KFParticle::D0Trigger); + 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, - D0MassRange.first, - D0MassRange.second); + QAG4SimulationKFParticle *D0QA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::D0Name, + KFPARTICLE::D0Name, + KFPARTICLE::D0MassRange.first, + KFPARTICLE::D0MassRange.second); se->registerSubsystem(D0QA); } - if (KFParticle::runLambdacReco) + if (KFPARTICLE::runLambdacReco) { - DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFParticle::LambdacName); + DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::LambdacName); LambdacFinder->Verbosity(verbosity); - LambdacFinder->setDecayDescriptor(KFParticle::LambdacDecayDescriptor); - LambdacFinder->triggerOnDecay(KFParticle::LambdacTrigger); + 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, - LambdacMassRange.first, - LambdacMassRange.second); + QAG4SimulationKFParticle *LambdacQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacMassRange.first, + KFPARTICLE::LambdacMassRange.second); se->registerSubsystem(LambdacQA); } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index c23045535..ac4b792bd 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -13,7 +13,7 @@ #include #include #include -//#include +#include #include #include #include @@ -522,9 +522,8 @@ int Fun4All_G4_sPHENIX( //====================== // Run KFParticle on evt //====================== - //if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); - //if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); - //if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco(); + if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); //---------------------- // Standard QAs From 06af5c4cb81141b3ec24af02de8b3b318364ffaf Mon Sep 17 00:00:00 2001 From: Wei Xie Date: Fri, 17 Dec 2021 09:49:13 -0500 Subject: [PATCH 1125/1222] G4_Intt.C: update to include deadmap --- common/G4_Intt.C | 87 +++++++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 9321977cd..53ee3d451 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -25,7 +26,7 @@ R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libqa_modules.so) -namespace Enable + namespace Enable { bool INTT = false; bool INTT_OVERLAPCHECK = false; @@ -40,9 +41,9 @@ 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}; + 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}; @@ -51,10 +52,10 @@ namespace G4INTT enum enu_InttDeadMapType // Dead map options for INTT { kInttNoDeadMap = 0, // All channel in Intt is alive - kIntt4PercentDeadMap = 4, // 4% of dead/masked area (2% sensor + 2% chip) as a typical FVTX Run14 production run. - kIntt8PercentDeadMap = 8 // 8% dead/masked area (6% sensor + 2% chip) as threshold of operational + kInttDeadMap = 1, // with dead channel }; - enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + //enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + enu_InttDeadMapType InttDeadMapOption = kInttDeadMap; // Choose Intt deadmap here } // namespace G4INTT @@ -72,7 +73,7 @@ void InttInit() } double Intt(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0) + const int absorberactive = 0) { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); bool intt_overlapcheck = Enable::OVERLAPCHECK || Enable::INTT_OVERLAPCHECK; @@ -105,7 +106,7 @@ double Intt(PHG4Reco* g4Reco, double radius, 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; + << " 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 @@ -122,6 +123,30 @@ void Intt_Cells() { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); + + // 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 <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "< Verbosity(verbosity); + //deadMapINTT -> Verbosity(1); + se->registerSubsystem(deadMapINTT); + // new storage containers PHG4InttHitReco* reco = new PHG4InttHitReco(); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here @@ -134,25 +159,25 @@ void Intt_Cells() //=========== // 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. - */ + 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); @@ -165,7 +190,8 @@ void Intt_Cells() // new containers PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); - digiintt->Verbosity(verbosity); + 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); @@ -183,7 +209,8 @@ void Intt_Clustering() 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 + // 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) From bdaded13e55c2dbeb3433176d3ccd860574887fd Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Tue, 21 Dec 2021 20:24:26 -0500 Subject: [PATCH 1126/1222] Porting Micromegas qa #403 to master branch (#483) * added Micromegas QA module * added Micromegas QA module Co-authored-by: Hugo Pereira Da Costa --- common/G4_Micromegas.C | 11 +++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 ++ 2 files changed, 13 insertions(+) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index f5ec3043f..1ca481fe4 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -14,6 +14,7 @@ #include #include +#include #include @@ -25,6 +26,7 @@ namespace Enable bool MICROMEGAS = false; bool MICROMEGAS_CELL = false; bool MICROMEGAS_CLUSTER = false; + bool MICROMEGAS_QA = false; } // namespace Enable namespace G4MICROMEGAS @@ -183,4 +185,13 @@ 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/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index ac4b792bd..6452e39d0 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -279,6 +279,7 @@ int Fun4All_G4_sPHENIX( 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 = true; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; @@ -538,6 +539,7 @@ int Fun4All_G4_sPHENIX( 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 and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA) QA_G4CaloTracking(); From 67abe5c3e5d6f3cff702a95a167fdd8c8e764da1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 Dec 2021 12:06:52 -0500 Subject: [PATCH 1127/1222] tiny changes in pipe dimensions (4cm diameter instead of 4.001 and 762 um thickness instead of 760) --- common/G4_Pipe.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index f1c2cac59..7bbc6573d 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -20,11 +20,11 @@ namespace Enable namespace G4PIPE { - 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_radius = 2.0; // 4.0 cm inner diameter from Dans drawing + double be_pipe_thickness = 0.0762; // 760 um based on Dans drawing double be_pipe_length = 80.0; // +/- 40 cm - double al_pipe_radius = 2.0005; // same as Be pipe + double al_pipe_radius = 2.0; // same as Be pipe double al_pipe_thickness = 0.1600; // 1.6 mm based on spec double al_pipe_length = 171.44; // extension beyond +/- 40 cm From fc0839a9d2c4e680950aa2d18ee5a3f2286f29a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 22 Dec 2021 16:46:14 -0500 Subject: [PATCH 1128/1222] add commented out setting for decalibrator and fixed cell energies --- common/G4_HcalIn_ref.C | 7 +++++++ common/G4_HcalOut_ref.C | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index f0537e0e9..a6ac0ba77 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -227,6 +227,8 @@ void HCALInner_Cells() // 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; @@ -240,6 +242,11 @@ void HCALInner_Towers() 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); diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 7bf8f6ed3..b5b9c21f8 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -153,6 +153,8 @@ void HCALOuter_Cells() // 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; @@ -167,6 +169,13 @@ void HCALOuter_Towers() 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 f1ba7392e24688a66133f819f60d9217eae9dc7e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 23 Dec 2021 15:48:09 -0500 Subject: [PATCH 1129/1222] set string flags for later conditions DB use --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 6452e39d0..09dfd66dd 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -59,6 +59,15 @@ int Fun4All_G4_sPHENIX( // or set it to a fixed value so you can debug your code // rc->set_IntFlag("RANDOMSEED", 12345); + //=============== + // conditions DB flags + //=============== + // tag + rc->set_StringFlag("XPLOAD_TAG","example_tag_1"); + // database + rc->set_StringFlag("XPLOAD_CONFIG","test"); + + //=============== // Input options //=============== @@ -374,8 +383,8 @@ int Fun4All_G4_sPHENIX( // 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/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 //--------------- From e582de4353673221e711f6b838d1740779525e26 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 6 Jan 2022 08:40:23 -0500 Subject: [PATCH 1130/1222] Add if statement to not run dead map if selected --- common/G4_Intt.C | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index 53ee3d451..be3548dab 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -124,29 +124,30 @@ void Intt_Cells() int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - // 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 <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "<deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); + } else { + cout <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "< Verbosity(verbosity); + //deadMapINTT -> Verbosity(1); + se->registerSubsystem(deadMapINTT); } - - deadMapINTT -> Verbosity(verbosity); - //deadMapINTT -> Verbosity(1); - se->registerSubsystem(deadMapINTT); - // new storage containers PHG4InttHitReco* reco = new PHG4InttHitReco(); // The timing windows are hard-coded in the INTT ladder model, they can be overridden here From 0ee16ee0c9a80bf645978964fad3ecba95ff86c4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 6 Jan 2022 09:26:32 -0500 Subject: [PATCH 1131/1222] clang-format --- common/G4_Intt.C | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index be3548dab..d3dab2b92 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -6,9 +6,9 @@ #include +#include #include #include -#include #include #include @@ -26,7 +26,7 @@ R__LOAD_LIBRARY(libg4intt.so) R__LOAD_LIBRARY(libintt.so) R__LOAD_LIBRARY(libqa_modules.so) - namespace Enable +namespace Enable { bool INTT = false; bool INTT_OVERLAPCHECK = false; @@ -41,9 +41,9 @@ 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}; + 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}; @@ -51,8 +51,8 @@ namespace G4INTT enum enu_InttDeadMapType // Dead map options for INTT { - kInttNoDeadMap = 0, // All channel in Intt is alive - kInttDeadMap = 1, // with dead channel + 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 @@ -73,7 +73,7 @@ void InttInit() } double Intt(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0) + const int absorberactive = 0) { int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); bool intt_overlapcheck = Enable::OVERLAPCHECK || Enable::INTT_OVERLAPCHECK; @@ -106,7 +106,7 @@ double Intt(PHG4Reco* g4Reco, double radius, 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; + << " 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 @@ -124,27 +124,32 @@ void Intt_Cells() int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); - if(G4INTT::InttDeadMapOption != G4INTT::kInttNoDeadMap) { + if (G4INTT::InttDeadMapOption != G4INTT::kInttNoDeadMap) + { // Load pre-defined deadmaps - PHG4InttDeadMapLoader * deadMapINTT = new PHG4InttDeadMapLoader("INTT"); - - for (int i = 0; i < G4INTT::n_intt_layer; i++) { + 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 <<"Tracking_Reco - fatal error - invalid InttDeadMapOption = "<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(verbosity); //deadMapINTT -> Verbosity(1); se->registerSubsystem(deadMapINTT); } @@ -191,8 +196,8 @@ void Intt_Cells() // new containers PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); - digiintt->Verbosity(verbosity); - //digiintt->Verbosity(3); + 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); @@ -210,7 +215,7 @@ void Intt_Clustering() 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 + // 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++) { @@ -222,7 +227,6 @@ void Intt_Clustering() se->registerSubsystem(inttclusterizer); } - void Intt_QA() { int verbosity = std::max(Enable::QA_VERBOSITY, Enable::INTT_VERBOSITY); From d607feb43294835ba57b03701b87024a3dc21cd7 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 11 Jan 2022 13:13:00 -0500 Subject: [PATCH 1132/1222] Removed micromegas tiles definitions, and micromegas configuration options All will be hardcoded in the next coresoftware update --- common/G4_Micromegas.C | 106 ++--------------------------------------- 1 file changed, 4 insertions(+), 102 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 1ca481fe4..6760dc966 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -31,21 +31,13 @@ namespace Enable namespace G4MICROMEGAS { - int n_micromegas_layer = 2; - enum Config - { - CONFIG_MINIMAL, - CONFIG_PHI_ONE_RING, - CONFIG_Z_ONE_SECTOR, - CONFIG_BASELINE, - CONFIG_MAXIMAL - }; - Config CONFIG = CONFIG_BASELINE; + // number of micromegas layers + int n_micromegas_layer = 2; // radius at which micromegas layers are installed double mm_radius = 85; - + } // namespace G4MICROMEGAS void MicromegasInit() @@ -63,7 +55,7 @@ void MicromegasInit() { G4TPC::n_gas_layer = 0; } - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 83.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 86.); BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 220. / 2.); BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -220. / 2.); } @@ -85,96 +77,6 @@ void Micromegas_Cells() // micromegas auto reco = new PHG4MicromegasHitReco; reco->Verbosity(0); - - static constexpr double length = 210; - static constexpr int nsectors = 12; - static constexpr double tile_length = 50; - static constexpr double tile_width = 25; - - switch (G4MICROMEGAS::CONFIG) - { - case G4MICROMEGAS::CONFIG_MINIMAL: - { - // one tile at mid rapidity in front of TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MINIMAL" << std::endl; - static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); - reco->set_tiles({{{phi0, 0, tile_width/CylinderGeomMicromegas::reference_radius, tile_length}}}); - break; - } - - case G4MICROMEGAS::CONFIG_PHI_ONE_RING: - { - // 12 tiles at mid rapidity, one in front of each TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_PHI_ONE_RING" << std::endl; - MicromegasTile::List tiles; - for (int i = 0; i < nsectors; ++i) - { - tiles.emplace_back(2. * M_PI * (0.5 + i) / nsectors, 0, tile_width/CylinderGeomMicromegas::reference_radius, tile_length); - } - reco->set_tiles(tiles); - break; - } - - case G4MICROMEGAS::CONFIG_Z_ONE_SECTOR: - { - // 4 tiles with full z coverage in front of one TPC sector - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_Z_ONE_SECTOR" << std::endl; - MicromegasTile::List tiles; - static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); - static constexpr int ntiles = 4; - for (int i = 0; i < ntiles; ++i) - { - tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); - } - reco->set_tiles(tiles); - break; - } - - case G4MICROMEGAS::CONFIG_BASELINE: - { - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_BASELINE" << std::endl; - MicromegasTile::List tiles; - - // for the first sector we put 4 tiles with full z coverage - static constexpr double phi0 = M_PI * (0.5 + 1. / nsectors); - static constexpr int ntiles_z = 4; - for (int i = 0; i < ntiles_z; ++i) - { - tiles.emplace_back(phi0, length * ((0.5 + i) / ntiles_z - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); - } - - // for the other sectors we put two tiles on either side of the central membrane - static constexpr double zoffset = 7; - for (int i = 1; i < nsectors; ++i) - { - const double phi = phi0 + 2.*M_PI*i/nsectors; - tiles.emplace_back( phi, length*(1.5/4-0.5) - zoffset, tile_width/CylinderGeomMicromegas::reference_radius, tile_length ); - tiles.emplace_back( phi, length*(2.5/4-0.5) + zoffset, tile_width/CylinderGeomMicromegas::reference_radius, tile_length ); - } - reco->set_tiles(tiles); - break; - } - - case G4MICROMEGAS::CONFIG_MAXIMAL: - { - std::cout << "Micromegas_Cells - Tiles configuration: CONFIG_MAXIMAL" << std::endl; - MicromegasTile::List tiles; - - // 4 tiles with full z coverage in front of each TPC sector - static constexpr int ntiles_z = 4; - for (int iphi = 0; iphi < nsectors; ++iphi) - { - const double phi = 2. * M_PI * (0.5 + iphi) / nsectors; - for (int iz = 0; iz < ntiles_z; ++iz) - { - tiles.emplace_back(phi, length * ((0.5 + iz) / ntiles_z - 0.5), tile_width/CylinderGeomMicromegas::reference_radius, tile_length); - } - } - reco->set_tiles(tiles); - break; - } - } - se->registerSubsystem(reco); se->registerSubsystem(new PHG4MicromegasDigitizer); From 99163c5f7c9713205aca7abcc828700caa9eb06c Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 1 Feb 2022 12:27:39 -0500 Subject: [PATCH 1133/1222] condition building mm surfaces in MakeActsGeometry to Enable::MICROMEGAS --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 30dd97d40..83516b969 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -101,6 +101,7 @@ void TrackingInit() geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); + geom->build_mm_surfaces(Enable::MICROMEGAS); se->registerSubsystem(geom); } From 7fe789c0c96525f2b83747103b789b6ea8cc4cc7 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 27 Jan 2022 17:10:36 -0500 Subject: [PATCH 1134/1222] removed configurable parameters --- common/G4_Micromegas.C | 5 ----- 1 file changed, 5 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 6760dc966..350beb263 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -34,9 +34,6 @@ namespace G4MICROMEGAS // number of micromegas layers int n_micromegas_layer = 2; - - // radius at which micromegas layers are installed - double mm_radius = 85; } // namespace G4MICROMEGAS @@ -66,8 +63,6 @@ void Micromegas(PHG4Reco* g4Reco) auto mm = new PHG4MicromegasSubsystem("MICROMEGAS", mm_layer); mm->OverlapCheck( Enable::OVERLAPCHECK ); mm->SetActive(); - mm->set_double_param("mm_length", 220); - mm->set_double_param("mm_radius", G4MICROMEGAS::mm_radius); g4Reco->registerSubsystem(mm); } From 4a7ad16fcb77523c74df6f3d878e166064f55322 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Fri, 11 Feb 2022 14:28:43 -0500 Subject: [PATCH 1135/1222] Disable cylinder supports --- common/G4_TrackingService.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index cad5254f7..5f874588d 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -226,15 +226,15 @@ float TrackingService(PHG4Reco *g4Reco, float radius) //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("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("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)); + //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)); From c3413c914294e10f40739229500a30d74fd6db66 Mon Sep 17 00:00:00 2001 From: cdean-github <59485912+cdean-github@users.noreply.github.com> Date: Fri, 11 Feb 2022 14:32:26 -0500 Subject: [PATCH 1136/1222] Disable cylinder supports (#490) --- common/G4_TrackingService.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index cad5254f7..5f874588d 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -226,15 +226,15 @@ float TrackingService(PHG4Reco *g4Reco, float radius) //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("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("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)); + //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)); From 498bfcfe8d38205a961b6953d0b404a575c1458a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 11 Feb 2022 14:52:13 -0500 Subject: [PATCH 1137/1222] surrounding black hole cylinder radius needs a 2cm increase --- common/G4_Micromegas.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index 350beb263..f352edc9c 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -52,7 +52,7 @@ void MicromegasInit() { G4TPC::n_gas_layer = 0; } - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 86.); + 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.); } From 84338d408be975229eb024b5a676cf70e60c926a Mon Sep 17 00:00:00 2001 From: cdean-github Date: Wed, 23 Feb 2022 16:15:15 -0500 Subject: [PATCH 1138/1222] Patch to use built-in Sartre generator --- common/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index ed0ec5bd7..80f7ba49c 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -470,7 +470,7 @@ void InputRegister() } // 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::READEIC) + if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::SARTRE or Input::READEIC) { if (Input::HEPMC) { From eb02d3af5e3ffc388a1b334f63bafa594391033e Mon Sep 17 00:00:00 2001 From: cdean-github <59485912+cdean-github@users.noreply.github.com> Date: Wed, 23 Feb 2022 16:22:33 -0500 Subject: [PATCH 1139/1222] Patch to use built-in Sartre generator (#492) * Disable cylinder supports * Patch to use built-in Sartre generator --- common/G4_Input.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index ed0ec5bd7..80f7ba49c 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -470,7 +470,7 @@ void InputRegister() } // 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::READEIC) + if (Input::HEPMC or Input::PYTHIA8 or Input::PYTHIA6 or Input::SARTRE or Input::READEIC) { if (Input::HEPMC) { From 10d80c5e33f1064eb4f5c381b61803c1d5a6366e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 24 Feb 2022 17:10:54 -0500 Subject: [PATCH 1140/1222] and is an alternative keyword, && is the primary one. In any case we should not mix them --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 09dfd66dd..fd9c32b29 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -271,19 +271,19 @@ int Fun4All_G4_sPHENIX( Enable::MVTX = true; Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; - Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true; + Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true; Enable::TrackingService = true; Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; Enable::INTT_CLUSTER = Enable::INTT_CELL && true; - Enable::INTT_QA = Enable::INTT_CLUSTER and Enable::QA && 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 and Enable::QA && true; + Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && true; Enable::MICROMEGAS = true; Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; @@ -292,7 +292,7 @@ int Fun4All_G4_sPHENIX( Enable::TRACKING_TRACK = true; Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; - Enable::TRACKING_QA = Enable::TRACKING_TRACK and Enable::QA && 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 @@ -304,7 +304,7 @@ int Fun4All_G4_sPHENIX( 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 and Enable::QA && true; + Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; @@ -312,7 +312,7 @@ int Fun4All_G4_sPHENIX( 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 and Enable::QA && true; + Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; @@ -323,7 +323,7 @@ int Fun4All_G4_sPHENIX( 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 and Enable::QA && true; + Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && true; Enable::EPD = true; @@ -351,7 +351,7 @@ int Fun4All_G4_sPHENIX( Enable::JETS = true; Enable::JETS_EVAL = Enable::JETS && true; - Enable::JETS_QA = Enable::JETS and Enable::QA && 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 @@ -551,7 +551,7 @@ int Fun4All_G4_sPHENIX( if (Enable::MICROMEGAS_QA) Micromegas_QA(); if (Enable::TRACKING_QA) Tracking_QA(); - if (Enable::TRACKING_QA and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA) QA_G4CaloTracking(); + if (Enable::TRACKING_QA && Enable::CEMC_QA && Enable::HCALIN_QA && Enable::HCALOUT_QA) QA_G4CaloTracking(); //-------------- // Set up Input Managers From 36b825e4a703f471a9c5a7155076654619cb186c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 24 Feb 2022 17:11:50 -0500 Subject: [PATCH 1141/1222] suppress cling -Wundefined-internal warning from this include --- common/G4_TPC.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 429a1984a..94aad1466 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -19,7 +19,11 @@ #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" #include +#pragma GCC diagnostic pop + #include #include From ed0719185a1dc9ff53df02293d55ec32dd572cb5 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 24 Feb 2022 19:49:21 -0500 Subject: [PATCH 1142/1222] load libqa_kfparticle.so and libdecayfinder.so to resolve macro content --- common/G4_KFParticle.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C index 2f9b5d0ee..8bfd8a49b 100644 --- a/common/G4_KFParticle.C +++ b/common/G4_KFParticle.C @@ -11,6 +11,8 @@ #include R__LOAD_LIBRARY(libkfparticle_sphenix.so) +R__LOAD_LIBRARY(libqa_kfparticle.so) +R__LOAD_LIBRARY(libdecayfinder.so) namespace Enable { From f9a63b0693a537033a586bed24da959297e1c524 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 4 Mar 2022 15:01:23 -0500 Subject: [PATCH 1143/1222] need to load libtpccalib.so for TpcDirectLaserReconstruction, move TimeOrderedDistortions.root from private area to CALIBRATIONSROOT --- common/G4_TPC.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 94aad1466..7395a3aff 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -35,6 +35,7 @@ R__LOAD_LIBRARY(libg4tpc.so) R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtpccalib.so) R__LOAD_LIBRARY(libqa_modules.so) namespace Enable @@ -68,7 +69,7 @@ namespace G4TPC auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; bool ENABLE_TIME_ORDERED_DISTORTIONS = false; - std::string time_ordered_distortion_filename = "/gpfs/mnt/gpfs02/sphenix/user/klest/TimeOrderedDistortions.root"; + std::string time_ordered_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/TimeOrderedDistortions.root"; // distortion corrections bool ENABLE_CORRECTIONS = false; From 6a0f6a422e47b8e2fd8b0f2b60df03c51e998551 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 10 Mar 2022 14:24:44 -0500 Subject: [PATCH 1144/1222] swap to acts track projection --- common/G4_Tracking.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 83516b969..92992536c 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -18,10 +18,10 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include +#include #include #include #include -#include #include #include #include @@ -418,7 +418,7 @@ void Tracking_Reco() // Track Projections //=============== - PHGenFitTrackProjection* projection = new PHGenFitTrackProjection(); + PHActsTrackProjection* projection = new PHActsTrackProjection(); projection->Verbosity(verbosity); se->registerSubsystem(projection); From 41c17d228ef529a4f4e0deb59c0d13ed7f74f862 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Mon, 14 Mar 2022 14:21:50 -0400 Subject: [PATCH 1145/1222] Disabled MVTX service macro --- common/G4_TrackingService.C | 6 +++++- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/G4_TrackingService.C b/common/G4_TrackingService.C index 5f874588d..edcb5a66a 100644 --- a/common/G4_TrackingService.C +++ b/common/G4_TrackingService.C @@ -18,7 +18,11 @@ #include #include -//sPHENIX Tracking Services +//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; diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index fd9c32b29..f21052105 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -272,7 +272,7 @@ int Fun4All_G4_sPHENIX( Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true; - Enable::TrackingService = true; + Enable::TrackingService = false; Enable::INTT = true; Enable::INTT_CELL = Enable::INTT && true; From aaa525ba30839303452045fbc18bb89f700af2d1 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 15 Mar 2022 15:34:38 -0400 Subject: [PATCH 1146/1222] remove rave --- common/G4_Tracking.C | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 92992536c..9d2ae19c3 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -24,7 +24,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include -#include #include #include #include @@ -77,11 +76,6 @@ namespace G4TRACKING 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() @@ -404,18 +398,6 @@ void Tracking_Reco() // 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 //=============== PHActsTrackProjection* projection = new PHActsTrackProjection(); @@ -479,15 +461,6 @@ void Tracking_QA() 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 //================================= QAG4SimulationVertex* qav = new QAG4SimulationVertex(); From 6fa93b3f012cf4bec2f5e883b7d1c177010bb958 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 18 Mar 2022 15:07:27 -0400 Subject: [PATCH 1147/1222] set correct conditions DB flags --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index fd9c32b29..5e4cd87a4 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -63,9 +63,9 @@ int Fun4All_G4_sPHENIX( // conditions DB flags //=============== // tag - rc->set_StringFlag("XPLOAD_TAG","example_tag_1"); + rc->set_StringFlag("XPLOAD_TAG","sPHENIX_ExampleGT_1"); // database - rc->set_StringFlag("XPLOAD_CONFIG","test"); + rc->set_StringFlag("XPLOAD_CONFIG","sPHENIX_cdb"); //=============== From 17658f417acaf69077ecdcb5b13c207575213b5b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 19 Mar 2022 00:38:37 -0400 Subject: [PATCH 1148/1222] add 64 bit timestamp and cdb option for magnetic fields --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 +++- detectors/sPHENIX/G4Setup_sPHENIX.C | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 5e4cd87a4..e8e5743c0 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -64,8 +64,10 @@ int Fun4All_G4_sPHENIX( //=============== // tag rc->set_StringFlag("XPLOAD_TAG","sPHENIX_ExampleGT_1"); - // database + // database config rc->set_StringFlag("XPLOAD_CONFIG","sPHENIX_cdb"); + // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",12345678912345); //=============== diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 937363e81..303ad821c 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -100,7 +100,8 @@ int G4Setup() if (stringline.fail()) { // conversion to double fails -> we have a string - if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos) + if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos || + G4MAGNET::magfield == "CDB") { g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); } From 8d7ef8e30f0162a5fd5ccf81b06e00f2e3e398fe Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 22 Mar 2022 11:13:06 -0400 Subject: [PATCH 1149/1222] Give simple event generator a realistic vertex distribution --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 16e85e1c2..2550b4cea 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -148,11 +148,11 @@ int Fun4All_G4_sPHENIX( } else { - INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); + 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., 0., 5.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0.01, 0.01, 5.); } INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); From fac16bbac08a9a2778b1fbee83bccba657c800ca Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 23 Mar 2022 14:10:47 -0400 Subject: [PATCH 1150/1222] rebase QA branch --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 39 +++++++++++++++++--------- detectors/sPHENIX/README.md | 7 +++++ 2 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 detectors/sPHENIX/README.md diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 2550b4cea..dc6d13548 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -57,7 +57,7 @@ int Fun4All_G4_sPHENIX( // 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); + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()); //=============== // conditions DB flags @@ -96,7 +96,7 @@ int Fun4All_G4_sPHENIX( //INPUTEMBED::listfile[0] = embed_input_file; Input::SIMPLE = true; - // Input::SIMPLE_NUMBER = 2; // if you need 2 of them + Input::SIMPLE_NUMBER = 2; // if you need 2 of them // Input::SIMPLE_VERBOSITY = 1; // Input::PYTHIA6 = true; @@ -114,8 +114,8 @@ int Fun4All_G4_sPHENIX( //Input::LAMBDAC = false; //Input::LAMBDAC_VERBOSITY = 0; // Upsilon generator - //Input::UPSILON = true; - //Input::UPSILON_NUMBER = 3; // if you need 3 of them + Input::UPSILON = true; + Input::UPSILON_NUMBER = 1; // if you need 3 of them //Input::UPSILON_VERBOSITY = 0; // Input::HEPMC = true; @@ -140,7 +140,9 @@ int Fun4All_G4_sPHENIX( // add the settings for other with [1], next with [2]... if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); + // low pT pions + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 10); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi+", 10); if (Input::HEPMC || Input::EMBED) { INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); @@ -156,7 +158,16 @@ int Fun4All_G4_sPHENIX( } INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 2.); + + // high pT pions + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi-", 10); + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi+", 10); + 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(-1, 1); + INPUTGENERATOR::SimpleEventGenerator[1]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[1]->set_pt_range(2, 50.); } // Upsilons // if you run more than one of these Input::UPSILON_NUMBER > 1 @@ -293,14 +304,14 @@ int Fun4All_G4_sPHENIX( Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true; Enable::TRACKING_TRACK = true; - Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; - Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && false; + Enable::TRACKING_QA = Enable::TRACKING_TRACK and 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 = true; + Enable::CEMC = false; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; Enable::CEMC_TOWER = Enable::CEMC_CELL && true; @@ -308,7 +319,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; - Enable::HCALIN = true; + Enable::HCALIN = false; Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -316,10 +327,10 @@ int Fun4All_G4_sPHENIX( Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; - Enable::MAGNET = true; - Enable::MAGNET_ABSORBER = true; + Enable::MAGNET = false; + Enable::MAGNET_ABSORBER = false; - Enable::HCALOUT = true; + Enable::HCALOUT = false; Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; @@ -351,7 +362,7 @@ int Fun4All_G4_sPHENIX( Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; - Enable::JETS = true; + Enable::JETS = false; Enable::JETS_EVAL = Enable::JETS && true; Enable::JETS_QA = Enable::JETS && Enable::QA && true; diff --git a/detectors/sPHENIX/README.md b/detectors/sPHENIX/README.md new file mode 100644 index 000000000..cde1b7bbb --- /dev/null +++ b/detectors/sPHENIX/README.md @@ -0,0 +1,7 @@ +[//]: # (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-low-occupancy) + +## Tracking QA at low occupancy + +Low occupancy tracking QA concists full tracker + reconstruction of events with 20 $\pi^+$, 20 $\pi^-$ and one $\Upsilon(1S) \rightarrow e^+ e^-$. 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-low-occupancy or [comparing it to the master branch](https://github.com/sPHENIX-Collaboration/macros/compare/QA-tracking-low-occupancy?expand=1). From 0653d8cc0776c766d13e534e6f7267f91b1ab5a9 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Wed, 23 Mar 2022 14:12:46 -0400 Subject: [PATCH 1151/1222] rebase QA branch --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 38 ++++++++++++++++++-------- detectors/sPHENIX/README.md | 10 ++++--- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index dc6d13548..9b126e263 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -58,7 +58,6 @@ int Fun4All_G4_sPHENIX( // 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()); - //=============== // conditions DB flags //=============== @@ -96,7 +95,7 @@ int Fun4All_G4_sPHENIX( //INPUTEMBED::listfile[0] = embed_input_file; Input::SIMPLE = true; - Input::SIMPLE_NUMBER = 2; // if you need 2 of them + Input::SIMPLE_NUMBER = 3; // if you need 2 of them // Input::SIMPLE_VERBOSITY = 1; // Input::PYTHIA6 = true; @@ -114,7 +113,7 @@ int Fun4All_G4_sPHENIX( //Input::LAMBDAC = false; //Input::LAMBDAC_VERBOSITY = 0; // Upsilon generator - Input::UPSILON = true; + Input::UPSILON = false; Input::UPSILON_NUMBER = 1; // if you need 3 of them //Input::UPSILON_VERBOSITY = 0; @@ -140,9 +139,17 @@ int Fun4All_G4_sPHENIX( // 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-", 10); - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi+", 10); + 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); @@ -156,18 +163,27 @@ int Fun4All_G4_sPHENIX( 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(-1, 1); - INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + 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-", 10); - INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi+", 10); + 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(-1, 1); - INPUTGENERATOR::SimpleEventGenerator[1]->set_phi_range(-M_PI, M_PI); + 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 diff --git a/detectors/sPHENIX/README.md b/detectors/sPHENIX/README.md index cde1b7bbb..03a189d86 100644 --- a/detectors/sPHENIX/README.md +++ b/detectors/sPHENIX/README.md @@ -1,7 +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-low-occupancy) +[//]: # (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 low occupancy +## Tracking QA at high occupancy -Low occupancy tracking QA concists full tracker + reconstruction of events with 20 $\pi^+$, 20 $\pi^-$ and one $\Upsilon(1S) \rightarrow e^+ e^-$. Please note the calorimeters are disabled to improve execution speed, which also removed some of the correlated albedo background for the tracker. +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. -The source code of the macro can be found at https://github.com/sPHENIX-Collaboration/macros/tree/QA-tracking-low-occupancy or [comparing it to the master branch](https://github.com/sPHENIX-Collaboration/macros/compare/QA-tracking-low-occupancy?expand=1). +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). From b65e026892f7dcc9df22086dbb096d144e6b42cb Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 23 Mar 2022 14:41:24 -0400 Subject: [PATCH 1152/1222] Updated default distortion and correction files to working combination --- common/G4_TPC.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 7395a3aff..e879bf7bf 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -66,14 +66,14 @@ namespace G4TPC // distortions bool ENABLE_STATIC_DISTORTIONS = false; - auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + 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")) + "/TPC/DistortionMaps/fluct_average.rev3.1side.3d.file0.h_negz.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root"; + 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; From fee7e9902b4803b551bf866eeb98aaac6bf4cc92 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 4 Apr 2022 09:53:53 -0400 Subject: [PATCH 1153/1222] add silicon seed merger --- common/G4_Tracking.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 9d2ae19c3..62adf44d9 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -24,6 +24,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include +#include #include #include #include @@ -124,6 +125,10 @@ void Tracking_Reco() silicon_Seeding->Verbosity(verbosity); silicon_Seeding->fieldMapName(G4MAGNET::magfield); se->registerSubsystem(silicon_Seeding); + + PHSiliconSeedMerger *merger = new PHSiliconSeedMerger(); + merger->Verbosity(verbosity); + se->registerSubsystem(merger); } //================================================ From b80387bdf00653f6e79219d9868a223ff584a75c Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 5 Apr 2022 15:37:26 -0400 Subject: [PATCH 1154/1222] Remove obsolete set commands for PHSiliconTpcTrackMatcher. --- common/G4_Tracking.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 62adf44d9..a5fae5c50 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -228,10 +228,8 @@ void Tracking_Reco() 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); From 22214a625a23a9b54216e7f4f9b537f43396f770 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 8 Apr 2022 10:13:43 -0400 Subject: [PATCH 1155/1222] add truth table module --- common/G4_Tracking.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index a5fae5c50..5a7026062 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -15,6 +15,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include +#include #include #include @@ -441,6 +442,10 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + return; } From 4ad41a070fa86ac1a91bd10b4f0acb7289bc0991 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 Apr 2022 11:13:52 -0400 Subject: [PATCH 1156/1222] add black hole again (please do not just comment things out, this prevented standalone running of the mvtx) --- common/G4_Mvtx.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 225595eb6..42704ba31 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -50,9 +50,9 @@ namespace G4MVTXAlignment void MvtxInit() { - //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 5); - //BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -20); - //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 25.); + 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, From c645d98aaa464b3a115b7cb92d9f57dbe1e875fb Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 Apr 2022 11:14:42 -0400 Subject: [PATCH 1157/1222] put absorber and support readout for INTT under ENABLE namespace --- common/G4_Intt.C | 10 ++++++++++ detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index d3dab2b92..fd23d1740 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -29,10 +29,12 @@ 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 @@ -98,6 +100,14 @@ double Intt(PHG4Reco* g4Reco, double radius, 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 diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 2550b4cea..965f5c764 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -277,6 +277,8 @@ int Fun4All_G4_sPHENIX( Enable::TrackingService = false; 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; @@ -344,6 +346,7 @@ int Fun4All_G4_sPHENIX( Enable::GLOBAL_RECO = true; //Enable::GLOBAL_FASTSIM = true; + //Enable::KFPARTICLE = true; //Enable::KFPARTICLE_VERBOSITY = 1; //Enable::KFPARTICLE_TRUTH_MATCH = true; @@ -387,7 +390,7 @@ int Fun4All_G4_sPHENIX( // 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 +// G4MAGNET::magfield_rescale = 1.; // make consistent with expected Babar field strength of 1.4T //--------------- // Pythia Decayer From 5de399f6163dfa37bdb60413e6bf564c62934b2e Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 8 Apr 2022 12:27:52 -0400 Subject: [PATCH 1158/1222] added flag to run "simple" clusterizer instead of default clusterizer this is meant for testing purpose when investigating direct laser reconstruction --- common/G4_TPC.C | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index e879bf7bf..8af86432e 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -22,6 +22,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wundefined-internal" #include +#include #pragma GCC diagnostic pop #include @@ -63,6 +64,9 @@ namespace G4TPC // TPC drift velocity scale double drift_velocity_scale = 1.0; + + // use simple clusterizer + bool USE_SIMPLE_CLUSTERIZER = false; // distortions bool ENABLE_STATIC_DISTORTIONS = false; @@ -260,11 +264,21 @@ void TPC_Clustering() // For the Tpc //========== - auto tpcclusterizer = new TpcClusterizer; - tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); - tpcclusterizer->Verbosity(verbosity); - se->registerSubsystem(tpcclusterizer); + if( G4TPC::USE_SIMPLE_CLUSTERIZER ) + { + + auto tpcclusterizer = new TpcSimpleClusterizer; + tpcclusterizer->Verbosity(verbosity); + se->registerSubsystem(tpcclusterizer); + + } else { + + auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); + tpcclusterizer->Verbosity(verbosity); + se->registerSubsystem(tpcclusterizer); + } if( !G4TPC::ENABLE_DIRECT_LASER_HITS ) { From 72b6151a37fb29470cfaf9652299c3793d268f36 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 Apr 2022 07:36:41 -0400 Subject: [PATCH 1159/1222] set embedid only if Input::EMBED is true --- common/G4_Input.C | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/common/G4_Input.C b/common/G4_Input.C index 80f7ba49c..cf91445f4 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -272,9 +272,12 @@ void InputInit() INPUTGENERATOR::Pythia6 = new PHPythia6(); INPUTGENERATOR::Pythia6->set_config_file(PYTHIA6::config_file); + if (Input::EMBED) + { INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); Input::PYTHIA6_EmbedId = Input::EmbedId; Input::EmbedId++; + } } if (Input::PYTHIA8) { @@ -282,9 +285,12 @@ void InputInit() // see coresoftware/generators/PHPythia8 for example config INPUTGENERATOR::Pythia8->set_config_file(PYTHIA8::config_file); + if (Input::EMBED) + { INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); Input::PYTHIA8_EmbedId = Input::EmbedId; Input::EmbedId++; + } } if (Input::SARTRE) { @@ -298,9 +304,12 @@ void InputInit() INPUTGENERATOR::SartreTrigger->SetEtaHighLow(1.0, -1.1); // central arm INPUTGENERATOR::SartreTrigger->PrintConfig(); + if (Input::EMBED) + { INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); Input::SARTRE_EmbedId = Input::EmbedId; Input::EmbedId++; + } } // single particle generators if (Input::DZERO) @@ -309,9 +318,12 @@ void InputInit() { std::string name = "DZERO_" + std::to_string(i); PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); + if (Input::EMBED) + { dzero->Embed(Input::EmbedId); Input::DZERO_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } } @@ -321,9 +333,12 @@ void InputInit() { std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); + if (Input::EMBED) + { gun->Embed(Input::EmbedId); Input::GUN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::Gun.push_back(gun); } } @@ -333,9 +348,12 @@ void InputInit() { std::string name = "IONGUN_" + std::to_string(i); PHG4IonGun *iongun = new PHG4IonGun(name); + if (Input::EMBED) + { iongun->Embed(Input::EmbedId); Input::IONGUN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::IonGun.push_back(iongun); } } @@ -345,9 +363,12 @@ void InputInit() { std::string name = "PGEN_" + std::to_string(i); PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(name); + if (Input::EMBED) + { pgen->Embed(Input::EmbedId); Input::PGEN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::ParticleGenerator.push_back(pgen); } } @@ -357,9 +378,12 @@ void InputInit() { std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); + if (Input::EMBED) + { simple->Embed(Input::EmbedId); Input::PGEN_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } } @@ -369,9 +393,12 @@ void InputInit() { std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); + if (Input::EMBED) + { upsilon->Embed(Input::EmbedId); Input::UPSILON_EmbedIds.insert(Input::EmbedId); Input::EmbedId++; + } INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } From b328fe1d36040da432c6a67e98f5b4b9aa1f6ff2 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 13 Apr 2022 07:37:28 -0400 Subject: [PATCH 1160/1222] clang-format --- common/G4_Input.C | 90 +++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index cf91445f4..e89cd783e 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -274,9 +274,9 @@ void InputInit() if (Input::EMBED) { - INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); - Input::PYTHIA6_EmbedId = Input::EmbedId; - Input::EmbedId++; + INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); + Input::PYTHIA6_EmbedId = Input::EmbedId; + Input::EmbedId++; } } if (Input::PYTHIA8) @@ -287,9 +287,9 @@ void InputInit() if (Input::EMBED) { - INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); - Input::PYTHIA8_EmbedId = Input::EmbedId; - Input::EmbedId++; + INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); + Input::PYTHIA8_EmbedId = Input::EmbedId; + Input::EmbedId++; } } if (Input::SARTRE) @@ -306,9 +306,9 @@ void InputInit() if (Input::EMBED) { - INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); - Input::SARTRE_EmbedId = Input::EmbedId; - Input::EmbedId++; + INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); + Input::SARTRE_EmbedId = Input::EmbedId; + Input::EmbedId++; } } // single particle generators @@ -318,12 +318,12 @@ void InputInit() { std::string name = "DZERO_" + std::to_string(i); PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); - if (Input::EMBED) - { - dzero->Embed(Input::EmbedId); - Input::DZERO_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + dzero->Embed(Input::EmbedId); + Input::DZERO_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } } @@ -333,12 +333,12 @@ void InputInit() { std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); - if (Input::EMBED) - { - gun->Embed(Input::EmbedId); - Input::GUN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + gun->Embed(Input::EmbedId); + Input::GUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::Gun.push_back(gun); } } @@ -348,12 +348,12 @@ void InputInit() { std::string name = "IONGUN_" + std::to_string(i); PHG4IonGun *iongun = new PHG4IonGun(name); - if (Input::EMBED) - { - iongun->Embed(Input::EmbedId); - Input::IONGUN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + iongun->Embed(Input::EmbedId); + Input::IONGUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::IonGun.push_back(iongun); } } @@ -363,12 +363,12 @@ void InputInit() { std::string name = "PGEN_" + std::to_string(i); PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(name); - if (Input::EMBED) - { - pgen->Embed(Input::EmbedId); - Input::PGEN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + pgen->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::ParticleGenerator.push_back(pgen); } } @@ -378,12 +378,12 @@ void InputInit() { std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); - if (Input::EMBED) - { - simple->Embed(Input::EmbedId); - Input::PGEN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + simple->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } } @@ -393,12 +393,12 @@ void InputInit() { std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); - if (Input::EMBED) - { - upsilon->Embed(Input::EmbedId); - Input::UPSILON_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + if (Input::EMBED) + { + upsilon->Embed(Input::EmbedId); + Input::UPSILON_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + } INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } From 20dfe0bf6e21f4ff200a4d1368c47e3b52401244 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 Apr 2022 10:59:24 -0400 Subject: [PATCH 1161/1222] Revert "Embedid" --- common/G4_Input.C | 81 ++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index e89cd783e..80f7ba49c 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -272,12 +272,9 @@ void InputInit() INPUTGENERATOR::Pythia6 = new PHPythia6(); INPUTGENERATOR::Pythia6->set_config_file(PYTHIA6::config_file); - if (Input::EMBED) - { - INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); - Input::PYTHIA6_EmbedId = Input::EmbedId; - Input::EmbedId++; - } + INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); + Input::PYTHIA6_EmbedId = Input::EmbedId; + Input::EmbedId++; } if (Input::PYTHIA8) { @@ -285,12 +282,9 @@ void InputInit() // see coresoftware/generators/PHPythia8 for example config INPUTGENERATOR::Pythia8->set_config_file(PYTHIA8::config_file); - if (Input::EMBED) - { - INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); - Input::PYTHIA8_EmbedId = Input::EmbedId; - Input::EmbedId++; - } + INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); + Input::PYTHIA8_EmbedId = Input::EmbedId; + Input::EmbedId++; } if (Input::SARTRE) { @@ -304,12 +298,9 @@ void InputInit() INPUTGENERATOR::SartreTrigger->SetEtaHighLow(1.0, -1.1); // central arm INPUTGENERATOR::SartreTrigger->PrintConfig(); - if (Input::EMBED) - { - INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); - Input::SARTRE_EmbedId = Input::EmbedId; - Input::EmbedId++; - } + INPUTGENERATOR::Sartre->set_embedding_id(Input::EmbedId); + Input::SARTRE_EmbedId = Input::EmbedId; + Input::EmbedId++; } // single particle generators if (Input::DZERO) @@ -318,12 +309,9 @@ void InputInit() { std::string name = "DZERO_" + std::to_string(i); PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); - if (Input::EMBED) - { - dzero->Embed(Input::EmbedId); - Input::DZERO_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + dzero->Embed(Input::EmbedId); + Input::DZERO_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); } } @@ -333,12 +321,9 @@ void InputInit() { std::string name = "GUN_" + std::to_string(i); PHG4ParticleGun *gun = new PHG4ParticleGun(name); - if (Input::EMBED) - { - gun->Embed(Input::EmbedId); - Input::GUN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + gun->Embed(Input::EmbedId); + Input::GUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::Gun.push_back(gun); } } @@ -348,12 +333,9 @@ void InputInit() { std::string name = "IONGUN_" + std::to_string(i); PHG4IonGun *iongun = new PHG4IonGun(name); - if (Input::EMBED) - { - iongun->Embed(Input::EmbedId); - Input::IONGUN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + iongun->Embed(Input::EmbedId); + Input::IONGUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::IonGun.push_back(iongun); } } @@ -363,12 +345,9 @@ void InputInit() { std::string name = "PGEN_" + std::to_string(i); PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(name); - if (Input::EMBED) - { - pgen->Embed(Input::EmbedId); - Input::PGEN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + pgen->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::ParticleGenerator.push_back(pgen); } } @@ -378,12 +357,9 @@ void InputInit() { std::string name = "EVTGENERATOR_" + std::to_string(i); PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); - if (Input::EMBED) - { - simple->Embed(Input::EmbedId); - Input::PGEN_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + simple->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::SimpleEventGenerator.push_back(simple); } } @@ -393,12 +369,9 @@ void InputInit() { std::string name = "UPSILON_" + std::to_string(i); PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); - if (Input::EMBED) - { - upsilon->Embed(Input::EmbedId); - Input::UPSILON_EmbedIds.insert(Input::EmbedId); - Input::EmbedId++; - } + upsilon->Embed(Input::EmbedId); + Input::UPSILON_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); } } From e64509f3b92446e6b935f3a1542b1d98ab61607c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 14 Apr 2022 13:28:35 -0400 Subject: [PATCH 1162/1222] start EmbedId = 2 if Input::EMBED is set --- common/G4_Input.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/G4_Input.C b/common/G4_Input.C index 80f7ba49c..39424059b 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -241,6 +241,13 @@ 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) From 881b8b5ab9683a43636f68a7d0fe76291dd8f28e Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 21 Apr 2022 15:04:27 -0400 Subject: [PATCH 1163/1222] Add some parameter setters. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 965f5c764..fe63f4d13 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -57,7 +57,8 @@ int Fun4All_G4_sPHENIX( // 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); + //rc->set_IntFlag("RANDOMSEED", 12345); + //rc->set_IntFlag("RANDOMSEED", 1234); //=============== // conditions DB flags @@ -140,7 +141,7 @@ int Fun4All_G4_sPHENIX( // add the settings for other with [1], next with [2]... if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 1); if (Input::HEPMC || Input::EMBED) { INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); @@ -156,7 +157,7 @@ int Fun4All_G4_sPHENIX( } INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.3, 0.4); } // Upsilons // if you run more than one of these Input::UPSILON_NUMBER > 1 @@ -302,7 +303,7 @@ int Fun4All_G4_sPHENIX( // into the tracking, cannot run together with CEMC // Enable::CEMCALBEDO = true; - Enable::CEMC = true; + // Enable::CEMC = true; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; Enable::CEMC_TOWER = Enable::CEMC_CELL && true; @@ -310,7 +311,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; - Enable::HCALIN = true; + ///Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -318,10 +319,10 @@ int Fun4All_G4_sPHENIX( Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; - Enable::MAGNET = true; + // Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; - Enable::HCALOUT = true; + //Enable::HCALOUT = true; Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; From da855f8beda85dd8689967586e34c15312c7ca30 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 26 Apr 2022 17:03:08 -0400 Subject: [PATCH 1164/1222] add boolean to set repeat flag in embedding input managers --- common/G4_Input.C | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 39424059b..4e8132e82 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -194,6 +194,7 @@ namespace INPUTEMBED { map filename; map listfile; + bool REPEAT = true; } // namespace INPUTEMBED namespace PYTHIA6 @@ -523,7 +524,10 @@ void InputManagers() Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); hitsin->fileopen(iter->second); hitsin->Verbosity(Input::VERBOSITY); - hitsin->Repeat(); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } se->registerInputManager(hitsin); } for (auto iter = INPUTEMBED::listfile.begin(); iter != INPUTEMBED::listfile.end(); ++iter) @@ -532,7 +536,10 @@ void InputManagers() Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); hitsin->AddListFile(iter->second); hitsin->Verbosity(Input::VERBOSITY); - hitsin->Repeat(); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } se->registerInputManager(hitsin); } } From 6c36d884b075666b3702fbba535b05005caf90c6 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 26 Apr 2022 17:09:09 -0400 Subject: [PATCH 1165/1222] allow run(0) if INPUTEMBED::REPEAT is false --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 965f5c764..d708eb1e4 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -605,7 +605,8 @@ int Fun4All_G4_sPHENIX( return 0; } // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !Input::HEPMC && !Input::READHITS) + // 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; From 6a9b0f6af20d0bb527f315bf9a105edb1e6753ba Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 26 Apr 2022 20:47:04 -0400 Subject: [PATCH 1166/1222] Minor changes. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index fe63f4d13..75a4cfeef 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -42,7 +42,7 @@ int Fun4All_G4_sPHENIX( const string &outdir = ".") { Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); + se->Verbosity(1); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. PHRandomSeed::Verbosity(1); @@ -141,7 +141,7 @@ int Fun4All_G4_sPHENIX( // add the settings for other with [1], next with [2]... if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 1); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 50); if (Input::HEPMC || Input::EMBED) { INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); From 248c0b2e9614ad0c811fb516ff0f9d8c2e168ef3 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 28 Apr 2022 13:34:48 -0400 Subject: [PATCH 1167/1222] Moved loading distortion corrections from G4_TPC::TPC_Clustering to G4_Tracking::Tracking_Reco The reason is that the distortion corrections are actually irrelevant to TPC clustering and relevant for the tracking. This is particularily important if we split the clustering and the tracking to two different macros Also added a flag to disable TPC hit_to_cluster association from the steering macro And a flag to disable initializing the ACTS magnetic field Both are needed to simplify the clusterize_only macro --- common/G4_TPC.C | 13 ++++--------- common/G4_Tracking.C | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 8af86432e..2dcf57c81 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -26,7 +26,6 @@ #pragma GCC diagnostic pop #include -#include #include @@ -88,6 +87,9 @@ namespace G4TPC // 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"; @@ -276,6 +278,7 @@ void TPC_Clustering() auto tpcclusterizer = new TpcClusterizer; tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); tpcclusterizer->Verbosity(verbosity); + tpcclusterizer->set_do_hit_association( G4TPC::DO_HIT_ASSOCIATION ); se->registerSubsystem(tpcclusterizer); } @@ -286,14 +289,6 @@ void TPC_Clustering() tpcclustercleaner->Verbosity(verbosity); se->registerSubsystem(tpcclustercleaner); } - - // space charge correction - if( G4TPC::ENABLE_CORRECTIONS ) - { - auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; - tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); - se->registerSubsystem(tpcLoadDistortionCorrection); - } // direct laser reconstruction if( G4TPC::ENABLE_DIRECT_LASER_HITS ) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 5a7026062..1b1d1f8c9 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -38,6 +38,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include +#include #include #include @@ -69,7 +70,8 @@ namespace G4TRACKING // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom bool add_fake_surfaces = true; - + bool init_acts_magfield = true; + // 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 @@ -88,17 +90,20 @@ void TrackingInit() } /// Build the Acts geometry - Fun4AllServer* se = Fun4AllServer::instance(); + auto se = Fun4AllServer::instance(); int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); /// Geometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); geom->Verbosity(verbosity); + + geom->loadMagField(G4TRACKING::init_acts_magfield); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); geom->build_mm_surfaces(Enable::MICROMEGAS); se->registerSubsystem(geom); + } void Tracking_Reco() @@ -106,6 +111,16 @@ void Tracking_Reco() int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); Fun4AllServer* se = Fun4AllServer::instance(); + // space charge correction + /* corrections are applied in the track finding, and via PHTpcClusterMover before the final track fit */ + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); + } + + // Assemble silicon clusters into track stubs - needed for initial vertex finding //============================================================ if (G4TRACKING::use_truth_silicon_seeding) From 3e659001aff81e2cfbc99c67c91cf98ec74dd1d0 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 2 May 2022 16:14:38 -0400 Subject: [PATCH 1168/1222] Do not run anything in tracking chain after PHTpcResiduals when SC_CALIB_MODE is on --- common/G4_Tracking.C | 100 ++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 1b1d1f8c9..2e71f6029 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -317,30 +317,34 @@ void Tracking_Reco() 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 + if (!G4TRACKING::SC_CALIBMODE) { - PHSimpleVertexFinder* vtxfinder = new PHSimpleVertexFinder(); - vtxfinder->Verbosity(verbosity); - se->registerSubsystem(vtxfinder); + // Choose the best silicon matched track for each TPC track seed + 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); } - - /// Propagate track positions to the vertex position - PHActsVertexPropagator* vtxProp = new PHActsVertexPropagator(); - vtxProp->Verbosity(verbosity); - se->registerSubsystem(vtxProp); + } //========================================================= @@ -391,26 +395,31 @@ void Tracking_Reco() residuals->Verbosity(verbosity); se->registerSubsystem(residuals); } - - 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 + + if (!G4TRACKING::SC_CALIBMODE) { - 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); + 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); + + } } //================================== @@ -419,10 +428,13 @@ void Tracking_Reco() // Track Projections //=============== - PHActsTrackProjection* projection = new PHActsTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem(projection); - + if (!G4TRACKING::SC_CALIBMODE) + { + auto projection = new PHActsTrackProjection; + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + } + return; } From 9b0dc27ca26eddfb9b566727d4f2de63c5da1897 Mon Sep 17 00:00:00 2001 From: cdean-github Date: Tue, 3 May 2022 09:37:26 -0400 Subject: [PATCH 1169/1222] Added option for MVTX SRO mode --- common/G4_Mvtx.C | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 225595eb6..464c7c491 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -33,6 +33,7 @@ namespace Enable bool MVTX_QA = false; bool MVTX_ABSORBER = false; int MVTX_VERBOSITY = 0; + bool MVTX_SRO = false; } // namespace Enable @@ -92,6 +93,7 @@ void Mvtx_Cells() // new storage containers PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); maps_hits->Verbosity(verbosity); + maps_hits->set_int_param("mvtx_in_sphenix_srdo", Enable::MVTX_SRO); for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) { // override the default timing window for this layer - default is +/- 5000 ns From 0c84d014da515c1dd7527d23d9d68b6da81f032a Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 3 May 2022 12:44:39 -0400 Subject: [PATCH 1170/1222] Split Tracking_Reco into two functions: - Tracking_Reco_TrackSeeding that does the seeding - Tracking_Reco_TrackFit that does the track fit, vertexing, and track propagation to vertex and EMCAL This should allow to run track seeding and track finding in two different macros --- common/G4_Tracking.C | 353 ++++++++++++++++++------------------------- 1 file changed, 145 insertions(+), 208 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2e71f6029..b719a3de4 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -89,11 +89,11 @@ void TrackingInit() G4MICROMEGAS::n_micromegas_layer = 0; } - /// Build the Acts geometry + // Build the Acts geometry auto se = Fun4AllServer::instance(); int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - /// Geometry must be built before any Acts modules + // Geometry must be built before any Acts modules MakeActsGeometry* geom = new MakeActsGeometry(); geom->Verbosity(verbosity); @@ -103,13 +103,6 @@ void TrackingInit() geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); geom->build_mm_surfaces(Enable::MICROMEGAS); se->registerSubsystem(geom); - -} - -void Tracking_Reco() -{ - int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); - Fun4AllServer* se = Fun4AllServer::instance(); // space charge correction /* corrections are applied in the track finding, and via PHTpcClusterMover before the final track fit */ @@ -119,55 +112,56 @@ void Tracking_Reco() tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); se->registerSubsystem(tpcLoadDistortionCorrection); } - - // 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); - - PHSiliconSeedMerger *merger = new PHSiliconSeedMerger(); - merger->Verbosity(verbosity); - se->registerSubsystem(merger); - } +void Tracking_Reco_TrackSeed() +{ + + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); - //================================================ - // Section 1: Reco chain of track propagation and final fitting - //================================================ if (!G4TRACKING::use_full_truth_track_seeding) - { - // TPC track seeding (finds all clusters in TPC for tracks) - //============================================ + { + // 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("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 { + 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 - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + auto 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 - { + + } 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) @@ -183,11 +177,12 @@ void Tracking_Reco() seeder->useFixedClusterError(true); se->registerSubsystem(seeder); - PHTpcTrackSeedCircleFit* vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); + // perform track circle fit to get firt estimate of track parameters at origin
 auto vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); vtxassoc2->Verbosity(verbosity); se->registerSubsystem(vtxassoc2); - PHSimpleKFProp* cprop = new PHSimpleKFProp("PHSimpleKFProp"); + // 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) { @@ -200,16 +195,7 @@ void Tracking_Reco() se->registerSubsystem(cprop); } - // Associate TPC track stubs with silicon and Micromegas - //============================================= - - /* - * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks - * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles - * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER - */ - if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); - + // redo circle fit on fully propagated tracks auto vtxassoc = new PHTpcTrackSeedCircleFit; vtxassoc->Verbosity(verbosity); se->registerSubsystem(vtxassoc); @@ -218,29 +204,20 @@ void Tracking_Reco() auto ghosts = new PHGhostRejection; ghosts->Verbosity(verbosity); se->registerSubsystem(ghosts); - - // correct for particle propagation in TPC - se->registerSubsystem(new PHTpcDeltaZCorrection); - - // Silicon cluster matching to TPC track seeds + + // match silicon track seeds to TPC track seeds if (G4TRACKING::use_truth_si_matching) { - std::cout << " Using truth Si matching " << std::endl; + 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 - // intended only for diagnostics - PHTruthSiliconAssociation* silicon_assoc = new PHTruthSiliconAssociation(); + auto silicon_assoc = new PHTruthSiliconAssociation; silicon_assoc->Verbosity(verbosity); se->registerSubsystem(silicon_assoc); - } - else - { - std::cout << " Using stub matching for Si matching " << std::endl; - + } else { + std::cout << "Tracking_Reco_TrackSeed - 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(); + auto silicon_match = new PHSiliconTpcTrackMatching; silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); @@ -250,24 +227,22 @@ void Tracking_Reco() // 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 - { + } 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 + silicon_match->set_test_windows_printout(false); // used for tuning search windows se->registerSubsystem(silicon_match); } - + // Associate Micromegas clusters with the tracks - if (G4MICROMEGAS::n_micromegas_layer > 0) + if( Enable::MICROMEGAS ) { - std::cout << " Using Micromegas matching " << std::endl; + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; // Match TPC track stubs from CA seeder to clusters in the micromegas layers - PHMicromegasTpcTrackMatching* mm_match = new PHMicromegasTpcTrackMatching(); + auto mm_match = new PHMicromegasTpcTrackMatching; mm_match->Verbosity(verbosity); mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) @@ -279,9 +254,7 @@ void Tracking_Reco() 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 - { + } 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); @@ -293,149 +266,113 @@ void Tracking_Reco() 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); - /// If running with distortions, fit only the silicon+MMs first - actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); - actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); - 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->setSavehistograms( G4TRACKING::SC_SAVEHISTOGRAMS ); - residuals->setHistogramOutputfile( G4TRACKING::SC_HISTOGRAMOUTPUT_FILENAME ); - residuals->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); - residuals->Verbosity(verbosity); - se->registerSubsystem(residuals); - } - - if (!G4TRACKING::SC_CALIBMODE) - { - // Choose the best silicon matched track for each TPC track seed - 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); - } - - } - - //========================================================= - // Section 2: Full truth track finding with Acts final fitting - //========================================================= - else if (G4TRACKING::use_full_truth_track_seeding) - { - std::cout << " Using full truth track seeding for Acts" << std::endl; + } 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 - PHTruthTrackSeeding* pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); pat_rec->Verbosity(verbosity); pat_rec->set_track_map_name("SvtxTrackMap"); se->registerSubsystem(pat_rec); - /* - * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks - * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles - * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER - */ - if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); - - // correct for particle propagation in TPC - se->registerSubsystem(new PHTpcDeltaZCorrection); - - // Fitting of tracks using Acts Kalman Filter - //================================== - - std::cout << " Using Acts track fitting " << std::endl; + } + + /* + * all done + * at this stage tracks are fully assembled. They contain clusters spaning Silicon detectors, TPC and Micromegas + * they are ready to be fit. + */ + +} - 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); +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); - if (G4TRACKING::SC_CALIBMODE) + /* + * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks + * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles + * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER + */ + if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); + + // correct clusters for particle propagation in TPC + se->registerSubsystem(new PHTpcDeltaZCorrection); + + // 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 + */ + + // Choose the best silicon matched track for each TPC track seed + auto cleaner = new PHTrackCleaner; + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); + + if (G4TRACKING::use_truth_vertexing) { - /// run tpc residual determination with silicon+MM track fit - 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); + 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); } - - if (!G4TRACKING::SC_CALIBMODE) - { - - 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); - } - } - - //================================== - // Common to all sections - //================================== + // Propagate track positions to the vertex position + auto vtxProp = new PHActsVertexPropagator; + vtxProp->Verbosity(verbosity); + se->registerSubsystem(vtxProp); - // Track Projections - //=============== - if (!G4TRACKING::SC_CALIBMODE) - { + // project tracks to EMCAL auto projection = new PHActsTrackProjection; projection->Verbosity(verbosity); se->registerSubsystem(projection); } - return; +} + +void Tracking_Reco() +{ + /* + * just a wrapper around track seeding and track fitting methods, + * to minimize disruption to existing steering macros + */ + Tracking_Reco_TrackSeeding(); + Tracking_Reco_TrackFit(); } void Tracking_Eval(const std::string& outputfile) From 1e0fdc6f1893bde2ba857975017c295c9cb76e8b Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 3 May 2022 13:43:57 -0400 Subject: [PATCH 1171/1222] Fixed TrackSeed method name Fixed module definition --- common/G4_Tracking.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index b719a3de4..99a076bbc 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -177,7 +177,8 @@ void Tracking_Reco_TrackSeed() seeder->useFixedClusterError(true); se->registerSubsystem(seeder); - // perform track circle fit to get firt estimate of track parameters at origin
 auto vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); + // perform track circle fit to get firt estimate of track parameters at origin + auto vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); vtxassoc2->Verbosity(verbosity); se->registerSubsystem(vtxassoc2); @@ -371,7 +372,7 @@ void Tracking_Reco() * just a wrapper around track seeding and track fitting methods, * to minimize disruption to existing steering macros */ - Tracking_Reco_TrackSeeding(); + Tracking_Reco_TrackSeed(); Tracking_Reco_TrackFit(); } From e6a8979d7031916e267b0feb497d4793bc496fd5 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Tue, 3 May 2022 14:23:32 -0400 Subject: [PATCH 1172/1222] do not run TpcTrackCleaner in full_truth_track_seeding mode. It breaks. --- common/G4_Tracking.C | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 99a076bbc..ff556a032 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -335,10 +335,14 @@ void Tracking_Reco_TrackFit() * propagate tracks to EMCAL */ - // Choose the best silicon matched track for each TPC track seed - auto cleaner = new PHTrackCleaner; - cleaner->Verbosity(verbosity); - se->registerSubsystem(cleaner); + 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) { From 8c896953bcb706a014361585ff15329f9d115806 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 3 May 2022 17:03:48 -0400 Subject: [PATCH 1173/1222] Revert "Enable MVTX SRO mode" --- common/G4_Mvtx.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 8267e74ac..42704ba31 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -33,7 +33,6 @@ namespace Enable bool MVTX_QA = false; bool MVTX_ABSORBER = false; int MVTX_VERBOSITY = 0; - bool MVTX_SRO = false; } // namespace Enable @@ -93,7 +92,6 @@ void Mvtx_Cells() // new storage containers PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); maps_hits->Verbosity(verbosity); - maps_hits->set_int_param("mvtx_in_sphenix_srdo", Enable::MVTX_SRO); for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) { // override the default timing window for this layer - default is +/- 5000 ns From 5fc74c832f57eecdd07a45ddb5f8ca7aa71af2ea Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 4 May 2022 13:25:15 -0400 Subject: [PATCH 1174/1222] update tracking macro --- common/G4_Tracking.C | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ff556a032..d25df7967 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -23,7 +23,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include -#include #include #include #include @@ -31,7 +30,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include -#include #include #include #include @@ -80,6 +78,10 @@ namespace G4TRACKING 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() @@ -177,11 +179,6 @@ void Tracking_Reco_TrackSeed() seeder->useFixedClusterError(true); se->registerSubsystem(seeder); - // perform track circle fit to get firt estimate of track parameters at origin - auto vtxassoc2 = new PHTpcTrackSeedCircleFit("PrePropagatorPHTpcTrackSeedCircleFit"); - vtxassoc2->Verbosity(verbosity); - se->registerSubsystem(vtxassoc2); - // expand stubs in the TPC using simple kalman filter auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); cprop->set_field_dir(G4MAGNET::magfield_rescale); @@ -196,16 +193,6 @@ void Tracking_Reco_TrackSeed() se->registerSubsystem(cprop); } - // redo circle fit on fully propagated tracks - auto vtxassoc = new PHTpcTrackSeedCircleFit; - vtxassoc->Verbosity(verbosity); - se->registerSubsystem(vtxassoc); - - // Choose the best duplicate TPC track seed - auto ghosts = new PHGhostRejection; - ghosts->Verbosity(verbosity); - se->registerSubsystem(ghosts); - // match silicon track seeds to TPC track seeds if (G4TRACKING::use_truth_si_matching) { @@ -287,7 +274,17 @@ void Tracking_Reco_TrackSeed() * 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() From 774b339bf752178ecfb31f3d32cf9cb0bb50dc64 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 4 May 2022 13:25:40 -0400 Subject: [PATCH 1175/1222] added central membrane clusterizer and matcher --- common/G4_TPC.C | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 2dcf57c81..96d7e2f96 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -27,6 +27,8 @@ #include +#include +#include #include #include @@ -299,7 +301,17 @@ void TPC_Clustering() 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); + } } From d1bb9221cd042232dffe8a3e9967fa5fee50a45a Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 5 May 2022 13:44:56 -0400 Subject: [PATCH 1176/1222] add include --- common/G4_Tracking.C | 1 + 1 file changed, 1 insertion(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index d25df7967..72bcab9ae 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -16,6 +16,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include +#include #include #include From 1bbb1afe1b3274f0e7e24a45a529590c738c9b78 Mon Sep 17 00:00:00 2001 From: Jin Huang Date: Thu, 5 May 2022 13:49:22 -0400 Subject: [PATCH 1177/1222] adjust order of high level truth table building --- common/G4_Tracking.C | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index ff556a032..53732cb13 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -390,6 +390,13 @@ void Tracking_Eval(const std::string& outputfile) 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); + //---------------- // Tracking evaluation //---------------- @@ -411,10 +418,6 @@ void Tracking_Eval(const std::string& outputfile) eval->Verbosity(verbosity); se->registerSubsystem(eval); - SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); - tables->Verbosity(verbosity); - se->registerSubsystem(tables); - return; } From 0e652bac7f27e06703783b38aa40eee12188db40 Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Thu, 5 May 2022 16:00:08 -0400 Subject: [PATCH 1178/1222] New beam-pipe based on STAR beam-pipe. Original was damaged in fire. --- common/G4_BeamLine.C | 6 +- common/G4_Pipe.C | 401 +++++++++++++++++++++++++++++++++---------- 2 files changed, 311 insertions(+), 96 deletions(-) diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C index 6ec922f57..61f44a3bf 100644 --- a/common/G4_BeamLine.C +++ b/common/G4_BeamLine.C @@ -35,9 +35,9 @@ 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::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length + 2*no_overlapp; + // 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); diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index 7bbc6573d..fb95ef205 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -20,29 +20,44 @@ namespace Enable namespace G4PIPE { - double be_pipe_radius = 2.0; // 4.0 cm inner diameter from Dans drawing - double be_pipe_thickness = 0.0762; // 760 um based on Dans drawing - double be_pipe_length = 80.0; // +/- 40 cm + // 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 = 2.75*2.54/2 - (al_pipe_radius + al_pipe_thickness); // Atlas 2.75" flange, radial thickness + double flange_length = 1.2825; // Atlas 2.75" flange + + double ss_pipe_precone_length = 2.04; + double ss_pipe_precone_radius = 2.00025; // same as Be pipe + double ss_pipe_thickness = 0.1397; // 1.397 mm or 0.055" + double ss_pipe_cone_length = 15.24; + double ss_pipe_ext_radius = 3.81; // past the cone + double ss_pipe_ext_length = 89.52; // 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 + + ss_pipe_precone_length + ss_pipe_cone_length + ss_pipe_ext_length; - double al_pipe_radius = 2.0; // same as Be pipe - double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - double al_pipe_length = 171.44; // extension beyond +/- 40 cm - - double al_pipe_cone_length = 8.56; - - double al_pipe_ext_radius = 2.5005; - double al_pipe_ext_length = 90.; // extension beyond conical part } // namespace G4PIPE void PipeInit() { - BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); - BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length +no_overlapp ); - BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::be_pipe_length / 2. + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + G4PIPE::al_pipe_ext_length) - no_overlapp); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_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); @@ -54,8 +69,11 @@ double Pipe(PHG4Reco* g4Reco, double radius) gSystem->Exit(-1); } - // mid-rapidity beryillium pipe - PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0); + 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); @@ -66,8 +84,9 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius", G4PIPE::be_pipe_radius); + 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"); @@ -78,11 +97,12 @@ double Pipe(PHG4Reco* g4Reco, double radius) g4Reco->registerSubsystem(cyl); // north aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); - cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + no_overlapp); + 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_length); + 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"); @@ -90,11 +110,11 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3); - cyl->set_double_param("place_z", 0.5 * G4PIPE::be_pipe_length + 0.5 * G4PIPE::al_pipe_length + no_overlapp); + 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_length); + 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"); @@ -102,12 +122,110 @@ double Pipe(PHG4Reco* g4Reco, double radius) 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 + // SS + cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.5*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); + 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 aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); - cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - no_overlapp); + 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_length); + 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"); @@ -115,11 +233,11 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5); - cyl->set_double_param("place_z", -0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_length - no_overlapp); + 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_length); + 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"); @@ -127,112 +245,209 @@ double Pipe(PHG4Reco* g4Reco, double radius) cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - PHG4ConeSubsystem* cone = nullptr; - - double cone_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + 0.5 * G4PIPE::al_pipe_cone_length; - double ext_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + G4PIPE::al_pipe_cone_length + 0.5 * G4PIPE::al_pipe_ext_length + no_overlapp; + // 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); - /* north aluminum pipe (conical part) */ - cone = new PHG4ConeSubsystem("N_AL_PIPE_CONE", 6); - cone->SetR1(G4PIPE::al_pipe_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); - cone->SetR2(G4PIPE::al_pipe_ext_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); - cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); - cone->SetPlaceZ(cone_position + no_overlapp); - cone->SetMaterial("G4_Al"); - cone->SuperDetector("PIPE"); - if (AbsorberActive) cone->SetActive(); - cone->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cone); + // 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); - /* north aluminum pipe (extension) */ - cyl = new PHG4CylinderSubsystem("N_AL_PIPE_EXT", 7); - cyl->set_double_param("place_z", ext_position); - cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); + // south flange 2B + // All SS + cyl = new PHG4CylinderSubsystem("S_FLANGE_2B_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.5*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::al_pipe_ext_length); - cyl->set_string_param("material", "G4_Al"); - cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->set_double_param("length", G4PIPE::flange_length); + 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 aluminum pipe (conical part) */ - cone = new PHG4ConeSubsystem("S_AL_PIPE_CONE", 8); - cone->SetR1(G4PIPE::al_pipe_ext_radius, G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness); - cone->SetR2(G4PIPE::al_pipe_radius, G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); - cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); - cone->SetPlaceZ(-cone_position - no_overlapp); - cone->SetMaterial("G4_Al"); - cone->SuperDetector("PIPE"); - if (AbsorberActive) cone->SetActive(); - cone->OverlapCheck(OverlapCheck); - g4Reco->registerSubsystem(cone); + /* north stainless pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::ss_pipe_precone_length; + cyl = new PHG4CylinderSubsystem("VAC_N_SS_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::ss_pipe_precone_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_precone_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); - /* south aluminum pipe (extension) */ - cyl = new PHG4CylinderSubsystem("S_AL_PIPE_EXT", 9); - cyl->set_double_param("place_z", -ext_position); - cyl->set_double_param("radius", G4PIPE::al_pipe_ext_radius); + /* north stainless pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("N_SS_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::ss_pipe_precone_radius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::al_pipe_ext_length); - cyl->set_string_param("material", "G4_Al"); - cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->set_double_param("length", G4PIPE::ss_pipe_precone_length); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* north aluminum pipe (conical part) [vacuum] */ - cone = new PHG4ConeSubsystem("VAC_N_AL_PIPE_CONE", 10); - cone->SetR1(0., G4PIPE::al_pipe_radius); - cone->SetR2(0., G4PIPE::al_pipe_ext_radius); - cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); - cone->SetPlaceZ(cone_position + no_overlapp); + PHG4ConeSubsystem* cone = nullptr; + + /* north stainless pipe (conical part) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::ss_pipe_precone_length + 0.5 * G4PIPE::ss_pipe_cone_length; + cone = new PHG4ConeSubsystem("VAC_N_SS_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::ss_pipe_precone_radius); + cone->SetR2(0., G4PIPE::ss_pipe_ext_radius); + cone->SetZlength(G4PIPE::ss_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 aluminum pipe (extension) [vacuum] */ - cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE_EXT", 11); - cyl->set_double_param("place_z", ext_position + no_overlapp); + /* north stainless pipe (conical part) */ + cone = new PHG4ConeSubsystem("N_SS_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::ss_pipe_precone_radius, G4PIPE::ss_pipe_precone_radius + G4PIPE::ss_pipe_thickness); + cone->SetR2(G4PIPE::ss_pipe_ext_radius, G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness); + cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + cone->SetPlaceZ(north_pipe_place_z + no_overlapp); + cone->SetMaterial("G4_STAINLESS-STEEL"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north stainless pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::ss_pipe_cone_length + 0.5 * G4PIPE::ss_pipe_ext_length; + cyl = new PHG4CylinderSubsystem("VAC_N_SS_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::ss_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north stainless pipe (extension) */ + cyl = new PHG4CylinderSubsystem("N_SS_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::ss_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::ss_pipe_ext_length); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south stainless pipe (pre-conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::ss_pipe_precone_length); + cyl = new PHG4CylinderSubsystem("VAC_S_SS_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::al_pipe_ext_length); + cyl->set_double_param("length", G4PIPE::ss_pipe_precone_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_precone_radius); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* south aluminum pipe (conical part) [vacuum] */ - cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", 12); - cone->SetR1(0., G4PIPE::al_pipe_ext_radius); - cone->SetR2(0., G4PIPE::al_pipe_radius); - cone->SetZlength(G4PIPE::al_pipe_cone_length / 2); - cone->SetPlaceZ(-cone_position - no_overlapp); + /* south stainless pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("S_SS_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::ss_pipe_precone_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::ss_pipe_precone_length); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south stainless pipe (conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::ss_pipe_precone_length + 0.5 * G4PIPE::ss_pipe_cone_length); + cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::ss_pipe_ext_radius); + cone->SetR2(0., G4PIPE::ss_pipe_precone_radius); + cone->SetZlength(G4PIPE::ss_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 aluminum pipe (extension) [vacuum] */ - cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE_EXT", 13); - cyl->set_double_param("place_z", -ext_position - no_overlapp); + /* south stainless pipe (conical part) */ + cone = new PHG4ConeSubsystem("S_SS_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::ss_pipe_ext_radius, G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness); + cone->SetR2(G4PIPE::ss_pipe_precone_radius, G4PIPE::ss_pipe_precone_radius + G4PIPE::ss_pipe_thickness); + cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + cone->SetPlaceZ(south_pipe_place_z - no_overlapp); + cone->SetMaterial("G4_STAINLESS-STEEL"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south stainless pipe (extension) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::ss_pipe_cone_length + 0.5 * G4PIPE::ss_pipe_ext_length); + cyl = new PHG4CylinderSubsystem("VAC_S_SS_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::al_pipe_ext_length); + cyl->set_double_param("length", G4PIPE::ss_pipe_ext_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south stainless pipe (extension) */ + cyl = new PHG4CylinderSubsystem("S_SS_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::ss_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::ss_pipe_ext_length); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - radius = G4PIPE::al_pipe_ext_radius + G4PIPE::al_pipe_thickness; + radius = G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness; if (verbosity > 0) { From bedaababe4b8377a34e59fae19d6f0627b74a503 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 10 May 2022 11:27:09 -0400 Subject: [PATCH 1179/1222] Removed obsolete PHTpcClusterMover. --- common/G4_Tracking.C | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 53732cb13..2e00885f2 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -29,7 +29,6 @@ R__LOAD_LIBRARY(libqa_modules.so) #include #include #include -#include #include #include #include @@ -105,7 +104,7 @@ void TrackingInit() se->registerSubsystem(geom); // space charge correction - /* corrections are applied in the track finding, and via PHTpcClusterMover before the final track fit */ + /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit */ if( G4TPC::ENABLE_CORRECTIONS ) { auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; @@ -295,13 +294,6 @@ void Tracking_Reco_TrackFit() int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); auto se = Fun4AllServer::instance(); - /* - * add cluster mover to apply TPC distortion corrections to clusters belonging to tracks - * once the correction is applied, the cluster are moved back to TPC surfaces using local track angles - * moved clusters are stored in a separate map, called CORRECTED_TRKR_CLUSTER - */ - if( G4TPC::ENABLE_CORRECTIONS ) se->registerSubsystem(new PHTpcClusterMover); - // correct clusters for particle propagation in TPC se->registerSubsystem(new PHTpcDeltaZCorrection); From 113d95c2474202f8f70e2c344a476111eb6f7ec2 Mon Sep 17 00:00:00 2001 From: jtaou Date: Wed, 11 May 2022 00:14:28 -0400 Subject: [PATCH 1180/1222] macros: tow slope mdc2 commit for production running --- .../tower_slope_macro/Fun4All_G4_SlopeCal.C | 56 + .../calo/tower_slope_macro/G4_CEmc_Spacal.C | 588 +++++++ .../calo/tower_slope_macro/G4_HcalIn_ref.C | 355 ++++ .../calo/tower_slope_macro/G4_HcalOut_ref.C | 284 +++ ...IN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt | 1536 +++++++++++++++++ .../HCALIN_GainsCalib1.22.txt | 1536 +++++++++++++++++ ...UT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt | 1536 +++++++++++++++++ .../HCALOUT_GainsCalib1.22.txt | 1536 +++++++++++++++++ calibrations/calo/tower_slope_macro/README.md | 80 + .../calo/tower_slope_macro/do_eta_fit.C | 21 + .../calo/tower_slope_macro/do_eta_fit2.C | 25 + .../do_run_calo_fromMd2Hits_towslope.csh | 66 + .../emc_corr_files/emcal_corr1_00.root | Bin 0 -> 42920 bytes .../emc_corr_files/emcal_corr1_29.root | Bin 0 -> 43178 bytes .../emc_corr_files/emcal_corr_12bands.root | Bin 0 -> 43269 bytes .../emc_corr_files/emcal_newPatternCinco.root | Bin 0 -> 44253 bytes .../emc_corr_files/make_EmcCorr.C | 34 + .../emc_corr_files/save_makeEmcCorr.C | 53 + ...lo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C | 494 ++++++ .../calo/tower_slope_macro/run_f4a.csh | 15 + 20 files changed, 8215 insertions(+) create mode 100644 calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C create mode 100644 calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C create mode 100644 calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C create mode 100644 calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C create mode 100644 calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt create mode 100644 calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt create mode 100644 calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt create mode 100644 calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt create mode 100644 calibrations/calo/tower_slope_macro/README.md create mode 100644 calibrations/calo/tower_slope_macro/do_eta_fit.C create mode 100644 calibrations/calo/tower_slope_macro/do_eta_fit2.C create mode 100755 calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/emcal_corr1_00.root create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/emcal_corr1_29.root create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/emcal_corr_12bands.root create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/emcal_newPatternCinco.root create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/make_EmcCorr.C create mode 100644 calibrations/calo/tower_slope_macro/emc_corr_files/save_makeEmcCorr.C create mode 100644 calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C create mode 100755 calibrations/calo/tower_slope_macro/run_f4a.csh 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..a071142f6 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/README.md @@ -0,0 +1,80 @@ +Various macros and files for running tower slope modules in various situations: + +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 <Ly%CA2I-V?q`O5?kO3)?4h3t5knWHY8EHY35XC@;l#mWZK}qRm z5Ev#Nc(3p2z3Q0v>b-A1j=%!ujAzf@|33e}{WJ_!7Y;ENPvUc_G5Cw^d2zhM1rVoMuf~{xRJY+Wi`1t0bwRyaGCIH}K zI<}XGLyb2B0Gum)^Y;dufBD;E>i5q!LvzYH0~j=h!?z8GM8(pdD!~$;2Y)w- z>hWr-M7Ik(xYVI4HknixkE`$yiiWB>4O1og)bikvXsR5Gi%GEIFcpQ=NXL83=O9`5#h725)X zizg1`5lZH(I!_rSo$1cQA$L%*PHj)HlgJ|wbWnAC-kx}>EDvwzq>BB$_KPlFc|;16 zs;-FkBrx0_fX7&C86=WmMP`rB!B}_vkw~I@ggq{8O07+<$VCSodqVM)I;Sy_q|?pz zIHZSbk0ll-*b3Ma>^WR_;z@Dh$wGTP=4Z8bw~H@2JJ}P-J*#s;4}o46C!L=e2N22B zT1B}fShI}d^T^aWw7MmFrj6q=+^w~};dar{e4J4FZk_X-ThiJ7aU9Ciwbtni3HI{i z1j4859A7RZdRL6&v98zJKU}!zdTyKuxL)UqUWio{wX{M^&Pb|xnbUv;v z_q@w5$}3a+=!BN^y{>?Cc&7CE32h)k+}Drnn27R@CXpa<|JaCQ64pB&?|mfh7piki z%s9D8B3C>hrTLhYXYynDv75eu0>?zPO`F6LZ~9*>JSORA`dIeKO}|K|W8!ALO;WdS z23(#wCXHDTKHK|v-)m3b0G449^}S7^QJ((sX~PosdmqcRdisT%4~reT(2PG2+9&s1rL}c>cRq`W`VC5+fG+$TP&tZSG?Le zzh0@nZ!tyq+$-jR^(uYv;w2#Ffjr5sN-_;LT-pm)@HzJGCf4Ltq75p(z#&f^qQS{d z8+cWPLsm3IQ{WhF@SR$YeIyzh>@@KgvN<_q_%t;6jpBpKvN;qO8#K7Z;sXn9IOJp+ zG=)6kgDXZkfCRi6ySEu%$fV2K%f+k7r)3;envf;G{i+5Rzj0u}fh<|ctD1r*jDzoW zXYC_DuED|7bs<+GOGfax=AI*6LAT4Y6n0K%@W^%r-tfwjQ<%^cKGPNa5S|6Z+tI*A zD1IS>%z7`!jz(TJ@t~3jYkAt_22O7Az2F@h5wMoo zW7^1n@Mh4hLTd%)-Ue=|n}OGztmWi-8--3SQ({VkAIw+-iS{<^rtrLw#WJ#&XKy2) zp64U&GbjT@23&bExRWx6RSTE^=EVYZ51X=ii_b3d z@0>8MLn}3t!CjPjta`vS@LrS~VhD}}fNbK^PMD+nNLc^5 z6UMVq4;TmLL}?&m;T)6dozdB>npgmMIS@)9U_%{#xY{VOByD@4&Gu`DYmPiANhf!* zp}q91`rz%7%R6Um81AnJL!Q-Gye@&_v5Zm$%Tyaixu?;ljnd`G)O?2t^QyPu*PSp) z6DwJh>Rr*fth&HdumtKjq63ZvfNaz-R%xh-riw<`vW%ous&I>@@afnxb){74*oj_} zX|~<9e7I7Hz9gATz?Sjx;VP|zC8?5ywmYYvRjNsqqzF3MGXE75=EcjH3kkBR;i6J~a}_wSl8<%26Dll5KE zd93=tbg(?i2eAmp0zfu;@)dPY7+#X?&e^r%uwR*}Bbi$whq1*$QTs?os#ICd&e_TR z>aravLS8w{FD4cB&vabc2hU+eF;?y;6iwbuX1n9pm@tCC&>s|GZjPz}W5Mhw6+|eU zc9N%4KO3rn1%Q`Bp}2I}RDpa-hGB+jGzr;sIef~8n+(&p9muA+n6G3~V0f9SJDdJi zzVgv2Lnxs{Hg%+fl5uKB8hu&z_UjJHX3snRArr>qcJ0?q80{H&{3K78elAo8m;x3< z*&rIR0g#PGO+_uE*i?yZuAP&O`_;r^Qv__dn4dK&>UqRok{{(_UFX}cxXmz`oi1lb z9iO76mSL(`LJrHT{Qau@hAI39a+v-#6DC^sgAwLt;Xz;ySPPYa;9D`C%Int8hfYBz z@;dc%pjyC-V1CpAL_XYj@_pd5Zb;XxjB~ij9W>R?h{eR}*l?2`Zd5zv5fg7d%1wE? zQ60R^AV!HUmspig&0WhN&L|<5%$866G`~Tt)`8q@Ci!Y7PZ-1>>CUA%nXi7HsXazb zB9}zhLCy0>d)&dYTykdz^|P|=v3g#)q(>*!yw9}9TflQE&rhmD2t{HP$?S-g86UZ+ ziNqO3*pXQ?*86aa#A@o;Z8J`J!ZW4*9DQ+&s(>Ad_Tfh!2aDrO3hl@p z57(cODvs54vLiKn_UP29;`pO8W2|Uf%Cpbv!4z&W$}D5V>N1bq_1xl&)5gf`W$I50 zxy5Rmk8L}2_t8lgw|KMuF$(Xy_2+jj#Hh=Uk?5a(N zZQ%%qm9DA09{p?3gTU+HBd9Vgz;hU?=-h}LaIH}oygUx$LQdi)|38KEg((~#CpBOe zSPd0{U|bQOvhQxY3N^$6td&E)An$`*)iB5f*zL!qPG-aB+EGQKsG&riDsq8~WhivN z3OjWQuL>7aN2sFCG3rZuYq@qUYVKE}iB0C@bnnf%UKe;{)g) zzxNKhgoOBr^%BI!S>BK6WG_j#d2QsNI z@2KUZF9}sPAEt)lb8=FLYAPAU#ir3^b8gSqR6f!fn@(oKNt@EBbg(q`GRr6@!`((@ zi>27VYg2Zb%mP>hwm?-NPOmIajrX)&gC4>HY?K3kwp$;1;`LuF#N2++E_@Ya0J{QK zMEN5KR!FB9y0HN0+0|dHw16zn(aQL#LQIOY3p{*^p+~p?bO3f0Y>3K4sIFiEARGU@ zds63)0|I|#h_N@@gNj3Nt!PgrbqnW%j9}SdO)S9Z0Qldr!+tNsm_5AsJwwd1M|!YA z@L^Ob!gl5HR8o)dHPAsUz(zUrCx}ZwU3QH=?$sBBnA_L8i>`tUVVPi6R2X9W%ATo1 z*Z}lw{r{`iUtGOLmUB7h{5QlTUq7*OZQ@WzQ6@+g76#sq;zyXk{|I1$!6v8zgvrXa zsY5+Q1t7`4u1ZP(>n-THsz-jpDExVMhS17YeLSYlkVg_3d@aZINRM=eJt@l&oIS2j zB-XotQ#e^Q^na=Q+@C;$pL>qumEToFeinnG*E3ukbSVx4Fz{rj^d~UJOMjb2u zuH;rSJF)O*%~nFo$!)mwr6F|!R(y|5Telr74eKei5}Y<|Ba|u)ZE>>N)7RTdajG=@ z1+oS>IfsjY&WAh>Yr*~S(T|C13`iF#8 z@3i6VS_-L`AL48CX(hE-3VT{nB6$l;j$%Sc!W}1`wiji9lwmYk|Q%2DUi7UG!kL%E;c1DbqUE#WZT$lNIXVh!2D;$?6bQtb+M$W;n z@I08%WkqyGqsc7U0(LZ01&KurMOboX?P%HYNGxhm$C5ohxtT6kEON5hlKWTRaKT^cz%W65*Bw*`oNyh~kwLb~1c z%D{e@9~cish#-eEV*}8yS4*Q&EQ4&pdz-1FJR(NY208QgwlKDOL@k>SvM1eX-hRU) za=L$zyZlbe&N+|h4f(;{(LT+z=}Qsg6@y$wJ}t~Im!ekB4RS!&ni(E0Mb0A!d0=ZT zP)yXy@g4u%0`@zM56|uhFfEE3p$oq>A>HAcIiLay#R81FLcWeB5_B_dM4sVJ1DB9z z;5G9RS?N2Cf-auH_xnfoQTjA+>{`B%CqE)1?9;f%VmYY1Vnl&;t$}CXa^SmpPiy~F zLJ>TgkV^dByj8?{#7Z<_?H6_n3=!+&v(tn&sO;wN2+<=uMibs!yIW{6L?4$XE~J)o zH(#TM-ZrDSuLf|DBhgko`_%{IIDJZsRS@Q4fVAKfjy-k^`O%_yXrE`zs@SC2%? zD6BIfL*Ny!J^{Z`Xw!iV{_h)NSOjwhlwg5iQWQNx5N#m;|!h-vGHMeKyj zO?bD@Ul~w@1%QcA6j*>@80u$;ORs-eh*6#W@gc_ZKp~g`C4@K%zdzyKF`qf03Jb>q zymE#8x=h6H5@HhXe{+aoA-_JL3=0NRqIMw^;AbaR+vhW|0Be2vAB{_B)_T0$?VDW! z@004cng%u>B3lgvTaSMssov&2QvL52MD%UH!GABv=acHU3H?T@-`;5qpg*|7cL-+d zdHC_|2Tq&R`tlRcZaWL~-JZSeG&ebX_k5eofH$t+uE4G1$5B5(Tcn)zOW#PBLR-Bh zvV9Bfb3F;;^AW0a+x{!|zHCUfj}>tifSjs- zr}i^S`T6D2O6YgxT`ec7z3nEtUb=?i)K2Aicj64eY*!Wq^JK{1egO z_cW+D)kM(%2nGW~P-p~dWn+5v={#0o^%gFk{{r*Js-=(S|Ij0{9`N}E(}m4Ok{{S6 z@{^1U1wP?47<^og74@m;Zq|ID5hNR}fr>?7 z1z-rX_29QHS>M!;^~r%T{3j0#KCbmj{Zw=h>owp(NFmx3Rf50@z!2E^Z-2qS;9Mh( zAgy-&C|3$b`#$&MZ;bzcBC&(W$nm+S^t+)~frgMwvAT8u`A&f z>)U>jZ)z5StVe&W!HNvOkY9w47)JfE4pF4uALvp*jn8iqg&2Js_mhEGrw3X9G=UVL z51{f9#w&SK`q%*URQV@+OMjA0!*7()Pj2RlQ!C4`?6luw7^2xepD~5h{3Kuc2%Cs8 zBp0oNNyfc0yjZ)Cs!GPgjL{J1xN%+?IO-|`099Ca7rxiUW0)&so; zJOsf8tR8{^zICQyVOc{&H#@S&UB8iN{Z|BP}sSNSZ3O{b|xU}wwkPdg+LP_Tg>~RK!fMUh0um4O$c{@GGQu^P&Cc?X;Oh6 zPyy@!Bp+>r%0XzaBuxqb0Z{v`Q69|men)l#>lgIO1NnYvQ#Nd?U4B{m8~d`6HE%oS zzqVceP4z$+v-n<(+OKjOYCB>N{Ln;EJ17ID1PMfA1L}&<|Etq65*LzDT^RVNg2Dd> z=7Ty0r`U?sAdzS$lqA9t{&b?K1C#~B1}tBL{IPn9Sz`TI0hN*1RNvB>3e54b!s*)O zKX45oF`r*MMQ8s|x&ivw7DH#?8yN>nly6Bo?=W=yDhW~K2xhqSglqf26__F<0F4c( zDMEiS;Q;v<@-fbVJ)5PuU!>w% zL4+B+e8RP3AQPqv2}jeTumOo6)VtCYKWGVjhopM4!*l z8PxxwjDsQJEs_qhY%hqfen`5q&G=*Z{~%-j{HDJ~-39oC^m- z*8fI_`!nr;5cd&vFZHh#Xh`u-P0v3WxDGRel%rixFA(=vys-h0m5tv;cD{b5y{EGS zd@Ja3^TTQ`pI1ZuWT5c@Tk8K*fkuF;w+IG;z|de63bC=WIz9h%02_emas6ES=tpPT zmoZ2&#cvsLyS{;T@X0_kc-If_uM9MI_YW4Mtxz?H;1$Yg)+fM1h$#jeuyzRc{REJH z>b>@Rfo7Z_3jaF>8ox?+)Ci(}C3>3mDewlw9CHVa4OlAzze|Vvb+>fiInboj?)`#5 zgX`CY$Xn5$hCTsahaAC_p&d}zfJqSQ!arh5_g4p+JK#Z`{{|XD+;Mo@B(w{d2hqc% zp=D5>h(7^pG<%C67MKe3Y1A@ee5Gv~O8F=4!@o7N{mbRs@cgt9NpRswP$w)KqKSz^ zbD^*SIUv;gdIeYUvidDrqo1m6;~XOHr}$+{ zs9(Zuqap6^g5^QR$GRy&tMM{4Rg|vupwAiRHT>xfmTx z3R)axk7$EKCxO@i)Rgz1g_D1s;&u#~JmufNni1d%!$A|Uc1Q+B2@{AWMKK_-0x-na zNbdbQbvjO5;UB*P@T+7-Nh4h00~4?gNESv76N$zKv=o7Vgo0QDhI}NXz3I z2dM0~&;Lf!z1(}G``<5!W!)by$mf&phkjSG-`=8Jwu6vre+Q=K(e0kzgVudgeZ4MQ z)cdUuO;?81X1g)n{gw9>ad76pue$X&B||?}a@*8uBf{TH;=`)(w!arb^_l&OYw_>4 z_~PI|;lN2qCng)CiHS$^p!5+~0nDoSpLO@v!@pXif7}(F@ll!nI@k|W-}^Af_iLs1 z{wEAVL0n9;AQSUerwz^aA>An)oR@^>x-hvIUCbr4G|Ck*0EbONJ`JGf-|blVU9D=7 z2aCYlE8(vftb(lve_Tiu)A_?BUcaT4#rtW43_iZv7kN}{xmchET>osbGz|J-UOqqWZbyys?+P*m z_>Vrvo8mq93e-T+hlRs_vAx^p1R1#>6l55vc6_!$#aj!DRS58Fov$Fvlpi<0Lg)N2 zTe2S)WRPDMWaQaIu=`XPD!prBk%`&(v>_Q%^{cJomZdT6A9aiSC6_X8iVrSjIDVQd z@l!lK`UTJfzQwJ%d;Zn8p&wq#Sg4YffPvs`C^`fm+;}3dT|Wbg z4OoO=-p%&tFz#o2>l24m{7eVG5q&HYh>t;EZ{qh0EM=$mTQZ>}5DxIJiM$T|ET|eV z5{wOK!JxjtE>4b3#2MiCR?cmS=yMeiftpwp-5{}FErN(_0e)NuaV_bGNr%3(U&irc zgo{tux3^t^Dgpz*geWouRsgda{T*FQ=Y1<9aPVnA)RJ;B3uYEg%yLXP}qPW%m#MHxG%`eeOLd>9~Wf8@xNz~!SSnG z37=+oDtrTE4!Z+(M-3ye0+?0L-~HnLG3B4{QMVSL{(?IhTwLwxq$k4HK}TR^UBU zY*_F3+Fpe3qOtQyj={(;5oB=uTHu!^rMp~n2XtU5U~!Zk0xN)7z5ly+%wLl;{mvYN zmY*TW;P`!}J;*x-BAC_bF5e)DOi|tATH>icLt$U%C5OV_nND_b#&P`WK%VO5LEGv;zLba~S<4ikr@v7dc8>!!6z7C4Sz$&a1gvN3T^&po~$f#Io1R+uM7!bzkdzsLFkpsLkVl#$oSd z|G(y)td{wLUFFl((yz9^ZCxJ^aCysp(|O}KKcz3b0|wz@@k`8g|^@cqwq`-ZLe4H>H~Gg_~ul|)#}(dA4S-QG4yo=6&ImssH)R2RgzEbhl~ghX{etO`yWf+f{RF|QPpKBCh1&-8hD#Q z%u|kzc2rx(CbYsVYX)s;mbbNxG$+X?Akr=U-7RBUY)S zJYnche4Rb;wGt-dB-O0{DO3PhIXOIp-r0Yux!--4JgtAl(pcJt=u>gefp|JP369W2 zjX@&M(CXMJ&ASFSq?rQkvW{?N*NpBBF2I*pp=h$Gd{jlHUEW|C+i_AT#atozLLmH7 zPMARP_$l484KIb9Nf!W+Sds+lwm_Vob7_(X=Wa+3B#Z zvEC-JJ9O-#rO8k=$yM>7Zko1gNg`#M?c)GvoFMi9*)mDyk&xrs+;f5rg**{iXH+wX z^^YrPI62nI^%x0~RwZUycn@UY_K zEu-mIa9P5WIrZ#Ie&s}>*o~xvmxYhTrE0cmkITv5DQ{%jb*D}oZXl7d81fMcz z>~fS3uEf|stizR^nq`t*PKD4T275~!?bD6L^(Rw!8gN!EOr}Wf*WG$vQ|l-YE|zRd z*DVXr94~sp8mAfMG&LMAcVk|Zo|REfc>tJYNyXVwiV52(M7z4y>q=Pe6U!>3YNx+B zzQ?yl9U%T@)Frn@{bKrWqps%QWJ|j_>Q+u~#$6O7A|mAB>gu)m)2(0oqPGhGKyAHs z9;s_@&a;2(2@(l^JCBZorx%&==DW(u+15kT#m<#R#r5Pdr_*ds4la(iHk+S3y*A%& zOw@pDQk!qL7PF%fEcNa;E{`mNHNz74v}1K6DQ}<7R!PxPIg;zu`jR!^rhaC#Sy&uz zO4^IryUZ`=n%(VQN7*+mX)P5w$&?B3l?loyrPUU*l9`I6v5}AO3KVsnWOxwS9 zC98L(KSuk-)pLd>M&1dq7q4;^j~E9pWND_|9f3mTttop6{o5{n&Z_qqw5dLo@YvCp&=5 zfy?#t3Q+pc8&ZwygmWNHqNnz%Px#E9_=3VZLruK;&aVyj^cQoLHs`od-P@I55%r+B z)OX&NK-<`bt3bGpU(=sATSydjuL@331&^>i!y7%hXsIc3{*Jg#I#fwp8o(zSLr)M# zqXBbLW?CArur=9kP=0+S?5Rf91=c&6g)WjM$7hdg)(`LrtoXO0v~@Ek|S9=8pTf4Ug%iB^&48sJanI?%|k~7RK}{ zl_slS<28xdYZn+@NReu}(AisfOXP`HVWpZ+hKT)DOfrj`(78n86ls@sJrK9zF9kY3 zf5DcgL8o~i(vzq#(PmPyU~}a}Pk&FF=Yscwiku9>pxd=UCc|EmpqYQ zfk~L>;lFG$6q+KUf#*YTE?u9Ympat-NRMQHw=%Sp$w+}xu%KH|`W&e4#Y&Sa(>d7g zwTIkm^2`G+m<-KiIkLerhSqD7x6(!Hgpgeo`xgsLETeq+XiTZO^9q(k)fahBQbt)f zH(iw_-ac3REM>_2sU!J1<(Z_&k$pkYiVqCSEArh33k$c|c^|ap3fU8x%3#Jn-E>zv z@`+IRlVcr6S`)o(V``7Rgvsz;-FEP(A24{|z3PREs)a&JA1#sQUWM{tQF)qLhnj0G z1W+SyTVA6S7aF<}p@^P4;V1Ym;@p@rtavV%%DO`Ww&%D7gTzVZ7T>lPZ4Z&u=*owE zsy0MKM!>aZ@im96}w@$3T6!0XvoO)%Pd@7G%#a2HN4RACb z%fC;>=^(*+_GCGIcR-or#zrGzZE8rvZd()-#Bffw)~EfEcRbXS$7)4+d}-I1ruP$V zBg0AlzP#~+WtfhrF&FlGl;eq>FZa`j>{M&H)MuV-AxIaBzM`p&3Ef~G9Ymb$cy*e2 z+AZi}a2s4UZF+^2A*-TEiL}ImshQ}ph>d%EUkF$-4n#5K8)t`aMM*a?KpT83cMy#8!wmVpL|F~ z`?&;7IFYh+9@6YtpcW3>m6}&{YTL{)ahs;+6VX2 z>YftI8<1X;RcHyj-&E~BrzvrMTE@vflz>I;!5E=Iy|P7096Qm|<;)rmsb(t(cVWTf zXrEg_S}y6~!*r%srF??bE4Ut}?-jZF-fBsx#wrurmg@|J)Hm98UQ7LNJ;J53ov z7B_F*^G<5^;sM&;D%wGHDh&d?J_5#YJ~1nt;-KMWj~O z>#1*RY|Pd@skuFYgVD)!h>SKZeUJzzOlMNs?f!r>lpm+!jL9@{1)gJ(oCZ`fCY?P` zqpSklO~J(Aeq=rCx%3@PYX_2pm5S2Asa*2>nlsOI>&Y&{`xZuO+O3A_xI1L}p$tOf zM+L9@+KM8#F$QJ(9x>?#6Rh$)=VOUN-PIm59MbJ?qm7rc&pyiP^dKPw(d%7BK1=X` z_CSAEp5Da>yG1u#`?))3HlQpeq+(6@ro1hY)^5fIWXeANEat4#9rNX?tB7WXS;<-h zgTUPc;48=2nd%#N59F$|#)GH~IPbM*p9j{X3_aWw1U<~nTJ;M1E2YSp6_peW8N}K{ zsxxxu5?3|LXIvlbdJ*Rk6X9XXfC-$MU_g|=2D=jz?Yh8iy4YA%PKt|AzFtm49khRk zWu&C|$!k?FV&+}+^zR#ZKF+Cb6@SL=`BFn(UoTce{7BaAS_=qnNh{hT=H5i$kse(m zVQ0=cEjmy9yF~UpnWkpfbgy66&b)4R#OTU(dS&$>u%`ipaOGJI4mk=#aan_ zyc8ds4n<#n>|46cTjJL1fd`?lQ;Ioj)MQmNp;`Nwr(tD|Ab1c_({YTZ$HHvk4o4v{ z6MX%0CQ1PuPBHtCRF;nOs3pl%DXXbE$mPUN1s>UZw`{eF4Z=@w)nsNq3#?xtz1^W- z=E!%`u$Jmr)+sXgL(_E^Eb*`Dal5JNZ;*xW(dx_~E%0*DG~sA@eM6=`U6a<9oY~>% ziGq-jhKAE=Ea$os&bEe&*HvC04y-ibCWMkS5~Z2li?D#vpJqv=RA^5?@3`m9fhn-p zI5U%5gxvRXZ^YDngPoT}yZc@;ZW!XsXSH3azH|o`&=^)O6Bv^kRS+9+YC}xJvtrg4 z=&-gZS4!Ee(bHY3gk~@FH-bj*7Zm8uXPzsz8hxTVSJBWCds}&*5^0Q^6C07(TolZ0 z$Ly5-+yyGHqa@&G#9&2yh$24pR(;>DOZ4ZMLu+~g_jxM|aAz!-dy66TXAa(*gmF3| zO0V)}jgi%KU6j4Sl>fR@D9MEJ$yB@cvUPmqUbRZwh6@HfrfQDO!Xh$_7Uqcuh@Gho zrgL@{N!()}rYFlK%_O;O(j<5daZdO7oOHjSKy}Q%=g`+dh8kKQr3zFgZv z4D52VSkR{AH0{0nus&9KT*Apxr4Lzs`E-Y;_AS7uWYF`6PAipMXW%D$S|hzuFGZA# z8WRaAd!6uP99a*#Og5}S3(s=QrW6i72exe1ZdglX%(#2>aK|C?u(o((&J#^OP1N>| z>(wJ>V`CCYrR2}58OSo*NHW`qGY^{y~6YNLd9Gmnf`tXfzkPnM>rH zziH#>eYR%yq22M$YwYGcavmery~If@vsIpHr$oSn<}Q2A_bB1r2F7f!yXXRb%)0micW+rFxPLC5tWUyzey-8FOP=svt}|Ug^--HK$}SldZ*?hG zLbxOz+!p5^yTV=vJZAzbEx}!_BP>M+Wrm6beI78C6AexWS>E9WfarV~oP6;rkcK*T z%?p9*w5uHBuEl$HKW4WICr<3{%`-TuuC8VtY&K%Q=6&d&P)4?0`d zP|%qeVV;;K9e#ITr1-F=#7ps+yWt5Xq+A+JKTd+Go*v_sX2j81|$`Y|F?>XU!BlsG>07INz~P0*Pr1;}v@#ySZ516qR#( zP`^tHqKIqp}CHdy3R@QF2S2eeOZ^_3wIwMm6zEkCq1hcGCsWB$=Ql-!_A-T8M0S~ zTJ@H0y@88xC6#3wNxbE*4Yqy9cUL{4=euu(KOk0ye%i=)44B0`OkzeoNG=+~ou!tn zcQ}P!2tP2y=wNdx1Ci1Uvo_1os=3Gpa*o1_2fc80rcRWTE1EI$(CqekP>g~+>$cd? zmtKA@4u{vV_6JGR58eW)I!7#4YtLGz2?o@!$<5q?irFQ_;fZ7%-+1)k)VSS1D01%n zso>*|!)eZOd0;LKU9dzZ06AO&*20@dA^0G)=eim=>g~TX&t*q3P@q zYr?_jwMMVghfkF`TrGQY1<#T7Xi-{rNwAkprhM@R8~@(PJ9B$Cx?pE|gqojs2h8!Y zbtd#bf83edHzW1zSYrkL5nax#J9PxBZ3WDt+UR~ zdl~oao_l#?TDRpA={g`lL%h{n)~^s$?ff}##~dP5Zs$nEy-r= z@oduOBzuIQl;g6KNB0p>>K|=?{%A0&;Pj!}qV`VL?o;&?Je%`3wZhvYw>kr*+c|r8 zhtsUiupp~JWODq2meu3eyh#%BASbvEES~iOxw&Q4EhmOGw;PZbJwGChvNOgZMV$hh z?RQ9opt+=&@3EgrEvBAXVtsOUA7r+<`GCg)8R+m~F5_lU$wq+m#vQdB-s%RFx8-w> z^0qnK<~TznAeUMqOqyuBTNIA&P;}~ZP2_Qov%x}epzXs|=elVVK+??anFkBz_aEG> zbK7`XlFwXPbiavd$v$iQc73*r>o56PUx-0k$H+Lk1N%jx9i|?ulk4|u)S|ZmcDK0T4C>wo2f{_qZ{>fMi(lqCles|4C8gJ zDCpqU`H^5r+HGMEtpm;nGKPyHGl|A{z!-s?bY57CGyswoXFo_)=0H za}5ghP!>@bGhR!UV|1ibMbdfveR&0s)Nb5i271@`pN-n3a0a$9Nu4x1btFFOXbq|$ za`i5A&DnuRKAva$1k>(%42lmWd1mSXvMDrYkflXuly HG6C=(J6Npt literal 0 HcmV?d00001 diff --git a/calibrations/calo/tower_slope_macro/emc_corr_files/emcal_corr1_29.root b/calibrations/calo/tower_slope_macro/emc_corr_files/emcal_corr1_29.root new file mode 100644 index 0000000000000000000000000000000000000000..180ba0cac205f39e00884ed53f52d638a39e4ab2 GIT binary patch literal 43178 zcmeHQ1zc2V-yIsHOHw)nLAsHlJESCxp+ibS1;rUU1f)}>LlgxB0hM*=5Tq3ql$H{y z8G(VB`Osb8S9jGhcXi*7A6MiEGuM0X^PGF1|M{Qe<>BE20IVVa0Dv6;aQVv4=Cbp5 z;Le7%vuWe*{9z9Oq%Z*hR0jcAGfvJNIkuE9s(87D+k);c?fmO!eS`sCzmTEppj|sa z;>|1Xyc+<3XQJ-xYENzNW^3&Vvi0!t5&?CR5Q*(H#Vm%Tjz z2LL$t`sa538?5_wUSu0!sY`ep04Vhb_+l;gE0F>Kgg7F+=INI5x-7Dq2x**DhvIkw z65)CP&d>Kpo!E)pJ_D8jz<$+t4vFC(2LgbF{PQ8f^YJ+CY=_~PAYUJodBNY03HMXm z6ZVJi1oV};4OhSYJe580`tL7i&l*Xr9-3}TG`V8*`0TY?&$ma>C^Tn44;GQCRS-pz z6)rC>JCT}GBSp%I5MFG`NL9N$iex8MUVM>AHP;D>RNrP^EFvvcn}oO|J1$;4J}tH5 z{c$Ni1-v*69jXpD;*wqMcnM@W)ZAC&QvIij0eF0>*5?l<+0Yc@a`UM<-#eJ%l~jyP zTcT=zQoE6$vLh>pJ3#rMI{~ z7f$u-a>OFGXtqfyPqG(q#M@`la{OU=%E?kk9Hz(34%Ow!Zmy05a*tcwQRARj<*Dah z%m4^vnyoLKNU~*~!R3`{aqd2m;+;8zO?Ru={`!ezmm@RyQny;%UYOa zwVdQAKZ7Ua*W&VQIpuWS3=ZpNv*X?6WDoxt0^nwg2Wlg6h`fMR6Bq|(LnwQaUmSy)`U9Jjnsh=svM$*5!&K;)WK=Z9Fm?9I`R{V z0U=x*B3hc-q6vvXNd+7d&YC*1{fU9mb{t|B?b?zz5`#0RIHdgAbre>O1A=Jsgw^(H zi<~zON=V8Rx8JKHbI&;Nyh)y@>1Az+E5^YYgL#rCFY6qb9|#B&&lAye(iY1Y2ui8S zlW=p=k$W-_c)=%6?C7kv)a`-bELfh@xmg_`LM$MV#705~Da}r(wO5%stUQEMo-#s{ zi-S7!vMQ&nNQ9Pv4Rv^JGp7QPrX~kfVn_iOrwpH_7QazqSXBY%0fu%>9?`_mQaesL znRc!HUWws#Q=CA&y_)R1j6?Eh@};@=YVm0shuuiZm#4j~$<1#Zdc`DPR^qaj;Bn*d z+k^QEq)wWgi~}J>;`uUyPFnjc2g0hW@(=8p)#Q~O2)*u;FLz*8OX$o%_+3~&5Qn~< z4PPuIm&8_@lfGlGx>#66w5>dKT00kySZIl^t*lsDhk%1v_^mEm1!D7dj@^|Zg#xxR z`^-D|4^@WUEVVtr^r)RjvNH6VtF4^eqmKQj*2vK}!hd^V3nY+kXD9Ox$!DIF=9TW? z)Aw%GIfFci$c3rQh4+&evT6g9z@BU4nVw;D~adtPE1nc7`*tLf-V z&ujwuDau&CM&qoNOuD)$+A_bU!_QW-$o;3Nvo{;f?yg*7-JYU@Zmx|EU+Tr`3c%$M z{@)xh9^>$)x$ptzjgxtr zzD=ej9qm<%Cd-EvS){IZ z)E6H&9;&XmwC9B#-JQ*F$m6DCuPU-}n5QVhWf~1HcxF;(PSF(0G<}BwGySOj*Bvma zv+(>mje*!ARy|+_SRCnu=!0PZAX`lg4VvmA86wg4%#-Q$syrg;e7g3G1L+OA4k8z2 zy6jojEb5haSEO+Z*fVrmG-w~H$dD+t-?Q+zUR|;xUC`B@>F*dYPoG8pv<%~|qYq30 z3n0xA6)@Ymw*J^cRviogyk<0u%%_0*(wwr{?Y>JaumZZ@=2Sq4zHBTKJBnb2#)DxZ znUv9XH2Dlo=B*-GM7nlViRq0dMIx6Ny6kpWrZ*jVF7i_hn8k@l|I~n~8G}#GwGG4; zvl;-i!1736#0m@p0NHv_qNI1+@S^NsAq(7DQH8NDjYqtY;l8tyj%8nlWL4pw#W_U{ z*}nAsK7~wA=adZ2^j%bd6|y23>J{-t(%4Dt>3@v@BM6NAK@3wlr4Eb-b0Ad_kud5x z-hP9EY)uRRtR_1fo2Gywluz04ykRC)QUOgNpNhpj!>nB<1yso;%BEKgFEI`l?7mr| za&+D>8(+MDGR9fiIHNCfcU1xHHD{H>Px}5P1IDYm`RfLZ&I?%L9PfZZQMN8H9W08p zLv&yQAX^<;O4>&88R7-pd*(V6)kWje1?;$)9(O3|d&OUrpW^31}1~~ktT=|nDN~Ez-K*>Zde-^@{l@fX`B&_i`TW|A-3pHKjjsdcw~x)+^<6e zyz5|`GEEVo8lSqS_Q3?Bq#_b~J`F$qgYnuXMY~K()K4Bim}ogzM0T=7;~ZmeoVs`s zk)E@NN{V$0Cx%Of1GrR%WEIK9=!K{(N(%Yn>0z0H4jd7PSn1CfqJtJk6O1k+LnQWuN1 zGm_=;dae${hab0|I#r%{^u=>lls);`$8BJ;6LBic&j~eTT0QkoBp7EtCvlW%^V@$S zUgya3U1qmhPr9E-JUsH8?DVa+b1cho8uHJH4E$QXk1Z#d)jcQm@M}A(upDpT|2)bb zhH!=t%ojf}xSD+kcnxfctik|1fg;QNC*^<}9YWx>87TMm9Cq6OFX4RQ5{|E{Ixrus zj*Lbyz{Tbr2YW7O8)5)9Y9L>*?z6qFd9VoJpomSG#)ivH-$10KsZ5z69Ky{!9;v9x zL7Bc+m7B3IQc2f_@}hJzH_M8aqB2!{8W$Hg!@qedV@Vw7xsq)Pyb3;qEJawrE9V^_ zU;t2ytl#yK^ngv8U;sm$A}$Z15|R1|Wr~D@Av`43L>j&v6!Ds>Ji81d)qQLz63v@= z$UGx8{HfyNRJnMFw6xT{jN%eZ3Vy|zY^K5-nTe2rd(Y1d_LO8B1B=1>7=W2k)Q_M3 zh(VjJr@_mKpzY^9kXV74T~_#96oEv_2ZJaxDMGkta*0&T8!590Rk^6*Bb80^C@;}B zbM3B(R5>z1nT^ZEMH#83Y?Kh6NmIZ@TcV|6*&m-pV#h_D-l2TxM*Jn_DK5HO9V*9G z2B_@sCl{vLRUa0(92*$WFA5djsbvd{rjFt z-TF)f{!WT`e&@0?G4AaoUU2m`QHll>F$(oeU#wmV_^3n-@g+F;pbkRdb=tcE;~poQ<7H^T&= z7Tf;6di}-K>+KqDx5EEWOxm^M@T;?CePwwdHRyRTEs`H$3i~sF4hNeeuOLj}SLe+h zlwAQy{C!nYJm{k<4=(GI9yf}5GMKv`e%Szru|J|!JeTjjlRmL!|M`bixq^#M1_ZMG zk=;JI`<~9~lb`92dIrlCLeBO8@I@mUNUZlZ(RUN7i=OX`wicMA@4@8}jqK31<{wDw zCUFprdfa8be=V&Cd-siq76EI%PV??vhi;sIP--o>VBUi-c_Z?^tM$I&N8MznZbUuZ zZi2qB7TS8$gGJ^Q(ZoEyw@td6NZ;%HK<2o>jC2p)ey_;RBjfx-wcVudUQxp%{z+1nFR5Y%uO)Eywk7D%W|5kwU|7Q)7r zOQ=WRNOfUZm5n1lLYF3wDrUBsji(|)k9mSBc7uzJJyKJbDj^|ys(_8VL{pEkKj8w* zj*T*h2T}Ql2-8o=D2!D%`8baL?$%s!0w<@?~Ax zD@HN%gE>4mFYE1@H;P4w=di~(=~8F(M?bI1;lAdi$MmHC!YiK~&P%hpbhrCsUcz#C zf1A}~MfAs_NUYd`>ANVxM5D)}t+?{(@6)%6URcq!;z&&EqA3!Mnd`FRsZ6`i{9H74 zQ^1Nn%Djsz$sTKEC^ZSesZ(M-8T5(={)U~_%M$F<1E8aVg?gO_wSu_l0rFuPb zMirrfU>qbqf)vJt2|&GCzY&XM9%Boa?xMWl6+M|b##JnRpP}39!rGBBj?~&N+Us61 z3nODZHMRHmy!49Qk{@G__3fh0T8*Bm8{;nXz0dS)^}@RU7-#lI7v0^}n5FG8Ug*aC zZ1e@V6aBxpfc=i*!+S6qOpWA0=)o?|O7(f8Yv<=F@ z7sjEAsK;gB+d!yKs7!UfH-ueaoX`N5gDSFJm7TvYLZ8HjD(X=)`~H;(18k~s?AZ4`Zr3OCN{AYnVi($MH^ACu6wyeNySHVpK9RQ3 z`TnF_f$6;lc>G3@_e^s6zc0lw3l@$lLqoyD$lVA**x}ilUXNT1z{W7^Prys#AEub4 zM-?f*0>x-_%+>UHwZ$J#G2SMnU^?V}#8KFt+0%VXd82C3C=9@~ z2lUrfB7PT&NxAdQ6vIqxU|aU{<68;v8&ib{!M2J>T|D^=FFw z^9!c++22)_v!QwJOdpfZ(!hTk5|-&+>kLp1-`JA?dGv?Wz~NhT2B>M^U!(?qEQE?t z%$ALUpinRbi9#UZTMO$$OBjLmo7gx(%S<1um$okbsY_%t`14Dq%R8+kKd@2cCpj-< zxcCd?4_Qlr=8$rf6|w;l3@5+@K;YSL`b$8l$&a;|-~_T`{r`!1qs{s7fFZ*Tn(K zrgjm?X6(mWtVnQ6`Gxrip_Cu%5#84RlVA#{`T1?45TkEXf6@`^KFGcTG=*G2nIKCL z#_-~K155yFzUGtNr9a6{!|$TePu|RxXVh0=xYK@5V~Aq=e9hFh)+ZIymTbbtkRp^W zG94iXcbxAT%q{_90yeLLzES`F%RB3m|HWHqSbZO5#%j|H+*Kk=Rx*Wpcw=c zuxUbk8O3PckvTfX;0M1vE^jnILm&Ilbv(1NnYvTQ>A{!~B}mH+E)kH@)qd|JsK6 zH}wM{^vZix>cIM4NLs``nAvPuFDMtP3<*VH0$R#Y|E<(95SEfqgp7XF!{Gl<%mjNC|`sY-qNu50nqZ1gu?!{JDOLUS<7Q36+7++`!6>0?hfb(&@&fKdB8M zai3p3MHT!|!2!zVwMJ+38#M>3+zAK2qu`+tVi!?4pa#ejKTyom7%^^ zal0B4QX`g9(7Zi@!wO^TCn!^wYGLW&=r!nJNDayz`4n*nei{=1fp7g`v-9;M?LDU*;9E_oQ5h5jfug`jBw`D`zOXbjiU~kJ@c3K-=|@M}muX1R z;mf$@H*rOx)y~A*eC(PU9ee*w{82M!>L z;RXxY4}sSpmgp*!GZGUp2SSGYD{krjZlb9LkLmu0Xz;OTU_Eo$1HfX4J~|U6gY-uH z1yHAwE`uCH*P;B7Yls(Ut9AZoLgBPzR9;6Pg3{Lkl2U=mZou5))7e zLcZ^a@E@6ia8Uj9KeV#_%dNNJ1iB!GU}bZl0ca6K51oOMKw<)Jf{>qZb^D~ar#=~b zDER-?Ag>KU$Z*}~M*E?K5FK<1N)UM%Q3Lb91c2e|-{Lmazt#)(Z+JqL=2({gP|e{F1LU9O7GO7_`~ai~t&2`ai6I>k zJ+SOKASM7gfBLW1$-hoAv|ECv(P?BK3W|egTe&dF9ZJw53zPM>14$HzsT;ff7h0SYX7V; z|6g*mmwQik|HmP*>iqK|`Fz>^_#bZewD(o2=u~)|%b_1Dy6yP25#UM_`Lb%h?eT?Bd}hz$M&i3|zF1h< zFyI`dA68i0D4{Quikr`QD5!TKjVSQ{is!c3-pIM@O@b2`?dCa|1}38 zBP^#{mWg}o)rMmGkoOc8)-!zn0dx^s4}B3Oh4es-!k}}IPXnl>cY7B8aI9M4#bEL_ zE%f!KRnX1wkDH02`+u0t>$fzMe8P5Lj%}c6gjz)V5!i=q01S^~afQ}NfT+>YY}R-h6#A=g`< zJs{y<*4O^jH}Xfi$hH;+tG$2C#6?C(a-H=Euoip*IfiI}2QLr|kz)eTPzZ)IgSmm8 z05^<~4a02r0jIrx&AcVUCX6|n;!i&@k4C*?Rq=Jh3Zv!39twKd0L8a)Je$Fv=}p<1 zjVX}_+Wyr>yQt@^ANShb*7=fLo)-c2pOH=RetJbMdh1J4W4=iN_n!Rios!)4#A!vV z4FL9AYsx9|&vkQ!Bw%o-L~(qzH}&R4h|@>?+*gF&b=t?l=KQ>XigzL`P)p?B(+=q! zoz<5YhDA~5!SI5PzNuhf`ni%&>PGvk~ADqgt0=3|Y^SloX zu4J14OTb3R0?cU@h>lM?RK362^FRF<`r)aJnIcUY7z*Bnq(Sh(jAx5`4RW(F0V@#n zyQ@9A42o=Tv*NauJ~PE{(g1@EVkhY9gZzGhsqB=Z6(dp{;S3v?E$%bO&sGPywRBr0_*@r6pcV#KH%R!~CgUOK02pO37 z>`ZS@ZZ;-h1p@iHP@f-HQt0~CNM>h|g9Ry%@Pn<*&h+)NFoss>BLO4bM zy~O+fW$P~vzm{Vw*ZnWa;NzwY2o;0$p_yPAq!(fu);X8@7hp)J40H@y2lhj*BBtS; z3#sUTTlwejC7FeQdTm59Y~P$&e^~)Y3z`7tMq&aA(OVz%=-;_Bn*O?#xu2r^^Y@Yr z4))bKvw^ZAkRCJxEP*_ZcmTr)pq4-wqcA?AF?jIvmVbIvPF4NMY3c`xqsRzL3qd;2 z6tE!D5^)peGB?y;h6zAGq2JQ``$@6e!w;{Semc$X7t|O?vz2Fo4UA42)?`s^6nvR1+Ex=0suw^3hwi^k3VJ z@LgPXKB+O7{3S>REAT$-;+)igN71M*G#xC4bU<7X($O#%H?a6NYf;sLLv<3!u8gLdtJg8-c0CF8O9 zf0mA8P}5^W0DxV(083p$UI1X52;hrV3F5D50@K8XH8?TS>*3@(TZxlK7X|i-3uoY~ zt1Ic!TEg$XuC`SdISJK@4C-v-8Pu; zQR*fhsrx=+=R8|{x*B!$yR`+X7$hsK9{HR;eR{oHp?fJ(^^W_6o$bHrVec&ef6b+= zp7)eP_0##%)3opB<(hRU>3hXrl%L{eEqfiAJ9ToGVHyWbA$<#puB%2MA}igw9a+hu?+e16hRw0!eIyRbD%$?N|)?x9?S$ zuvHj0R$pVV-N>wnww0$&Yv;OaC2E{@PrOJhSSY>2%>TZWf9L5g8_697+4^>U>~^#K z^U8ow0UHq=^Lsr4lXNMSLCM?qJW6dOT+BO{wi~jyTVx-uNijWY=Ru8wBr8L&eHV)q zAzy~bSJ4#Q_#%;Nt`iigzRe#>BQ(?0I3xOBnf@_u0+|jq_tm&m|2lQ>u7hzyoPE8l z2o=aIIWiXr3rBtQ8#MY)iC@oh-Xs`3E7%GB>N;Gf_cr%yX?g#<(OdkU;g#)Mdq!t=Wj&BZiW~z+;@x~_kNoNwh{C;KJTs_4`@YVbXjmzON@2n@m0E8UbXLZYNo9^mS6$MmXg0yJ2D9c6VgY^@LYB z>63BNPtXANMH4vy02>#83jpBp>`YW003pCmv_xXr&Lm-nXJX=IZ%=CPW(%_Q@bUur z?0oln8tB3T@ZjytL)T31XyYi+9Jq5aJR)xlN8+*-uX0{Y43!zB(%^n`!h~cyHDX%j zdhH0dYAkepBczwS{D$E&=b&;`dGr~FmoISXl4)*P&tz_;$*p(qnc$QO1hcl+kH=16 z?|C||RAMfB#pL`0ZTg^>WVJ6-cCj0j&@ZKzCPr6>GDhPDWu4`jns_KJAW&yA;}cnwJzwFomS)HWh?K(aa|9z5)@{%$t=U79*y;0$6=O$fw*WfyoNFTa=Nhwiv-i?+ckrN6^*Cwc z>c{5l?CxT3xAVo@XXoN0paN`5?_7NM54*TB51mwy<7i1`Nnt&oDZLt^rK?@-daK%1 zjqE8m-wi93^y{?=RGro0cg}`0d!7!@Nat1?jx;-dX;44&a`mLFGjpwAf1Z;|fdm3S z=yoiPCKz@aLgNT`?t!oj+?#i1+ok$98NjB?Am-OGm~|eCDl(B zkv*s*)A)QDYgo|lw#+tVb)!EOU)hzs^bA(2m*DgGtG*YWuQp0DpCt~}Ulzp!nZ553b z%*{>Q`=Wv$!JFFQBaEXbnhwDM(JDX!?w5ae}&g9wnTRnYcIXW19PONZhDl&yJ z!$@oIIqkiBj%YZ`UN&)`4qi~A8e&_|he&VSbC}vs@1@4RuEl=3o=2*EkKDML4*!#U zgQ1*LW5LvUY=gH}*6i`%%(AiV&Z#k9HK+TJtMIp#({xLfTs2mjuGZe<>EIYW z8Jw{YIM>pCHF>w^QIlTr>6FHKuYw6_LYG1AA|VFdY--(9ya8JaT?5?Cpt#45W&W9KCF`A(G(e)`#3aE?#xqkY zDqyAdvyH0+uB+!zCDS)jFC!6Ci1^#)W;gpY%uh@1a;dbg9l`4;V@xO`><}XCD0WLY zi=4c-KA)_5S7BzWLfgS~@sX~eCUzRm_A$-fkFg^SEe8Zgnu7(>@glPVQcNaxFWfE5 zbDvr%Qd+lHTIW`pc|3b+GgeQzgMB0Mn46N`O*v_A9rxXOWFZ224mddFymqEm<3SaxBX%c?Qkh988FeWh*OaR143v zLjuJhZu7%Roon|E7uuvKUOAG!=plTegMId1*nu&F7OjJ!cz0?f zj0QviCyk$%+@WvQs-^HVt)VgrE^xuyet4#Ae&rw!;j4^MD*q=H($;li7NXqKa(7x)D(*Ijpl|h|Byo{#hYc$?`Jv72NwXHbo;d&{aGsg~jdg<9cd2pn3)&x7zbL2#uBrCME>$9tLj zbIl4=iWkX9H^saM?&-{*U}|%Ceq?mpA@~~U%`PvAo0b-GNn}dRl4+JULsuKlGtnh& zt?WHTRCnUpiD7Rq_vCWR zCj1%>x01s&(BH6#OLJ}8h@e)%3+rwBu!_nz;*%(|?(WVl(Qy_AXb@ea2s%Eb*i|Yh z?Q?Enyz;ktT(Z2QHa<0m(4uhQkX*am7Ee^DV|jZsFr zRatNnpB(YRkNBE3XWrl~%If1Z`B+^hZZYRh_&c~fd&!?BV{y!$rHqk+U8Z&yZnNRV zHY7@%!?5;ollmS8Y<~|1;=A%*rfR0v)9Ft)+8(~AbJ>Dc2cW3BLM zdnYUn+!w@j%a_@@J*9#e_-D(;r-R3=Unb*sQFaSyrOZ9#F|%6LeIBm+62Bzl2*Wi{ z+h)hBDXKO#fdo8pU%DCZ=D7mn{<1q6tlW7Dk|yOcXXAW#Y40D_Z?cfjtj~IU9XuvP z{#dHtj;#D(LWNL!MxY4ExR%!mdBFmpP2x+qOybS9g3=&S8op&5TFO4@S1!><^#CA+ z(VWA_nl}@7=53?dTFFa`g#7UY!`6gaM$xx(0`;dZh*z1DMVh<2fLUy`WHiHM#?;*9 zGF0}%po?CfifQQy^x;>O$*%ijodd01RSjW3NKAp<%{=OOVrcrw{bgrf%U4#TKEr_k zN%JvH&9;W}(gfNYf(w`RYKF1{%uXE^(LB3m-_UJ>tU2~ckWc2){m2^dDxqI zXK&{4Z~mEy;0( zV$+T(-AnR)syN>ba%%CMMog#nU7qeY`HJ3AFKc|u7%!7u39{XyN8O3(mdpL z63*IeXxQ_<;!usPj4QaLH>n!!yndTK<<8rSRkrm4zI` z*6L-IP^E%xaYV|wX_cx#115Bamtj~leWXuKFWjD_APxy z}4ffeVDqEt{~Plpa(_tFO9p%^=)&D z6Fke^x9GbrdP}}<&1rdmH?Tpp_w13($mo#$alznJHDz)Mi2z^qO!4G!xdGNp*wxFl zq4y~ARLgEqa6l@})ofWJ4)b5?AofT?^-PV2`%9}6s#;X67nc~`9b>D1&@)2R0Xe1g z%5>myPhukP870}XtuJ4=%grFN?Cn!YOVt8RY0Sx=l%LvgthX+_g9LY^(S#mwem3xc30s!i|47a1Wt}crT`7k5Xy@HxGK!+%h*E7qFiiXs5XA#0tmw1QiNXEUD z&4&V)x~Z~2*Kzk6Se1@uhJpMw$kF=|wN9Fs=#0=%Zu6;g&Biy^6eb_L>k$~15)0>F zt7FkfQ~(NF?r%vclFY9>%C|;GdcH?HmWktmu6va!A=s%i?`pT)(*V)sPW(RNpjkg9 zahEmwdV|h-4Ou0hr)pLv1l&rFW&~pANAKa2v7Q;!TeGsHG-LotP2BDz=b+`BS~TgR zyvXVd?!6ho?~gS6+lxjuov+Jc95hd>M?goszVHXd0= z=&YQZ5=c#nj#0XO*CNX`Pf3k8j_rl}?ba8g!A@z3FgdrV6xri`c^>q39=k-ZO4!hT-JQnL+3WT#FD{41;jtmQ5=`) zR#~n@=K6@sVz->!r5ANgnGtI&1CmGP29NVVhYyd%URWNd=V$Ze+f{x8&@CXllr9?_ zH4VtRxO_gBw0a)Z$-6l0%+cMUBg{3Ruk3G1eW_i5ePP`ISK_)^Y(}MihM1YP>2}o( zmOCpq_&v3+>+T8n%-P5kSvuS|1YhkN4385>kmi!3)~zngFdy&nqjVhBKHwnB@JhxB zM#!j=ae%x^r!uyD8p5w!(HWM1s)5ZIyr_g#@=CEYcsW>yo{!dzV}R=bIm0PI^H$D^ zS-P`@r8h5yXfqWG4DZ4RH0X?k9agmSOrkm8%zg9ZZR6Yfiq>9v6?QpkBS&Ky(R5EU zOWEin3hM@rP!TP*>Q$5OG3uTsnMQN$+|PT6#-UoPk0MdJ{t2nMbq8dtO{D#fUnyyf zD%Z?n(Oj?98JMhGGj=C@u5s18&S&h{kl+d5AfUh+Q4W&1Kc~*fPU+GW+ zW!0q=yeu2BBA*7eslA0q328+Lb}hLoEFUOq-Y3NG^2D-;LyC`ZO;QKx@Iq7H^)8&I zsXSrSSG=Z8d4(_0{%+@lN(SfS9CXeT5hO?~Io+%SDbfwWBZDGvqy%tKyWCkyft3I;|$aQ&mW7&`Ik^i0CnF}6nlBc_R z9rxFrle?SNl(~X$xi;c?^XZdveH2aCo*w$-*!B);Q}^DHhD!_0%|6P%ZKdaP&Uc;V z)b7u7&6Ya2Suo~-MhNw$9ur4tt8i&S`}b=xm^uY;XHDPX=&WtUd%0tjc&ah>L2yj->M>==xCtQbcUJE z4J@9@cD-SzfIYgeEek+iv$m+L9X^cBSa%U(FrOc|60*q6oBm+tHp}hQ)RznG=Z7qd zEftT}R?QkXwXPHq>z_TRWmBCXRh=5g-dTG4`PlTh*l@4x=_6AEDL7Jat9#t8yLR}G zfawh2>BId@38Y4H(Yp^$j9m6Fza~5&aB(2K2f7CIQ=$_3!ppBm)I7cj$bqI?O2?6W3r zo$%wPLNWW#6c(Ba@pqyD^~C)6?Ypjf4wZw9-PTm0*3B?euM_Z$F5mQNUnFWWLZPDF zzI75kJ)T?QA#Rpan}56^xp2j~@$pfTebYYHng!+38Kh?sOEP-|QyE;ZvrRsbr6awk zcrXQbdc4S$sN@jD{bo^~Tou=&lD?^Ns_KGgfs*ixa5i1o!eiP!p%xFr=q#KyXPSA9 zaLFiMz*vV|&O=@fcCGkM(Xggl;CWvZsyGpD#!(wqSR3lOwdCv9dGOrOE{Aqugme*w z5C2hsG`_gZp<|Miqa&Kb4aCSLGw9mMmOjxQ!t5sE-d7`Qi%+@{jmWJ?z2TgrZl$10 zo{)RC_|j87VORMx0uCR3#tVGPf!3cP?mJkuV6qvHN;C<)gkq{BdWASLC9^k~MNFl9 z8>U$gwB}+FC1Sq8cA9-5LYBL`@eT)~<*~_KZA)}eYBBpUC&`)YQZqZj>_lFKtutwQ zMhR{WcpwZRJEPrt@MJ?qayd)#AlF$2+a^)r@D&JgUy$~V^+U@B#LIQ9VLdFj(YeK8 z_s`mD3eP>XZDK;lHVc>PS;UY67u>f;_INJ={Wq35UlxZSeOMyJ2wNsUargKnvSp#^ ztdDJ7Iy$5Lgu_dmY%C2lfkNwDx1E(E;G1=;UH@ITy6p1%deX<&t#%fjE?+qTe$2LP zxNpBqwqI}Far;p5F&!or56%k!Ah7h!(HL$2mw)_P`SVXl0y7mm-@{IRxUY|hZ2RE; zI5a;WCno?70C4K{&u#zjux)>M;1C=CSoV=as*lL6RCah2V3its7JWAlg< zf{7D(S1oZ;13<9-9Lys1031>bUyO$9AM!ck;4|0;VPW`kh&k;_xce8pXT6dK&IStY zgz;V1-N&$RkI}aS0DIKlIZ4KUo*Do){f8$B&(G_)n%YI8IcXxfvTv#_$?THJqmx%|KHnNeqtIMIJy=9)wjq?swzzz_ z97O7_jg%=z!uYVMqSPGoD9^d7@!^X`sk=X;O!aT(!y?jFvrmjqcI4*6~ zOGf7onHA$pmZ*Eo8Ks^WEXE>pQ*+4ZO?H+j#uIW=Km52i<=FLNoSn03F1LEmdHNL- z?44EjLiDDBVJ-k1#%9|Hkz_kk7hEpJ7S~ph6z>=pY?}0D$0Ct)Zh9{G;^{5!&qY!L zx?HeGteWjp%9EW0UGR2WwH$g-o^rI*1&8@jvvXDXIS+Ri0{KTRo~UuqtMb%SFQx$m zvdwm9k0d*=Oyly&wzzd4N%75`#-_j7>~!_Wxx@RX@uhFJc)UE4dU9kMiz1-eA!{kw zMPV9GIH2Y5)1{Q-wbM9k8_h0tOXs`-rwM=?EncYgq#=p|HZ5R0m>sEv2!`Rz67*vP zUU^^>u(Jm*h1V++>WGBUgv5t&O4t$V$~4jhpH|}(Gd`^&kw+7n*32p8eOg!HSyE6K zH>aq!mX26rQb=+Er=**fu3UdoaEv3TxK+E3)U~A0%t=n^fOcKQ71N*)+B^~UT{@y? zOhXcr^CX;h>B`__&A~ro>8dwBri)es_&Jqk@0FVp7DaM|F2Hk_p8Pc^= zI~OiS_!OQ1?=sOBTto5W??ASD6Ik;Rh9E94tRA?f~!?+ZvPHS;< z(u7}BkW4jiwSWMSusqs)8J=C*{5qx)*OK!U=q_sU2$+UnGRv2fyr?a7$TafS zV7?-ms}>j2Kv&dnms8|_ zbHI3w!<%L!2Plf!41k$n8RQYfI1B>-*&KeO`?+o$GDVFJ*_3C@P(|7NmVj8;HpzrB@UVdbXbuFM?m329dPXXhAIiN_y_U|1q zz8wa@L@+l}3y}chn$_%&D`3;c0Klq&*?5AERMA$ACMgw}bfu1Tm#vztA5>(KxjWLF zf7H0Is^Y@V7moC|HzFaAnhw6I$i`urq>PkpG(PK{Ns~EATP)l30|w00!}i~Iz@*N= z^Jg^&;)>Yxff-;4q${Eih5>+VHZeA6X^3Ws#yGJ|q}QwQil+1HIWY~SH|RNwo|o-% zVqLYWSJ_dK#v|y&*lE?Ev#%mUveaqk{G)mesfu(VcPHk*W57Il8uiOEjIXW%Fa<1# zv_w?E9A?}4;|keyF#z!D(JXSm0-6i6Di*i;F0jH1=}+h>0?KfH72`9;nbgSzw1xbtR(FlFh|LP9&y}c{UoyVHG+40XMv3Zy zIpb`6i2|xvHx<*2zRVrh3+S%6soFg5`8!);rU`exl1BOM}dcbtB7}62Z zfeCm?UIK6!7ev?NHJXOGp=VxnZ)K%>#<|yNe5m$XG1wroP5*%XpNM8Yfly zE;Syez9?lqd#dv?%{;8j+Dao-1+ScQxsL%r zEwKI2N7B9aX+lAa@k+S7gvvx3M^q>ijly_I?T9q}IVlsg)Od-Fqcr^NDU&RldC9$_ zGy|#Q>%>gSTLlAgy zk~#W83;=3j?KdkeY*iQPZ;TQnO=D+Wm)T7T# z@b9D;7n|M4L0m`AM!&{D7!@*2Vk z-Z__gU-&X;9|mBvI{O#krC)A$ZAaqNS5QpVmBF%$AY*7ASRHu=K?mPGXMqVoEwufA z_4=!;*IU&*9)d-S_I-~%?9QGlAjs%+{FCom~m**_*mt6u$ z{(V(aJm|wq_b(cd9Wsf2Jea!&e$fzzssD7VL@xh5R|693{xc7*=L#*j8WPC$M|Jz< z?tU_3Kyji!`Y9||7&+4ez!y8+Kx((EiJ_ZNL+ngnjGf>FLk}*mSX76eoxng^H>tB& z^rJ4jJ*#Ow*gLMBZV|NO@3ibD-goWH{Zc!jdCMMrscTX9-0gM`KkOzyb}jnJRulAv zo$%(v9xQU7(@iYnyV_*Bi41(s3}lWAPRsP*?eU4~+&?ZbRMSo7=@UIXGQMZ6rU!?0 z<#e0EIDe0SH_5@3Gefl%k~hF)NG60N?C{J`Z&@x#6&is7nD9aiE&BHmD6T~H1di_> zUGJse(h$^e1k@8C&K^vtM;SsLGZx0qolB_C z&`5oDNsXN|;j|uY9(C+YGdpj^X?>Pw)N$+F>>N>Aden)DF_Q)CJSAHCO#O*xVUFxv z>Fs(ut|i94m}KX>*{;vJk{Gu|o5LQyOONV|NzAk49PYwh`iyr?&aRl{aGtxUM|a62 zc5X0-_r^v2opUB}2#FkySXVuojQ*JC*K>HTxau=M?mzp=FNf>Gj2`{1{@9nW9KJg< z`fP~)I25TZdniK}WrSGFc#JJ~KEpkRRT_gJ2b#cc@M zaztBpQKwvsnJTsAxomll>A|(LaCcj-^AEdrR9%Z*cwx(T`{6y{Rwt{b;f!>zSI(#s zG#HG7#7B_9m@xsUS8LbekSt^DkuqIWXMJKOGRL@!W$rO{`TZvuV8smem-^)gy zg}XBRdkfg_C_a1#W56^>UW7jE{ET#;SKg=^GztSS=>_>VnMg!s=7a)$O*_vX-|)-( zC*-7SI)prZBX5sPC{p;hbFr?56)Q~03j25LKDZiDT|2RtZM~gOaW(wieNTsw415tB z>eKbO9J?9_4G2}J&-8|I2#ymP;&M_)wX1Om^qn>!wWp4L*vzqK`LrQ6b>it}ZVvtq zEdyec#502h973~NhWKKMQC*H4yC1b1kozP?k4$n1Z?qd?5u2QDq|M#cvde%-$K*_Z za<1UiE<-#4lc>99xdK0yVpxOVTrn=WF7Xz?9%=QcL()hcUjkX;#7g+_uYkgSNku#+=uy^FaRfc0U+Px2CqtqrG$Zo7j(@Er~L zcK5&^+Hnz^4>japEVLi^kI-K9wa{K&dFPCh5}7TfyDg4FFwTw?Ug`grYsC?6U!=MB#94TXK9B!7!GHZgJ(j^H z_{O&0-tnDtW&HMBiAH{SuD)DvPrT<3y**vODPYGwhM;k%ldn~0)gAY3)qVA$M^zqz z!&M7a?k{Jb-8|JJJ9->Dm^J+M>*uLLK(F;W8|S}MNrkd|t8x1tMd(H<+W!+O>K>&W zmmu~njZf8gmgW1Rs0d+wi}|CP&^Ry~QW0?qwmGwg3D}xzd#5ZkN%7^C)cWinD%V-p zI(4FtS$A>Zznuz8^sfa7DCh5NR)9SGQ-k3AJpu&O6!0$^gg;B9kp_t`E3_d!ZgmdFYOMgWSyERFjcE)3RXk{FUkuTRRTpfvBxLjFPi z|BJpIL`sIsJ7+kUeGzC3$wR3jqYyN3K1=`v9x0j${mzDkDYmz*B;VCX0@;ZBRPPlj zZmEC>KOvOrQ_Z7W1|KM?fLdSPKMFDVK3OO|q2B%MOF(nTC6pPm1YrsEI(|>Cx{hPvqFnamD@^x@M zF_I3k8)h+6)(gsoszAa~n1Gft)PGBOjD)46lwqTvG&lJF3-eKngJbOF8jx5N6H*d! z7&bIh)(6UmVggn#Lq065qF2~HRa<2wv^2E!pagS$s;0Vr;R6{0B>v0Gs;GjWszgB9 zzZUO|ey12=h2pJ#=N<7*a6LYf48aVOp7H7(&4DUILQ$B2rZUu5YZ10OA)k^XxUk#q z4~|t{kNuSK#KiFrEJ3!EzubFbJ?W>qf~-fswx57}gE0tpun@uqRz2g@H<|}kheV@x zATa?cAmqEQ6+dYTd`H0(9JGvEg+DI+N#)LH)cZ<=6@o7p?~ED#R58N1@N50f*1f+- z-iUCk=DmhSuR;$%ZljJN7ZAhnYD@qGUi>w(pO22Tub0U|x7z+t%KcT5fREiu^^ofK zA{r9hWAlp-Mz26^Ak`>O7GC_5fH4u|#76)-9kv&Kv2MUTeQcG}CxzaepAu1lM~b zClGD$xOuiA;8nUi}XeO1<;_DDT5qD*P;TD ztB7fM&wMt;Uu+To(VgwzZodsDSQn8B6P^Y2Lkl3<=tL9`5))7eLcVX6@E@6iNJ#zE zKeV&`+wHgE1Rq8W!OCVq1JELfJ~{&>iNpll03knP_x4$FPyIRUq0s+VgS>VMA;`>_zQ>02bG2UNkaNNx_k8<1N~kQ1HEh4v6Y76FMc-RD^HTa3ptaBmC@!QXA`Zqj3+#tr z0ucAvzSSi5Z+JqL;armWSk2*2XXIaH39y4uVE|Hu)~c9Z#x2@z2j@c-X=)&Q>zR?# z2rt;^473lDkJdoPqA&sX%D_LvT&x{UHgWpiwjQ7V9gVpW0Q(PZIcWYvjrkYr@q6Fu z@t-JD)w9#8Dl2fX;|mZo58_K*+nlOk z*~RwHYUkft=?_YkpNRWX7yM0RNdnm?to4IIOfo}zcc0l7D0Vdp81H86tl+t+y?~5XvuXaa>P&w<{P6D;ox!h4iBf(AwxE6d%$Mfe}Ej ziT~BAZzKAfZT+XcP`RIU_HTjyG{e4+Yk$Aht?$2HBIJbS)JwAQZ>`->>>snL!oqrr zA2@(6LhGZ?qok2uh*21H7V>!jwfJr)!=DCM%X}C-;iiPY-QxKSgiwpXcU&$0TC3YOsK5$V#wO%`Ys&{D{L8M}2i+uphLLP(V{qpC z*GydGgrry5_5*9cN04KP26*T^!4L%|01bs;xH6dg?Fn!r2-z{rb{{e3``64{vg{(5 zlPo^?i8(at9cPPg8&(({Dt1yb$OS3AP4C$V{X#3t)@)1xKG61W_T@!AXZy4@@0RY@ z#Q3}js{ev0i}%AWYS5cs6EgE%y14g5aqkrBww@hVvRwyYzjd;lr1(bV@dC9-@gv=n-cetDeW~tKf{-^PlYsNfk_;}c z##hB!ybiuVj(YtymFXGir^WyLyr&%vihqh^@NiqdB+lZ!zzgJP*~h)cezUdPmynG7 zPa+w5N`^1aw0N6(u?7KtYgiU!mEzNRS*XIFmSpzxNM`HXNJfEO1aq{7vC6x-7kTK- z&u5rzseg02+^RIX_mcs0zvWcMOa9TR3@cb0o;1gI-|$kl8L$Lwf-JxsZh`3dyrI?m zyFLHYkD(u*%2+7VRDj`NVk9ksA7(mJ+-sPdjR{zWpx@o?(PLC%e;X~grTm4Ve-nln zToXG%-=6#T8%$-#lx&%h5(qcgz)W$UVScs-FcypnxQ9l5MZ%msyNCxM_^kun3c;6} zCIYoFn7~02zS%c%>mKma)`{z>Kh16Qo%J$SFe6NS#-+C>CtDd93dTp0A}|8zwYVP` ze7YD^AA^NU{bx#M2iuqCm!h~a1ZDoxBtwAf+}D$rtqzO^??4J7tYDQhE|`F=QP4-@ z|Gukd`%?|u+hLhF*p>K{|FXT#?Fn8L7zrjvvLIw(zBALkJ-OMKfMp2e+cJQDUP+a1*e_Hw=dk_ z%7Ab&$N-uNmPPs?reK}3seb{6gv&q&p|#)u3mLp0yY#D+1|5Gr*F_Lx}q@ zi~wp8gfThe6B>j2zi#=bH|5y%5B#ToqBx42u(S}Q3rztFA*~TNV25Xi`pYl@2q^S> zI)Xndc6;#gJ=4#J|NVv<0~z-6Ebw0B2?QKAKRYx~Rtz$PVgeS?D2(YDKTTs`3H(Xr zpTAdQFcVa-fry1M&r0`u6^v>@6TnXiR!!R zh-dr?g}F&!penBSwm>}SwRD_l%YBhq0AK{b`9m@uXZWFX9D~Ll8v+0j>jA9w2>Aej zEh2zFRwdB)c`0%iD_Lltgh&Ry#z4I*6N5fZzMHKCSaE3P%X$FSmvBZ~_ykRVWF0IY$R-jLOlmKp`r1cr+juCjeV5`h2gPwyja5d6^~{PG2L+n6 zcJ4Y`G1IiW5=G*n!s#6rf%l{XJCAqSOKmI2*0$>7wwe{5R|bU(+KcL1-t7^bpiij` zIk$D!tJGfdux01sRzvnyi`;`%Y37IRyr^-IRAu;;A7Y#$?9UkWDu$8=Uo=YH{TXGd zfAhz}3oW!XPl)|jrhkx!K(<5Ob0t1CuvP<1Y!pAl)z{00P=(A;AajARNYp34L8Cti z2z#3ICh+KK!FEPimrbqy+nBJ$r9JN^h55&QEL?9z@jqc<>~GS-wBE#p1=hcpu(!gI zzkWJyBg~NTo=eQQ@7w6G^^mt|dv%Vypk>L?C81H#H?e!8t2n?Fns>tYfR!d1-vF`r8EXVa%2qX8TXX7T_4HaP$n z0Kntjo~U*MgkJ|vB&}~x5{`IgW{p(vB!r_`MU|UK3D5-YmmnttRoPZOgOZBuKM7CEJI@bzI3!v z-MvMnrM1c%b>ar@mRe2@^&?hC6D2G(GG8eXgdf$3iE^ACjy*V^b4PbCBG{XxOJ{+a z%CtlKHlEd`^Jb^w{CMjLLXt97l4Kii9(rbu>xTba%g_BjB`8U+P_p&V;JLE~55{%! zCkl6?%=_m&@7_G@iBHF{GTVz4NN|-*;MyY#-5t%?x{rKU8qRZcQ3nfrRzOySy3X=oWZ+QQgM0sOl;YiP-)f4bzn2+ty!)N9+Xd0Hi?Bx@K)dW z=AG^|o6AR;G~`h9)_2D^XhvmGp2q}VlGjWeWq=%Lg}!Ws604#XvA7nL<#PpwHJ1Pa zf_44lYnii?R3iejwY9#E6!l%Mt;K9~Hasm2e31Sn+u*iYI%eoS2fqerP|sQ+f&?$g zZEgFyyT8600OD`%2HDqlLkj*McY}tTyA%EP-C*bb$NeBGW^d=|=)1?q%gb;3Ctm;P zSKUeg0JYKU&ysmfk-Gs(Z$8WCkI&L`^YtS&-M-`OJe+*AJ)OO%)x3_{y9cnlyLldV za@_vI*Khk)B%lUt$!y<>_iPTkvkVX+a%_$&TrpRY7Zv796c*Wy2O7rmu$@D5!pYqG`k z8T!`zcAJTz2sfLQ#>h0%I+#zy-7xyyb+>hfkCd8FoQ;!mqw0Ir=%8e(XlZHY*%ux9 z5Z=@dA7L6j+Vl+1TxZ0%?pB+ANI@R?SfTcd^o4BHQR4Xj9|0oXE2ew0-i*dUP=6lz8FfWK;@MhKcsBQ#!kL z?$>mayJ+S)6*{j>J;c7250P2F>pZ!K!AG5AO`GF*J+E~8PWf?lU4h5>hC?~W#zM2v zL-#K39o{pPV`gcyV?2wG&kz;{V5q=?ZJJ7on6{i`y=)OJ;G;Tfjv#Lz3A@9#S!9ED zx3uw}Y4Fv~nmH7jSvI!SIXUL9?t1Uhb^I-rG`&(~cg^Ld%QZK6J2*#=hGxtM&$hH* zKDWdBfLX7^R7&HVPr)-8!o!0+MZ%1F*))2ocmobrdWN{2A+zJ%A^~9RJqHL19x7Q= zYw55fW60dvv)A^SSt&hvns~;-urZCTrm@sh*1IGAz>aJ5VK17b9$i5B6|xF5H6C{) zVq1Y%vc|#euc2}o1 zov6rLQDZh%bY44=3LQs{1veUJx53Nt;awU7OB1f~*pROX+!QnJ=bMGGW4L_!+MY&t!ustQ(aKiRlK z;J$JSRWfxg^&%26iAcC*X>p@J!}7Qk@!?9lni0H?GN!~b!VY1=j$)6*lgNp?Yjfw+ z>J+CpD|DRA7ar;fX?D8=mAj`_N>JkQDHBIPwF zYR%TrlVe?G%{yr6;cP}^Dpy%St5$fTC0g*Iv;EG!r{k8(m{=7o^ZIKDflBarjAIz;Monkn(CuPRV0e{JpMf&kK-*%<9a)C zvC>}4yJ{%n=rK2}+_`$sc)m@V@|6qOiyp!ky4WZ0M(iCkY|%Cf$GcrEX)+)RIBNR5 z z%zbnYf8iF%v`c$~D3yJ{dF4~6(h#>Zi;ApjEOkPMW6!25D_>zL#dS(EZNjhS^eC~R zh2Fs;Db00gBZAt7&abuY#wsdbPe`W9s@suUqU$CC&?LG-8FFYysjE~-#_!bpc;%gX zT=KjFHsHw4G|qBhD?*x{WY;Qn%2gz#%pIE zSj3NQ`De|9a9DB^SQrvF=&|2AKr^!2(TdStzw+=Q@paS`{(@rADwC{CtBTMBJ_X`M z0Lc|QuDrpUR8@y)^Rc?jJYr8B33NXE^rb+Wtkpp$)-ona4%r%F+-BqRZAg>^r*X}r zCXJnp*nwV*By|ct=IZ8lQ|V9E+aFL`KMVKbK~^`_w|VsAph_(H_A5H~y~-Gz_djH^ zQ-so+B?Y@n!Ra2CqgvX@C&~yOoLO0)mD8qS%;_9*t}hz2r{WH&jg~#J7x9(uZ8W3-t$Pkm-rpvg)hvp(z5Rq&WF#Utr{NAhx` z#0uf|j9^jHac!R?3PJ@y`=pm}*`yn71*IWkwERmrbX0vZuMWo?&lA49vRW925eX%BH_NEYk)f%__mf674DAmW?|Q!=ho6yzC}c=nop z^;3T;9Jx`^*bT=kc@nW{kY`QOnXTzLnSzIyE^k%(GTH8X*&Xp5wJ9~OSZv-gsdqu4 zkD@P&Zf$d6guZS(SZoAxhGqW+s+M~)2BC@&(;DdQbJrIR;_jrTrm_sXm5j4G6CUxr zuQ*(DGvg92*$wJON1r=0$2?iR%FlxHF6fq=O(9ElA5Im$El2cLuFwHv9){IB-N;4 zo19Vd9@?dAbF)Y&m~DEG|H}Y!;cJh17qEj#TU;|GccyJKwV%phl~YS!5rrtRjp9}T z$BPwCko)xockBE8dGuHtz1fnu8@+6VD-Tka(-p;=2K1qb{>Aab@_k!85(H0kcQ5#_ ziQQD_TXkL9(+zA8>pi(YGb$!*PkbmiRb7QbQZmS2BU9pBr2GI|ChYP>y70S{d1__X zC^;dOmg)|yr)>l-bdY!@qk1OCBLihL2-U1A){0Av>&DpY@Ar%lbwG|OzcL?q)RUCN zcS2e2Wb4Zpp7PU(EGMT_vQqV6b6QJ^$K}V?UFz)$ZzI7SX|&;c-JTDqEe_tqy~>nv zY%9IQbfLGj*Da1K3BD^N-<4WY^1wBwD@R^Ntkx+$XZ1cdmdHifyUeGlb-+m$Br!hb zG~QI%7^zouzuR@h$wfj2p0~=tGbkX-+qV@3*%}P@Vt`!_>ND@ubALQNKe*+=t4h&w zU2Zgd*Ia~&`7R-?YM^s8$mgl`dc}F(W3i+%%JwEw-ZKc1=nH(q^rYjyDwadRi`~>& zpsTpM3~ftCGb2EOniS|gh#FU|3-l&vD39gjsb1f2gEqX|Mo`?Hm_^VBLM0Xg(__Q#|a@YDpyVJVMrzQnc zQ(|J3Z`E04x#uaX^To5j@VwRfVl>n>EeR&?5uGA;C?L;^!O@FY>`HESIZq9pB=tZ;hx=oilGFv&#%m-%K{u4Lxg z$l--s-~_8R?y~o+-L$(>DZP=^KoUmq3u^QlQps&rY)(>ItB78P?hBEXVjt))hv`q?)mp z;<|2ST=^74K&7HHBL7$eyD4}<8LQ-#QfKH=s4fFPod@Rt_g)IdV?vg#Top6)Cksn& zTnN))E)*Ol#s@U$jzrifIeI74o@wT}arBnyt=&bduY3x-Ty>D6aZG6XCz++}45tfg z2li7FEwt)ak?l0;o+6z>b8fHay~N^CtyKq*D80bM)ZE&=a#dzB0f#P?G)9+eWwC0l z)#wgPRIZwO5roCm=dmafBz`X4q5~@r;ll-qkHoRHZ9ULId{Vg-CQEgLssZh?A6Uv|128>i|vPTEKp0D;;R)gQ3yl zT$RhJn>N4$Wej{&?n$Lo^(u6<9v&}d7sW?6Uk>$;1{!Q$Cwtb>K&|BlGoKw;IF{{x z%~271baz`8fTDVJK}9EW7@Mi~Jj8G=KX^H8frl^s{`4)@TdAop=iAQ=Sr=O?9jLiJ zW9ZttTts4U@|3oHRiboNYCK10>8py>iF*PY$HuNW*RK^0*Uk^B)283BZ#F zdzcf+OypyB7(E-g7+8KqWI*uzKx7Ye73j~Cs(FXbOX(?$ZDG`}H%RmtyBBhNFK=h^ ziD?t1$v8);q<*ibx^OyKu!@S!KG}yv3sux!x9n}RZ`|dmOa`#ErdDM|H4tNlazjNh<#ubhkGmlRAA#>r_ zJtqna&4mRz(SUjq0sMC2tKLK9AXAT3HK<)P%-rV)Jfq7$eaat+nmDak(eBhbfu0)A zE%B1D$f?Oc)NrnF*{$)>0n*)5es)>~FC{O-6_rsFD$#Lqcf~Ub!@bhqXJ=pvsx}D)x4OSi)FJuh5wB+`PjCZez=+Fd|QEI!52`>l|-))`zK|0onsYOE#HD^)dTIg zS;dH0uCX8Im_IGY)7^NR6VdX>tWL)o9gcOmYz|9TMZtF zK*&w&v>F|4$T(NddTx;WB%?!+SZ63)?4V@;)r`E9kfJd zA2>8IqvM)IO7*Q`$$;~oTO&Jt7lDE6OI$CDBM&?%k!FG|Q5>l|G=XfHZ#wDcP@9g< xC_m!-5+@r=6HTDlTIaF7bENua?~3@pdsi15|JYCZ{NB~}&Q%HCami%B{{irkd9?rl literal 0 HcmV?d00001 diff --git a/calibrations/calo/tower_slope_macro/emc_corr_files/emcal_newPatternCinco.root b/calibrations/calo/tower_slope_macro/emc_corr_files/emcal_newPatternCinco.root new file mode 100644 index 0000000000000000000000000000000000000000..95f8227f5ff63d92c5fc5bcc7891a6bbf80344aa GIT binary patch literal 44253 zcmeHQ2Ut_t)(ss*x=58KMU*PNNa(#6K?OrEN|B;~VnRm*q)HQsbWs!(1Qf^6i}a#^ zpaBKx(h`A?^5e|-KW9dbbw=kszZ)Toc)5P}oU_l}d+oJ+yuADXfYoLI0N@A!lsw&f zrEPt$x%DF0dRY-~{pADzWNHBb^u_=JN*d?bjstY_rL@LkEujw@wt(5+@474_~{B?H)E}EsjSeXpLyO!84(fmQb$)oNh<%WJ@e`l>(!4 z8V#UEQ$XbHTGoAbkZL0~&?)C?wT%wg99|GCTHG&Ewm(b8R|F*k#D`R6VJ z^h_j8kIGS*^ivLOMhMUsX!sle5K(_;aGCr*qyR(~e;!;UeqR1=j(A2F=FRAu75;5> z@jZ1o;dG=XxVO|}r1I@?3flkX`&ZLvOr=&1PPQbQUo#y(bK~wyG#rP;?GElHpis9B zrA@IV79i%P&~UA%O+67VKu8y@?wCt^(N$f5R6JV4{W)z~K%)Qwg^s#?QbLL&uKfURgjBzL0V0+*b?4g&7u_8N$mH5IJXaFZf+mUpB!cR8=Z#bBcN7ux32L}KG*0zN zDI#PnR(HB)eDRoh5vf$MhR3XN+UbEJ0xCCkhs>T7XUQTGVK2n0T8h?+D3|{*ll+q-p$hF+ANmp9qU5KkkRN^D0b0J--T2n zqsjfHSXy9*3jyV!M*GyV6el4Ul6{Aojy*0*Jz3&H#5UaMTv>L}!`+2UVYtZ?I}UnX zmUec23P2{;Xm{a6iUa!;v4C8YTi1zH->fM@rn`+!H&0wVZaqaRbGOOk)rqt-qf-Pl zfsGE?ODQgjQzW8+O~;=trTX8WBI4X=ba}9J(JN?*47kzcgHFv_S9 z1knsxA70?K2O$|3SIAOCtqQrWSSUkiLO7449l4%tJwwPjb)Nku=X51=8N$*Vd8ED1 z=_x)>4i4w#5!cby-Jg^knv%~W<)*DC-&PQM1{2n*={eU#{5t$QX(`l)?U(q zxm~tdA|zVhe!p4zL&-vku#66SY2WmA#h2y55kmIjdR7njrW5M{eZww|K9}~dZa?s9H8@J~xwsKJW{{?kQy-WP7Q@)0>JVWwWc_#m%mQ$dr8}@r z@91)-%>Bt-iyO6CO3N9dL6dCojXERn@+Bbd7exw=+U?q0gbd+Vhb z->pb@PMep9A>yj~Zh7%@IzsjgQPqvRl_<2edFYeF^Lcm632N)?HBFAJ$lrZ{rB$1M ze{w{L<8B4HRvi(afjb9xRW%Q{r%dZK#!Bx;)~ByMuzlP@Bl9RT|vws9)wCfMl|*+|<6| zdF(G_1!UU<4Sk#SPGgKwIS93xs6LtkPF-LMcn=<60FFJ><(*AwJwcy#x8CBW_hq)x ziJet<8*E;AL&+2;=;8zG&9axXnC?$7mIgK)dA6KQ6Ewj9-Ke*GuzZ;lJ;4OqScQ*V z?jh(1Cgu_Q@0>7RkLobx&&EIJ23CWxhYqx zLhYTtn|+eGMXpZA&^uEiYm$BHZmouhcg8;JN!G!;bq1c^mlQ@PIo1Me)i{>Z1r+g4 z7#k%D&VTQO@oh5%CV_b|+Neat?isDV_DLJZ<=~5i?PI!@%o{L z!;f!eQ@J}bTpF%FSb6L6u6akMnvE#PaKq8px1dDq6SPrs^(Gg*vly}_b`;4qe1i!y zIn?^|PMEZ5WZsNce|#aQ0WcFRiE%~sBJco^%?6e_ZB6k^@mMGJ7a6tc{Nfpc`cAC< z8Fl*3;+Nz)oH$kw)vE5imCh&R#L|AKPWRxgOsNv5U30^=n$ov2gx#Ik{*DRr^jY)| z8)1C)41uX&A&eF37Q$hsr7ymKQx6Y-tb%7#`{grSo>8^D*L#@*kI|T1MajAe)bhRSb@qT#_Fs;6S=5tFiW`^Gg=6bh@eN9q!GP zt|-{GFr%y`-&#kr}PW%g$6tjK4);ih)vN$3);tk##VaiJm0t>*pm=u&C(rmV9 zz^E8H3z;tJGb(`U0xyF1V$4y+2(y_#0-y9ix^8Dyz)$6-qjh?JLZZGSKjon|%~L)J z$<`D6G=Xhe;BCeUsyhnFH3T)ib&ZouQwp~`32FuIHBQtuFWhEPtaS7)albzg^C;sG|RfIr%!&rb4FBMr87R(OrHy`<_l4(wy##d4|Xl#Y}etNcW$s+itg~fw_xZbN~6?SUaH?%-zKN z`=i_R?e_MkcWrmxA2ZxxC$gH}O}O*+xh5ey!FH>zZ3l0ke^g>8JZIHSDt$Y;)7@_0 z$WRycsoOD6(G9S9JJHRdZUSnba}Dg{ds<|>C=7kh_h*d@P04nXi1=N;`sDnPiYQF4Hk(9c;ST; zUJU3aQ(B4c4jSJFU+_k2n zU$M3UYhTg@gd^APj8^@fx0B-LC%6RewiJQ72bk91}qOv zFRYkf;kkHKpYfV$-0Z*={ySF9FN5Pw!-Zxj%kG$d)_Cs)IiDcI;${E#GykPS(e_FCg7*cV8On*jafyZeiY5pk}BO zh;HZ5GMbj@@wx(6hJ}EMFr+9d1RFj8`+DtmJcfOYD@wM5?t)M3i>xu;BH2!sE}sjl z)?++r)g6pCed6Xu$M~zNJ9oYEiQiNlU7uUxn~EE*3m;RX3Jnn+}M z)(b_Z>Q+7x--zqhFXUya+k`!RqiRN9DA5G8?&eqxFH(FVCmPVU@91h|)%_O-IM-VR zlvX3&&3ih8W|E2#(Vwd&=H63BZb+_5f4(Q2TWFlzh?s{yx>cQfZ|^z7?e_FBLyg=b z%jb*;>66Yi@^TBdX&Y`cO*%i2&n-NoZA7|1DZ0avd*5)YA+=9Z%;*HS=tip%!8X%# z^*eI*H0?2@&^0~Zmy#nixyOiPuW9r{^PIikHpH+C7r<3v5nxKpPLwd>$aGbYR}LOv zeT4G|h)d(|4>5~Fw^DzG5Tn&LQ`PI02iJtff!Q$9C=bNQG#&u^y5@%^yx|Wq3e9C6 z|9pt)?oCAPLMTl8_bgt4tH8p*WEg5ZKokt~BgCcG-z~&wEPVeE<7-|5X2OV|Y!Efm z{=JL2a1B@t9$?Z7_VY3kze$Kmt@-K@!%lSrt_F(&(_lDI2M}kb*LoIn@Br&0Mjwnz zSk4xrLPh|9(BvHs`Bv}6Z`^V5j6ZY8Ke<6+o#6Kdg-mf>Vij7Atp)`no?V%2FYF4}uFdDV9jH4WK%(~0w=p=D!u0C^3DDB$LUlwNNdJXrL_K+AI^ zO*xU=@s;s?52S!@H&p&kSne<{%g^ zY|)wEq4Xt8`P$~lhRf9IEx6apS?C-ti>e?Ib(JQt;%v(68yh;l$c@LViIo;}a{Ui_ z(GcQ8cDuHk5**(dP$q8&l*H_x2h^uGC2SM1J5Fw?x3Nq0Mfj;Q~HD zHSbow;u6e-*8ETrY+0caqg4LU?2+ywu-F~2gK-alcei6dud`Z)`M`jB+2 z7{(6OfQZ5efRWvw);9Ig8#Df2ePf6TcO$iC;|Dm4fu@jrtTrYQg%^OKj%-A|ZE5?e zezuR^7?XeVjUgs@Zf?n526Xv06z&4AjU-ee0g{W|U}6S@8)=ry1P{sTi3%k}AuGqlb}`R0eY#LOUtSba{t0n^)=m6*{%ovh`RmI=~>OmO%+)g|* z?Q1(b&`oce)P9CQ6Dwb~=Y4^OD1;BChe(?i?FHq+)FIJW`m=MCLXSY#VCIlwtSP1d zrH4$L75x*S`J2!HSm2Kx?X8@jp)~*${H{&yus3o8t1@5N*N$#@t2pqbas$6sUqo@s zf2i??)NaEtqV^#yr%QW4IWSd71Qs9AREqsios)&UWIJs*{DTS*|GP2o)qyz0Ri+7v z!?I$eP{$F2)1|$jJQzM;^*ZFw)o0ua=Z6Z=EaX;3wjQ+L-5)AEuV4NXR|Asp>9uEU z{&%HoVC~;9oZw%{*jS-?OLBUL;S^F!ilIWWA!Me#df-=JDv&TNKA@o#``LsIbUWlj zoDCN)TkDWGmG!s}sdK#W|C4SCTIJIPI@XiFt8~hG%o~jk$QP)m5QYe&jv%V0y?Wuf zFbzlyb|(fOkP5=QEA8=}mcVytP9ed|#FeDuG9RQj!K433*H|I@bcWNI(RXERjElY@ zIiWlM!V9DzuAK84gx`eOKx(k3Fbk*=WEDODf-L$RZq$2c+UIi#Vd$3M=!AczZIBW+ z(+$!6T!Ds?_|)9uWB3i&5l9u*6Y~^RgY?G-K#-fiixhqNO#6dQ5%8@bPWk)Qa6YXD z{n0=Z0Jb&yp#qH%?NBKU1c70}7z}C?xi+^r2*(HD9(jE#{q}=1?eiG8xU#p5LXNMX zZG1G)jNJ_(`a1*7UFESdtR1ES6@{dk<9rM(fmq@20qd5qZzmx2L+`c!5NM`IE)aji zKoe5yjd_7;LB`K<4gzmNtZ~&?e874s_+2{T&%34j#(^fALH08O4Pi(>st9Q`2Yn2@ z0XdATz`9}Z0W%;>_`hOH_jd=HYVer;{|6dU!YM@e4749u1Tn;AVdXHssJ{T3^s=Rp zqqzInK+Gy?3fVmerTL3?pG=%63s1KG8(ZMBQ`7ro^0ubhpdJ_Ln zQxFTSo&1L~+do~tjVRBcW){oV;2`tG+sejrM>gRCV=*dU>VMP!l zTsHOq<_u~Lu{Z;&#GzMVfzpH6tMuMS!MZJ&+unDlP&`iD5$F1z@Nzku3aq>U6w>qThc9 z5K_yAkwJMO;M1^PNFGiT7l*|Mbe4j@hXPwGj_Sp^&aI{e*LOJP#sI?KxaIbSf99Bf za?=9MTUUk4Z<`hz4m39Rxh&DgaFO$b+V0tx8?tG_bSF;+#h+YWmAmR=ct;**+sHitw!V4XAG@|$Wmg=sy*2n#kB-jThQZz|PcGl5xz@69 z%D8ua`nN+4go)u0{z3+UhJ=g}rf*poT-7VXy;`#h{}o z%)tlUXE7ibHP?KlSv3v=PK&uGX!EIum^WzFH5-9Eo z_5pX@jNfvyK*7N1aNAU7({!&HA|LE0Flb6vi$tAp% z55#i4PY#WM;2CL9KdumGfV+g1!FZwI2-pnd;{bN?-A0h#MbwrB@aPUsihj9{8f+u# z!}_+kzVD_y{52gqA8~?E;2JB!8eyO)AQCc*8^9Ig%y4)CIQcr`*G{wd2t2GXeR0Ej z7aXnjVObQ&%y*M{__Cr5J1uhno{}1N5%`XB%3n*JTOud~Au5FAyl_?fjj&IYOKpbYGl_z=ezEp5 z_9f?s<)6`dpJNp@A6)whb}4@}RH?>oevXmRSJ4Xpz$tvE&WV2RuWY*xAbhKqIzjWP z0>h9bJc6lMo-dY5-?#*E{h-Cbvgo_!4@88!Kg~1c9ak0XBF(o{=z52|_W7005AkV! z4Kj&DKWva8Cf58c>y$UFEJJYbW_$Eml)2v8 z7ot@@(OB|@5gujEcF>o5Oa25)*(qgPR*WRd4beYc)N7On)da?Y@d2GU%xAb5DsYK; z07BlX46cxUsxT)|2anJoB=L*2InkZK56g3|r+qg?+jsWM1R*R4iD{Rf?ki9gU>KMb zvmJ#Oz^%o9Lv!85;M!OMV*1~mSlc*1)gu?ni^q)hhYm7i#Lm6lxlj#Y40tC-2z3Zi zKJ9`JK*K@rwV3>>miG_!yKfn?5)qb@(*DbGom&gM8ZZh>jbTU0A$+H&db)F<_<&^y z*>!0o^#v_wq9QZWRSFuOBPO2yuzQ zz+em-wSionn;Pscg@SHF-$^NDr0@7RDS#-9a3m z8SE>?2cTfEuW6|MDB11t`*WrrH<&^W!c~ZnA0dEVs2)zzqANs1j7d`;;?uf zTD}{{zzX=C%0GWE$6z|RRudJ6V4IQY^U8;7!xF)}G5CNy+@=Hbm$rC(6X~LlatvPl z6hVd{q!V#zMyB7Z5Uvl)083z;QFsB|TFvj4Mt@Jv^c!;wI)8*9LlE+bt~KxY+Thma z`hz1SbHxo@btN)?gu>heFi4Hqdy61`^9^;J0_~wIunaH;5dB6OPg?#nbsSHN0wDwd z*rpFStWRzM0H7%V0R-iXw}mTOB5ICIE-a5TY2x&E(3V=3bl5SByOx5sCFPoa~0=``Xu8Y4WBLB zR1AF*FDXv&ahAUEe4aSD%_N;?M*(w_po)&JN#_3hDu*7LWN*8#qp{Z{qblIiUh_D0 zBFGpGIs~{xhOOmX|KJ-m&N5G4>S~+9eLdl0W>NPB@|37twRbI^osSyoeiGCeR%SS36t>ONh zHZ7p>eRi6b+FGag|A*9nl#fiVO~Z2~AuZ^>CU~21!r<=S9!``RWSRz(14Kk&KllcR z`;%qevn#(^a6QZ4a;@t)a^K*saoysQ$h+Qk0rBs%dt6cafBQPFU;XQ}e>JcRs{MoK z;|h1)`nmXxa3hvZm)LRNw`O+hp>O>kA2{-ZmZjiJ!f^3ljUeHxM8Fk>ckCd6<*}eQ zj*u(+V7GoXg@mn=K~|WytRdlVtnSvMAj9vv-F@9&%8B=hfNIJ|{m`G_0Ne}a3R|65 zv;blNfQ0|oWli*ryGL5<)*|6ZVs7r^%rZM}Q53=9zf_(`@_tsCYF zdPFL;*(2?g;;uRLjEwW434220xaC60pA!+^p$+Yw;N8hePOy)g;Eak&89n6@JxB;p zxsH=gxN%2lT)db6>w^avO&u>hUA&a>bU5SkB>T1trtxZ$+B=obah+Fx`m|m%$GX_v zeBVvI6I$BmPTnO}Bx0wX5F8}edu82rPDb6n!5+~bsH3O@M;IIWo*;7yz(%ZM`q5wE>>3E8z-mo0!i0MD;Mh&OCMyZ z1T(QH)XYm1e>o%7Y<*e0yQhAhBxv#ugG=lYz1Wt{o%U$!&_dXw*7F1)^Hs8rM{??Q z#{wZm%m;mas3R*YA(3Wsv+84z5!ixP%srxcE6D|D@`BOz*YU{!-09khN3|D~FOG~X z0qC`rOd8WQt7Yx6f=6K$rE$Hz7uZ%+0-YdSYZOBHA-gpiJVybDYK1DnIu zAcT+j+&i}Jyw{uY0Fdy|6?*|td@~+0hJG6lnr`k+tXt#3&K>0Gj~ap*NrYtnmZ@&>O$`b+W%jRpmD)$kh7n*Xg_Y`fWGc8g_ObPCh!G&R+ED zUMKC{1G(JYJdZm$Zhi6f+ZvB#^Z>N%)_CkZa@?JL@T8IgPg5F4D(Cqu*_Ch|ecej; zyOr)5)KB>YZ`-P6+^kNbZ?BZBITOY1?H`qy!KX12ZF%hSfMM3v$`|r(?A5}3xvt0a zrBI}y_u_YGgAx9a9Uh6CD#3&sy}7O-l{5Zbzm%VG+34}imuETQe9HM%$HptUsq8Zx zX@T-6=zyMF{mUhS5#hjla%j5B`XGA2(rdXHnVj^mz~@O<0xrBW;{ zt$6eo#yE}?%c=8B&3UayUJORM9Z9W^O5gqf;S>2VoN3>K8r_i-C8jhN;-%f_dSBN& zD4Qu+S($tG#)J(a8(NX0tniZ!&q*wFM@=5wYcUAT&!rwK(3#IzfMO@6fS&N_3}z^_ zKF&J3)rx)G#%47eW2bfKNt#aQ+6UP_eSH`{5PMdlU}7RV zl{M2;XU|#PJ-e*6+~lvCdrpSUsn8E{t>r;v*B?4hh%ozTaIfib``7ZzwC++E*U;Ph zB+qE@%Bit1C~mOx>VXlF!7JugM|O^93kVn?!U4>;2oRfQQetLJXE?4~#_aV`gIl1e zTSvox;oK}df^)Yz5-?rotCKx_EG(;Z4Bb947NFtUIb1=CR!!G0QE}H=Zn$23hrf*n zeljd`E@Y;u_4>t~-Zthvl9Q?Rvp)IHWyy~Z@D+-(=tCLw(@6Rq4(S^aw};M*cZmgp z2}Nwk@`scU(`)N;VPdJ=TA^zP%?~L*eU^0I(x^V2v%0>-Q_j0B!Di=erttX&>EX** zzXA?X)_Q+O3eFW|IcNOq^EoyQPh#fW);3(s%gWNXms|K+PF5+fzNi|y>(KJjBKJs{ zhh5yL>AtG8hSRrlSJc@|l$_U2r-8^D2UM@^JL&|pR-r@k9d~3r#dXd?u;k+KsC&b+ zu(SOhY)88o4jf0ZCx`9xI0$)Ms5sr7cK?armA#XRJInJ<-zZ*dr`rLfI7YcWjLmFn zLQM^<(t4(Th0J~BEVg*^cG^`8Y66vb&&u*nU#6A6^tR*WcGaUKZKbS9rQ~g*&9d~o=xSe~`NX*e=c0{FpwbNv-MTYjZ3)Or#`Me(CnTL@F#*CVDj3Y>D zs-#T&#Q`VHUKZCdH|kW=23l0nn}_8eCqX|xT{^pL%uoJ06HXuWtK`EQ z56TY_t)?iC#W4=}>ODcbD)@@h?P_{3sVrU(&>>v07b@dA9VLt7 zmXm$3_r9Ww!_!3j$z_Q<)KjOi_04-qD~8ldh(aT5Niu~Fu8`(J1R5a3vg9(&$Jxhw z*!prT^VNzLsHrw2eET2j&7NRuaeiqHM>~hzpt{rHBX#HSA%zrbl}73G!}f#M>&~+= zrED(mIYn{*#IqA4zCNBePt058Xh;}UR1&y1&nJexI8>Ll+(?F|P(u_Rx+-*C{dCy5 z=CT*RbXJ9^vTo)KUnE_)M>*xvS|?6tA9zXSEVd-n?fjw=hdTQM;p1@^GE`Jg@Cdo$DxG+W*auQ*0PVFuxvdsg)aNS&YWUBH!*+~#SPlfV}r^a zCBm|PXXnPtf2k#=&b7ItqM(+=C?}iE5V`BN_`;IQF{hI=6_&-<*Hbsdbd{O2Ow+8Z zz)n6=sw3oEcOQF$B#*@V<$-$l!8}T zL5I0V+}RUB&c~m<+M6zS=%^D%DJw0vT=h2M zMw3e|7_20ZN%e4p<}Mb(ATJim2Z}xx8Wwhw8Bf<+AJZOw9^u7@scNWg@#rJM7F!8e zD>?VR&K#HvIA*#_jMkeym9Rt6sdKlZdit5CDkwgp89ASob7tXe8Qk)&^L09t@yFE0 znvs)Et^``d^OQ_WSGl^pWkOl@PM3~PhK5!*pcg)#@@RUVmNU@vcifw+RF1dn8RL2PCHU= zOv6(lQ%wW`Tk!E#PR~eUj=H8weKUyQENJz*dN{W+B`skWJKW{O;N+9eB{zY?uWjLe zBOw53t1)fumb$W%B*xpqb5{+j2BE>0r;dngTes$#o_ayd;6Hyel1`zf=9a%Tsq`=gG^R)#+59gW31QF<-V-82VZqXzQk@y zk1G{fv`y$=R_vwe&1PKNTo`3~Fdnjh6mp*3`Z8Tpr>tR^62z<;R&%jp;VAJgdU`sm z@OvpltJ4vYFMEq3v^F!Z5mVivuXptMW%`sShgaDJaPDQj;tQ!%Y3?Iw;x!7i{Jxoo z)+-t&GHYB+Tl~Te1TTvOrU>lK#44&#-}KYra%h)htH+EdIJNpkIh)IL-j3=A6Mu_ z^GT9D%h|UOu(toMV(+T!l1LY@Zhy}i>#XS5aFK*CaGHiHjg(YyfM%BD#VCb-&Md_B ztBes3X>-*}Z`1NX%B?gUIL;l}d%2C$D+Sv#2(j2^!N_yPlcPAtFgyy-@OG(+>X1#IZRpjaerI#Gur^b?Y)AlS2 zXldIx$$=!t$DGC+%Il-_3m=QN#@!PO z<{fmGINiWKch0f7Sqr$SyQrda&)Ms!CuZPKooFUVYp#d;6XfenWMo%3#N?bP<#NaR zkli`G<+Bq)X{oVsD)$~7%689H(GW=Bn)kfdJP!|ZO;1KBc*La29}CR&Vs`Y}w*N*B zw2Uu_=hE|s^O!@9@)X2%6>)ZLy~oSAp4v#+NnE*_rz@^9Xkr-=ku2R)h|3-5s}t&4 z_Q@FZcE#9qH?k2e2`68^6+<-T5lqA`y0?qCb1CHH`GQtPc_C??xp1qEFn!`wXv)*x zaXY3ABj%>`5j_W^DfFnuk8uj0T1SPvj z60_Yc&5_Dl8$G_zrJ!(m{(eK&xmAvSY3rGRWBjm@BV+Lwmd2U)a(N4GE4vNo5|Urc zkPnNQ1Y}=YI-f&TIg4!1xvxB}k&Ea%iw?wil+@k97yqxs2!@aF%Cz zE$50LXI0BQKvSVt9$z*I*{gc1Ju>f99hVt+L4~0BwQ_sdQkWjIAfpFQKkoq=mQ%u3 z&AV?+Go2|YxpO&Om#si(WE&}BaIQ20bZC{SpX;tGbn@5+5sb8Ca8QMyzU z!IHrwx{AxGB-!>7g?@D!6MG75$Qi}Swk^6VEgdLr+$XyC_>;qhJTijhtI~QH=Xq^I z_Xo%w4P{C20LiKr)n&nCrw8rN)iQSvU%_2@B8~w`T+Fa+BgjnCAUArVs(g>BBh%4& zSJio^AO=bz@3e^9&ox2@oIBE)ZJJnfdTvCJvsog`5-Lxx0CJ8$zP%JEI22TqGj+ks zL)yQi$3^7+S%nAb4Oz>ihgV0v?>v1{W{BOkgGM-pC*G!l6Wa(vC`Eb=7!vV0|JwEEcZ8eA&-QgkqSk=qa)cp0>0* zYNJkA9lFA%xkz@RNe`PcE$CDC@_~YqxDJ~;&L(hTCE%N{2K(SahMN^s&)e$g zwcQXFGyMyvpzgOFl?dVcTCxE&RjUiCx=|y9toJWLjArvfmctkL1Tr2?-Q&2ImiB6{ z_59%BqQlBI)fLl5uFcDZl!j-{>eyE%$yBB#aJQG-dpR~aE-}(0?{7WPpGqWyw0+3u zzHKZ1k+GcyJbf&}mPBQ$5WCa(`RLW4vKwOkLYMlZx?!up0KPP>Ul_fVpCLFG;C?;9 z;-|R0FyjaK+fzOJ*eSaSZ9Mm3hq@ z+|%YB?Z{&mqH!Xp3kobm_qO8zwUm2FTescx9xMZyd913#>>3dkJ|~cw9RV4W0T}Fy zb4s^botj_ZCdYG%y(BHKROcP5yI8R7RzGaBecz;?opyeiY$nwi)S}!j;WQTan_Mp* z$um(sR5nf}o*XZ9rzk!M@w`)*t5Cr^RNOl;PG6b-EJPZ43CX38m>Xu?6>;csB-0@` z?WslqQ(|h`c?9R+@$-;Z10Bl&6FWFF4w3j?61{aI%95u#vY0c7fGnw`+`*&LbnsE_kvdAuq9ttgWK-|{ZgOY?WzXx;)rBWrsCvw1w86*~ z8;=suWpBts2U6LI?#SzVGlP#Dc_sjS%7ZhUqU<%Um^0r<#3q}ET*k7MQ@lo5Psr`L z$RVLthDK=D0_}J?_EWIm=JMyBJ15WARbRt{Y8p0wpnDh>npVVp)Kz*4T4L!a3{4h5 zIk-_}WEK-wf%_v-@>9Ca#wY7CFP3p!9N;~};?S^PENU4-*&C{Rd+p$o5#`eT=E!c2 zd$^pU$j&nk+F~=09U9nh@r`0728ZIPfODSc(Otfaz@YV|-LHzGY#tZOup*XdPCPjF z0@F0taK_K!eg-bH?1b|xA}E0tj!dcffyY+nNb}e9)wchnuS(K>%O~MYUv1@{N}l>l Hr2zg9r+-e@ literal 0 HcmV?d00001 diff --git a/calibrations/calo/tower_slope_macro/emc_corr_files/make_EmcCorr.C b/calibrations/calo/tower_slope_macro/emc_corr_files/make_EmcCorr.C new file mode 100644 index 000000000..e8f15e618 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/emc_corr_files/make_EmcCorr.C @@ -0,0 +1,34 @@ + +{ + + TFile f("inv_emcal_corr_sec12bands.root","recreate"); + TTree t1("emc_corr_tree",""); + Int_t towid; + Float_t corr; + t1.Branch("corr",&corr,"corr/F"); + t1.Branch("towid",&towid,"towid/I"); + + for (Int_t i=0;i< 96; i++) { + + int k = i/8; + // int ll = (6-abs(6-k)); + int ll = k%6; + + for (int j=0; j < 256; j++) { + + towid = i*1000 + j; + 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/emc_corr_files/save_makeEmcCorr.C b/calibrations/calo/tower_slope_macro/emc_corr_files/save_makeEmcCorr.C new file mode 100644 index 000000000..2a60c4a90 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/emc_corr_files/save_makeEmcCorr.C @@ -0,0 +1,53 @@ + +{ + + TFile f("emcal_newPatternCinco.root","recreate"); + TTree t1("emc_corr_tree",""); + Int_t towid; + Float_t corr; + t1.Branch("corr",&corr,"corr/F"); + t1.Branch("towid",&towid,"towid/I"); + + for (Int_t i=0;i< 96; i++) { + + // int k = i/8; + // int ll = (6-abs(6-k)); + // int ll = k%6; + + for (int j=0; j < 256; j++) { + + towid = i*1000 + j; + + int ket = i/8; + // int ll = (6-abs(6-k)); + int llet = ket%6; + int pket = j/8; + int ppkket = pket % 3;// + llet%2; + + corr = 0.88+llet*0.04 - 0.01+0.01*ppkket; + + if (ket > 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 < Date: Wed, 11 May 2022 00:31:09 -0400 Subject: [PATCH 1181/1222] Update README.md --- calibrations/calo/tower_slope_macro/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/calibrations/calo/tower_slope_macro/README.md b/calibrations/calo/tower_slope_macro/README.md index a071142f6..ab587a6b3 100644 --- a/calibrations/calo/tower_slope_macro/README.md +++ b/calibrations/calo/tower_slope_macro/README.md @@ -1,5 +1,9 @@ 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 From 055d45a7e39b0a3965e7e24ae2548ca92a7d0c23 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 12 May 2022 12:16:46 -0400 Subject: [PATCH 1182/1222] add tables to QA --- common/G4_Tracking.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2e00885f2..d4aed9dac 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -423,6 +423,10 @@ void Tracking_QA() Fun4AllServer* se = Fun4AllServer::instance(); + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); // qa->addEmbeddingID(2); qa->Verbosity(verbosity); From 6168cc1ae97e68673bc9f754095ed0c0aaf6328b Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Fri, 13 May 2022 07:55:47 -0400 Subject: [PATCH 1183/1222] move to standalone function --- common/G4_Tracking.C | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index d4aed9dac..17ba5adce 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -372,6 +372,21 @@ void Tracking_Reco() 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); @@ -382,12 +397,7 @@ void Tracking_Eval(const std::string& outputfile) 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); + build_truthreco_tables(); //---------------- // Tracking evaluation @@ -423,9 +433,7 @@ void Tracking_QA() Fun4AllServer* se = Fun4AllServer::instance(); - SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); - tables->Verbosity(verbosity); - se->registerSubsystem(tables); + build_truthreco_tables(); QAG4SimulationTracking* qa = new QAG4SimulationTracking(); // qa->addEmbeddingID(2); From 08efb9b55e2670df8d96e2cccd6ab62d79f976bc Mon Sep 17 00:00:00 2001 From: mchiu-bnl Date: Thu, 19 May 2022 16:13:57 -0400 Subject: [PATCH 1184/1222] Updated with aluminum outer pipes to replace the steel ones --- common/G4_Pipe.C | 202 ++++++++++++++++++++++++++--------------------- 1 file changed, 114 insertions(+), 88 deletions(-) diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C index fb95ef205..8279513dd 100644 --- a/common/G4_Pipe.C +++ b/common/G4_Pipe.C @@ -32,25 +32,25 @@ namespace G4PIPE 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 = 2.75*2.54/2 - (al_pipe_radius + al_pipe_thickness); // Atlas 2.75" flange, radial thickness + 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 ss_pipe_precone_length = 2.04; - double ss_pipe_precone_radius = 2.00025; // same as Be pipe - double ss_pipe_thickness = 0.1397; // 1.397 mm or 0.055" - double ss_pipe_cone_length = 15.24; - double ss_pipe_ext_radius = 3.81; // past the cone - double ss_pipe_ext_length = 89.52; // extension beyond conical part + 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 + - ss_pipe_precone_length + ss_pipe_cone_length + ss_pipe_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::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness); + 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) ); } @@ -206,13 +206,26 @@ cout << "**** STAR PIPE ***************" << endl; g4Reco->registerSubsystem(cyl); // north flange 2B - // SS - cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_SS", ilayer++); - cyl->set_double_param("place_z", flange_place_z + 0.5*G4PIPE::flange_length); + // 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); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + 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(); @@ -273,42 +286,55 @@ cout << "**** STAR PIPE ***************" << endl; cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - // south flange 2B - // All SS - cyl = new PHG4CylinderSubsystem("S_FLANGE_2B_SS", ilayer++); - cyl->set_double_param("place_z", flange_place_z - 0.5*G4PIPE::flange_length); + // 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); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + 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 stainless pipe (extension) [vacuum] */ - north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::ss_pipe_precone_length; - cyl = new PHG4CylinderSubsystem("VAC_N_SS_PIPE_PRECONE", ilayer++); + // 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::ss_pipe_precone_length); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_precone_radius); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* north stainless pipe (pre-conical part) */ - cyl = new PHG4CylinderSubsystem("N_SS_PIPE_PRECONE", ilayer++); + /* 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::ss_pipe_precone_radius); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::ss_pipe_precone_length); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + 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); @@ -316,12 +342,12 @@ cout << "**** STAR PIPE ***************" << endl; PHG4ConeSubsystem* cone = nullptr; - /* north stainless pipe (conical part) [vacuum] */ - north_pipe_place_z += 0.5 * G4PIPE::ss_pipe_precone_length + 0.5 * G4PIPE::ss_pipe_cone_length; - cone = new PHG4ConeSubsystem("VAC_N_SS_PIPE_CONE", ilayer++); - cone->SetR1(0., G4PIPE::ss_pipe_precone_radius); - cone->SetR2(0., G4PIPE::ss_pipe_ext_radius); - cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + /* 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"); @@ -329,78 +355,78 @@ cout << "**** STAR PIPE ***************" << endl; cone->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cone); - /* north stainless pipe (conical part) */ - cone = new PHG4ConeSubsystem("N_SS_PIPE_CONE", ilayer++); - cone->SetR1(G4PIPE::ss_pipe_precone_radius, G4PIPE::ss_pipe_precone_radius + G4PIPE::ss_pipe_thickness); - cone->SetR2(G4PIPE::ss_pipe_ext_radius, G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness); - cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + /* 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_STAINLESS-STEEL"); + cone->SetMaterial("G4_Al"); cone->SuperDetector("PIPE"); if (AbsorberActive) cone->SetActive(); cone->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cone); - /* north stainless pipe (extension) [vacuum] */ - north_pipe_place_z += 0.5 * G4PIPE::ss_pipe_cone_length + 0.5 * G4PIPE::ss_pipe_ext_length; - cyl = new PHG4CylinderSubsystem("VAC_N_SS_PIPE_EXT", ilayer++); + /* 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::ss_pipe_ext_length); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_ext_radius); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* north stainless pipe (extension) */ - cyl = new PHG4CylinderSubsystem("N_SS_PIPE_EXT", ilayer++); + /* 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::ss_pipe_ext_radius); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::ss_pipe_ext_length); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + 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 stainless pipe (pre-conical part) [vacuum] */ - south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::ss_pipe_precone_length); - cyl = new PHG4CylinderSubsystem("VAC_S_SS_PIPE_PRECONE", ilayer++); + /* 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::ss_pipe_precone_length); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_precone_radius); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* south stainless pipe (pre-conical part) */ - cyl = new PHG4CylinderSubsystem("S_SS_PIPE_PRECONE", ilayer++); + /* 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::ss_pipe_precone_radius); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::ss_pipe_precone_length); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + 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 stainless pipe (conical part) [vacuum] */ - south_pipe_place_z -= (0.5 * G4PIPE::ss_pipe_precone_length + 0.5 * G4PIPE::ss_pipe_cone_length); + /* 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::ss_pipe_ext_radius); - cone->SetR2(0., G4PIPE::ss_pipe_precone_radius); - cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + 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"); @@ -408,46 +434,46 @@ cout << "**** STAR PIPE ***************" << endl; cone->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cone); - /* south stainless pipe (conical part) */ - cone = new PHG4ConeSubsystem("S_SS_PIPE_CONE", ilayer++); - cone->SetR1(G4PIPE::ss_pipe_ext_radius, G4PIPE::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness); - cone->SetR2(G4PIPE::ss_pipe_precone_radius, G4PIPE::ss_pipe_precone_radius + G4PIPE::ss_pipe_thickness); - cone->SetZlength(G4PIPE::ss_pipe_cone_length / 2); + /* 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_STAINLESS-STEEL"); + cone->SetMaterial("G4_Al"); cone->SuperDetector("PIPE"); if (AbsorberActive) cone->SetActive(); cone->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cone); - /* south stainless pipe (extension) [vacuum] */ - south_pipe_place_z -= (0.5 * G4PIPE::ss_pipe_cone_length + 0.5 * G4PIPE::ss_pipe_ext_length); - cyl = new PHG4CylinderSubsystem("VAC_S_SS_PIPE_EXT", ilayer++); + /* 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::ss_pipe_ext_length); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); cyl->set_string_param("material", "G4_Galactic"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_ext_radius); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); cyl->SuperDetector("PIPE"); if (AbsorberActive) cyl->SetActive(); cyl->OverlapCheck(OverlapCheck); g4Reco->registerSubsystem(cyl); - /* south stainless pipe (extension) */ - cyl = new PHG4CylinderSubsystem("S_SS_PIPE_EXT", ilayer++); + /* 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::ss_pipe_ext_radius); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); cyl->set_int_param("lengthviarapidity", 0); - cyl->set_double_param("length", G4PIPE::ss_pipe_ext_length); - cyl->set_string_param("material", "G4_STAINLESS-STEEL"); - cyl->set_double_param("thickness", G4PIPE::ss_pipe_thickness); + 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::ss_pipe_ext_radius + G4PIPE::ss_pipe_thickness; + radius = G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness; if (verbosity > 0) { From 0be500cc33a9499c0f5a4fea1802eb0d651dda43 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Mon, 23 May 2022 16:29:28 -0400 Subject: [PATCH 1185/1222] change truth track seeding container names --- common/G4_Tracking.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0405de3b3..5373e0f26 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -135,7 +135,7 @@ void Tracking_Reco_TrackSeed() // 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("SvtxSiliconTrackMap"); + 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); @@ -157,7 +157,7 @@ void Tracking_Reco_TrackSeed() // 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("SvtxTrackMap"); + 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); @@ -264,7 +264,7 @@ void Tracking_Reco_TrackSeed() // Includes clusters for TPC, silicon and MM's auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); pat_rec->Verbosity(verbosity); - pat_rec->set_track_map_name("SvtxTrackMap"); + pat_rec->set_track_map_name("SvtxTrackSeedContainer"); se->registerSubsystem(pat_rec); } From bd993622eae7b1b19524d04c20da8b9de508a4a3 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Wed, 22 Jun 2022 22:08:32 -0400 Subject: [PATCH 1186/1222] Enable setting of global TPC drift velocity from the macro. --- common/G4_Input.C | 3 ++- common/G4_TPC.C | 12 ++++++++++++ common/G4_Tracking.C | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 4e8132e82..1f9e6a9e0 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -2,6 +2,7 @@ #define MACRO_G4INPUT_C #include +#include #include @@ -215,7 +216,7 @@ namespace SARTRE namespace PILEUP { string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; - double TpcDriftVelocity = 8.0 / 1000.0; + double TpcDriftVelocity = G4TPC::tpc_drift_velocity; } // namespace PILEUP // collection of pointers to particle generators we can grab in the Fun4All macro diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 96d7e2f96..7778255ab 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -23,6 +23,7 @@ #pragma GCC diagnostic ignored "-Wundefined-internal" #include #include +#include #pragma GCC diagnostic pop #include @@ -63,6 +64,9 @@ namespace G4TPC 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 = 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas + // TPC drift velocity scale double drift_velocity_scale = 1.0; @@ -124,6 +128,9 @@ void TPCInit() { G4INTT::n_intt_layer = 0; } + + // Set the drift velocity in the cluster Z crossing correction module + TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity; } //! TPC end cap, wagon wheel, electronics @@ -228,6 +235,10 @@ void TPC_Cells() edrift->setTpcDistortion( distortionMap ); } + // override the default drift velocity parameter specification + edrift->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); + padplane->SetDriftVelocity(G4TPC::tpc_drift_velocity); + // 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 @@ -235,6 +246,7 @@ void TPC_Cells() 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); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 5373e0f26..2ca94fa1f 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -209,6 +209,8 @@ void Tracking_Reco_TrackSeed() silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); + silicon_match->set_pp_mode(false); if (G4TRACKING::SC_CALIBMODE) { // search windows for initial matching with distortions @@ -293,8 +295,12 @@ void Tracking_Reco_TrackFit() auto se = Fun4AllServer::instance(); // correct clusters for particle propagation in TPC - se->registerSubsystem(new PHTpcDeltaZCorrection); + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + // perform final track fit with ACTS auto actsFit = new PHActsTrkFitter; actsFit->Verbosity(verbosity); From bbb7f459d83aa6764b60cdd75a404829e0da3771 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 23 Jun 2022 10:31:31 -0400 Subject: [PATCH 1187/1222] Revert Fun4All macxro to repo version. --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 66e94210e..d708eb1e4 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -42,7 +42,7 @@ int Fun4All_G4_sPHENIX( const string &outdir = ".") { Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(1); + se->Verbosity(0); //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. PHRandomSeed::Verbosity(1); @@ -57,8 +57,7 @@ int Fun4All_G4_sPHENIX( // 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); - //rc->set_IntFlag("RANDOMSEED", 1234); + // rc->set_IntFlag("RANDOMSEED", 12345); //=============== // conditions DB flags @@ -141,7 +140,7 @@ int Fun4All_G4_sPHENIX( // add the settings for other with [1], next with [2]... if (Input::SIMPLE) { - INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 50); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5); if (Input::HEPMC || Input::EMBED) { INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); @@ -157,7 +156,7 @@ int Fun4All_G4_sPHENIX( } INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); - INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.3, 0.4); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.); } // Upsilons // if you run more than one of these Input::UPSILON_NUMBER > 1 @@ -303,7 +302,7 @@ int Fun4All_G4_sPHENIX( // into the tracking, cannot run together with CEMC // Enable::CEMCALBEDO = true; - // Enable::CEMC = true; + Enable::CEMC = true; Enable::CEMC_ABSORBER = true; Enable::CEMC_CELL = Enable::CEMC && true; Enable::CEMC_TOWER = Enable::CEMC_CELL && true; @@ -311,7 +310,7 @@ int Fun4All_G4_sPHENIX( Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; - ///Enable::HCALIN = true; + Enable::HCALIN = true; Enable::HCALIN_ABSORBER = true; Enable::HCALIN_CELL = Enable::HCALIN && true; Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; @@ -319,10 +318,10 @@ int Fun4All_G4_sPHENIX( Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; - // Enable::MAGNET = true; + Enable::MAGNET = true; Enable::MAGNET_ABSORBER = true; - //Enable::HCALOUT = true; + Enable::HCALOUT = true; Enable::HCALOUT_ABSORBER = true; Enable::HCALOUT_CELL = Enable::HCALOUT && true; Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; From 7983d03ed117ac4cc4dec2c74b8dcd8484b74aec Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 23 Jun 2022 14:14:52 -0400 Subject: [PATCH 1188/1222] Set the drift velocity in the tpccalib/DirectLaserReconstruction module from the macro. --- common/G4_TPC.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 7778255ab..999f0bbbb 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -129,7 +129,7 @@ void TPCInit() G4INTT::n_intt_layer = 0; } - // Set the drift velocity in the cluster Z crossing correction module + // Set the (static) drift velocity in the cluster Z crossing correction module TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity; } @@ -207,6 +207,7 @@ void TPC_Cells() 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); se->registerSubsystem(directLaser); } From d6c95bf89d7002770ff00553b4c2186118d4c707 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 30 Jun 2022 12:28:04 -0400 Subject: [PATCH 1189/1222] Partway through separating simulation and reco drift velocities. --- common/G4_Input.C | 2 +- common/G4_TPC.C | 19 ++++++++++++------- common/G4_Tracking.C | 6 ++++-- common/G4_Tracking_Genfit.C | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 1f9e6a9e0..200bc733e 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -216,7 +216,7 @@ namespace SARTRE namespace PILEUP { string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; - double TpcDriftVelocity = G4TPC::tpc_drift_velocity; + double TpcDriftVelocity = G4TPC::tpc_drift_velocity_sim; } // namespace PILEUP // collection of pointers to particle generators we can grab in the Fun4All macro diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 999f0bbbb..d38ebe591 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -64,8 +64,12 @@ namespace G4TPC 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 = 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas + // the 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 + // Allow the possibility of making the reco drift velocity different from the smulation value + double sim_reco_drift_velocity_difference = 0.0; + //double sim_reco_drift_velocity_difference = 0.2; + double tpc_drift_velocity_reco = tpc_drift_velocity_sim + sim_reco_drift_velocity_difference; // TPC drift velocity scale double drift_velocity_scale = 1.0; @@ -130,7 +134,7 @@ void TPCInit() } // Set the (static) drift velocity in the cluster Z crossing correction module - TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity; + TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity_reco; } //! TPC end cap, wagon wheel, electronics @@ -207,7 +211,7 @@ void TPC_Cells() 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); + directLaser->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); se->registerSubsystem(directLaser); } @@ -237,8 +241,8 @@ void TPC_Cells() } // override the default drift velocity parameter specification - edrift->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); - padplane->SetDriftVelocity(G4TPC::tpc_drift_velocity); + 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 @@ -291,7 +295,8 @@ void TPC_Clustering() } else { auto tpcclusterizer = new TpcClusterizer; - tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); + tpcclusterizer->set_drift_velocity(G4TPC::tpc_drift_velocity_reco); + tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); // do not use tpcclusterizer->Verbosity(verbosity); tpcclusterizer->set_do_hit_association( G4TPC::DO_HIT_ASSOCIATION ); se->registerSubsystem(tpcclusterizer); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2ca94fa1f..3562b2a99 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -165,6 +165,7 @@ void Tracking_Reco_TrackSeed() } else { auto seeder = new PHCASeeding("PHCASeeding"); + seeder->StDriftVelocity(G4TPC::tpc_drift_velocity_reco); seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right if (G4MAGNET::magfield.find("3d") != std::string::npos) { @@ -181,6 +182,7 @@ void Tracking_Reco_TrackSeed() // expand stubs in the TPC using simple kalman filter auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + sprop->StDriftVelocity(G4TPC::tpc_drift_velocity_reco); cprop->set_field_dir(G4MAGNET::magfield_rescale); if (G4MAGNET::magfield.find("3d") != std::string::npos) { @@ -209,7 +211,7 @@ void Tracking_Reco_TrackSeed() silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); + silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); silicon_match->set_pp_mode(false); if (G4TRACKING::SC_CALIBMODE) { @@ -296,7 +298,7 @@ void Tracking_Reco_TrackFit() // correct clusters for particle propagation in TPC auto deltazcorr = new PHTpcDeltaZCorrection; - deltazcorr->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity); + deltazcorr->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); deltazcorr->Verbosity(verbosity); se->registerSubsystem(deltazcorr); diff --git a/common/G4_Tracking_Genfit.C b/common/G4_Tracking_Genfit.C index fda93b33b..3c710593b 100644 --- a/common/G4_Tracking_Genfit.C +++ b/common/G4_Tracking_Genfit.C @@ -362,6 +362,7 @@ void Tracking_Reco() silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); + silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { From 2ea2e773e7a740edac54aba1dbb9383bbe2600ec Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 Jul 2022 23:01:15 -0400 Subject: [PATCH 1190/1222] Add section for xpload --- common/GlobalVariables.C | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index b3576c325..1fcf46bef 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -20,8 +20,8 @@ namespace Input namespace DstOut { - string OutputDir = "."; - string OutputFile = "test.root"; + std::string OutputDir = "."; + std::string OutputFile = "test.root"; } // namespace DstOut // Global settings affecting multiple subsystems @@ -32,6 +32,7 @@ namespace Enable bool DSTOUT_COMPRESS = false; bool OVERLAPCHECK = false; bool SUPPORT = false; + bool XPLOAD = false; int VERBOSITY = 0; } // namespace Enable @@ -55,7 +56,7 @@ namespace G4P6DECAYER // our various tracking macro namespace TRACKING { - string TrackNodeName = "SvtxTrackMap"; + std::string TrackNodeName = "SvtxTrackMap"; } namespace G4MAGNET @@ -64,6 +65,13 @@ namespace G4MAGNET // 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; - string magfield; + std::string magfield; } // namespace G4MAGNET + +namespace XPLOAD +{ + std::string config = "sPHENIX_cdb"; + std::string tag = "TEST"; + uint64_t timestamp = 12345678912345; +} #endif From cf3ee65795b72e89b2c33bde130fd14745c096ab Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 Jul 2022 23:02:57 -0400 Subject: [PATCH 1191/1222] set calib filename to CDB if xpload is enabled --- common/G4_CEmc_Spacal.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index ad7cccbda..1e443835d 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -434,6 +434,10 @@ void CEMC_Clusters() 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"; + if (Enable::XPLOAD) + { + emc_prof = "CDB"; + } ClusterBuilder->LoadProfile(emc_prof); se->registerSubsystem(ClusterBuilder); } From 8068f91312ca5d69b3ff38d8244e9a7f712e502e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 Jul 2022 23:10:03 -0400 Subject: [PATCH 1192/1222] set magnetic fieldmap filename to CDB if XPLOAD is enabled --- common/G4_Magnet.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index 53d703769..ca9940619 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -32,7 +32,14 @@ void MagnetFieldInit() } if (G4MAGNET::magfield.empty()) { - G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); + if (Enable::XPLOAD) + { + G4MAGNET::magfield = "CDB"; + } + else + { + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); + } } } From b46eb1b3ddffd9062e540c596b1d2a9ec3dc4e74 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 1 Jul 2022 23:10:59 -0400 Subject: [PATCH 1193/1222] use xpload strings from GlobalVarialbes.C --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index d708eb1e4..7225b0475 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -59,16 +59,6 @@ int Fun4All_G4_sPHENIX( // or set it to a fixed value so you can debug your code // rc->set_IntFlag("RANDOMSEED", 12345); - //=============== - // conditions DB flags - //=============== - // tag - rc->set_StringFlag("XPLOAD_TAG","sPHENIX_ExampleGT_1"); - // database config - rc->set_StringFlag("XPLOAD_CONFIG","sPHENIX_cdb"); - // 64 bit timestamp - rc->set_uint64Flag("TIMESTAMP",12345678912345); - //=============== // Input options @@ -378,6 +368,17 @@ int Fun4All_G4_sPHENIX( // 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 //--------------- From 4c6bd9d17ae52bc63820c902211fa271022eb410 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 5 Jul 2022 14:24:57 -0400 Subject: [PATCH 1194/1222] Set verbosities back to defaults. --- common/G4_TPC.C | 16 ++++------------ common/G4_Tracking.C | 5 +---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/common/G4_TPC.C b/common/G4_TPC.C index d38ebe591..5cbb1596f 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -64,16 +64,10 @@ namespace G4TPC int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; double tpc_outer_radius = 77. + 2.; - // the 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 - // Allow the possibility of making the reco drift velocity different from the smulation value - double sim_reco_drift_velocity_difference = 0.0; - //double sim_reco_drift_velocity_difference = 0.2; - double tpc_drift_velocity_reco = tpc_drift_velocity_sim + sim_reco_drift_velocity_difference; - - // TPC drift velocity scale - double drift_velocity_scale = 1.0; - + // 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= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas + // use simple clusterizer bool USE_SIMPLE_CLUSTERIZER = false; @@ -295,8 +289,6 @@ void TPC_Clustering() } else { auto tpcclusterizer = new TpcClusterizer; - tpcclusterizer->set_drift_velocity(G4TPC::tpc_drift_velocity_reco); - tpcclusterizer->set_drift_velocity_scale(G4TPC::drift_velocity_scale); // do not use tpcclusterizer->Verbosity(verbosity); tpcclusterizer->set_do_hit_association( G4TPC::DO_HIT_ASSOCIATION ); se->registerSubsystem(tpcclusterizer); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 3562b2a99..e1ee5814e 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -97,6 +97,7 @@ void TrackingInit() // 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); @@ -165,7 +166,6 @@ void Tracking_Reco_TrackSeed() } else { auto seeder = new PHCASeeding("PHCASeeding"); - seeder->StDriftVelocity(G4TPC::tpc_drift_velocity_reco); seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right if (G4MAGNET::magfield.find("3d") != std::string::npos) { @@ -182,7 +182,6 @@ void Tracking_Reco_TrackSeed() // expand stubs in the TPC using simple kalman filter auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); - sprop->StDriftVelocity(G4TPC::tpc_drift_velocity_reco); cprop->set_field_dir(G4MAGNET::magfield_rescale); if (G4MAGNET::magfield.find("3d") != std::string::npos) { @@ -211,7 +210,6 @@ void Tracking_Reco_TrackSeed() silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); silicon_match->set_pp_mode(false); if (G4TRACKING::SC_CALIBMODE) { @@ -298,7 +296,6 @@ void Tracking_Reco_TrackFit() // correct clusters for particle propagation in TPC auto deltazcorr = new PHTpcDeltaZCorrection; - deltazcorr->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); deltazcorr->Verbosity(verbosity); se->registerSubsystem(deltazcorr); From d28e3f338c2c42ed5eda454299ae0b532a80615f Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 5 Jul 2022 14:36:55 -0400 Subject: [PATCH 1195/1222] Missed one. --- common/G4_Tracking_Genfit.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_Tracking_Genfit.C b/common/G4_Tracking_Genfit.C index 3c710593b..fda93b33b 100644 --- a/common/G4_Tracking_Genfit.C +++ b/common/G4_Tracking_Genfit.C @@ -362,7 +362,6 @@ void Tracking_Reco() silicon_match->Verbosity(verbosity); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_reco); silicon_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { From 3ce6a1e0d9bb2e96fc9335f659bd8cd2c892a955 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 6 Jul 2022 12:19:16 -0400 Subject: [PATCH 1196/1222] remove obsolete 1d projective option to simplify cemc macro --- common/G4_CEmc_Spacal.C | 140 ---------------------------------------- 1 file changed, 140 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 1e443835d..a5dfee271 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -26,9 +26,6 @@ #include -double -CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); - double CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); @@ -65,9 +62,6 @@ namespace G4CEMC // 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; @@ -95,101 +89,7 @@ void CEmcInit(const int i = 0) 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 @@ -335,26 +235,10 @@ void CEMC_Towers() 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 RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); @@ -376,22 +260,6 @@ void CEMC_Towers() 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 @@ -407,14 +275,6 @@ void CEMC_Towers() TowerCalibration->set_variable_pedestal(true); //read pedestals from calibrations file comment next line if true // TowerCalibration->set_pedstal_ADC(0); } - } - 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; From ebbcb6a37c5d1c8534aaa447e95fc6ec92aaf6be Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 7 Jul 2022 16:03:45 -0400 Subject: [PATCH 1197/1222] Modifications to optionally set time windows for pp mode --- common/G4_Input.C | 5 ++++- common/G4_Intt.C | 10 +++++++--- common/G4_Mvtx.C | 7 ++++++- common/G4_TPC.C | 6 ++++++ common/G4_Tracking.C | 18 ++++++++++-------- common/GlobalVariables.C | 2 ++ 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/common/G4_Input.C b/common/G4_Input.C index 200bc733e..56ef4f2bd 100644 --- a/common/G4_Input.C +++ b/common/G4_Input.C @@ -605,7 +605,10 @@ void InputManagers() INPUTMANAGER::HepMCPileupInputManager->AddFile(PILEUP::pileupfile); INPUTMANAGER::HepMCPileupInputManager->set_collision_rate(Input::PILEUPRATE); double time_window = 105.5 / PILEUP::TpcDriftVelocity; - INPUTMANAGER::HepMCPileupInputManager->set_time_window(-time_window, time_window); + 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); } } diff --git a/common/G4_Intt.C b/common/G4_Intt.C index fd23d1740..cda0028fe 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -165,9 +165,13 @@ void Intt_Cells() } // new storage containers PHG4InttHitReco* reco = new PHG4InttHitReco(); - // The timing windows are hard-coded in the INTT ladder model, they can be overridden here - //reco->set_double_param("tmax",80.0); - //reco->set_double_param("tmin",-20.0); + + // 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); diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 42704ba31..a9dd2870e 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -92,11 +92,16 @@ void Mvtx_Cells() // 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; for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) { // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -5000, 5000); + maps_hits->set_timing_window(ilayer, -maps_readout_window, maps_readout_window + extended_readout_time); } + std::cout << "MVTX readout window is from " << -maps_readout_window << " to " << maps_readout_window + extended_readout_time << std::endl; se->registerSubsystem(maps_hits); PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 5cbb1596f..b4ef1ccdc 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -234,6 +234,12 @@ void TPC_Cells() edrift->setTpcDistortion( distortionMap ); } + double tpc_readout_time = 13200; // 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 << "TPC 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); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e1ee5814e..83552f864 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -72,7 +72,7 @@ namespace G4TRACKING // 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_tpc_seeding = true; // 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 @@ -171,7 +171,7 @@ void Tracking_Reco_TrackSeed() { seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); } - seeder->Verbosity(verbosity); + seeder->Verbosity(0); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) seeder->SetMinHitsPerCluster(0); @@ -207,10 +207,10 @@ void Tracking_Reco_TrackSeed() // 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->Verbosity(1); silicon_match->set_field(G4MAGNET::magfield); silicon_match->set_field_dir(G4MAGNET::magfield_rescale); - silicon_match->set_pp_mode(false); + silicon_match->set_pp_mode(TRACKING::pp_mode); if (G4TRACKING::SC_CALIBMODE) { // search windows for initial matching with distortions @@ -234,7 +234,7 @@ void Tracking_Reco_TrackSeed() // 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); + mm_match->set_sc_calib_mode(G4TRACKING::SC_CALIBMODE); if (G4TRACKING::SC_CALIBMODE) { // calibration pass with distorted tracks @@ -302,7 +302,7 @@ void Tracking_Reco_TrackFit() // perform final track fit with ACTS auto actsFit = new PHActsTrkFitter; - actsFit->Verbosity(verbosity); + actsFit->Verbosity(0); // in calibration mode, fit only Silicons and Micromegas hits actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); @@ -418,8 +418,10 @@ void Tracking_Eval(const std::string& outputfile) eval->do_vtx_eval_light(true); eval->do_eval_light(true); eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); - 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 + 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 eval->Verbosity(verbosity); se->registerSubsystem(eval); diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 1fcf46bef..5d7c45cc9 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -57,6 +57,8 @@ namespace G4P6DECAYER namespace TRACKING { std::string TrackNodeName = "SvtxTrackMap"; + double pp_mode = true; + double pp_extended_readout_time = 7000.0; // ns } namespace G4MAGNET From 8ba4f0f64bdaadd959a79f19b0867fd1b9419da0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 7 Jul 2022 21:43:26 -0400 Subject: [PATCH 1198/1222] initialize acts geometry via common function --- common/G4_Micromegas.C | 17 ++++++++--------- common/G4_Tracking.C | 15 +++++++++++++-- common/GlobalVariables.C | 12 ++++++++++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index f352edc9c..f8469942a 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -21,22 +22,18 @@ 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 = false; bool MICROMEGAS_CELL = false; bool MICROMEGAS_CLUSTER = false; bool MICROMEGAS_QA = false; } // namespace Enable -namespace G4MICROMEGAS -{ - - // number of micromegas layers - int n_micromegas_layer = 2; - -} // namespace G4MICROMEGAS - void MicromegasInit() { if (!Enable::MVTX) @@ -68,6 +65,8 @@ void Micromegas(PHG4Reco* g4Reco) void Micromegas_Cells() { +// the acts geometry needs to go here since it will be used by the PHG4MicromegasHitReco + G4TRACKING::ActsGeomInit(); auto se = Fun4AllServer::instance(); // micromegas auto reco = new PHG4MicromegasHitReco; diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index e1ee5814e..8c87af566 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -82,10 +82,15 @@ namespace G4TRACKING // use of the various evaluation tools already available bool convert_seeds_to_svtxtracks = false; -} // namespace G4TRACKING -void TrackingInit() +void ActsGeomInit() { + static bool wasCalled = false; + if (wasCalled) + { + return; + } + wasCalled = true; if (!Enable::MICROMEGAS) { G4MICROMEGAS::n_micromegas_layer = 0; @@ -106,11 +111,17 @@ void TrackingInit() geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); geom->build_mm_surfaces(Enable::MICROMEGAS); se->registerSubsystem(geom); +} +} // namespace G4TRACKING +void TrackingInit() +{ + G4TRACKING::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); diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 1fcf46bef..875a63ed4 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -73,5 +73,17 @@ 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 + #endif From 5015b62713ce2eb7b933f250d41fb8947fab3c60 Mon Sep 17 00:00:00 2001 From: Genki Nukazuka Date: Fri, 8 Jul 2022 11:57:45 -0400 Subject: [PATCH 1199/1222] The phi offset of the INTT barrel was modified to be the same as the design. --- common/G4_Intt.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index fd23d1740..fd7e32a63 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -49,7 +49,7 @@ namespace G4INTT 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]}; + double offsetphi[4] = {-0.5 * 360.0 / nladder[0], 0.0, -0.5 * 360.0 / nladder[2], 0.0 }; enum enu_InttDeadMapType // Dead map options for INTT { From 3a49ce44db32be73b6ccb2f5346de91208a2ab7d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 8 Jul 2022 15:47:12 -0400 Subject: [PATCH 1200/1222] Revert "The phi offset of the INTT barrel changed" --- common/G4_Intt.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Intt.C b/common/G4_Intt.C index fd7e32a63..fd23d1740 100644 --- a/common/G4_Intt.C +++ b/common/G4_Intt.C @@ -49,7 +49,7 @@ namespace G4INTT 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.5 * 360.0 / nladder[0], 0.0, -0.5 * 360.0 / nladder[2], 0.0 }; + 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 { From 57301d71dfdbae3201ea5af63a7e6da28638dc3b Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Tue, 12 Jul 2022 15:44:57 -0400 Subject: [PATCH 1201/1222] remove truth eff --- common/G4_ParticleFlow.C | 1 - 1 file changed, 1 deletion(-) diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C index c54b4086e..d069fdb48 100644 --- a/common/G4_ParticleFlow.C +++ b/common/G4_ParticleFlow.C @@ -33,7 +33,6 @@ void ParticleFlow() // note: assumes topoCluster input already configured ParticleFlowReco *pfr = new ParticleFlowReco(); pfr->set_energy_match_Nsigma(1.5); - pfr->set_emulated_efficiency(1.0); pfr->Verbosity(verbosity); se->registerSubsystem(pfr); From 415fc55c9dd46d30f66e67d390a1df789042d809 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Tue, 19 Jul 2022 20:33:32 -0400 Subject: [PATCH 1202/1222] Set default pp_mode to false, add some cout statements. --- common/G4_Mvtx.C | 2 +- common/G4_TPC.C | 4 ++-- common/G4_Tracking.C | 16 ++++++++++------ common/GlobalVariables.C | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index a9dd2870e..0df5cc60a 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -101,7 +101,7 @@ void Mvtx_Cells() // override the default timing window for this layer - default is +/- 5000 ns maps_hits->set_timing_window(ilayer, -maps_readout_window, maps_readout_window + extended_readout_time); } - std::cout << "MVTX readout window is from " << -maps_readout_window << " to " << maps_readout_window + extended_readout_time << std::endl; + 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(); diff --git a/common/G4_TPC.C b/common/G4_TPC.C index b4ef1ccdc..0b4bac26a 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -234,11 +234,11 @@ void TPC_Cells() edrift->setTpcDistortion( distortionMap ); } - double tpc_readout_time = 13200; // ns + 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 << "TPC readout window is from 0 to " << tpc_readout_time + extended_readout_time << std::endl; + 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); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 2047dbdf9..f4a77b486 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -72,7 +72,7 @@ namespace G4TRACKING // 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 = true; // if true runs truth silicon seeding instead of reco TPC 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 @@ -126,11 +126,13 @@ void TrackingInit() 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); @@ -222,6 +224,7 @@ void Tracking_Reco_TrackSeed() 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 @@ -307,13 +310,13 @@ void Tracking_Reco_TrackFit() // correct clusters for particle propagation in TPC auto deltazcorr = new PHTpcDeltaZCorrection; - deltazcorr->Verbosity(verbosity); + deltazcorr->Verbosity(1); se->registerSubsystem(deltazcorr); // perform final track fit with ACTS auto actsFit = new PHActsTrkFitter; - actsFit->Verbosity(0); + actsFit->Verbosity(2); // in calibration mode, fit only Silicons and Micromegas hits actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); @@ -346,7 +349,7 @@ void Tracking_Reco_TrackFit() // 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); + cleaner->Verbosity(5); se->registerSubsystem(cleaner); } @@ -433,7 +436,8 @@ void Tracking_Eval(const std::string& outputfile) 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 - eval->Verbosity(verbosity); + std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl; + eval->Verbosity(1); se->registerSubsystem(eval); return; diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 8587923e3..6f01194d0 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -57,7 +57,7 @@ namespace G4P6DECAYER namespace TRACKING { std::string TrackNodeName = "SvtxTrackMap"; - double pp_mode = true; + double pp_mode = false; double pp_extended_readout_time = 7000.0; // ns } From 62187e6aa5eb242c2f73346595fe7b3a0591da5b Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 2 Aug 2022 15:47:46 -0400 Subject: [PATCH 1203/1222] add geantino based phi offset, run with gdml hcals on demand --- common/G4_HcalIn_ref.C | 123 +++++++++++++++++++++++++--------------- common/G4_HcalOut_ref.C | 111 ++++++++++++++++++++++++------------ 2 files changed, 152 insertions(+), 82 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index a6ac0ba77..629e4b527 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include @@ -19,6 +21,7 @@ #include #include #include + #include #include @@ -27,6 +30,7 @@ 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); @@ -42,6 +46,7 @@ namespace Enable bool HCALIN_EVAL = false; bool HCALIN_QA = false; bool HCALIN_SUPPORT = false; + bool HCALIN_OLD = true; int HCALIN_VERBOSITY = 0; } // namespace Enable @@ -50,7 +55,9 @@ 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; //Inner HCal absorber material selector: //false - old version, absorber material is SS310 //true - default Choose if you want Aluminum @@ -100,60 +107,81 @@ double HCalInner(PHG4Reco *g4Reco, bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALIN_OVERLAPCHECK; int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + PHG4DetectorSubsystem *hcal; // 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 (Enable::HCALIN_OLD) { - if (verbosity > 0) + hcal = new PHG4InnerHcalSubsystem("HCALIN"); + if (! isfinite(G4HCALIN::phistart)) + { + G4HCALIN::phistart = 0.0328877688; // offet in phi (from zero) extracted from geantinos + } + // 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 { - cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + } + hcal->set_string_param("material", "SS310"); } - hcal->set_string_param("material", "G4_Al"); + // 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 { - if (verbosity > 0) + hcal = new PHG4IHCalSubsystem("HCALIN"); + std::string hcaltiles = std::string(getenv("CALIBRATIONROOT")) + "/HcalGeo/InnerHCalAbsorberTiles_merged.gdml"; + hcal->set_string_param("GDMPath",hcaltiles); + if (! isfinite(G4HCALIN::phistart)) { - cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + G4HCALIN::phistart = 0.0295080867; // extracted from geantinos } - 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"); - + if (G4HCALIN::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALIN::light_scint_model); + } hcal->SetActive(); hcal->SuperDetector("HCALIN"); if (AbsorberActive) @@ -242,6 +270,11 @@ void HCALInner_Towers() HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); TowerBuilder->Detector("HCALIN"); TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->set_double_param("phistart",G4HCALIN::phistart); + if (isfinite(G4HCALIN::tower_emin)) + { + TowerBuilder->set_double_param("emin",G4HCALIN::tower_emin); + } // this sets specific decalibration factors // for a given cell // TowerBuilder->set_cell_decal_factor(1,10,0.1); diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index b5b9c21f8..322f183b6 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -7,6 +7,8 @@ #include #include +#include + #include #include @@ -17,6 +19,7 @@ #include #include #include + #include #include @@ -25,6 +28,7 @@ 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 @@ -37,6 +41,7 @@ namespace Enable bool HCALOUT_CLUSTER = false; bool HCALOUT_EVAL = false; bool HCALOUT_QA = false; + bool HCALOUT_OLD = true; int HCALOUT_VERBOSITY = 0; } // namespace Enable @@ -44,6 +49,9 @@ namespace G4HCALOUT { double outer_radius = 264.71; double size_z = 304.91 * 2; + double phistart = 0.026598397; + double tower_emin = NAN; + int light_scint_model = -1; // Digitization (default photon digi): RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; @@ -82,44 +90,68 @@ double HCalOuter(PHG4Reco *g4Reco, 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"); + PHG4DetectorSubsystem *hcal; + if (Enable::HCALOUT_OLD) + { + hcal = new PHG4OuterHcalSubsystem("HCALOUT"); + if (! isfinite(G4HCALOUT::phistart)) + { + G4HCALOUT::phistart = 0.026598397; // offet in phi (from zero) extracted from geantinos + } + + // 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 (! isfinite(G4HCALOUT::phistart)) + { + G4HCALOUT::phistart = -0.0248462127; // offet in phi (from zero) extracted from geantinos + } + + } + if (G4HCALOUT::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALOUT::light_scint_model); + } hcal->SetActive(); hcal->SuperDetector("HCALOUT"); if (AbsorberActive) @@ -169,6 +201,11 @@ void HCALOuter_Towers() HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); TowerBuilder->Detector("HCALOUT"); TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->set_double_param("phistart",G4HCALOUT::phistart); + if (isfinite(G4HCALOUT::tower_emin)) + { + TowerBuilder->set_double_param("emin",G4HCALOUT::tower_emin); + } // this sets specific decalibration factors // for a given cell // TowerBuilder->set_cell_decal_factor(1,10,0.1); From dd7f0706252be0a7c64d2acc79f13a7eaa135dba Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Thu, 4 Aug 2022 23:16:20 -0400 Subject: [PATCH 1204/1222] Add MvtxHitPruner to G4_Mvtx.C. --- common/G4_Mvtx.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index 42704ba31..2c40cdec6 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -12,6 +12,7 @@ #include +#include #include #include @@ -113,6 +114,11 @@ 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"); From 0419bba566e8c7b9551a51173021b7c506682d8d Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 5 Aug 2022 16:57:58 -0400 Subject: [PATCH 1205/1222] make tower_energy_source configurable in Fun4All macro --- common/G4_HcalIn_ref.C | 10 +++++++++- common/G4_HcalOut_ref.C | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 629e4b527..45ad5aec1 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -58,6 +58,8 @@ namespace G4HCALIN 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 @@ -246,7 +248,7 @@ void HCALInner_Cells() PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); hc->Detector("HCALIN"); - // hc->Verbosity(2); + hc->Verbosity(verbosity); // check for energy conservation - needs modified "infinite" timing cuts // 0-999999999 // hc->checkenergy(); @@ -275,6 +277,10 @@ void HCALInner_Towers() { 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); @@ -293,6 +299,7 @@ void HCALInner_Towers() 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 @@ -315,6 +322,7 @@ void HCALInner_Towers() 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; diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 322f183b6..ec893fa87 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -52,6 +52,7 @@ namespace G4HCALOUT double phistart = 0.026598397; 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; @@ -176,7 +177,7 @@ void HCALOuter_Cells() PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); hc->Detector("HCALOUT"); - // hc->Verbosity(2); + hc->Verbosity(verbosity); // check for energy conservation - needs modified "infinite" timing cuts // 0-999999999 // hc->checkenergy(); @@ -206,6 +207,10 @@ void HCALOuter_Towers() { 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); @@ -226,6 +231,7 @@ void HCALOuter_Towers() 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 @@ -245,6 +251,7 @@ void HCALOuter_Towers() 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; From bf8d25d24c883dee6d22d552157cc970aeb9978f Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 5 Aug 2022 21:50:35 -0400 Subject: [PATCH 1206/1222] read cluster correctons from cdb --- common/G4_CEmc_Spacal.C | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index a5dfee271..fe08c68ea 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -315,14 +315,20 @@ void CEMC_Clusters() } 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/")); + 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); From 9ecb3986aabfc53545ee9373190d75a49ec8fe59 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 8 Aug 2022 15:57:27 -0400 Subject: [PATCH 1207/1222] CDB access now handled differently - no more CDB string for DB access --- common/G4_CEmc_Spacal.C | 4 ---- common/G4_Magnet.C | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index fe08c68ea..91cadb0f4 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -294,10 +294,6 @@ void CEMC_Clusters() 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"; - if (Enable::XPLOAD) - { - emc_prof = "CDB"; - } ClusterBuilder->LoadProfile(emc_prof); se->registerSubsystem(ClusterBuilder); } diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C index ca9940619..53d703769 100644 --- a/common/G4_Magnet.C +++ b/common/G4_Magnet.C @@ -32,14 +32,7 @@ void MagnetFieldInit() } if (G4MAGNET::magfield.empty()) { - if (Enable::XPLOAD) - { - G4MAGNET::magfield = "CDB"; - } - else - { - G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); - } + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz.root"); } } From e081deb8763e0be5d6cdbdebe2314940dd21ec6c Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 8 Aug 2022 20:21:20 -0400 Subject: [PATCH 1208/1222] more uses of cdb --- common/G4_CEmc_Spacal.C | 17 +++++++++++++++-- common/G4_Centrality.C | 9 ++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index 91cadb0f4..ec041cb24 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -157,7 +157,6 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) 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 @@ -252,8 +251,15 @@ void CEMC_Towers() 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, + 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"); @@ -268,8 +274,15 @@ void CEMC_Towers() 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 diff --git a/common/G4_Centrality.C b/common/G4_Centrality.C index cc895bfd1..855c6c31d 100644 --- a/common/G4_Centrality.C +++ b/common/G4_Centrality.C @@ -28,7 +28,14 @@ void Centrality() PHG4CentralityReco *cent = new PHG4CentralityReco(); cent->Verbosity(verbosity); - cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/")); + if (Enable::XPLOAD) + { + cent->GetCalibrationParameters().ReadFromCDB("CENTRALITY"); + } + else + { + cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/")); + } se->registerSubsystem( cent ); return; From 3964b03473e25a42f4be05e2c2c98d6325b87ec1 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Thu, 11 Aug 2022 11:11:32 -0400 Subject: [PATCH 1209/1222] use CDB for phg4detectorsubsystem derived G4 implementations --- common/G4_CEmc_Spacal.C | 63 +++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C index ec041cb24..e0e7b0dda 100644 --- a/common/G4_CEmc_Spacal.C +++ b/common/G4_CEmc_Spacal.C @@ -89,7 +89,7 @@ void CEmcInit(const int i = 0) double CEmc(PHG4Reco *g4Reco, double radius, const int crossings) { - return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); } //! 2D full projective SPACAL @@ -157,8 +157,15 @@ CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) 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/")); + 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 @@ -234,10 +241,10 @@ void CEMC_Towers() 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 + // 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"); @@ -258,7 +265,7 @@ void CEMC_Towers() else { TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, - string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database } se->registerSubsystem(TowerDigitizer); @@ -266,28 +273,28 @@ void CEMC_Towers() 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) + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) { - TowerCalibration->GetCalibrationParameters().ReadFromCDB("EMCTOWERCALIB"); + // 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); + 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; @@ -332,11 +339,11 @@ void CEMC_Clusters() else { clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, - //raw location - string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + //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/")); + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); } clusterCorrection->Verbosity(verbosity); From 33250b02e4a1aaae724b3308e572112cbb2b6d82 Mon Sep 17 00:00:00 2001 From: Anthony Denis Frawley Date: Mon, 15 Aug 2022 21:10:05 -0400 Subject: [PATCH 1210/1222] Set time windows properly for MVTX, fix verbosity. --- common/G4_Mvtx.C | 9 ++++----- common/G4_Tracking.C | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/common/G4_Mvtx.C b/common/G4_Mvtx.C index be66756fc..961fa6fe3 100644 --- a/common/G4_Mvtx.C +++ b/common/G4_Mvtx.C @@ -97,11 +97,10 @@ void Mvtx_Cells() 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; - for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) - { - // override the default timing window for this layer - default is +/- 5000 ns - maps_hits->set_timing_window(ilayer, -maps_readout_window, maps_readout_window + 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); diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index f4a77b486..0289a352a 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -184,7 +184,7 @@ void Tracking_Reco_TrackSeed() { seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); } - seeder->Verbosity(0); + seeder->Verbosity(verbosity); seeder->SetLayerRange(7, 55); seeder->SetSearchWindow(0.01, 0.02); // (eta width, phi width) seeder->SetMinHitsPerCluster(0); @@ -220,7 +220,7 @@ void Tracking_Reco_TrackSeed() // 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(1); + 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); @@ -310,13 +310,13 @@ void Tracking_Reco_TrackFit() // correct clusters for particle propagation in TPC auto deltazcorr = new PHTpcDeltaZCorrection; - deltazcorr->Verbosity(1); + deltazcorr->Verbosity(verbosity); se->registerSubsystem(deltazcorr); // perform final track fit with ACTS auto actsFit = new PHActsTrkFitter; - actsFit->Verbosity(2); + actsFit->Verbosity(verbosity); // in calibration mode, fit only Silicons and Micromegas hits actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); @@ -349,7 +349,7 @@ void Tracking_Reco_TrackFit() // 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(5); + cleaner->Verbosity(verbosity); se->registerSubsystem(cleaner); } @@ -437,7 +437,7 @@ void Tracking_Eval(const std::string& outputfile) 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(1); + eval->Verbosity(verbosity); se->registerSubsystem(eval); return; From 20604e8b327fa9e46c03c2d73983d07a36920278 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Aug 2022 11:08:40 -0400 Subject: [PATCH 1211/1222] remove obsolete TrackingService, disable jet reco if needed input modules are disabled --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 12 ++++++------ detectors/sPHENIX/G4Setup_sPHENIX.C | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 7225b0475..452a021c3 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -264,7 +264,6 @@ int Fun4All_G4_sPHENIX( Enable::MVTX_CELL = Enable::MVTX && true; Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true; - Enable::TrackingService = false; Enable::INTT = true; // Enable::INTT_ABSORBER = true; // enables layerwise support structure readout @@ -334,7 +333,7 @@ int Fun4All_G4_sPHENIX( //Enable::PLUGDOOR = true; Enable::PLUGDOOR_ABSORBER = true; - Enable::GLOBAL_RECO = true; + Enable::GLOBAL_RECO = (Enable::BBCFAKE || Enable::TRACKING_TRACK) && true; //Enable::GLOBAL_FASTSIM = true; //Enable::KFPARTICLE = true; @@ -344,25 +343,26 @@ int Fun4All_G4_sPHENIX( Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; - Enable::JETS = true; + 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 = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + 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 = false && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + Enable::TOPOCLUSTER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; // particle flow jet reconstruction - needs topoClusters! - Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + 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) diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C index 303ad821c..803f96a25 100644 --- a/detectors/sPHENIX/G4Setup_sPHENIX.C +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +51,6 @@ void G4Init() // load detector/material macros and execute Init() function if (Enable::PIPE) PipeInit(); - if (Enable::TrackingService) TrackingServiceInit(); if (Enable::MVTX) MvtxInit(); if (Enable::INTT) InttInit(); if (Enable::TPC) TPCInit(); @@ -121,7 +119,6 @@ int G4Setup() double radius = 0.; if (Enable::PIPE) radius = Pipe(g4Reco, radius); - if (Enable::TrackingService) TrackingService(g4Reco, radius); if (Enable::MVTX) radius = Mvtx(g4Reco, radius); if (Enable::INTT) radius = Intt(g4Reco, radius); if (Enable::TPC) radius = TPC(g4Reco, radius); From e0adaab2e1af6ae05a37909b404cbd722639076e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Aug 2022 18:38:04 -0400 Subject: [PATCH 1212/1222] set phistart at towerbuilder, not in G4 setup. It crashed when running over a DST in the jets --- common/G4_HcalIn_ref.C | 19 +++++++++++-------- common/G4_HcalOut_ref.C | 23 ++++++++++++----------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index 45ad5aec1..d961c4fa4 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -114,10 +114,6 @@ double HCalInner(PHG4Reco *g4Reco, if (Enable::HCALIN_OLD) { hcal = new PHG4InnerHcalSubsystem("HCALIN"); - if (! isfinite(G4HCALIN::phistart)) - { - G4HCALIN::phistart = 0.0328877688; // offet in phi (from zero) extracted from geantinos - } // these are the parameters you can change with their default settings // hcal->set_string_param("material","SS310"); if (G4HCALIN::inner_hcal_material_Al) @@ -175,10 +171,6 @@ double HCalInner(PHG4Reco *g4Reco, hcal = new PHG4IHCalSubsystem("HCALIN"); std::string hcaltiles = std::string(getenv("CALIBRATIONROOT")) + "/HcalGeo/InnerHCalAbsorberTiles_merged.gdml"; hcal->set_string_param("GDMPath",hcaltiles); - if (! isfinite(G4HCALIN::phistart)) - { - G4HCALIN::phistart = 0.0295080867; // extracted from geantinos - } } if (G4HCALIN::light_scint_model >= 0) { @@ -272,6 +264,17 @@ void HCALInner_Towers() 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)) { diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index ec893fa87..5030b4d67 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -49,7 +49,7 @@ namespace G4HCALOUT { double outer_radius = 264.71; double size_z = 304.91 * 2; - double phistart = 0.026598397; + double phistart = NAN; double tower_emin = NAN; int light_scint_model = -1; int tower_energy_source = -1; @@ -95,11 +95,6 @@ double HCalOuter(PHG4Reco *g4Reco, if (Enable::HCALOUT_OLD) { hcal = new PHG4OuterHcalSubsystem("HCALOUT"); - if (! isfinite(G4HCALOUT::phistart)) - { - G4HCALOUT::phistart = 0.026598397; // offet in phi (from zero) extracted from geantinos - } - // hcal->set_double_param("inner_radius", 183.3); //----------------------------------------- // the light correction can be set in a single call @@ -142,11 +137,6 @@ double HCalOuter(PHG4Reco *g4Reco, hcal = new PHG4OHCalSubsystem("HCALOUT"); std::string hcaltiles = std::string(getenv("CALIBRATIONROOT")) + "/HcalGeo/OuterHCalAbsorberTiles_merged.gdml"; hcal->set_string_param("GDMPath",hcaltiles); - if (! isfinite(G4HCALOUT::phistart)) - { - G4HCALOUT::phistart = -0.0248462127; // offet in phi (from zero) extracted from geantinos - } - } if (G4HCALOUT::light_scint_model >= 0) @@ -202,6 +192,17 @@ void HCALOuter_Towers() 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.0248462127; // offet in phi (from zero) extracted from geantinos + } + } TowerBuilder->set_double_param("phistart",G4HCALOUT::phistart); if (isfinite(G4HCALOUT::tower_emin)) { From c00c39808238b68795990c7f0ea90f42a59cee6e Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Fri, 19 Aug 2022 18:40:08 -0400 Subject: [PATCH 1213/1222] add SyncReco, HeadReco and FlagHandler to default running --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 452a021c3..47fd8c2fe 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -21,6 +21,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -29,6 +34,7 @@ #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 @@ -222,6 +228,22 @@ int Fun4All_G4_sPHENIX( // 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; From 84f0c77c679ec4675f108e7ce42757a5db6858de Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Sat, 20 Aug 2022 01:51:06 -0400 Subject: [PATCH 1214/1222] fix bbc black hole overlap --- common/G4_Bbc.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_Bbc.C b/common/G4_Bbc.C index 4d9ac1f06..1b75e083b 100644 --- a/common/G4_Bbc.C +++ b/common/G4_Bbc.C @@ -40,7 +40,7 @@ void BbcInit() { 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, 15.0); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 125.0); } } From 3bebf3053f4ed784bad3a314d21fcbd04116f079 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 24 Aug 2022 10:30:49 -0400 Subject: [PATCH 1215/1222] move ActsGeomInit to its own macro --- common/G4_ActsGeom.C | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 common/G4_ActsGeom.C diff --git a/common/G4_ActsGeom.C b/common/G4_ActsGeom.C new file mode 100644 index 000000000..59f75261e --- /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->add_fake_surfaces(G4TRACKING::add_fake_surfaces); + geom->build_mm_surfaces(Enable::MICROMEGAS); + se->registerSubsystem(geom); + } +} // namespace ACTSGEOM + +#endif From a1960f4f69c418a5ac9e47cd3b9b6daa2e3dd64a Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 24 Aug 2022 10:31:29 -0400 Subject: [PATCH 1216/1222] move ActsGeomInit to its own macro --- common/G4_Micromegas.C | 3 ++- common/G4_TPC.C | 8 +++++--- common/G4_Tracking.C | 38 +++++--------------------------------- common/GlobalVariables.C | 13 +++++++++++++ 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/common/G4_Micromegas.C b/common/G4_Micromegas.C index f8469942a..4dca16095 100644 --- a/common/G4_Micromegas.C +++ b/common/G4_Micromegas.C @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -66,7 +67,7 @@ void Micromegas(PHG4Reco* g4Reco) void Micromegas_Cells() { // the acts geometry needs to go here since it will be used by the PHG4MicromegasHitReco - G4TRACKING::ActsGeomInit(); + ACTSGEOM::ActsGeomInit(); auto se = Fun4AllServer::instance(); // micromegas auto reco = new PHG4MicromegasHitReco; diff --git a/common/G4_TPC.C b/common/G4_TPC.C index 0b4bac26a..e7fda8e72 100644 --- a/common/G4_TPC.C +++ b/common/G4_TPC.C @@ -2,10 +2,11 @@ #define MACRO_G4TPC_C #include -#include +#include #include #include +#include #include #include @@ -66,7 +67,8 @@ namespace G4TPC // 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= 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; @@ -276,7 +278,7 @@ void TPC_Cells() void TPC_Clustering() { int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); - + ACTSGEOM::ActsGeomInit(); Fun4AllServer* se = Fun4AllServer::instance(); //------------- diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 0289a352a..5175d2b15 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -8,6 +8,7 @@ R__LOAD_LIBRARY(libqa_modules.so) #include +#include #include #include #include @@ -67,8 +68,9 @@ namespace G4TRACKING bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom - bool add_fake_surfaces = true; - bool init_acts_magfield = true; +// now declared in GlobalVariables.C + // bool add_fake_surfaces = true; + // bool init_acts_magfield = true; // 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 @@ -82,41 +84,11 @@ namespace G4TRACKING // use of the various evaluation tools already available bool convert_seeds_to_svtxtracks = false; - -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 = std::max(Enable::VERBOSITY, Enable::TRACKING_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->add_fake_surfaces(G4TRACKING::add_fake_surfaces); - geom->build_mm_surfaces(Enable::MICROMEGAS); - se->registerSubsystem(geom); -} } // namespace G4TRACKING void TrackingInit() { - G4TRACKING::ActsGeomInit(); + ACTSGEOM::ActsGeomInit(); // space charge correction /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit */ if( G4TPC::ENABLE_CORRECTIONS ) diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 6f01194d0..647b2d699 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -88,4 +88,17 @@ namespace G4MICROMEGAS 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 +{ + // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom + bool add_fake_surfaces = true; + bool init_acts_magfield = true; +} + + #endif From e4aeb16be147dc893f4b62c043628e79b3a7191d Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Wed, 24 Aug 2022 11:39:07 -0400 Subject: [PATCH 1217/1222] update with no fake surf call --- common/G4_ActsGeom.C | 8 +------- common/G4_Tracking.C | 5 ----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/common/G4_ActsGeom.C b/common/G4_ActsGeom.C index 59f75261e..8a05edc1f 100644 --- a/common/G4_ActsGeom.C +++ b/common/G4_ActsGeom.C @@ -22,12 +22,7 @@ namespace ACTSGEOM { void ActsGeomInit() { - static bool wasCalled = false; - if (wasCalled) - { - return; - } - wasCalled = true; + if (!Enable::MICROMEGAS) { G4MICROMEGAS::n_micromegas_layer = 0; @@ -45,7 +40,6 @@ namespace ACTSGEOM geom->loadMagField(G4TRACKING::init_acts_magfield); geom->setMagField(G4MAGNET::magfield); geom->setMagFieldRescale(G4MAGNET::magfield_rescale); - geom->add_fake_surfaces(G4TRACKING::add_fake_surfaces); geom->build_mm_surfaces(Enable::MICROMEGAS); se->registerSubsystem(geom); } diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C index 5175d2b15..9d3361f5d 100644 --- a/common/G4_Tracking.C +++ b/common/G4_Tracking.C @@ -66,11 +66,6 @@ namespace G4TRACKING // Vertexing bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit - - // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom -// now declared in GlobalVariables.C - // bool add_fake_surfaces = true; - // bool init_acts_magfield = true; // 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 From 73e2d4d27dfe18758987b1314c648b850a6d3bd8 Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 25 Aug 2022 11:52:29 -0400 Subject: [PATCH 1218/1222] return bool for geom build check --- common/G4_ActsGeom.C | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/G4_ActsGeom.C b/common/G4_ActsGeom.C index 8a05edc1f..a145d75f1 100644 --- a/common/G4_ActsGeom.C +++ b/common/G4_ActsGeom.C @@ -22,7 +22,13 @@ namespace ACTSGEOM { void ActsGeomInit() { - + static bool wasCalled = false; + if (wasCalled) + { + return; + } + wasCalled = true; + if (!Enable::MICROMEGAS) { G4MICROMEGAS::n_micromegas_layer = 0; From 3920115ad7d1f5907427fcf9140122bf355b96df Mon Sep 17 00:00:00 2001 From: Joe Osborn Date: Thu, 25 Aug 2022 14:45:28 -0400 Subject: [PATCH 1219/1222] clean up obsolete variables --- common/GlobalVariables.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C index 647b2d699..13c6b90f7 100644 --- a/common/GlobalVariables.C +++ b/common/GlobalVariables.C @@ -57,7 +57,7 @@ namespace G4P6DECAYER namespace TRACKING { std::string TrackNodeName = "SvtxTrackMap"; - double pp_mode = false; + bool pp_mode = false; double pp_extended_readout_time = 7000.0; // ns } @@ -95,8 +95,6 @@ namespace G4TPC namespace G4TRACKING { - // set to false to disable adding fake surfaces (TPC, Micromegas) to MakeActsGeom - bool add_fake_surfaces = true; bool init_acts_magfield = true; } From af0d4020a6ba60d99e50d9c0dbb966d6c92c6a09 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Mon, 29 Aug 2022 12:21:34 -0400 Subject: [PATCH 1220/1222] adjust phistart for fixed outer hcal from gdml --- common/G4_HcalOut_ref.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index 5030b4d67..f86b55a87 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -200,7 +200,7 @@ void HCALOuter_Towers() } else { - G4HCALOUT::phistart = -0.0248462127; // offet in phi (from zero) extracted from geantinos + G4HCALOUT::phistart = -0.024960211; // offet in phi (from zero) extracted from geantinos } } TowerBuilder->set_double_param("phistart",G4HCALOUT::phistart); From 0d5666044a468bd20c96c35a078d330ada3fc3a0 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Aug 2022 09:12:51 -0400 Subject: [PATCH 1221/1222] make new gdml based hcals the default --- common/G4_HcalIn_ref.C | 2 +- common/G4_HcalOut_ref.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C index d961c4fa4..b0ad182da 100644 --- a/common/G4_HcalIn_ref.C +++ b/common/G4_HcalIn_ref.C @@ -46,7 +46,7 @@ namespace Enable bool HCALIN_EVAL = false; bool HCALIN_QA = false; bool HCALIN_SUPPORT = false; - bool HCALIN_OLD = true; + bool HCALIN_OLD = false; int HCALIN_VERBOSITY = 0; } // namespace Enable diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C index f86b55a87..7049f39dc 100644 --- a/common/G4_HcalOut_ref.C +++ b/common/G4_HcalOut_ref.C @@ -41,7 +41,7 @@ namespace Enable bool HCALOUT_CLUSTER = false; bool HCALOUT_EVAL = false; bool HCALOUT_QA = false; - bool HCALOUT_OLD = true; + bool HCALOUT_OLD = false; int HCALOUT_VERBOSITY = 0; } // namespace Enable From 307ace8ad7e7e7e1e52aaac4e096c7f2cf8195d4 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Tue, 30 Aug 2022 09:13:34 -0400 Subject: [PATCH 1222/1222] enable tracking only if tracker detector clustering is enabled --- detectors/sPHENIX/Fun4All_G4_sPHENIX.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C index 47fd8c2fe..7b93dc6d0 100644 --- a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -305,7 +305,7 @@ int Fun4All_G4_sPHENIX( Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true; - Enable::TRACKING_TRACK = 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;