Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:24

0001 #ifndef FUN4ALL_YEAR2_C
0002 #define FUN4ALL_YEAR2_C
0003 
0004 #include <Calo_Calib.C>
0005 #include <QA.C>
0006 
0007 #include <caloreco/CaloTowerBuilder.h>
0008 #include <caloreco/CaloTowerCalib.h>
0009 #include <caloreco/CaloTowerStatus.h>
0010 #include <caloreco/CaloWaveformProcessing.h>
0011 #include <caloreco/DeadHotMapLoader.h>
0012 #include <caloreco/RawClusterBuilderTemplate.h>
0013 #include <caloreco/RawClusterDeadHotMask.h>
0014 #include <caloreco/RawClusterPositionCorrection.h>
0015 #include <caloreco/TowerInfoDeadHotMask.h>
0016 
0017 #include <mbd/MbdReco.h>
0018 
0019 #include <zdcinfo/ZdcReco.h>
0020 
0021 #include <globalvertex/GlobalVertexReco.h>
0022 
0023 #include <ffamodules/CDBInterface.h>
0024 #include <ffamodules/FlagHandler.h>
0025 #include <ffamodules/HeadReco.h>
0026 #include <ffamodules/SyncReco.h>
0027 
0028 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0029 
0030 #include <fun4all/Fun4AllDstInputManager.h>
0031 #include <fun4all/Fun4AllDstOutputManager.h>
0032 #include <fun4all/Fun4AllInputManager.h>
0033 #include <fun4all/Fun4AllRunNodeInputManager.h>
0034 #include <fun4all/Fun4AllServer.h>
0035 #include <fun4all/Fun4AllUtils.h>
0036 #include <fun4all/SubsysReco.h>
0037 
0038 #include <phool/recoConsts.h>
0039 
0040 #include <calotrigger/MinimumBiasClassifier.h>
0041 #include <calotrigger/TriggerRunInfoReco.h>
0042 #include <centrality/CentralityReco.h>
0043 
0044 #include <calovalid/CaloValid.h>
0045 #include <globalqa/GlobalQA.h>
0046 
0047 R__LOAD_LIBRARY(libfun4all.so)
0048 R__LOAD_LIBRARY(libfun4allraw.so)
0049 R__LOAD_LIBRARY(libcalo_reco.so)
0050 R__LOAD_LIBRARY(libcalotrigger.so)
0051 R__LOAD_LIBRARY(libcentrality.so)
0052 R__LOAD_LIBRARY(libffamodules.so)
0053 R__LOAD_LIBRARY(libmbd.so)
0054 R__LOAD_LIBRARY(libzdcinfo.so)
0055 R__LOAD_LIBRARY(libglobalvertex.so)
0056 R__LOAD_LIBRARY(libcalovalid.so)
0057 R__LOAD_LIBRARY(libglobalQA.so)
0058 
0059 void Fun4All_Year2(int nEvents = 100,
0060                    const std::string &fname = "DST_TRIGGERED_EVENT_run2pp_ana451_2024p009-00047748-00000.root",
0061                    const std::string &outfile = "DST_CALO_run2pp_ana451_2024p009-00047748-00000.root",
0062                    const std::string &outfile_hist = "HIST_CALOQA_run2pp_ana451_2024p009-00047748-00000.root",
0063                    const std::string &dbtag = "ProdA_2024")
0064 {
0065   // towerinfov1=kPRDFTowerv1, v2=:kWaveformTowerv2, v3=kPRDFWaveform, v4=kPRDFTowerv4
0066   CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kPRDFTowerv4;
0067 
0068   Fun4AllServer *se = Fun4AllServer::instance();
0069   se->Verbosity(1);
0070 
0071   recoConsts *rc = recoConsts::instance();
0072 
0073   pair<int, int> runseg = Fun4AllUtils::GetRunSegment(fname);
0074   int runnumber = runseg.first;
0075 
0076   // conditions DB flags and timestamp
0077   rc->set_StringFlag("CDB_GLOBALTAG", dbtag);
0078   rc->set_uint64Flag("TIMESTAMP", runnumber);
0079   CDBInterface::instance()->Verbosity(1);
0080 
0081   FlagHandler *flag = new FlagHandler();
0082   se->registerSubsystem(flag);
0083 
0084   TriggerRunInfoReco *triggerruninforeco = new TriggerRunInfoReco();
0085   se->registerSubsystem(triggerruninforeco);
0086   // MBD/BBC Reconstruction
0087   MbdReco *mbdreco = new MbdReco();
0088   se->registerSubsystem(mbdreco);
0089 
0090   CaloTowerBuilder *caZDC = new CaloTowerBuilder("ZDCBUILDER");
0091   caZDC->set_detector_type(CaloTowerDefs::ZDC);
0092   caZDC->set_builder_type(buildertype);
0093   caZDC->set_processing_type(CaloWaveformProcessing::FAST);
0094   caZDC->set_nsamples(16);
0095   caZDC->set_offlineflag();
0096   se->registerSubsystem(caZDC);
0097 
0098   // ZDC Reconstruction--Calib Info
0099   ZdcReco *zdcreco = new ZdcReco();
0100   se->registerSubsystem(zdcreco);
0101 
0102   // Official vertex storage
0103   GlobalVertexReco *gvertex = new GlobalVertexReco();
0104   se->registerSubsystem(gvertex);
0105 
0106   /////////////////
0107   // build towers
0108   CaloTowerBuilder *ctbEMCal = new CaloTowerBuilder("EMCalBUILDER");
0109   ctbEMCal->set_detector_type(CaloTowerDefs::CEMC);
0110   ctbEMCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0111   ctbEMCal->set_builder_type(buildertype);
0112   ctbEMCal->set_offlineflag(true);
0113   ctbEMCal->set_nsamples(12);
0114   ctbEMCal->set_bitFlipRecovery(true);
0115   se->registerSubsystem(ctbEMCal);
0116 
0117   CaloTowerBuilder *ctbIHCal = new CaloTowerBuilder("HCALINBUILDER");
0118   ctbIHCal->set_detector_type(CaloTowerDefs::HCALIN);
0119   ctbIHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0120   ctbIHCal->set_builder_type(buildertype);
0121   ctbIHCal->set_offlineflag();
0122   ctbIHCal->set_nsamples(12);
0123   ctbIHCal->set_bitFlipRecovery(true);
0124   se->registerSubsystem(ctbIHCal);
0125 
0126   CaloTowerBuilder *ctbOHCal = new CaloTowerBuilder("HCALOUTBUILDER");
0127   ctbOHCal->set_detector_type(CaloTowerDefs::HCALOUT);
0128   ctbOHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE);
0129   ctbOHCal->set_builder_type(buildertype);
0130   ctbOHCal->set_offlineflag();
0131   ctbOHCal->set_nsamples(12);
0132   ctbOHCal->set_bitFlipRecovery(true);
0133   se->registerSubsystem(ctbOHCal);
0134 
0135   CaloTowerBuilder *caEPD = new CaloTowerBuilder("SEPDBUILDER");
0136   caEPD->set_detector_type(CaloTowerDefs::SEPD);
0137   caEPD->set_builder_type(buildertype);
0138   caEPD->set_processing_type(CaloWaveformProcessing::FAST);
0139   caEPD->set_nsamples(12);
0140   caEPD->set_offlineflag();
0141   se->registerSubsystem(caEPD);
0142 
0143   /////////////////////
0144   // Geometry
0145   std::cout << "Adding Geometry file" << std::endl;
0146   Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
0147   std::string geoLocation = CDBInterface::instance()->getUrl("calo_geo");
0148   intrue2->AddFile(geoLocation);
0149   se->registerInputManager(intrue2);
0150 
0151   /////////////////////////////////////////////////////
0152   // Set status of towers, Calibrate towers,  Cluster
0153   Process_Calo_Calib();
0154 
0155   ///////////////////////////////////
0156   // Validation
0157   CaloValid *ca = new CaloValid("CaloValid");
0158   ca->set_timing_cut_width(200);
0159   se->registerSubsystem(ca);
0160 
0161   GlobalQA *gqa = new GlobalQA("GlobalQA");
0162   se->registerSubsystem(gqa);
0163 
0164   Fun4AllInputManager *In = new Fun4AllDstInputManager("in");
0165   In->AddFile(fname);
0166   se->registerInputManager(In);
0167 
0168   Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile);
0169   out->StripNode("CEMCPackets");
0170   out->StripNode("HCALPackets");
0171   out->StripNode("ZDCPackets");
0172   out->StripNode("SEPDPackets");
0173   out->StripNode("MBDPackets");
0174   se->registerOutputManager(out);
0175 
0176   se->run(nEvents);
0177   se->End();
0178 
0179   QAHistManagerDef::saveQARootFile(outfile_hist);
0180 
0181   CDBInterface::instance()->Print();  // print used DB files
0182   se->PrintTimer();
0183   delete se;
0184   std::cout << "All done!" << std::endl;
0185   gSystem->Exit(0);
0186 }
0187 
0188 #endif