Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:42

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 <fun4all/Fun4AllDstInputManager.h>
0007 #include <fun4all/Fun4AllNoSyncDstInputManager.h>
0008 #include <fun4all/Fun4AllUtils.h>
0009 #include <fun4all/Fun4AllOutputManager.h>
0010 #include <phool/recoConsts.h>
0011 
0012 #include <ffamodules/FlagHandler.h>
0013 #include <ffamodules/HeadReco.h>
0014 #include <ffamodules/SyncReco.h>
0015 #include <ffamodules/CDBInterface.h>
0016 
0017 #include <calotrigger/MinimumBiasClassifier.h>
0018 #include <centrality/CentralityInfo.h>
0019 
0020 #include <caloreco/CaloTowerCalib.h>
0021 
0022 #include <litecaloeval/LiteCaloEval.h>
0023 
0024 #include <calovalid/CaloValid.h>
0025 
0026 R__LOAD_LIBRARY(libfun4all.so)
0027 R__LOAD_LIBRARY(libfun4allraw.so)
0028 R__LOAD_LIBRARY(libcalovalid.so)
0029 R__LOAD_LIBRARY(libffamodules.so)
0030 R__LOAD_LIBRARY(libcalo_reco.so)
0031 R__LOAD_LIBRARY(libcalotrigger.so)
0032 R__LOAD_LIBRARY(libcentrality.so)
0033 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0034 
0035 #endif
0036 
0037 void Fun4All_tsc(int nevents = 1000,const std::string &fname = "dst_calo-00023714.list")
0038 {
0039 
0040   Fun4AllServer *se = Fun4AllServer::instance();
0041   int verbosity = 0;
0042 
0043   se->Verbosity(verbosity);
0044   recoConsts *rc = recoConsts::instance();
0045 
0046   ifstream file(fname);
0047   string first_file;
0048   getline(file, first_file);
0049 
0050  //===============
0051   // conditions DB flags
0052   //===============
0053   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0054   int runnumber = runseg.first;
0055    cout << "run number = " << runnumber << endl;
0056 
0057   // global tag
0058   rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
0059   // // 64 bit timestamp
0060   rc->set_uint64Flag("TIMESTAMP",runnumber);
0061 
0062   Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS");
0063   in->AddListFile(fname);
0064   se->registerInputManager(in);
0065 
0066   std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1);
0067   std::string OutFile = "CALOHIST_" + filename;
0068 
0069   ////////////////////
0070   // Calibrate towers
0071   CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB");
0072   calib->set_detector_type(CaloTowerDefs::HCALOUT);
0073   calib->set_directURL("/sphenix/u/bseidlitz/work/macros/calibrations/calo/hcal_tsc_cos/cdbConv/ohcal_cdb_calib.root");
0074   se->registerSubsystem(calib);
0075 
0076   CaloTowerCalib *calib2 = new CaloTowerCalib("CEMCCALIB");
0077   calib2->set_detector_type(CaloTowerDefs::HCALIN);
0078   calib2->set_directURL("/sphenix/u/bseidlitz/work/macros/calibrations/calo/hcal_tsc_cos/cdbConv/ihcal_cdb_calib.root");
0079   se->registerSubsystem(calib2);
0080 
0081   LiteCaloEval *eval7e = new LiteCaloEval("EVALUATOR", "HCALOUT",Form("tsc_hcalout_%d.root",runnumber));
0082   eval7e->CaloType(LiteCaloEval::HCALOUT);
0083   eval7e->setInputTowerNodeName("TOWERINFO_CALIB_HCALOUT");
0084   se->registerSubsystem(eval7e);
0085 
0086   LiteCaloEval *eval7e2 = new LiteCaloEval("EVALUATOR2", "HCALIN",Form("tsc_hcalin_%d.root",runnumber));
0087   eval7e2->CaloType(LiteCaloEval::HCALIN);
0088   eval7e2->setInputTowerNodeName("TOWERINFO_CALIB_HCALIN");
0089   se->registerSubsystem(eval7e2);
0090 
0091 
0092 
0093   cout << "adding validation module" << endl;
0094   CaloValid *ca = new CaloValid("calomodulename",OutFile);
0095   ca->set_timing_cut_width(200);  //integers for timing width, > 1 : wider cut around max peak time
0096   ca->apply_vertex_cut(false);  
0097   ca->set_vertex_cut(20.);
0098   ca->set_debug(false);
0099   se->registerSubsystem(ca);
0100 
0101   //se->Verbosity(5);
0102   
0103   se->run(nevents); //update number of events as needed
0104   se->End();
0105   cout << "JOB COMPLETE :)" <<endl;
0106 
0107 }