File indexing completed on 2025-08-05 08:11:15
0001 #pragma once
0002 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0003 #include <calowaveformsim/GL1TriggerSelect.h>
0004 #include <globalvertex/GlobalVertexReco.h>
0005 #include <ffamodules/CDBInterface.h>
0006 #include <ffamodules/FlagHandler.h>
0007 #include <ffamodules/HeadReco.h>
0008 #include <ffamodules/SyncReco.h>
0009 #include <fun4all/Fun4AllUtils.h>
0010 #include <centrality/CentralityReco.h>
0011 #include <centrality/CentralityValid.h>
0012 #include <calotrigger/MinimumBiasClassifier.h>
0013
0014 #include <fun4all/SubsysReco.h>
0015 #include <fun4all/Fun4AllServer.h>
0016 #include <fun4all/Fun4AllInputManager.h>
0017 #include <fun4all/Fun4AllDstInputManager.h>
0018 #include <vector>
0019
0020 #include <phool/recoConsts.h>
0021 #include <frog/FROG.h>
0022 #include <calotrigger/TriggerRunInfoReco.h>
0023
0024 #include <caloreco/CaloTowerBuilder.h>
0025 #include <mbd/MbdReco.h>
0026 #include <zdcinfo/ZdcReco.h>
0027
0028 #include <caloreco/CaloTowerCalib.h>
0029
0030 R__LOAD_LIBRARY(libemulatortreemaker.so)
0031 R__LOAD_LIBRARY(libfun4all.so)
0032 R__LOAD_LIBRARY(libffamodules.so)
0033 R__LOAD_LIBRARY(libcentrality.so)
0034 R__LOAD_LIBRARY(libglobalvertex.so)
0035
0036 R__LOAD_LIBRARY(libcentralityvalid.so)
0037 R__LOAD_LIBRARY(libzdcinfo.so)
0038 R__LOAD_LIBRARY(libmbd.so)
0039 R__LOAD_LIBRARY(libzdcinfo.so)
0040
0041 #endif
0042
0043 void Fun4All_CentralityValid(const std::string filename)
0044 {
0045 gSystem->Load("libFROG");
0046 gSystem->Load("libg4dst");
0047 gSystem->Load("libcentrality");
0048 gSystem->Load("libcentralityvalid");
0049 gSystem->Load("libcalotrigger");
0050
0051 CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kPRDFTowerv4;
0052
0053 std::pair<int, int> run_seg = Fun4AllUtils::GetRunSegment(filename);
0054 int runnumber = run_seg.first;
0055 int segment = run_seg.second;
0056
0057 int nevents = 0;
0058 int verbosity = 0;
0059
0060 const char* env_p = std::getenv("MBD_CENTRALITY_CALIB_PATH");
0061
0062 if(!env_p)
0063 {
0064 std::cout << "no env MBD_CENTRALITY_CALIB_PATH set."<<endl;
0065 return;
0066 }
0067
0068
0069 const char* env_cdb = std::getenv("CDB_TAG");
0070
0071 if(!env_cdb)
0072 {
0073 std::cout << "no env CDB_TAG set."<<endl;
0074 return;
0075 }
0076
0077 char *dir = new char[100];
0078
0079 sprintf(dir, "output/run%d/mbdana", runnumber);
0080
0081
0082 const char *tree_outfile = Form("%s/%s/mbd_ana_tree_%08d_%05d.root", env_p, dir, runnumber, segment);
0083
0084 Fun4AllServer *se = Fun4AllServer::instance();
0085 se->Verbosity(0);
0086
0087 recoConsts *rc = recoConsts::instance();
0088 rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2024");
0089 rc->set_uint64Flag("TIMESTAMP",runnumber);
0090
0091 FROG *fr = new FROG();
0092
0093 std::string input = fr->location(filename.c_str());
0094 Fun4AllInputManager *in = new Fun4AllDstInputManager("in");
0095 in->fileopen(input.c_str());
0096 in->Verbosity(0);
0097 se->registerInputManager(in);
0098
0099 MbdReco *mbdreco = new MbdReco();
0100 mbdreco->Verbosity(0);
0101 se->registerSubsystem(mbdreco);
0102
0103 GlobalVertexReco* gblvertex = new GlobalVertexReco();
0104 gblvertex->Verbosity(0);
0105 se->registerSubsystem(gblvertex);
0106
0107 CaloTowerBuilder *caZDC = new CaloTowerBuilder("ZDCBUILDER");
0108 caZDC->set_detector_type(CaloTowerDefs::ZDC);
0109 caZDC->set_builder_type(buildertype);
0110 caZDC->set_processing_type(CaloWaveformProcessing::FAST);
0111 caZDC->set_nsamples(16);
0112 caZDC->set_offlineflag();
0113 se->registerSubsystem(caZDC);
0114
0115
0116 std::cout << "Calibrating ZDC" << std::endl;
0117 CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC");
0118 calibZDC->set_detector_type(CaloTowerDefs::ZDC);
0119 se->registerSubsystem(calibZDC);
0120
0121
0122
0123
0124 ZdcReco *zdcreco = new ZdcReco();
0125 zdcreco->set_zdc1_cut(0.0);
0126 zdcreco->set_zdc2_cut(0.0);
0127 se->registerSubsystem(zdcreco);
0128
0129 GL1TriggerSelect *gts = new GL1TriggerSelect("GL1TriggerSelect");
0130 gts->select_trigger(10);
0131 se->registerSubsystem(gts);
0132
0133
0134
0135 MinimumBiasClassifier *mb = new MinimumBiasClassifier();
0136 mb->Verbosity(0);
0137 se->registerSubsystem(mb);
0138
0139 CentralityReco *cr = new CentralityReco();
0140 cr->Verbosity(1);
0141 se->registerSubsystem(cr);
0142
0143
0144 CentralityValid *centralityvalidation = new CentralityValid("CentralityValid","cent_valid.root");
0145 se->registerSubsystem(centralityvalidation);
0146
0147 se->run(10);
0148 se->End();
0149 }