Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:24

0001 #ifndef MACRO_G4DSTREADER_C
0002 #define MACRO_G4DSTREADER_C
0003 
0004 #include <GlobalVariables.C>
0005 
0006 #include <G4_BlackHole.C>
0007 #include <G4_CEmc_Spacal.C>
0008 #include <G4_EPD.C>
0009 #include <G4_HcalIn_ref.C>
0010 #include <G4_HcalOut_ref.C>
0011 #include <G4_Magnet.C>
0012 #include <G4_Mbd.C>
0013 #include <G4_TrkrVariables.C>
0014 /*
0015 #include <G4_Intt.C>
0016 #include <G4_Magnet.C>
0017 #include <G4_Mvtx.C>
0018 #include <G4_TPC.C>
0019 */
0020 #include <g4eval/PHG4DSTReader.h>
0021 
0022 #include <fun4all/Fun4AllServer.h>
0023 
0024 R__LOAD_LIBRARY(libg4eval.so)
0025 
0026 //////////////////////////////////////////////////////////////////
0027 /*!
0028  \file G4_DSTReader.C
0029  \brief Convert DST to human command readable TTree for quick poke around the outputs
0030  \author  Jin Huang
0031  \version $Revision:  $
0032  \date    $Date: $
0033  */
0034 //////////////////////////////////////////////////////////////////
0035 
0036 namespace Enable
0037 {
0038   bool DSTREADER = false;
0039   int DSTREADER_VERBOSITY = 0;
0040 }  // namespace Enable
0041 
0042 namespace G4DSTREADER
0043 {
0044   bool save_g4_raw = true;
0045   double tower_zero_supp = 1.e-6;
0046 }  // namespace G4DSTREADER
0047 
0048 void G4DSTreaderInit() {}
0049 
0050 void G4DSTreader(const std::string &outputFile = "G4sPHENIXCells.root")
0051 {
0052   int verbosity = std::max(Enable::VERBOSITY, Enable::DSTREADER_VERBOSITY);
0053 
0054   // save a comprehensive  evaluation file
0055   PHG4DSTReader *ana = new PHG4DSTReader(outputFile);
0056   ana->set_save_particle(true);
0057   ana->set_load_all_particle(false);
0058   ana->set_load_active_particle(true);
0059   ana->set_save_vertex(true);
0060 
0061   ana->Verbosity(verbosity);
0062 
0063   if (G4DSTREADER::save_g4_raw)
0064   {
0065     if (Enable::MVTX)
0066     {
0067       ana->AddNode("MVTX");
0068     }
0069     if (Enable::INTT)
0070     {
0071       ana->AddNode("INTT");
0072     }
0073     if (Enable::TPC)
0074     {
0075       ana->AddNode("TPC");
0076     }
0077     if (Enable::MBD)
0078     {
0079       ana->AddNode("MBD");
0080     }
0081 
0082     if (Enable::CEMC)
0083     {
0084       ana->AddNode("CEMC");
0085       if (Enable::ABSORBER || Enable::CEMC_ABSORBER)
0086       {
0087         ana->AddNode("ABSORBER_CEMC");
0088         ana->AddNode("CEMC_ELECTRONICS");
0089         ana->AddNode("CEMC_SPT");
0090       }
0091     }
0092 
0093     if (Enable::HCALIN)
0094     {
0095       ana->AddNode("HCALIN");
0096       if (Enable::ABSORBER || Enable::HCALIN_ABSORBER)
0097       {
0098         ana->AddNode("ABSORBER_HCALIN");
0099       }
0100     }
0101 
0102     if (Enable::MAGNET)
0103     {
0104       if (Enable::ABSORBER || Enable::MAGNET_ABSORBER)
0105       {
0106         ana->AddNode("MAGNET");
0107       }
0108     }
0109 
0110     if (Enable::HCALOUT)
0111     {
0112       ana->AddNode("HCALOUT");
0113       if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER)
0114       {
0115         ana->AddNode("ABSORBER_HCALOUT");
0116       }
0117     }
0118 
0119     if (Enable::EPD)
0120     {
0121       ana->AddNode("EPD");
0122     }
0123 
0124     if (Enable::BLACKHOLE)
0125     {
0126       ana->AddNode("BH_1");
0127       ana->AddNode("BH_FORWARD_PLUS");
0128       ana->AddNode("BH_FORWARD_NEG");
0129     }
0130   }
0131 
0132   ana->set_tower_zero_sup(G4DSTREADER::tower_zero_supp);
0133   if (Enable::CEMC_TOWER)
0134   {
0135     ana->AddTower("SIM_CEMC");
0136     ana->AddTower("RAW_CEMC");
0137     ana->AddTower("CALIB_CEMC");
0138   }
0139   if (Enable::HCALIN_TOWER)
0140   {
0141     ana->AddTower("SIM_HCALIN");
0142     ana->AddTower("RAW_HCALIN");
0143     ana->AddTower("CALIB_HCALIN");
0144   }
0145   if (Enable::HCALOUT_TOWER)
0146   {
0147     ana->AddTower("SIM_HCALOUT");
0148     ana->AddTower("RAW_HCALOUT");
0149     ana->AddTower("CALIB_HCALOUT");
0150   }
0151   // Jets disabled for now
0152   //  if (do_jet_reco)
0153   //    {
0154   //
0155   //      ana->AddJet("AntiKt06JetsInPerfect");
0156   //      ana->AddJet("G4TowerJets_6");
0157   //    }
0158   //  if (embed_input_file && do_jet_reco)
0159   //    {
0160   //      ana->AddJet("G4TowerJets_combined_6");
0161   //    }
0162 
0163   Fun4AllServer *se = Fun4AllServer::instance();
0164   se->registerSubsystem(ana);
0165 }
0166 #endif