Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:41

0001 #ifndef FUN4ALL_HCALCALIB_C
0002 #define FUN4ALL_HCALCALIB_C
0003 
0004 #include <caloreco/CaloTowerBuilder.h>
0005 #include <caloreco/CaloWaveformProcessing.h>
0006 #include <caloreco/CaloGeomMapping.h>
0007 
0008 #include <ffamodules/FlagHandler.h>
0009 #include <ffamodules/HeadReco.h>
0010 #include <ffamodules/SyncReco.h>
0011 #include <ffamodules/CDBInterface.h>
0012 
0013 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0014 
0015 #include <fun4all/Fun4AllDstOutputManager.h>
0016 #include <fun4all/Fun4AllInputManager.h>
0017 #include <fun4all/Fun4AllServer.h>
0018 #include <fun4all/SubsysReco.h>
0019 
0020 #include <phool/recoConsts.h>
0021 
0022 #include <cosmictree/HCalCalibTree.h>
0023 
0024 R__LOAD_LIBRARY(libfun4all.so)
0025 R__LOAD_LIBRARY(libfun4allraw.so)
0026 R__LOAD_LIBRARY(libcalo_reco.so)
0027 R__LOAD_LIBRARY(libffamodules.so)
0028 R__LOAD_LIBRARY(libHCalCalibTree.so)
0029 
0030 void Fun4All_HCalCalib(int nevents = 0, const std::string &fname = "/sphenix/user/hanpuj/HCalCosmicCalib/prdf_file/cosmics-00028508-0000.prdf") {
0031     Fun4AllServer *se = Fun4AllServer::instance();
0032     se->Verbosity(0);
0033     recoConsts *rc = recoConsts::instance();
0034 
0035     //===============
0036     // conditions DB flags
0037     //===============
0038     rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
0039     rc->set_uint64Flag("TIMESTAMP", 6);
0040 
0041     Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
0042     in->fileopen(fname);
0043     se->registerInputManager(in);
0044 
0045     CaloTowerBuilder *ca2 = new CaloTowerBuilder();
0046     ca2->set_detector_type(CaloTowerDefs::HCALIN);
0047     ca2->set_nsamples(12);
0048     ca2->set_processing_type(CaloWaveformProcessing::TEMPLATE);//TEMPLATE
0049     ca2->set_builder_type(CaloTowerDefs::kWaveformTowerv2);
0050     ca2->set_outputNodePrefix("TOWERSV2_");
0051     ca2->set_softwarezerosuppression(true, 200);
0052     se->registerSubsystem(ca2);
0053 
0054     CaloTowerBuilder *ca3 = new CaloTowerBuilder();
0055     ca3->set_detector_type(CaloTowerDefs::HCALOUT);
0056     ca3->set_nsamples(12);
0057     ca3->set_processing_type(CaloWaveformProcessing::TEMPLATE);//TEMPLATE
0058     ca3->set_builder_type(CaloTowerDefs::kWaveformTowerv2);
0059     ca3->set_outputNodePrefix("TOWERSV2_");
0060     ca3->set_softwarezerosuppression(true, 200);
0061     se->registerSubsystem(ca3);
0062 
0063     HCalCalibTree *wt2 = new HCalCalibTree("HCalCalib_TREE_2","ihcal_hist.root", "TOWERSV2_");
0064     wt2->Detector("HCALIN");
0065     se->registerSubsystem(wt2);
0066 
0067     HCalCalibTree *wt3 = new HCalCalibTree("HCalCalib_TREE_3","ohcal_hist.root", "TOWERSV2_");
0068     wt3->Detector("HCALOUT");
0069     se->registerSubsystem(wt3);
0070 
0071     se->run(nevents);
0072     CDBInterface::instance()->Print(); // print used DB files
0073     se->End();
0074     se->PrintTimer();
0075     gSystem->Exit(0);
0076 }
0077 
0078 #endif