Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:24:01

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