Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef FUN4ALL_YEAR2_C
0002 #define FUN4ALL_YEAR2_C
0003 
0004 #include <Calo_Calib.C>
0005 #include <QA.C>
0006 
0007 #include <mbd/MbdReco.h>
0008 
0009 #include <epd/EpdReco.h>
0010 
0011 #include <zdcinfo/ZdcReco.h>
0012 
0013 #include <globalvertex/GlobalVertexReco.h>
0014 
0015 #include <calotrigger/MinimumBiasClassifier.h>
0016 
0017 #include <calotreegen/caloTreeGen.h>
0018 
0019 #include <calovalid/CaloValid.h>
0020 
0021 #include <centrality/CentralityReco.h>
0022 
0023 #include <globalqa/GlobalQA.h>
0024 
0025 #include <ffamodules/CDBInterface.h>
0026 #include <ffamodules/FlagHandler.h>
0027 #include <ffamodules/HeadReco.h>
0028 #include <ffamodules/SyncReco.h>
0029 
0030 #include <fun4all/Fun4AllDstInputManager.h>
0031 #include <fun4all/Fun4AllDstOutputManager.h>
0032 #include <fun4all/Fun4AllInputManager.h>
0033 #include <fun4all/Fun4AllRunNodeInputManager.h>
0034 #include <fun4all/Fun4AllServer.h>
0035 #include <fun4all/Fun4AllUtils.h>
0036 #include <fun4all/SubsysReco.h>
0037 
0038 #include <phool/recoConsts.h>
0039 
0040 
0041 R__LOAD_LIBRARY(libfun4all.so)
0042 R__LOAD_LIBRARY(libcalo_reco.so)
0043 R__LOAD_LIBRARY(libcalotrigger.so)
0044 R__LOAD_LIBRARY(libcentrality.so)
0045 R__LOAD_LIBRARY(libffamodules.so)
0046 R__LOAD_LIBRARY(libmbd.so)
0047 R__LOAD_LIBRARY(libepd.so)
0048 R__LOAD_LIBRARY(libzdcinfo.so)
0049 R__LOAD_LIBRARY(libglobalvertex.so)
0050 R__LOAD_LIBRARY(libcalovalid.so)
0051 R__LOAD_LIBRARY(libglobalQA.so)
0052 R__LOAD_LIBRARY(libcaloTreeGen.so)
0053 
0054 void Fun4All_Year2_Calib(int nEvents = 100,
0055                          const std::string &fname = "DST_CALOFITTING_run2pp_ana487_2024p018_v004-00047289-00000.root",
0056                          const std::string &outfile = "DST_CALO_run2pp_ana487_2024p018_v004-00047289-00000.root",
0057                          const std::string &outfile_hist = "HIST_CALOQA_run2pp_ana487_2024p018_v004-00047289-00000.root",
0058                          const std::string &outfile_tree = "TREE_CALOQA_run2pp_ana487_2024p018_v004-00047289-00000.root",
0059                          const std::string &dbtag = "ProdA_2024")
0060 {
0061   // towerinfov1=kPRDFTowerv1, v2=:kWaveformTowerv2, v3=kPRDFWaveform, v4=kPRDFTowerv4
0062   CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kPRDFTowerv4;
0063 
0064   Fun4AllServer *se = Fun4AllServer::instance();
0065   se->Verbosity(1);
0066 
0067   recoConsts *rc = recoConsts::instance();
0068 
0069   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fname);
0070   int runnumber = runseg.first;
0071 
0072   // conditions DB flags and timestamp
0073   rc->set_StringFlag("CDB_GLOBALTAG", dbtag);
0074   rc->set_uint64Flag("TIMESTAMP", runnumber);
0075   CDBInterface::instance()->Verbosity(1);
0076 
0077   FlagHandler *flag = new FlagHandler();
0078   se->registerSubsystem(flag);
0079 
0080   // MBD/BBC Reconstruction
0081   MbdReco *mbdreco = new MbdReco();
0082   se->registerSubsystem(mbdreco);
0083 
0084   // sEPD Reconstruction--Calib Info
0085   EpdReco *epdreco = new EpdReco();
0086   se->registerSubsystem(epdreco);
0087 
0088   // ZDC Reconstruction--Calib Info
0089   ZdcReco *zdcreco = new ZdcReco();
0090   zdcreco->set_zdc1_cut(0.0);
0091   zdcreco->set_zdc2_cut(0.0);
0092   se->registerSubsystem(zdcreco);
0093 
0094   // Official vertex storage
0095   GlobalVertexReco *gvertex = new GlobalVertexReco();
0096   se->registerSubsystem(gvertex);
0097 
0098   GlobalQA *gqa = new GlobalQA("GlobalQA");
0099   se->registerSubsystem(gqa);
0100 
0101   /////////////////////
0102   // Geometry
0103   std::cout << "Adding Geometry file" << std::endl;
0104   Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0105   std::string geoLocation = CDBInterface::instance()->getUrl("calo_geo");
0106   intrue2->AddFile(geoLocation);
0107   se->registerInputManager(intrue2);
0108 
0109   /////////////////////////////////////////////////////
0110   // Set status of CALO towers, Calibrate towers,  Cluster
0111   Process_Calo_Calib();
0112 
0113   ///////////////////////////////////
0114   // Validation
0115   CaloValid *ca = new CaloValid("CaloValid");
0116   ca->set_timing_cut_width(200);
0117   se->registerSubsystem(ca);
0118 
0119   // caloTreeGen *caloTree = new caloTreeGen(outfile_tree);
0120   // //enable subsystems
0121   // caloTree->doEMCal(1, "TOWERINFO_CALIB_CEMC");
0122   // caloTree->doClusters(1, "CLUSTERINFO_CEMC");
0123   // caloTree->doHCals(1, "TOWERINFO_CALIB_HCALOUT", "TOWERINFO_CALIB_HCALIN");
0124   // caloTree->doZDC(1, "TOWERINFO_CALIB_ZDC");
0125   // caloTree->doTrig(1, "GL1Packet");
0126 
0127   // //set subsystem cuts
0128   // caloTree->setEMCalThresh(0.7);
0129   // caloTree->setClusterThresh(0.5);
0130   // caloTree->doClusterDetails(1);
0131   // caloTree->setOHCalThresh(0.5);
0132   // caloTree->setIHCalThresh(0.1);
0133   // se->registerSubsystem(caloTree);
0134 
0135   Fun4AllInputManager *In = new Fun4AllDstInputManager("in");
0136   In->AddFile(fname);
0137   se->registerInputManager(In);
0138 
0139   Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile);
0140   out->StripNode("TOWERS_CEMC");
0141   out->StripNode("TOWERS_HCALIN");
0142   out->StripNode("TOWERS_HCALOUT");
0143   out->StripNode("TOWERS_ZDC");
0144   out->StripNode("TOWERS_SEPD");
0145   out->StripNode("MBDPackets");
0146   se->registerOutputManager(out);
0147 
0148   se->run(nEvents);
0149   se->End();
0150 
0151   QAHistManagerDef::saveQARootFile(outfile_hist);
0152 
0153   CDBInterface::instance()->Print();  // print used DB files
0154   se->PrintTimer();
0155   delete se;
0156   std::cout << "All done!" << std::endl;
0157   gSystem->Exit(0);
0158 }
0159 
0160 #endif