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 
0019 
0020 R__LOAD_LIBRARY(libfun4all.so)
0021 R__LOAD_LIBRARY(libfun4allraw.so)
0022 R__LOAD_LIBRARY(libcalo_reco.so)
0023 //R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
0024 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
0025 
0026 
0027 
0028 #endif
0029 
0030 // to get files from my local area
0031 void dst_simple_towerslope_runmacro(int nevents = 1e5, const char *fname = "/sphenix/user/sregmi/FINAL_VERSION/tower_slope_old_tower_method/3_RawWaveformTowerBuilder/macro/testoutput_400.root", const char * outfile =  "defout.root", const int runNumber = 0)
0032 
0033 {
0034   gSystem->Load("libg4dst");
0035 
0036   Fun4AllServer *se = Fun4AllServer::instance();
0037 
0038   // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile);
0039   // ca->Detector("CEMC");
0040   // se->registerSubsystem(ca);
0041 
0042   // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
0043   // in->fileopen(fname);
0044 
0045   Fun4AllInputManager *in = new Fun4AllDstInputManager("in");
0046 
0047   TString infiletstr(fname);
0048   if (infiletstr.Contains(".list"))
0049     in->AddListFile(fname);
0050   else
0051     in->fileopen(fname);
0052 
0053 
0054   se->registerInputManager(in);
0055 
0056   Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0057   intrue2->AddFile("updated_geo.root");
0058   se->registerInputManager(intrue2);
0059 
0060 
0061   //CaloTowerBuilder *ca = new CaloTowerBuilder();
0062 
0063   recoConsts *rc = recoConsts::instance();
0064   rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); // this points to the global tag in the CDB
0065   // The calibrations have a validity range set by the beam clock which is not read out of the prdfs as of now
0066   //  rc->set_uint64Flag("TIMESTAMP",0);
0067   rc->set_uint64Flag("TIMESTAMP",runNumber);
0068   
0069   
0070   CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB");
0071   // calib->setCalibName("cemc_abscalib_cosmic");// these two lines are needed to choose your own calibration
0072   // calib->setFieldName("cemc_abscalib_cosmic");
0073   calib->set_detector_type(CaloTowerCalib::CEMC);
0074   se->registerSubsystem(calib);
0075   
0076 
0077    RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2");
0078   ClusterBuilder->Detector("CEMC");
0079   ClusterBuilder->Verbosity(10);
0080   ClusterBuilder->set_threshold_energy(0.032);  // This threshold should be the same as in CEMCprof_Thresh**.root file below
0081   std::string emc_prof = getenv("CALIBRATIONROOT");
0082   emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
0083   ClusterBuilder->LoadProfile(emc_prof);
0084   ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
0085   se->registerSubsystem(ClusterBuilder);
0086 
0087 
0088   CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outfile);
0089                                                 // this call is needed for embedding
0090   //  eval_pi2->set_centrality_nclusters_cut(350);  // which uses more central events
0091                                                 // than we will for data to enhance Bkg
0092                                                 // to match the enhanced signal from embed
0093   eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
0094   se->registerSubsystem(eval_pi2);
0095   cout << "successful registration of pi0 " << endl;
0096 
0097 
0098 
0099   /*
0100   LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",outfile);
0101   //  LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str());
0102   //  eval->Verbosity(verbosity);
0103   eval7e->CaloType(LiteCaloEval::CEMC);
0104   //eval->CaloType(LiteCaloEval::HCALOUT);
0105   se->registerSubsystem(eval7e);
0106 
0107   */
0108 
0109 
0110   // in->AddListFile("g4hits.list");
0111 
0112 // Fun4All
0113 //  se->registerInputManager(in);
0114 
0115   //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root");
0116 
0117   //out->StripNode("WAVEFORMS_CEMC");
0118   //se->registerOutputManager(out);
0119 
0120   se->run(nevents);
0121 
0122   se->End();
0123   se->PrintTimer();
0124   gSystem->Exit(0);
0125 }