Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_CaloProduction_PreQM23.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_CaloProduction_PreQM23.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 #include <fun4all/SubsysReco.h>
8 #include <phool/recoConsts.h>
10 
11 
12 // #include <calotowerbuilder/CaloTowerBuilder.h>
13 #include <caloreco/CaloTowerBuilder.h>
14 #include <caloreco/CaloWaveformProcessing.h>
15 #include <caloreco/CaloTowerCalib.h>
16 #include <caloreco/RawClusterBuilderTemplate.h>
17 #include <caloreco/RawClusterPositionCorrection.h>
18 
19 #include <ffamodules/FlagHandler.h>
20 #include <ffamodules/HeadReco.h>
21 #include <ffamodules/SyncReco.h>
23 
25 #include <caloreco/DeadHotMapLoader.h>
26 
27 #include <caloreco/TowerInfoDeadHotMask.h>
28 
29 #include <caloreco/RawClusterDeadHotMask.h>
30 
31 R__LOAD_LIBRARY(libfun4all.so)
32 R__LOAD_LIBRARY(libfun4allraw.so)
33 R__LOAD_LIBRARY(libcalo_reco.so)
34 R__LOAD_LIBRARY(libffamodules.so)
35 
36 
37 #endif
38 void Fun4All_CaloProduction_PreQM23(string fname = "full-00007359-0000.prdf", const char *outfile = "testfile.root", int nEvents = 2)
39 {
40 
41  gSystem->Load("libg4dst");
43  se->Verbosity(0);
45 
46  //===============
47  // conditions DB flags
48  //===============
49  // ENABLE::CDB = true;
50  // global tag
51  rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023");
52  // // 64 bit timestamp
53  rc->set_uint64Flag("TIMESTAMP",stoi(fname.substr(fname.length()-15,5)));
54 
55  Fun4AllInputManager *dstIn = new Fun4AllDstInputManager("DSTIN");
56  dstIn -> AddFile(fname.c_str());
57  se -> registerInputManager(dstIn);
58 
59  std::cout << "Calibrating EMCal" << std::endl;
60  CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB");
61  calibEMC -> set_detector_type(CaloTowerCalib::CEMC);
62  se -> registerSubsystem(calibEMC);
63 
64  std::cout << "Calibrating OHcal" << std::endl;
65 
66  CaloTowerCalib *calibOHCal = new CaloTowerCalib("HCALOUT");
67  calibOHCal -> set_detector_type(CaloTowerCalib::HCALOUT);
68  se -> registerSubsystem(calibOHCal);
69 
70  std::cout << "Calibrating IHcal" << std::endl;
71 
72  CaloTowerCalib *calibIHCal = new CaloTowerCalib("HCALIN");
73  calibIHCal -> set_detector_type(CaloTowerCalib::HCALIN);
74  se -> registerSubsystem(calibIHCal);
75 
76  std::cout << "Calibrating ZDC" << std::endl;
77 
78  CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC");
79  calibZDC -> set_detector_type(CaloTowerCalib::ZDC);
80  se -> registerSubsystem(calibZDC);
81 
82  std::cout << "Loading EMCal deadmap" << std::endl;
83 
84  DeadHotMapLoader *towerMapCemc = new DeadHotMapLoader("CEMC");
85  towerMapCemc -> detector("CEMC");
86  se->registerSubsystem(towerMapCemc);
87 
88  std::cout << "Loading ihcal deadmap" << std::endl;
89 
90  DeadHotMapLoader *towerMapHCalin = new DeadHotMapLoader("HCALIN");
91  towerMapHCalin -> detector("HCALIN");
92  se->registerSubsystem(towerMapHCalin);
93 
94  std::cout << "Loading ohcal deadmap" << std::endl;
95 
96  DeadHotMapLoader *towerMapHCalout = new DeadHotMapLoader("HCALOUT");
97  towerMapHCalout -> detector("HCALOUT");
98  se->registerSubsystem(towerMapHCalout);
99 
100  std::cout << "Loading cemc masker" << std::endl;
101 
102  TowerInfoDeadHotMask *towerMaskCemc = new TowerInfoDeadHotMask("CEMC");
103  towerMaskCemc -> detector("CEMC");
104  se->registerSubsystem(towerMaskCemc);
105 
106  std::cout << "Loading hcal maskers" << std::endl;
107 
108  TowerInfoDeadHotMask *towerMaskHCalin = new TowerInfoDeadHotMask("HCALIN");
109  towerMaskHCalin -> detector("HCALIN");
110  se->registerSubsystem(towerMaskHCalin);
111 
112  TowerInfoDeadHotMask *towerMaskHCalout = new TowerInfoDeadHotMask("HCALOUT");
113  towerMaskHCalout -> detector("HCALOUT");
114  se->registerSubsystem(towerMaskHCalout);
115 
116  std::cout << "Adding Geometry file" << std::endl;
117 
118  Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO");
120  std::string geoLocation = cdb->getUrl("calo_geo");
121  intrue2->AddFile(geoLocation);
122  se->registerInputManager(intrue2);
123 
124  RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate");
125  ClusterBuilder->Detector("CEMC");
126  ClusterBuilder->set_threshold_energy(0.030);//for when using basic calibration
127  std::string emc_prof = getenv("CALIBRATIONROOT");
128  emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root";
129  ClusterBuilder->LoadProfile(emc_prof);
130  ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
131  se->registerSubsystem(ClusterBuilder);
132 
133  RawClusterDeadHotMask *clusterMask = new RawClusterDeadHotMask("clusterMask");
134  clusterMask->detector("CEMC");
135  se->registerSubsystem(clusterMask);
136 
137  RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC");
138  clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower
139  se->registerSubsystem(clusterCorrection);
140 
141  //removing unofficial vertex code
142  // MBD_VertexReco *ca = new MBD_VertexReco("name");
143  // se->registerSubsystem(ca);
144 
146  out->StripNode("dud");
147  se->registerOutputManager(out);
148 
149  se->run(nEvents);
150  se->End();
151  se->PrintTimer();
152  std::cout << "All done!" << std::endl;
153  gSystem->Exit(0);
154 }