Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:23

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 <fun4allraw/Fun4AllPrdfInputManager.h>
0007 #include <fun4all/Fun4AllDstInputManager.h>
0008 #include <phool/recoConsts.h>
0009 #include <fun4all/Fun4AllRunNodeInputManager.h>
0010 
0011 
0012 // #include <calotowerbuilder/CaloTowerBuilder.h>
0013 #include <caloreco/CaloTowerBuilder.h>
0014 #include <caloreco/CaloWaveformProcessing.h>
0015 #include <caloreco/CaloTowerCalib.h>
0016 #include <caloreco/RawClusterBuilderTemplate.h>
0017 #include <caloreco/RawClusterPositionCorrection.h>
0018 
0019 #include <ffamodules/FlagHandler.h>
0020 #include <ffamodules/HeadReco.h>
0021 #include <ffamodules/SyncReco.h>
0022 #include <ffamodules/CDBInterface.h>
0023 
0024 #include <fun4all/Fun4AllDstOutputManager.h>
0025 #include <caloreco/DeadHotMapLoader.h>
0026 
0027 #include <caloreco/TowerInfoDeadHotMask.h>
0028 
0029 #include <caloreco/RawClusterDeadHotMask.h>
0030 
0031 R__LOAD_LIBRARY(libfun4all.so)
0032 R__LOAD_LIBRARY(libfun4allraw.so)
0033 R__LOAD_LIBRARY(libcalo_reco.so)
0034 R__LOAD_LIBRARY(libffamodules.so)
0035 
0036 
0037 #endif
0038 void Fun4All_CaloProduction_PreQM23(string fname = "full-00007359-0000.prdf", const char *outfile = "testfile.root", int nEvents = 2)
0039 { 
0040    
0041   gSystem->Load("libg4dst");
0042   Fun4AllServer *se = Fun4AllServer::instance();
0043   se->Verbosity(0);
0044   recoConsts *rc = recoConsts::instance();
0045 
0046   //===============
0047   // conditions DB flags
0048   //===============
0049   // ENABLE::CDB = true;
0050   // global tag
0051   rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023");
0052   // // 64 bit timestamp
0053   rc->set_uint64Flag("TIMESTAMP",stoi(fname.substr(fname.length()-15,5)));
0054 
0055   Fun4AllInputManager *dstIn = new Fun4AllDstInputManager("DSTIN");
0056   dstIn -> AddFile(fname.c_str());
0057   se -> registerInputManager(dstIn);
0058   
0059   std::cout << "Calibrating EMCal" << std::endl;
0060   CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB");
0061   calibEMC -> set_detector_type(CaloTowerCalib::CEMC);
0062   se -> registerSubsystem(calibEMC);
0063   
0064   std::cout << "Calibrating OHcal" << std::endl;
0065 
0066   CaloTowerCalib *calibOHCal = new CaloTowerCalib("HCALOUT");
0067   calibOHCal -> set_detector_type(CaloTowerCalib::HCALOUT);
0068   se -> registerSubsystem(calibOHCal);
0069   
0070   std::cout << "Calibrating IHcal" << std::endl;
0071 
0072   CaloTowerCalib *calibIHCal = new CaloTowerCalib("HCALIN");
0073   calibIHCal -> set_detector_type(CaloTowerCalib::HCALIN);
0074   se -> registerSubsystem(calibIHCal);
0075 
0076   std::cout << "Calibrating ZDC" << std::endl;
0077 
0078   CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC");
0079   calibZDC -> set_detector_type(CaloTowerCalib::ZDC);
0080   se -> registerSubsystem(calibZDC);
0081 
0082   std::cout << "Loading EMCal deadmap" << std::endl;
0083 
0084   DeadHotMapLoader *towerMapCemc = new DeadHotMapLoader("CEMC");
0085   towerMapCemc -> detector("CEMC");
0086   se->registerSubsystem(towerMapCemc);
0087 
0088   std::cout << "Loading ihcal deadmap" << std::endl;
0089 
0090   DeadHotMapLoader *towerMapHCalin = new DeadHotMapLoader("HCALIN");
0091   towerMapHCalin -> detector("HCALIN");
0092   se->registerSubsystem(towerMapHCalin);
0093 
0094   std::cout << "Loading ohcal deadmap" << std::endl;
0095 
0096   DeadHotMapLoader *towerMapHCalout = new DeadHotMapLoader("HCALOUT");
0097   towerMapHCalout -> detector("HCALOUT");
0098   se->registerSubsystem(towerMapHCalout);
0099 
0100   std::cout << "Loading cemc masker" << std::endl;
0101 
0102   TowerInfoDeadHotMask *towerMaskCemc = new TowerInfoDeadHotMask("CEMC");
0103   towerMaskCemc -> detector("CEMC");
0104   se->registerSubsystem(towerMaskCemc);
0105 
0106   std::cout << "Loading hcal maskers" << std::endl;
0107 
0108   TowerInfoDeadHotMask *towerMaskHCalin = new TowerInfoDeadHotMask("HCALIN");
0109   towerMaskHCalin -> detector("HCALIN");
0110   se->registerSubsystem(towerMaskHCalin);
0111 
0112   TowerInfoDeadHotMask *towerMaskHCalout = new TowerInfoDeadHotMask("HCALOUT");
0113   towerMaskHCalout -> detector("HCALOUT");
0114   se->registerSubsystem(towerMaskHCalout);
0115 
0116   std::cout << "Adding Geometry file" << std::endl;
0117 
0118   Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0119   CDBInterface *cdb = CDBInterface::instance();
0120   std::string geoLocation = cdb->getUrl("calo_geo");
0121   intrue2->AddFile(geoLocation);
0122   se->registerInputManager(intrue2);
0123 
0124   RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
0125   ClusterBuilder->Detector("CEMC");
0126   ClusterBuilder->set_threshold_energy(0.030);//for when using basic calibration
0127   std::string emc_prof = getenv("CALIBRATIONROOT");
0128   emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0129   ClusterBuilder->LoadProfile(emc_prof);
0130   ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
0131   se->registerSubsystem(ClusterBuilder);
0132   
0133   RawClusterDeadHotMask *clusterMask = new RawClusterDeadHotMask("clusterMask");
0134   clusterMask->detector("CEMC");
0135   se->registerSubsystem(clusterMask);
0136 
0137   RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC");
0138   clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
0139   se->registerSubsystem(clusterCorrection);
0140 
0141   //removing unofficial vertex code
0142   // MBD_VertexReco *ca = new MBD_VertexReco("name");
0143   // se->registerSubsystem(ca);
0144 
0145   Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile);
0146   out->StripNode("dud");
0147   se->registerOutputManager(out);
0148 
0149   se->run(nEvents);
0150   se->End();
0151   se->PrintTimer();
0152   std::cout << "All done!" << std::endl;
0153   gSystem->Exit(0);
0154 }