File indexing completed on 2026-04-07 08:08:31
0001 #include <ffamodules/FlagHandler.h>
0002 #include <ffamodules/HeadReco.h>
0003 #include <ffamodules/SyncReco.h>
0004
0005 #include <fun4all/Fun4AllDstInputManager.h>
0006 #include <fun4all/Fun4AllDstOutputManager.h>
0007 #include <fun4all/Fun4AllInputManager.h>
0008 #include <fun4all/Fun4AllRunNodeInputManager.h>
0009 #include <fun4all/Fun4AllServer.h>
0010 #include <fun4all/Fun4AllUtils.h>
0011 #include <fun4all/SubsysReco.h>
0012
0013 #include <mbd/MbdReco.h>
0014 #include <globalvertex/GlobalVertexReco.h>
0015
0016 #include <caloreco/CaloTowerStatus.h>
0017 #include <caloreco/CaloTowerDefs.h>
0018 #include <caloreco/RawClusterBuilderTemplate.h>
0019
0020 #include <phool/recoConsts.h>
0021
0022 #include <ffamodules/CDBInterface.h>
0023 #include <GlobalVariables.C>
0024 #include <Calo_Calib.C>
0025
0026 #include <ctime>
0027 #include <iostream>
0028
0029 R__LOAD_LIBRARY(libfun4all.so)
0030
0031 #include <anneutral/AnNeutralMeson.h>
0032 R__LOAD_LIBRARY(libmbd.so)
0033 R__LOAD_LIBRARY(libglobalvertex.so)
0034 R__LOAD_LIBRARY(libanneutral.so)
0035
0036 void Fun4All_AnNeutralMeson(int nevents = 1,
0037 const std::string &inputfile_events = "DST_PHOTON_MBD_TRIGGER_LIST_run2pp_ana502_nocdbtag_v001-00053686-00000.root",
0038 const std::string &inputlist1 = "dst_calo.list",
0039 const std::string &inputlist2 = "dst_calofitting.list",
0040 const std::string &histname = "hist_suffix", const std::string &dstname = "DST_MICRO_ANNEUTRALMESON_1")
0041 {
0042
0043
0044 std::time_t t = std::time(0);
0045 std::tm* now = std::localtime(&t);
0046 std::cout << "date = " << (now->tm_year + 1900) << "-" << (now->tm_mon + 1) << "-" << now->tm_mday << std::endl;
0047
0048 Fun4AllServer *se = Fun4AllServer::instance();
0049 se->Verbosity(0);
0050 cout << "registered F4A" << std::endl;
0051
0052
0053 recoConsts *rc = recoConsts::instance();
0054
0055
0056
0057 ifstream file(inputlist2);
0058 string first_file;
0059 getline(file, first_file);
0060 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0061 int runnumber = runseg.first;
0062 cout << "run number = " << runnumber << endl;
0063
0064
0065
0066 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0067
0068 rc->set_uint64Flag("TIMESTAMP", runnumber);
0069 rc->set_IntFlag("RUNNUMBER", runnumber);
0070
0071
0072 std::cout << "Registering selection DST" << std::endl;
0073
0074
0075 Fun4AllInputManager *in_events = new Fun4AllDstInputManager("DST_SELECTED_EVENTS");
0076 in_events->AddFile(inputfile_events);
0077 se->registerInputManager(in_events);
0078
0079 if (inputlist1 != "" && inputlist2 == "")
0080 {
0081 std::cout << "Registering DST_CALO" << std::endl;
0082 Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_CALO_CLUSTERS");
0083 in->AddListFile(inputlist1);
0084 se->registerInputManager(in);
0085 }
0086
0087
0088
0089 if (inputlist2 != "")
0090 {
0091 std::cout << "Registering DST_CALOFITTING" << std::endl;
0092 Fun4AllInputManager *in2 = new Fun4AllDstInputManager("DST_CALOFITTINGS");
0093 in2->AddListFile(inputlist2);
0094 se->registerInputManager(in2);
0095 }
0096
0097
0098 if (inputlist2 != "") {
0099
0100 MbdReco *mbdreco = new MbdReco();
0101 se->registerSubsystem(mbdreco);
0102
0103
0104 GlobalVertexReco *gvertex = new GlobalVertexReco();
0105 se->registerSubsystem(gvertex);
0106
0107 std::cout << "Using Process_Calo_Calib()" << std::endl;
0108 Process_Calo_Calib();
0109 }
0110
0111
0112
0113
0114 std::cout << "Registering AnNeutralMeson" << std::endl;
0115 AnNeutralMeson *AN = new AnNeutralMeson("calomodulename", runnumber, histname, ".");
0116 se->registerSubsystem(AN);
0117
0118 Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", dstname);
0119 out->SplitLevel(99);
0120
0121 out->StripNode("EventHeader");
0122 out->StripNode("14001");
0123 out->StripNode("1002");
0124 out->StripNode("1001");
0125 out->StripNode("TOWERS_ZDC");
0126 out->StripNode("TOWERS_CEMC");
0127 out->StripNode("TOWERINFO_CALIB_CEMC");
0128 out->StripNode("CLUSTERINFO_CEMC");
0129
0130 out->StripNode("TOWERS_HCALIN");
0131 out->StripNode("TOWERINFO_CALIB_HCALIN");
0132 out->StripNode("TOWERS_HCALOUT");
0133 out->StripNode("TOWERINFO_CALIB_HCALOUT");
0134 out->StripNode("TOWERS_SEPD");
0135 out->StripNode("MbdOut");
0136 out->StripNode("MbdRawContainer");
0137 out->StripNode("MbdPmtContainer");
0138 out->StripNode("MbdVertexMap");
0139
0140 out->StripRunNode("TriggerRunInfo");
0141 out->StripRunNode("RunHeader");
0142 out->StripRunNode("Flags");
0143 out->StripRunNode("CdbUrl");
0144 out->StripRunNode("TOWERGEOM_CEMC_DETAILED");
0145 out->StripRunNode("TOWERGEOM_CEMC");
0146 out->StripRunNode("TOWERGEOM_HCALIN");
0147 out->StripRunNode("TOWERGEOM_HCALOUT");
0148 out->StripRunNode("CYLINDERGEOM_CEMC");
0149 out->StripRunNode("CYLINDERCELLGEOM_CEMC");
0150 out->StripRunNode("MbdGeom");
0151 se->registerOutputManager(out);
0152
0153 std::cout << "Running F4A" << std::endl;
0154 se->run(nevents);
0155 se->End();
0156 se->PrintTimer();
0157 delete se;
0158
0159 TFile* f_done_signal = new TFile("DONE.root","recreate");
0160 std::cout << "All done!" << std::endl;
0161 gSystem->Exit(0);
0162 }
0163