Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:24:08

0001 #ifndef MACRO_FUN4ALL_CALOVALID_C
0002 #define MACRO_FUN4ALL_CALOVALID_C
0003 
0004 #include <QA.C>
0005 
0006 #include <calotrigger/MinimumBiasClassifier.h>
0007 
0008 #include <caloreco/CaloTowerCalib.h>
0009 
0010 #include <calovalid/CaloValid.h>
0011 
0012 #include <centrality/CentralityInfo.h>
0013 
0014 #include <ffamodules/FlagHandler.h>
0015 #include <ffamodules/HeadReco.h>
0016 #include <ffamodules/SyncReco.h>
0017 #include <ffamodules/CDBInterface.h>
0018 
0019 #include <fun4all/SubsysReco.h>
0020 #include <fun4all/Fun4AllServer.h>
0021 #include <fun4all/Fun4AllInputManager.h>
0022 #include <fun4all/Fun4AllDstInputManager.h>
0023 #include <fun4all/Fun4AllNoSyncDstInputManager.h>
0024 #include <fun4all/Fun4AllUtils.h>
0025 #include <fun4all/Fun4AllOutputManager.h>
0026 
0027 #include <phool/recoConsts.h>
0028 
0029 #include <format>
0030 #include <fstream>
0031 
0032 R__LOAD_LIBRARY(libfun4all.so)
0033 R__LOAD_LIBRARY(libfun4allraw.so)
0034 R__LOAD_LIBRARY(libcalovalid.so)
0035 R__LOAD_LIBRARY(libffamodules.so)
0036 R__LOAD_LIBRARY(libcalo_reco.so)
0037 R__LOAD_LIBRARY(libcalotrigger.so)
0038 R__LOAD_LIBRARY(libcentrality.so)
0039 
0040 void Fun4All_CaloValid(int nevents = 1e5,const std::string &fname = "example.list")
0041 {
0042 
0043   Fun4AllServer *se = Fun4AllServer::instance();
0044   int verbosity = 0;
0045 
0046   se->Verbosity(verbosity);
0047   recoConsts *rc = recoConsts::instance();
0048 
0049   std::ifstream file(fname);
0050   std::string first_file;
0051   getline(file, first_file);
0052 
0053  //===============
0054   // conditions DB flags
0055   //===============
0056   std::pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0057   int runnumber = runseg.first;
0058   int segment = runseg.second;
0059    std::cout << "run number = " << runnumber << std::endl;
0060 
0061   // global tag
0062   rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
0063   // // 64 bit timestamp
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 fulloutfile_hist = std::format("./HIST_CALOR_QA-{:08}-{:04}.root", runnumber, segment);
0071 
0072 
0073 
0074   CaloValid *ca = new CaloValid("CaloValid");
0075   ca->set_timing_cut_width(200);  //integers for timing width, > 1 : wider cut around max peak time
0076   //ca->set_debug(false);
0077   se->registerSubsystem(ca);
0078 
0079 
0080   
0081   se->run(nevents); //update number of events as needed
0082   se->End();
0083 
0084   QAHistManagerDef::saveQARootFile(fulloutfile_hist);
0085 
0086   std::cout << "JOB COMPLETE :)" << std::endl;
0087 
0088 }
0089 
0090 #endif