File indexing completed on 2025-08-03 08:20:23
0001 #include <caloreco/CaloTowerBuilder.h>
0002 #include <caloreco/CaloWaveformProcessing.h>
0003
0004 #include <ffamodules/CDBInterface.h>
0005 #include <ffamodules/FlagHandler.h>
0006 #include <ffamodules/HeadReco.h>
0007 #include <ffamodules/SyncReco.h>
0008
0009 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0010
0011 #include <fun4all/Fun4AllDstInputManager.h>
0012 #include <fun4all/Fun4AllDstOutputManager.h>
0013 #include <fun4all/Fun4AllInputManager.h>
0014 #include <fun4all/Fun4AllRunNodeInputManager.h>
0015 #include <fun4all/Fun4AllServer.h>
0016 #include <fun4all/Fun4AllUtils.h>
0017 #include <fun4all/SubsysReco.h>
0018
0019 #include <phool/recoConsts.h>
0020
0021
0022 R__LOAD_LIBRARY(libfun4all.so)
0023 R__LOAD_LIBRARY(libfun4allraw.so)
0024 R__LOAD_LIBRARY(libcalo_reco.so)
0025 R__LOAD_LIBRARY(libffamodules.so)
0026
0027 void Fun4All_WaveformFit(const std::string &fname = "/sphenix/lustre01/sphnxpro/commissioning/slurp/calobeam/run_00040700_00040800/DST_TRIGGERED_RAW_beam_new_2023p015-00040797-0001.root", int nEvents = 10)
0028 {
0029
0030
0031
0032 CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kWaveformTowerv2;
0033
0034
0035
0036 Fun4AllServer *se = Fun4AllServer::instance();
0037 se->Verbosity(0);
0038
0039 recoConsts *rc = recoConsts::instance();
0040
0041 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fname);
0042 int runnumber = runseg.first;
0043 int segment = runseg.second;
0044 char outfile[100];
0045 char outfile_hist[100];
0046 sprintf(outfile, "DST_CALOR-%08d-%04d.root", runnumber, segment);
0047 sprintf(outfile_hist, "HIST_CALOR-%08d-%04d.root", runnumber, segment);
0048 string fulloutfile = string("./") + outfile;
0049 string fulloutfile_hist = string("./") + outfile_hist;
0050
0051
0052
0053
0054
0055 rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0056
0057 rc->set_uint64Flag("TIMESTAMP", runnumber);
0058 CDBInterface::instance()->Verbosity(1);
0059
0060 FlagHandler *flag = new FlagHandler();
0061 se->registerSubsystem(flag);
0062
0063
0064
0065
0066
0067 CaloTowerBuilder *ctbEMCal = new CaloTowerBuilder("EMCalBUILDER");
0068 ctbEMCal->set_detector_type(CaloTowerDefs::CEMC);
0069 ctbEMCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0070 ctbEMCal->set_builder_type(buildertype);
0071 ctbEMCal->set_offlineflag(true);
0072 ctbEMCal->set_nsamples(12);
0073 se->registerSubsystem(ctbEMCal);
0074
0075 CaloTowerBuilder *ctbIHCal = new CaloTowerBuilder("HCALINBUILDER");
0076 ctbIHCal->set_detector_type(CaloTowerDefs::HCALIN);
0077 ctbIHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0078 ctbIHCal->set_builder_type(buildertype);
0079 ctbIHCal->set_offlineflag();
0080 ctbIHCal->set_nsamples(12);
0081 se->registerSubsystem(ctbIHCal);
0082
0083 CaloTowerBuilder *ctbOHCal = new CaloTowerBuilder("HCALOUTBUILDER");
0084 ctbOHCal->set_detector_type(CaloTowerDefs::HCALOUT);
0085 ctbOHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0086 ctbOHCal->set_builder_type(buildertype);
0087 ctbOHCal->set_offlineflag();
0088 ctbOHCal->set_nsamples(12);
0089 se->registerSubsystem(ctbOHCal);
0090
0091 CaloTowerBuilder *caZDC = new CaloTowerBuilder("ZDCBUILDER");
0092 caZDC->set_detector_type(CaloTowerDefs::ZDC);
0093 caZDC->set_builder_type(buildertype);
0094 caZDC->set_processing_type(CaloWaveformProcessing::FAST);
0095 caZDC->set_nsamples(16);
0096 caZDC->set_offlineflag();
0097 se->registerSubsystem(caZDC);
0098
0099 CaloTowerBuilder *caEPD = new CaloTowerBuilder("SEPDBUILDER");
0100 caEPD->set_detector_type(CaloTowerDefs::SEPD);
0101 caEPD->set_builder_type(buildertype);
0102 caEPD->set_processing_type(CaloWaveformProcessing::FAST);
0103 caEPD->set_nsamples(12);
0104 caEPD->set_offlineflag();
0105 se->registerSubsystem(caEPD);
0106
0107 Fun4AllInputManager *In = new Fun4AllDstInputManager("in");
0108 In->AddFile(fname);
0109 se->registerInputManager(In);
0110
0111 Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", fulloutfile);
0112 out->StripNode("CEMCPackets");
0113 out->StripNode("HCALPackets");
0114 out->StripNode("ZDCPackets");
0115 out->StripNode("SEPDPackets");
0116 se->registerOutputManager(out);
0117
0118 se->run(nEvents);
0119 se->End();
0120
0121 CDBInterface::instance()->Print();
0122 se->PrintTimer();
0123 delete se;
0124 std::cout << "All done!" << std::endl;
0125 gSystem->Exit(0);
0126 }
0127