Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:32

0001 #pragma once
0002 
0003 #include <fun4all/Fun4AllDstInputManager.h>
0004 #include <fun4all/Fun4AllInputManager.h>
0005 #include <fun4all/Fun4AllServer.h>
0006 #include <fun4all/Fun4AllUtils.h>
0007 #include <ffamodules/CDBInterface.h>
0008 #include <phool/recoConsts.h>
0009 
0010 #include <GlobalVariables.C>
0011 #include <G4_Global.C>
0012 #include <G4_Mbd.C>
0013 
0014 #include <neutralmesontssa/neutralMesonTSSA.h>
0015 
0016 #include <caloreco/CaloTowerCalib.h>
0017 #include <caloreco/CaloTowerStatus.h>
0018 #include <caloreco/RawClusterBuilderTemplate.h>
0019 #include <caloreco/RawClusterPositionCorrection.h>
0020 
0021 #include <Calo_Calib.C>
0022 
0023 #include <fstream>
0024 
0025 R__LOAD_LIBRARY(libfun4all.so)
0026 R__LOAD_LIBRARY(libcalo_reco.so)
0027 R__LOAD_LIBRARY(libneutralMesonTSSA.so)
0028 
0029 std::string GetFirstFile(const char* filelist)
0030 {
0031   std::string firstfile = "";
0032   ifstream in(filelist);
0033   if (in.good())
0034   {
0035     std::getline(in, firstfile);
0036   }
0037   return firstfile;
0038 }
0039 
0040 void Fun4All_checkHotMaps(
0041                      int nEvents = 1,
0042                      const char *filelist1 = "dst_calo_cluster.list",
0043              const string outname_hists = "dummyhists.root",
0044              const string outname_trees = "dummytrees.root")
0045 {
0046   // this convenience library knows all our i/o objects so you don't
0047   // have to figure out what is in each dst type
0048   gSystem->Load("libg4dst.so");
0049   /* gSystem->Load("libneutralMesonTSSA.so"); */
0050 
0051   Fun4AllServer *se = Fun4AllServer::instance();
0052   se->Verbosity(1);  // set it to 1 if you want event printouts
0053   CDBInterface::instance()->Verbosity(1);
0054 
0055   // conditions DB flags and timestamp
0056   recoConsts *rc = recoConsts::instance();
0057   rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2024");
0058   std::string firstfile = GetFirstFile(filelist1);
0059   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(firstfile);
0060   int runnumber = runseg.first;
0061   rc->set_uint64Flag("TIMESTAMP", runnumber);
0062 
0063   Fun4AllInputManager *inCluster = new Fun4AllDstInputManager("DSTCaloCluster");
0064   std::cout << "Adding file list " << filelist1 << std::endl;
0065   inCluster->AddListFile(filelist1,1);
0066   se->registerInputManager(inCluster);
0067 
0068   // Tower calibrations
0069   /* Process_Calo_Calib();  // this line handles the calibrations, dead/hot tower masking and reruns the clusterizer */
0070   CaloTowerStatus *statusEMC = new CaloTowerStatus("TowerStatusEMC");
0071   /* statusEMC->Verbosity(1); */
0072   statusEMC->set_detector_type(CaloTowerDefs::CEMC);
0073   statusEMC->set_doAbortNoHotMap(true);
0074   /* statusEMC->set_time_cut(1); */
0075   se->registerSubsystem(statusEMC);
0076 
0077   /* CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB"); */
0078   /* calibEMC->set_detector_type(CaloTowerDefs::CEMC); */
0079   /* calibEMC->set_directURL("/sphenix/u/bseidlitz/work/temp24Calib/emcalCalib_withMask_may25.root"); */
0080   /* se->registerSubsystem(calibEMC); */
0081 
0082   // Clusterizer
0083   /*
0084   RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
0085   ClusterBuilder->Detector("CEMC");
0086   ClusterBuilder->set_threshold_energy(0.03);  // for when using basic calibration
0087   std::string emc_prof = getenv("CALIBRATIONROOT");
0088   emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0089   ClusterBuilder->LoadProfile(emc_prof);
0090   ClusterBuilder->set_UseTowerInfo(1);  // to use towerinfo objects rather than old RawTower
0091   ClusterBuilder->setOutputClusterNodeName("CLUSTERINFO_CEMC2");
0092   se->registerSubsystem(ClusterBuilder);
0093   */
0094 
0095   neutralMesonTSSA *eval = new neutralMesonTSSA("neutralMesonTSSA", outname_hists, outname_trees, false);
0096   /* eval->set_min_clusterE(0.5); */
0097   /* eval->set_max_clusterChi2(4.0); */
0098   se -> registerSubsystem(eval);
0099   
0100   se->run(nEvents);
0101   se->End();
0102   
0103   delete se;
0104   cout << "Analysis Completed" << endl;
0105   
0106   gSystem->Exit(0);
0107 }
0108