Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:54

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