Back to home page

sPhenix code displayed by LXR

 
 

    


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 <fun4all/Fun4AllRunNodeInputManager.h>
0007 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0008 #include <fun4all/Fun4AllDstInputManager.h>
0009 //#include <rawwaveformtowerbuilder/RawWaveformTowerBuilder.h>
0010 #include <fun4all/Fun4AllDstOutputManager.h>
0011 
0012 //#include <litecaloeval/LiteCaloEval.h>
0013 #include <caloreco/CaloTowerCalib.h>
0014 #include <caloreco/RawClusterBuilderTemplate.h>
0015 #include <calib_emc_pi0/CaloCalibEmc_Pi0.h>
0016 
0017 #include <phool/recoConsts.h>
0018 #include <g4centrality/PHG4CentralityReco.h> 
0019 
0020 
0021 R__LOAD_LIBRARY(libfun4all.so)
0022 R__LOAD_LIBRARY(libfun4allraw.so)
0023 R__LOAD_LIBRARY(libcalo_reco.so)
0024 //R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0025 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
0026 
0027 
0028 
0029 #endif
0030 
0031 // to get files from my local area
0032 void clus_dst_simple_superfastcalib( const int file_num = 0 )
0033 
0034 {
0035     const int nEvents = -1;
0036 
0037   Fun4AllServer *se = Fun4AllServer::instance();
0038   se->Verbosity(0);
0039 
0040     ///sphenix/lustre01/sphnxpro/mdc2/shijing_hepmc/fm_0_20/calocluster/run0007
0041 
0042   string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
0043     string inputFile1 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-"; 
0044   //string inputFile2 = "DST_TRUTH_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
0045   string inputFile3 = "DST_GLOBAL_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-";
0046     
0047   string outputFile = "RESULTS/mult_clus_ntuple/iter_23/Fun4All_ntuples_run7_sHijing_iter23_";
0048 
0049     int ynum_int = 100000 + file_num;
0050   TString yn_tstr = "";
0051   yn_tstr += ynum_int;
0052   yn_tstr.Remove(0,1);
0053   inputFile0 += yn_tstr.Data();
0054   inputFile1 += yn_tstr.Data();
0055   //inputFile2 += yn_tstr.Data();
0056   inputFile3 += yn_tstr.Data();  
0057     outputFile += yn_tstr.Data();
0058 
0059   inputFile0 += ".root";
0060   inputFile1 += ".root";
0061   //inputFile2 += ".root";
0062   inputFile3 += ".root";
0063   outputFile += ".root";
0064     
0065     std::cout << "-------------------------------------------------------------------" << std::endl;
0066     std::cout << " input files are" << std::endl;
0067     std::cout << "-------------------------------------------------------------------" << std::endl;
0068     std::cout << inputFile0 << std::endl;
0069     std::cout << inputFile1 << std::endl;
0070     //std::cout << inputFile2 << std::endl;
0071     std::cout << inputFile3 << std::endl;
0072 
0073     std::cout << "-------------------------------------------------------------------" << std::endl;
0074     std::cout << "output file is " << std::endl;
0075     std::cout << "-------------------------------------------------------------------" << std::endl;
0076     std::cout << outputFile << std::endl;
0077 
0078 
0079   gSystem->Load("libg4dst");
0080 
0081   //Fun4AllServer *se = Fun4AllServer::instance();
0082 
0083   // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile);
0084   // ca->Detector("CEMC");
0085   // se->registerSubsystem(ca);
0086 
0087   // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
0088   // in->fileopen(fname);
0089 
0090   Fun4AllInputManager *in1 = new Fun4AllDstInputManager("in1");
0091     in1->fileopen(inputFile1);
0092   se->registerInputManager(in1);
0093 
0094   Fun4AllInputManager *in3 = new Fun4AllDstInputManager("in3");
0095     in3->fileopen(inputFile3);
0096   se->registerInputManager(in3);
0097 
0098   //CaloTowerBuilder *ca = new CaloTowerBuilder();
0099   //Enable::CDB = true;
0100 
0101   recoConsts *rc = recoConsts::instance();
0102   //===============
0103   // conditions DB flags
0104   //===============
0105   // global tag
0106   rc->set_StringFlag("CDB_GLOBALTAG","MDC2");
0107   // // 64 bit timestamp
0108   rc->set_uint64Flag("TIMESTAMP",6);
0109 
0110     
0111   CaloTowerCalib *calib = new CaloTowerCalib("CALO_TOWER_CEMC");
0112     // make sure there is not any mistake in "full file path + name"
0113     // for first iteration file name can be any as we will not use correction factor and default is "1"
0114     calib->setCalibUseMode(1); // decide if we want to use correction factor("0" = do not use (set for first iteration), "1" = use (set for remaining))
0115   
0116     // these two lines are needed to choose your own correction factor (this is filename)
0117     calib->setCalibName("/sphenix/user/sregmi/WORKING_AREA/PI_0/pi0_calib_m-clust/CDB_CEMC/iter_file/m_clust_pi0_iter22_CDB.root");
0118     calib->setFieldName("cemc_pi0_abs_calib"); // (this is field name)
0119   calib->set_detector_type(CaloTowerCalib::CEMC);
0120 
0121   se->registerSubsystem(calib);
0122     
0123     
0124   RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2");
0125   ClusterBuilder->Detector("CEMC");
0126   ClusterBuilder->Verbosity(10);    
0127   ClusterBuilder->set_threshold_energy(0.032);  // This threshold should be the same as in CEMCprof_Thresh**.root file below
0128   std::string emc_prof = getenv("CALIBRATIONROOT");
0129   emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0130   ClusterBuilder->LoadProfile(emc_prof);
0131   ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower 
0132   se->registerSubsystem(ClusterBuilder);
0133         
0134     
0135   CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outputFile);
0136                                                 // this call is needed for embedding
0137   //  eval_pi2->set_centrality_nclusters_cut(350);  // which uses more central events
0138                                                 // than we will for data to enhance Bkg
0139                                                 // to match the enhanced signal from embed
0140   eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
0141   se->registerSubsystem(eval_pi2);
0142     
0143 
0144   // in->AddListFile("g4hits.list");
0145 
0146 // Fun4All
0147 //  se->registerInputManager(in);
0148 
0149   //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root");
0150 
0151   //out->StripNode("WAVEFORMS_CEMC");
0152   //se->registerOutputManager(out);
0153 
0154   se->run(nEvents);
0155 
0156   se->End();
0157   se->PrintTimer();
0158   gSystem->Exit(0);
0159 }