Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:21:01

0001 #ifndef FUN4ALL_EMCAL_C
0002 #define FUN4ALL_EMCAL_C
0003 
0004 #include <caloreco/CaloTowerCalib.h>
0005 #include <caloreco/RawClusterBuilderTemplate.h>
0006 #include <caloreco/RawClusterPositionCorrection.h>
0007 
0008 #include <ffamodules/FlagHandler.h>
0009 #include <ffamodules/HeadReco.h>
0010 #include <ffamodules/SyncReco.h>
0011 
0012 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0013 
0014 #include <fun4all/Fun4AllDstInputManager.h>
0015 #include <fun4all/Fun4AllDstOutputManager.h>
0016 #include <fun4all/Fun4AllInputManager.h>
0017 #include <fun4all/Fun4AllRunNodeInputManager.h>
0018 #include <fun4all/Fun4AllServer.h>
0019 #include <fun4all/Fun4AllUtils.h>
0020 #include <fun4all/SubsysReco.h>
0021 
0022 #include <phool/recoConsts.h>
0023 
0024 #include <cdbobjects/CDBTTree.h>  // for CDBTTree
0025 #include <ffamodules/CDBInterface.h>
0026 #include <GlobalVariables.C>
0027 
0028 #include <litecaloeval/LiteCaloEval.h>
0029 #include <calib_emc_pi0/pi0EtaByEta.h>
0030 
0031 R__LOAD_LIBRARY(libcdbobjects)
0032 R__LOAD_LIBRARY(libfun4all.so)
0033 R__LOAD_LIBRARY(libfun4allraw.so)
0034 R__LOAD_LIBRARY(libcalo_reco.so)
0035 R__LOAD_LIBRARY(libffamodules.so)
0036 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0037 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
0038 
0039 void createLocalEMCalCalibFile(const string fname, int runNumber);
0040 
0041 
0042 
0043 
0044 void Fun4All_EMCal(int nevents = 100, const std::string &fname = "inputdata.txt")
0045 {
0046 
0047   Fun4AllServer *se = Fun4AllServer::instance();
0048   se->Verbosity(0);
0049 
0050   // se->Verbosity(verbosity);
0051   recoConsts *rc = recoConsts::instance();
0052 
0053   ifstream file(fname);
0054   string first_file;
0055   getline(file, first_file);
0056 
0057   //===============
0058   // conditions DB flags
0059   //===============
0060   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0061   int runnumber = runseg.first;
0062   cout << "run number = " << runnumber << endl;
0063 
0064   // global tag
0065   rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
0066   // // 64 bit timestamp
0067   rc->set_uint64Flag("TIMESTAMP", runnumber);
0068 
0069   Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS");
0070   in->AddListFile(fname);
0071   se->registerInputManager(in);
0072 
0073   std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1);
0074   std::string OutFile = Form("OUTHIST_%s",filename.c_str());
0075 
0076 
0077     LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",OutFile);
0078     eval7e->CaloType(LiteCaloEval::CEMC);
0079     eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC");
0080     se->registerSubsystem(eval7e);
0081 
0082 
0083   se->run(nevents);
0084   se->End();
0085   se->PrintTimer();
0086   delete se;
0087 
0088 }
0089 
0090 
0091 
0092 
0093 #endif