File indexing completed on 2025-08-05 08:11:11
0001 #pragma once
0002 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0003
0004 #include <frog/FROG.h>
0005
0006 #include <GlobalVariables.C>
0007 #include <G4_Input.C>
0008 #include <QA.C>
0009 #include <caloreco/CaloGeomMapping.h>
0010 #include <caloreco/CaloTowerBuilder.h>
0011 #include <caloreco/CaloTowerCalib.h>
0012 #include <caloreco/CaloWaveformProcessing.h>
0013
0014
0015 #include <calowaveformsim/CaloWaveformSim.h>
0016
0017 #include <ffamodules/CDBInterface.h>
0018 #include <ffamodules/FlagHandler.h>
0019 #include <ffamodules/HeadReco.h>
0020 #include <ffamodules/SyncReco.h>
0021 #include <fun4all/Fun4AllRunNodeInputManager.h>
0022 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0023
0024 #include <fun4all/Fun4AllUtils.h>
0025 #include <fun4all/Fun4AllDstOutputManager.h>
0026 #include <fun4all/Fun4AllInputManager.h>
0027 #include <fun4all/Fun4AllServer.h>
0028 #include <fun4all/SubsysReco.h>
0029
0030 #include <phool/recoConsts.h>
0031
0032 #include <calotrigger/CaloTriggerEmulator.h>
0033 #include <calotrigger/TriggerRunInfoReco.h>
0034
0035
0036 #include <calowaveformsim/TriggerPerformance.h>
0037 #include <CaloEmulatorTreeMaker.h>
0038 R__LOAD_LIBRARY(libFROG.so)
0039 R__LOAD_LIBRARY(libdlutility.so)
0040 R__LOAD_LIBRARY(libfun4all.so)
0041 R__LOAD_LIBRARY(libfun4allraw.so)
0042 R__LOAD_LIBRARY(libCaloWaveformSim.so)
0043 R__LOAD_LIBRARY(libcalo_reco.so)
0044 R__LOAD_LIBRARY(libffamodules.so)
0045
0046 R__LOAD_LIBRARY(libcalotrigger.so)
0047 R__LOAD_LIBRARY(libtriggervalid.so)
0048 R__LOAD_LIBRARY(libemulatortreemaker.so)
0049 #endif
0050
0051 void Fun4All_Sim(
0052 const std::string filename = "DST_CALO_CLUSTER_pythia8_Detroit-0000000021-000000.root",
0053 const int nEvents = 100)
0054 {
0055
0056
0057 gSystem->Load("libFROG");
0058
0059 FROG *fr = new FROG();
0060
0061 std::string input_1 = fr->location(filename.c_str());
0062
0063 Fun4AllServer *se = Fun4AllServer::instance();
0064 se->Verbosity(1);
0065
0066 recoConsts *rc = recoConsts::instance();
0067
0068
0069 std::pair<int, int> run_seg = Fun4AllUtils::GetRunSegment(filename.c_str());
0070 int runnumber = run_seg.first;
0071 int segment = run_seg.second;
0072
0073 Enable::CDB = true;
0074 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0075 rc->set_uint64Flag("TIMESTAMP", 21);
0076 CDBInterface::instance()->Verbosity(1);
0077
0078
0079
0080
0081
0082
0083
0084 FlagHandler *flag = new FlagHandler();
0085 se->registerSubsystem(flag);
0086
0087
0088 TriggerRunInfoReco *trr = new TriggerRunInfoReco("TriggerRunInfoReco");
0089 trr->UseEmulator(true);
0090 trr->Verbosity(0);
0091 se->registerSubsystem(trr);
0092
0093 CaloTriggerEmulator *te = new CaloTriggerEmulator("CALOTRIGGEREMULATOR");
0094 te->setNSamples(12);
0095 te->setTriggerSample(6);
0096 te->setTriggerDelay(5);
0097 te->SetIsData(false);
0098 te->setEmcalLUTFile("/sphenix/user/dlis/Projects/macros/CDBTest/emcal_ll1_lut_0.50tr_new.root");
0099 te->setHcalinLUTFile("/sphenix/user/dlis/Projects/macros/CDBTest/hcalin_ll1_lut_0.50tr_new.root");
0100 te->setHcaloutLUTFile("/sphenix/user/dlis/Projects/macros/CDBTest/hcalout_ll1_lut_0.50tr_new.root");
0101 se->registerSubsystem(te);
0102
0103
0104
0105 TriggerPerformance *tp = new TriggerPerformance("TriggerPerformance","histo_trigger.root");
0106 tp->UseEmulator(true);
0107 tp->Verbosity(0);
0108 se->registerSubsystem(tp);
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 Fun4AllInputManager *in1 = new Fun4AllDstInputManager("in1");
0134 in1->fileopen(input_1.c_str());
0135 in1->Verbosity(0);
0136 se->registerInputManager(in1);
0137
0138 std::cout << "Adding Geometry file" << std::endl;
0139 Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0140 std::string geoLocation = CDBInterface::instance()->getUrl("calo_geo");
0141 intrue2->AddFile(geoLocation);
0142 se->registerInputManager(intrue2);
0143
0144 se->run(nEvents);
0145
0146 se->End();
0147
0148
0149
0150
0151
0152 se->PrintTimer();
0153 gSystem->Exit(0);
0154 }