File indexing completed on 2025-08-05 08:12:20
0001
0002 #include <caloreco/CaloTowerCalib.h>
0003 #include <caloreco/RawClusterBuilderTemplate.h>
0004 #include <caloreco/RawClusterDeadHotMask.h>
0005 #include <caloreco/RawClusterPositionCorrection.h>
0006
0007 #include <ffamodules/FlagHandler.h>
0008 #include <ffamodules/HeadReco.h>
0009 #include <ffamodules/SyncReco.h>
0010
0011 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0012
0013 #include <fun4all/Fun4AllDstInputManager.h>
0014 #include <fun4all/Fun4AllDstOutputManager.h>
0015 #include <fun4all/Fun4AllInputManager.h>
0016 #include <fun4all/Fun4AllRunNodeInputManager.h>
0017 #include <fun4all/Fun4AllServer.h>
0018 #include <fun4all/Fun4AllUtils.h>
0019 #include <fun4all/SubsysReco.h>
0020
0021 #include <phool/recoConsts.h>
0022
0023 #include <ffamodules/CDBInterface.h>
0024 #include <GlobalVariables.C>
0025
0026 #include <litecaloeval/LiteCaloEval.h>
0027
0028 R__LOAD_LIBRARY(libcdbobjects)
0029
0030 R__LOAD_LIBRARY(libfun4all.so)
0031 R__LOAD_LIBRARY(libfun4allraw.so)
0032 R__LOAD_LIBRARY(libcalo_reco.so)
0033 R__LOAD_LIBRARY(libffamodules.so)
0034 R__LOAD_LIBRARY(libmbd.so)
0035 R__LOAD_LIBRARY(libglobalvertex.so)
0036 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0037
0038 #include <caloana/CaloAna.h>
0039 R__LOAD_LIBRARY(libcaloana.so)
0040
0041 void Fun4All_EMCal_Hist(int nevents = 0, const std::string &fname = "inputdata.txt")
0042 {
0043
0044 Fun4AllServer *se = Fun4AllServer::instance();
0045 se->Verbosity(0);
0046
0047
0048 recoConsts *rc = recoConsts::instance();
0049
0050 ifstream file(fname);
0051 string first_file;
0052 getline(file, first_file);
0053
0054
0055
0056
0057 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0058 int runnumber = runseg.first;
0059 cout << "run number = " << runnumber << endl;
0060
0061
0062 rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
0063
0064 rc->set_uint64Flag("TIMESTAMP", runnumber);
0065
0066 Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS");
0067 in->AddListFile(fname);
0068 se->registerInputManager(in);
0069
0070 std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1);
0071 std::string OutFile = Form("OUTHIST_iter_%s",filename.c_str());
0072
0073
0074
0075 std::cout << "Calibrating EMCal" << std::endl;
0076 CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB");
0077 calibEMC->set_detector_type(CaloTowerDefs::CEMC);
0078 se->registerSubsystem(calibEMC);
0079
0080
0081
0082
0083 std::cout << "Building clusters" << std::endl;
0084 RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
0085 ClusterBuilder->Detector("CEMC");
0086 ClusterBuilder->set_threshold_energy(0.20);
0087 std::string emc_prof = getenv("CALIBRATIONROOT");
0088 emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0089 ClusterBuilder->LoadProfile(emc_prof);
0090 ClusterBuilder->set_UseTowerInfo(1);
0091 ClusterBuilder->setOutputClusterNodeName("CLUSTERINFO_CEMC2");
0092 se->registerSubsystem(ClusterBuilder);
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 CaloAna *ca = new CaloAna("calomodulename", OutFile);
0104 ca->set_timing_cut_width(16);
0105 ca->apply_vertex_cut(false);
0106 ca->set_vertex_cut(20.);
0107 se->registerSubsystem(ca);
0108
0109 se->run(nevents);
0110 se->End();
0111 se->PrintTimer();
0112 delete se;
0113
0114 TFile* f_done_signal = new TFile("DONE.root","recreate");
0115 std::cout << "All done!" << std::endl;
0116 gSystem->Exit(0);
0117
0118 }
0119