File indexing completed on 2025-08-06 08:21:00
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
0009 #include <fun4all/Fun4AllDstOutputManager.h>
0010 #include <fun4all/Fun4AllUtils.h>
0011
0012 #include <litecaloeval/LiteCaloEval.h>
0013 #include <caloreco/CaloTowerCalib.h>
0014 #include <caloreco/RawClusterBuilderTemplate.h>
0015
0016
0017 #include <phool/recoConsts.h>
0018
0019 #include "createLocalEMCalCalibFile.C"
0020 #include "mergeCDBTTrees.C"
0021 #include "TSCtoCDBTTree.C"
0022
0023 R__LOAD_LIBRARY(libfun4all.so)
0024 R__LOAD_LIBRARY(libfun4allraw.so)
0025 R__LOAD_LIBRARY(libcalo_reco.so)
0026 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0027
0028
0029
0030
0031 #endif
0032
0033
0034 void tsdst_plus_tsfit(int nevents = 1, const char *fname = "input.list", const char * outfile = "defout.root", const char * fitoutfile = "deffitout.root")
0035
0036 {
0037
0038 Fun4AllServer *se = Fun4AllServer::instance();
0039
0040
0041 Fun4AllInputManager *in = new Fun4AllDstInputManager("in");
0042
0043 TString infiletstr(fname);
0044 if (infiletstr.Contains(".list"))
0045 in->AddListFile(fname);
0046 else
0047 in->fileopen(fname);
0048
0049 se->registerInputManager(in);
0050
0051
0052
0053
0054 recoConsts *rc = recoConsts::instance();
0055 ifstream file(fname);
0056 string first_file;
0057 getline(file, first_file);
0058
0059 pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0060 int runnumber = runseg.first;
0061 cout << "run number = " << runnumber << endl;
0062
0063
0064 rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
0065
0066 rc->set_uint64Flag("TIMESTAMP",runnumber);
0067
0068 string local_cdb_copy_name = "local_cdb_copy.root";
0069 createLocalEMCalCalibFile(local_cdb_copy_name.c_str(),runnumber);
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 std::cout << "in tow dst " << std::endl;
0091
0092
0093 LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",outfile);
0094
0095
0096 eval7e->CaloType(LiteCaloEval::CEMC);
0097 eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC");
0098
0099 se->registerSubsystem(eval7e);
0100
0101
0102 se->run(nevents);
0103
0104 se->End();
0105 se->PrintTimer();
0106
0107
0108 LiteCaloEval modlce;
0109
0110
0111 modlce.CaloType(LiteCaloEval::CEMC);
0112
0113
0114 modlce.Get_Histos(outfile,fitoutfile);
0115
0116 modlce.m_myminbin = 8;
0117
0118
0119
0120 modlce.m_mymaxbin = 95 + 1 ;
0121
0122
0123
0124
0125 modlce.setFitMin(0.12);
0126 modlce.setFitMax(0.7);
0127
0128 modlce.FitRelativeShifts(&modlce,110);
0129
0130
0131
0132
0133 TSCtoCDBTTree(fitoutfile,"tsc_output_cdb.root");
0134 mergeCDBTTrees("tsc_output_cdb.root",local_cdb_copy_name.c_str(),"calib_post_TSC.root");
0135
0136 gSystem->Exit(0);
0137 }