File indexing completed on 2025-08-03 08:20:25
0001 #ifndef MACRO_G4KFPARTICLE_C
0002 #define MACRO_G4KFPARTICLE_C
0003
0004 #include <GlobalVariables.C>
0005
0006 #define HomogeneousField
0007 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
0008 #include <decayfinder/DecayFinder.h>
0009 #include <simqa_modules/QAG4SimulationKFParticle.h>
0010
0011 #include <fun4all/Fun4AllServer.h>
0012
0013 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0014 R__LOAD_LIBRARY(libsimqa_kfparticle.so)
0015 R__LOAD_LIBRARY(libdecayfinder.so)
0016
0017 namespace Enable
0018 {
0019 bool KFPARTICLE = false;
0020 bool KFPARTICLE_SAVE_NTUPLE = false;
0021 bool KFPARTICLE_APPEND_TO_DST = true;
0022 bool KFPARTICLE_TRUTH_MATCH = false;
0023 bool KFPARTICLE_DETECTOR_INFO = false;
0024 int KFPARTICLE_VERBOSITY = 0;
0025 std::string KFPARTICLE_TRACKMAP = "SvtxTrackMap";
0026 std::string KFPARTICLE_VERTEXMAP = "SvtxVertexMap";
0027 }
0028
0029 namespace KFPARTICLE
0030 {
0031 bool QA = false;
0032
0033 bool runUpsilonReco = false;
0034 std::string UpsilonName = "Upsilon";
0035 std::string UpsilonDecayDescriptor = UpsilonName + " -> e^+ e^-";
0036 std::pair<float, float> UpsilonMassRange(8, 11);
0037 bool UpsilonTrigger = false;
0038
0039 bool runD0Reco = false;
0040 std::string D0Name = "D0";
0041 std::string D0DecayDescriptor = "[" + D0Name + " -> K^- pi^+]cc";
0042 std::pair<float, float> D0MassRange(1.75, 1.95);
0043 bool D0Trigger = false;
0044
0045 bool runLambdacReco = false;
0046 std::string LambdacName = "Lambdac";
0047 std::string LambdacDecayDescriptor = "[" + LambdacName + " -> proton^+ K^- pi^+]cc";
0048 std::pair<float, float> LambdacMassRange(2.15, 2.45);
0049 bool LambdacTrigger = false;
0050 }
0051
0052 namespace KFParticleBaseCut
0053 {
0054 float minTrackPT = 0.5;
0055 float maxTrackchi2nDoF = 2;
0056 float minTrackIPchi2 = 15;
0057 float maxVertexchi2nDoF = 2;
0058 float maxTrackTrackDCA = 0.05;
0059 float minMotherPT = 0;
0060 }
0061
0062 void KFParticle_Upsilon_Reco()
0063 {
0064 int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY);
0065
0066 Fun4AllServer *se = Fun4AllServer::instance();
0067
0068 KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::UpsilonName + "_Reco");
0069 kfparticle->Verbosity(verbosity);
0070 kfparticle->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor);
0071
0072 if (Enable::KFPARTICLE_APPEND_TO_DST) kfparticle->saveDST();
0073 if (!Enable::KFPARTICLE_SAVE_NTUPLE) kfparticle->saveOutput(false);
0074 if (Enable::KFPARTICLE_TRUTH_MATCH) kfparticle->doTruthMatching();
0075 if (Enable::KFPARTICLE_DETECTOR_INFO) kfparticle->getDetectorInfo();
0076
0077 kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT);
0078 kfparticle->setMinimumTrackIPchi2(0);
0079 kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF);
0080
0081 kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF);
0082 kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA);
0083
0084 kfparticle->setMinimumMass(KFPARTICLE::UpsilonMassRange.first);
0085 kfparticle->setMaximumMass(KFPARTICLE::UpsilonMassRange.second);
0086 kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT);
0087
0088 kfparticle->setContainerName(KFPARTICLE::UpsilonName);
0089 kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::UpsilonName + "_reconstruction.root");
0090 kfparticle->magFieldFile(G4MAGNET::magfield_tracking);
0091 se->registerSubsystem(kfparticle);
0092
0093 KFPARTICLE::runUpsilonReco = true;
0094
0095 return;
0096 }
0097
0098
0099 void KFParticle_D0_Reco()
0100 {
0101 int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY);
0102
0103 Fun4AllServer *se = Fun4AllServer::instance();
0104
0105 KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::D0Name + "_Reco");
0106 kfparticle->Verbosity(verbosity);
0107 kfparticle->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor);
0108
0109 if (Enable::KFPARTICLE_APPEND_TO_DST) kfparticle->saveDST();
0110 if (!Enable::KFPARTICLE_SAVE_NTUPLE) kfparticle->saveOutput(false);
0111 if (Enable::KFPARTICLE_TRUTH_MATCH) kfparticle->doTruthMatching();
0112 if (Enable::KFPARTICLE_DETECTOR_INFO) kfparticle->getDetectorInfo();
0113
0114 kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT);
0115 kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2);
0116 kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF);
0117
0118 kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF);
0119 kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA);
0120
0121 kfparticle->setMinimumMass(KFPARTICLE::D0MassRange.first);
0122 kfparticle->setMaximumMass(KFPARTICLE::D0MassRange.second);
0123 kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT);
0124
0125 kfparticle->setContainerName(KFPARTICLE::D0Name);
0126 kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::D0Name + "_reconstruction.root");
0127 kfparticle->magFieldFile(G4MAGNET::magfield_tracking);
0128
0129 se->registerSubsystem(kfparticle);
0130
0131 KFPARTICLE::runD0Reco = true;
0132
0133 return;
0134 }
0135
0136
0137 void KFParticle_Lambdac_Reco()
0138 {
0139 int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY);
0140
0141 Fun4AllServer *se = Fun4AllServer::instance();
0142
0143 KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::LambdacName + "_Reco");
0144 kfparticle->Verbosity(verbosity);
0145 kfparticle->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor);
0146
0147 if (Enable::KFPARTICLE_APPEND_TO_DST) kfparticle->saveDST();
0148 if (!Enable::KFPARTICLE_SAVE_NTUPLE) kfparticle->saveOutput(false);
0149 if (Enable::KFPARTICLE_TRUTH_MATCH) kfparticle->doTruthMatching();
0150 if (Enable::KFPARTICLE_DETECTOR_INFO) kfparticle->getDetectorInfo();
0151
0152 kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT);
0153 kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2);
0154 kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF);
0155
0156 kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF);
0157 kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA);
0158
0159 kfparticle->setMinimumMass(KFPARTICLE::LambdacMassRange.first);
0160 kfparticle->setMaximumMass(KFPARTICLE::LambdacMassRange.second);
0161 kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT);
0162
0163 kfparticle->setContainerName(KFPARTICLE::LambdacName);
0164 kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::LambdacName + "_reconstruction.root");
0165 kfparticle->magFieldFile(G4MAGNET::magfield_tracking);
0166
0167 se->registerSubsystem(kfparticle);
0168
0169 KFPARTICLE::runLambdacReco = true;
0170
0171 return;
0172 }
0173
0174 void KFParticle_QA()
0175 {
0176 int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY);
0177
0178 Fun4AllServer *se = Fun4AllServer::instance();
0179
0180 if (KFPARTICLE::runUpsilonReco)
0181 {
0182 DecayFinder *UpsilonFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::UpsilonName);
0183 UpsilonFinder->Verbosity(verbosity);
0184 UpsilonFinder->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor);
0185 UpsilonFinder->triggerOnDecay(KFPARTICLE::UpsilonTrigger);
0186 UpsilonFinder->saveDST(true);
0187 UpsilonFinder->allowPi0(true);
0188 UpsilonFinder->allowPhotons(true);
0189 se->registerSubsystem(UpsilonFinder);
0190
0191 QAG4SimulationKFParticle *UpsilonQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::UpsilonName,
0192 KFPARTICLE::UpsilonName,
0193 KFPARTICLE::UpsilonMassRange.first,
0194 KFPARTICLE::UpsilonMassRange.second);
0195 se->registerSubsystem(UpsilonQA);
0196 }
0197
0198 if (KFPARTICLE::runD0Reco)
0199 {
0200 DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFPARTICLE::D0Name);
0201 D0Finder->Verbosity(verbosity);
0202 D0Finder->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor);
0203 D0Finder->triggerOnDecay(KFPARTICLE::D0Trigger);
0204 D0Finder->saveDST(true);
0205 D0Finder->allowPi0(true);
0206 D0Finder->allowPhotons(true);
0207 se->registerSubsystem(D0Finder);
0208
0209 QAG4SimulationKFParticle *D0QA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::D0Name,
0210 KFPARTICLE::D0Name,
0211 KFPARTICLE::D0MassRange.first,
0212 KFPARTICLE::D0MassRange.second);
0213 se->registerSubsystem(D0QA);
0214 }
0215
0216 if (KFPARTICLE::runLambdacReco)
0217 {
0218 DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::LambdacName);
0219 LambdacFinder->Verbosity(verbosity);
0220 LambdacFinder->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor);
0221 LambdacFinder->triggerOnDecay(KFPARTICLE::LambdacTrigger);
0222 LambdacFinder->saveDST(true);
0223 LambdacFinder->allowPi0(true);
0224 LambdacFinder->allowPhotons(true);
0225 se->registerSubsystem(LambdacFinder);
0226
0227 QAG4SimulationKFParticle *LambdacQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::LambdacName,
0228 KFPARTICLE::LambdacName,
0229 KFPARTICLE::LambdacMassRange.first,
0230 KFPARTICLE::LambdacMassRange.second);
0231 se->registerSubsystem(LambdacQA);
0232 }
0233
0234 return;
0235 }
0236
0237 #endif