Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:24:00

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