Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:11:10

0001 // c++ includes --
0002 #include <string>
0003 #include <iostream>
0004 
0005 // root includes --
0006 #include <TSystem.h>
0007 #include <TROOT.h>
0008 #include <TF1.h>
0009 
0010 #include <fun4all/Fun4AllDstInputManager.h>
0011 #include <fun4all/Fun4AllInputManager.h>
0012 #include <fun4all/Fun4AllRunNodeInputManager.h>
0013 #include <fun4all/Fun4AllServer.h>
0014 #include <fun4all/SubsysReco.h>
0015 #include <fun4all/Fun4AllUtils.h>
0016 
0017 #include <caloreco/CaloTowerStatus.h>
0018 
0019 #include <phool/recoConsts.h>
0020 
0021 #include <ffamodules/CDBInterface.h>
0022 
0023 #include <globalvertex/GlobalVertexReco.h>
0024 
0025 #include <mbd/MbdReco.h>
0026 
0027 using std::cout;
0028 using std::endl;
0029 using std::string;
0030 using std::pair;
0031 using std::istringstream;
0032 
0033 #include "Calo_Calib.C"
0034 
0035 void Fun4All_CaloCDB(const string &inputFile, Int_t nEvents = 0)
0036 {
0037   cout << "#############################" << endl;
0038   cout << "Run Parameters" << endl;
0039   cout << "inputFile: "    << inputFile << endl;
0040   cout << "Events: "       << nEvents << endl;
0041   cout << "#############################" << endl;
0042 
0043   Fun4AllServer *se = Fun4AllServer::instance();
0044 
0045   recoConsts *rc = recoConsts::instance();
0046 
0047   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0048 
0049   pair<ULong_t, Int_t> runseg = Fun4AllUtils::GetRunSegment(inputFile);
0050   ULong_t runnumber = runseg.first;
0051   rc->set_uint64Flag("TIMESTAMP", runnumber);
0052 
0053   // Geometry
0054   cout << "Adding Geometry file" << endl;
0055   Fun4AllInputManager* intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0056   string geoLocation = CDBInterface::instance()->getUrl("calo_geo");
0057   intrue2->AddFile(geoLocation);
0058   se->registerInputManager(intrue2);
0059 
0060   // MBD/BBC Reconstruction
0061   MbdReco* mbdreco = new MbdReco();
0062   se->registerSubsystem(mbdreco);
0063 
0064   // Official vertex storage
0065   GlobalVertexReco* gvertex = new GlobalVertexReco();
0066   se->registerSubsystem(gvertex);
0067 
0068   Process_Calo_Calib();
0069 
0070   Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTcalo");
0071   in->AddFile(inputFile.c_str());
0072   se->registerInputManager(in);
0073 
0074   se->run(nEvents);
0075   se->End();
0076   // se->PrintTimer();
0077 
0078   gSystem->Exit(0);
0079 }
0080 
0081 # ifndef __CINT__
0082 Int_t main(Int_t argc, const char* const argv[]) {
0083     if(argc < 2 || argc > 3){
0084         cout << "usage: ./bin/Fun4All_CaloCDB inputFile [events]" << endl;
0085         cout << "inputFile: Location of fileList containing dst." << endl;
0086         cout << "events: Number of events to analyze. Default: all" << endl;
0087         return 1;
0088     }
0089 
0090     Int_t events = 0;
0091 
0092     if(argc >= 3) {
0093         events = atoi(argv[2]);
0094     }
0095 
0096     Fun4All_CaloCDB(argv[1], events);
0097 
0098     cout << "done" << endl;
0099     return 0;
0100 }
0101 # endif