Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:01

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