Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef CALO_CALIB_H
0002 #define CALO_CALIB_H
0003 
0004 #include <caloreco/CaloTowerCalib.h>
0005 #include <caloreco/CaloTowerStatus.h>
0006 #include <caloreco/RawClusterBuilderTemplate.h>
0007 #include <caloreco/RawClusterDeadHotMask.h>
0008 #include <caloreco/RawClusterPositionCorrection.h>
0009 #include <fun4all/Fun4AllBase.h>
0010 
0011 R__LOAD_LIBRARY(libcalo_reco.so)
0012 
0013 void Process_Calo_Calib()
0014 {
0015   Fun4AllServer *se = Fun4AllServer::instance();
0016 
0017   std::string run = "47892";
0018   std::string base_path = "/gpfs02/sphenix/user/anarde/calo-cdb/calo-cdb/output/"+run+"_ana437_2024p007";
0019 
0020   //////////////////////////////
0021   // set statuses on raw towers
0022 
0023   std::cout << "status setters" << std::endl;
0024   CaloTowerStatus *statusEMC = new CaloTowerStatus("CEMCSTATUS");
0025   statusEMC->set_detector_type(CaloTowerDefs::CEMC);
0026   statusEMC->set_time_cut(1);
0027   statusEMC->set_directURL_time(base_path+"/CEMC_meanTime_ana437_2024p007_"+run+".root");
0028   statusEMC->set_directURL_chi2(base_path+"/CEMC_hotTowers_fracBadChi2_ana437_2024p007_"+run+".root");
0029   statusEMC->Verbosity(Fun4AllBase::VERBOSITY_MAX);
0030   se->registerSubsystem(statusEMC);
0031 
0032   CaloTowerStatus *statusHCalIn = new CaloTowerStatus("HCALINSTATUS");
0033   statusHCalIn->set_detector_type(CaloTowerDefs::HCALIN);
0034   statusHCalIn->set_time_cut(2);
0035   statusHCalIn->set_directURL_time(base_path+"/HCALIN_meanTime_ana437_2024p007_"+run+".root");
0036   statusHCalIn->set_directURL_chi2(base_path+"/HCALIN_hotTowers_fracBadChi2_ana437_2024p007_"+run+".root");
0037   statusHCalIn->Verbosity(Fun4AllBase::VERBOSITY_MAX);
0038   se->registerSubsystem(statusHCalIn);
0039 
0040   CaloTowerStatus *statusHCALOUT = new CaloTowerStatus("HCALOUTSTATUS");
0041   statusHCALOUT->set_detector_type(CaloTowerDefs::HCALOUT);
0042   statusHCALOUT->set_time_cut(2);
0043   statusHCALOUT->set_directURL_time(base_path+"/HCALOUT_meanTime_ana437_2024p007_"+run+".root");
0044   statusHCALOUT->set_directURL_chi2(base_path+"/HCALOUT_hotTowers_fracBadChi2_ana437_2024p007_"+run+".root");
0045   statusHCALOUT->Verbosity(Fun4AllBase::VERBOSITY_MAX);
0046   se->registerSubsystem(statusHCALOUT);
0047 
0048   ////////////////////
0049   // Calibrate towers
0050   std::cout << "Calibrating EMCal" << std::endl;
0051   CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB");
0052   calibEMC->set_detector_type(CaloTowerDefs::CEMC);
0053   se->registerSubsystem(calibEMC);
0054 
0055   std::cout << "Calibrating OHcal" << std::endl;
0056   CaloTowerCalib *calibOHCal = new CaloTowerCalib("HCALOUT");
0057   calibOHCal->set_detector_type(CaloTowerDefs::HCALOUT);
0058   se->registerSubsystem(calibOHCal);
0059 
0060   std::cout << "Calibrating IHcal" << std::endl;
0061   CaloTowerCalib *calibIHCal = new CaloTowerCalib("HCALIN");
0062   calibIHCal->set_detector_type(CaloTowerDefs::HCALIN);
0063   se->registerSubsystem(calibIHCal);
0064 
0065   std::cout << "Calibrating ZDC" << std::endl;
0066   CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC");
0067   calibZDC->set_detector_type(CaloTowerDefs::ZDC);
0068   se->registerSubsystem(calibZDC);
0069 
0070   //////////////////
0071   // Clusters
0072 
0073   std::cout << "Building clusters" << std::endl;
0074   RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
0075   ClusterBuilder->Detector("CEMC");
0076   ClusterBuilder->set_threshold_energy(0.030f);  // for when using basic calibration
0077   std::string emc_prof = getenv("CALIBRATIONROOT");
0078   emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0079   ClusterBuilder->LoadProfile(emc_prof);
0080   ClusterBuilder->set_UseTowerInfo(1);  // to use towerinfo objects rather than old RawTower
0081   // se->registerSubsystem(ClusterBuilder);
0082 
0083   // currently NOT included!
0084   //std::cout << "Applying Position Dependent Correction" << std::endl;
0085   //RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC");
0086   //clusterCorrection->set_UseTowerInfo(1);  // to use towerinfo objects rather than old RawTower
0087  // se->registerSubsystem(clusterCorrection);
0088 
0089 }
0090 
0091 #endif