File indexing completed on 2025-08-05 08:13:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define FUN4ALL_TESTCALOSTATUSMAPPER_C
0011
0012
0013 #include <string>
0014 #include <utility>
0015
0016 #include <ffamodules/CDBInterface.h>
0017 #include <ffamodules/FlagHandler.h>
0018
0019 #include <fun4all/Fun4AllDstInputManager.h>
0020 #include <fun4all/Fun4AllInputManager.h>
0021 #include <fun4all/Fun4AllServer.h>
0022 #include <fun4all/Fun4AllUtils.h>
0023 #include <fun4all/SubsysReco.h>
0024
0025 #include <jetqa/JetQADefs.h>
0026
0027 #include <phool/recoConsts.h>
0028
0029 #include <qautils/QAHistManagerDef.h>
0030
0031 #include <calostatusmapper/CaloStatusMapper.h>
0032 #include <calostatusmapper/CaloStatusMapperDefs.h>
0033
0034 R__LOAD_LIBRARY(libcalo_io.so)
0035 R__LOAD_LIBRARY(libcalostatusmapper.so)
0036 R__LOAD_LIBRARY(libfun4all.so)
0037 R__LOAD_LIBRARY(libfun4allraw.so)
0038 R__LOAD_LIBRARY(libjetqa.so)
0039
0040
0041
0042
0043
0044 void Fun4All_TestCaloStatusMapper(
0045 const int nEvents = 100,
0046 const std::string& inlist = "input/dst_calo_run2pp-00047289.list",
0047 const std::string& outfile = "test.root",
0048 const std::string& outfile_hist = "test_hists.root",
0049 const std::string& dbtag = "ProdA_2024",
0050 const int verbosity = 1
0051 ) {
0052
0053
0054
0055
0056 CaloStatusMapper::Config cfg_mapper {
0057 .debug = true,
0058 .histTag = "Test",
0059 .doTrgSelect = false,
0060 .trgToSelect = JetQADefs::GL1::MBDNSJet1
0061 };
0062
0063
0064 cfg_mapper.inNodeNames = {
0065 {"TOWERINFO_CALIB_CEMC", CaloStatusMapperDefs::Calo::EMCal},
0066 {"TOWERINFO_CALIB_HCALOUT", CaloStatusMapperDefs::Calo::HCal}
0067 };
0068
0069
0070
0071
0072 Fun4AllServer* se = Fun4AllServer::instance();
0073 se -> Verbosity(verbosity);
0074
0075
0076 ifstream files(inlist);
0077 std::string first("");
0078 std::getline(files, first);
0079
0080
0081 std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first);
0082 int runnumber = runseg.first;
0083
0084 Fun4AllServer* f4a = Fun4AllServer::instance();
0085 CDBInterface* cdb = CDBInterface::instance();
0086 recoConsts* rc = recoConsts::instance();
0087 f4a -> Verbosity(verbosity);
0088 cdb -> Verbosity(verbosity);
0089
0090
0091 rc -> set_StringFlag("CDB_GLOBALTAG", dbtag);
0092 rc -> set_uint64Flag("TIMESTAMP", runnumber);
0093
0094
0095 CDBInterface::instance()->Verbosity(verbosity);
0096
0097
0098 FlagHandler* flag = new FlagHandler();
0099 se -> registerSubsystem(flag);
0100
0101
0102
0103 Fun4AllDstInputManager* input = new Fun4AllDstInputManager("InputDstManager");
0104 input -> AddListFile(inlist);
0105 f4a -> registerInputManager(input);
0106
0107
0108
0109
0110 CaloStatusMapper* mapper = new CaloStatusMapper("CaloStatusMapper");
0111 mapper -> SetConfig(cfg_mapper);
0112 mapper -> Verbosity(verbosity);
0113 f4a -> registerSubsystem(mapper);
0114
0115
0116
0117
0118 f4a -> run(nEvents);
0119 f4a -> End();
0120
0121
0122 QAHistManagerDef::saveQARootFile(outfile_hist);
0123 delete f4a;
0124
0125
0126 gSystem -> Exit(0);
0127 return;
0128
0129 }
0130
0131