File indexing completed on 2025-08-06 08:21:02
0001 #include <string>
0002 #include <litecaloeval/LiteCaloEval.h>
0003 #include"../genFinalCalib/tsc_cos_merge.C"
0004
0005 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0006
0007 gSystem->mkdir("fitResults", true);
0008 gSystem->mkdir("cdbFiles", true);
0009
0010
0011 void run_cosmicsTS(const char *runs = "runList.txt", const char *TS_list= "lce_output_files.txt", bool run_ohcal=false, bool run_ihcal=false)
0012 {
0013 ifstream runlist(runs);
0014 std::string line;
0015
0016 ifstream tsList(TS_list);
0017 std::string line2;
0018
0019
0020 while(getline(runlist,line) && getline(tsList,line2))
0021 {
0022
0023 cout << "=============================================" << endl;
0024 cout << "Processing run number: " << line << endl;
0025
0026 if (line.empty() || line2.empty()) continue;
0027
0028 cout << "analysing file " << line2 << endl;
0029
0030
0031 if (run_ohcal){
0032
0033 std::cout << "Running analysis for **HCALOUT**..." << std::endl;
0034
0035 std::string oh_out = "fitResults/oh_cosmicsMerged_fitted_" + line + ".root";
0036
0037 LiteCaloEval hout;
0038 hout.CaloType(LiteCaloEval::HCALOUT);
0039 hout.set_spectra_binWidth(0.08);
0040 hout.Get_Histos(line2,oh_out.c_str());
0041 hout.setFitMin(0.4);
0042 hout.setFitMax(2.5);
0043 hout.FitRelativeShifts(&hout,110);
0044 hout.draw_spectra(oh_out.c_str());
0045 hout.fit_info(oh_out.c_str(), stoi(line));
0046
0047 string cosmic_CDB_file_oh = Form("/sphenix/u/bseidlitz/work/macros/calibrations/calo/hcal_towerSlope_y2/cosmicCalibFiles/ohcal_cosmic_calibration_%s.root",line.c_str());
0048
0049
0050 tsc_cos_merge(oh_out,cosmic_CDB_file_oh,Form("cdbFiles/ohcal_cdb_tsc_cos_calib_%s.root",line.c_str()),0);
0051
0052 }
0053
0054 if (run_ihcal){
0055
0056 cout << "Running analysis for **HCALIN**..." << std::endl;
0057
0058 string ih_out = "fitResults/ih_cosmicsMerged_fitted_" + line + ".root";
0059
0060 LiteCaloEval hin;
0061 hin.CaloType(LiteCaloEval::HCALIN);
0062 hin.set_spectra_binWidth(0.05);
0063 hin.Get_Histos(line2, ih_out.c_str());
0064 hin.setFitMin(0.20);
0065 hin.setFitMax(1.5);
0066 hin.set_doQA(true);
0067 hin.FitRelativeShifts(&hin,110);
0068 hin.draw_spectra(ih_out.c_str());
0069
0070
0071
0072 string cosmic_CDB_file_ih = Form("/sphenix/u/bseidlitz/work/macros/calibrations/calo/hcal_towerSlope_y2/cosmicCalibFiles/ihcal_cosmic_calibration_%s.root",line.c_str());
0073
0074
0075 tsc_cos_merge(ih_out,cosmic_CDB_file_ih,Form("cdbFiles/ihcal_cdb_tsc_cos_calib_%s.root",line.c_str()),1);
0076 }
0077
0078 }
0079
0080 std:cout << "Macro is done executing." << std::endl;
0081
0082 }