Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:21:02

0001 #ifndef FUN4ALL_HCALCALIB_C
0002 #define FUN4ALL_HCALCALIB_C
0003 
0004 #include <caloreco/CaloTowerBuilder.h>
0005 
0006 #include <ffamodules/FlagHandler.h>
0007 #include <ffamodules/HeadReco.h>
0008 #include <ffamodules/SyncReco.h>
0009 #include <ffamodules/CDBInterface.h>
0010 
0011 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0012 
0013 #include <fun4all/Fun4AllUtils.h>
0014 #include <fun4all/Fun4AllDstOutputManager.h>
0015 #include <fun4all/Fun4AllInputManager.h>
0016 #include <fun4all/Fun4AllServer.h>
0017 #include <fun4all/SubsysReco.h>
0018 
0019 #include <ffamodules/HeadReco.h>
0020 #include <ffamodules/SyncReco.h>
0021 
0022 #include <phool/recoConsts.h>
0023 
0024 #include <cosmictree/HCalCalibTree.h>
0025 #include <caloana/CaloTemp.h>
0026 
0027 R__LOAD_LIBRARY(libfun4all.so)
0028 R__LOAD_LIBRARY(libfun4allraw.so)
0029 R__LOAD_LIBRARY(libcalo_reco.so)
0030 R__LOAD_LIBRARY(libffamodules.so)
0031 R__LOAD_LIBRARY(libHCalCalibTree.so)
0032 R__LOAD_LIBRARY(libcalotemp.so)
0033 
0034 
0035 void Fun4All_HCalCalib(int nevents = 5e4, const std::string &fname = "inputdata.txt") {
0036 
0037     Fun4AllServer *se = Fun4AllServer::instance();
0038     se->Verbosity(0);
0039     recoConsts *rc = recoConsts::instance();
0040 
0041     Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in");
0042     in->AddListFile(fname);
0043     se->registerInputManager(in);
0044 
0045     ifstream file(fname);
0046     std::string first_file;
0047     getline(file, first_file);
0048 
0049     pair<int, int> runseg = Fun4AllUtils::GetRunSegment(first_file);
0050     int runnumber = runseg.first;
0051 
0052     //===============
0053     // conditions DB flags
0054     //===============
0055     rc->set_StringFlag("CDB_GLOBALTAG", "MDC2");
0056     rc->set_uint64Flag("TIMESTAMP", 6);
0057 
0058     // Sync Headers and Flags
0059     SyncReco *sync = new SyncReco();
0060     se->registerSubsystem(sync);
0061 
0062     HeadReco *head = new HeadReco();
0063     se->registerSubsystem(head);
0064 
0065 
0066     CaloTowerBuilder *ca2 = new CaloTowerBuilder();
0067     ca2->set_detector_type(CaloTowerDefs::HCALIN);
0068     ca2->set_nsamples(12);
0069     ca2->set_processing_type(CaloWaveformProcessing::TEMPLATE);//TEMPLATE
0070     //ca2->set_processing_type(CaloWaveformProcessing::FAST);
0071     ca2->set_builder_type(CaloTowerDefs::kWaveformTowerv2);
0072     ca2->set_outputNodePrefix("TOWERSV2_");
0073     ca2->set_softwarezerosuppression(true, 200);
0074     se->registerSubsystem(ca2);
0075 
0076     CaloTowerBuilder *ca3 = new CaloTowerBuilder();
0077     ca3->set_detector_type(CaloTowerDefs::HCALOUT);
0078     ca3->set_nsamples(12);
0079     ca3->set_processing_type(CaloWaveformProcessing::TEMPLATE);//TEMPLATE
0080     //ca3->set_processing_type(CaloWaveformProcessing::FAST);
0081     ca3->set_builder_type(CaloTowerDefs::kWaveformTowerv2);
0082     ca3->set_outputNodePrefix("TOWERSV2_");
0083     ca3->set_softwarezerosuppression(true, 200);
0084     se->registerSubsystem(ca3);
0085 
0086     HCalCalibTree *wt2 = new HCalCalibTree("HCalCalib_TREE_2",Form("ihcal_hist_%d.root",runnumber));
0087     wt2->Detector("HCALIN");
0088     se->registerSubsystem(wt2);
0089 
0090     HCalCalibTree *wt3 = new HCalCalibTree("HCalCalib_TREE_3",Form("ohcal_hist_%d.root",runnumber));
0091     wt3->Detector("HCALOUT");
0092     se->registerSubsystem(wt3);
0093 
0094 
0095     se->run(nevents);
0096     CDBInterface::instance()->Print(); // print used DB files
0097     se->End();
0098     se->PrintTimer();
0099     gSystem->Exit(0);
0100 }
0101 
0102 #endif