Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:57

0001 #include <fun4all/Fun4AllServer.h>
0002 
0003 #include <calotrigger/TriggerRunInfoReco.h>
0004 #include <globalvertex/GlobalVertexReco.h>
0005 
0006 #pragma GCC diagnostic push
0007 
0008 #pragma GCC diagnostic ignored "-Wundefined-internal"
0009 
0010 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
0011 
0012 #pragma GCC diagnostic pop
0013 
0014 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0015 R__LOAD_LIBRARY(libcalotrigger.so)
0016 
0017 namespace HeavyFlavorReco
0018 {
0019   int VERBOSITY_HF = 0;
0020 
0021   bool run_Kpi_reco = false;
0022   bool run_Kpi_reco_likeSign = false;
0023   bool run_Kpipi_reco = false;
0024   bool run_Kpipi_reco_likeSign = false;
0025   bool run_KKpi_reco = false; //Note, 2D matching
0026   bool run_pKpi_reco = false;
0027   bool run_pKpi_reco_likeSign = false;
0028   bool run_pipi_reco = true;
0029   bool run_Kstar_reco = false;
0030   bool run_KK_reco = false;
0031   bool run_Lambdapi_reco = false;
0032 
0033   std::string output_dir = "./"; //Top dir of where the output nTuples will be written
0034   std::string kfp_header = "outputKFParticle_";
0035   std::string processing_folder = "inReconstruction/";
0036   std::string trailer = ".root";
0037 
0038   // https://wiki.bnl.gov/sPHENIX/index.php/KFParticle
0039   std::string pipi_decay_descriptor = "K_S0 -> pi^+ pi^-"; //See twiki on how to set this
0040   std::string pipi_reconstruction_name = "pipi_reco"; //Used for naming output folder, file and node
0041   std::string pipi_output_reco_file;
0042   std::string pipi_output_dir;
0043 
0044   std::string Kstar_decay_descriptor = "[K*0 -> K^+ pi^-]cc"; //See twiki on how to set this
0045   std::string Kstar_reconstruction_name = "Kstar_reco"; //Used for naming output folder, file and node
0046   std::string Kstar_output_reco_file;
0047   std::string Kstar_output_dir;
0048 
0049   std::string KK_decay_descriptor = "phi -> K^+ K^-"; //See twiki on how to set this
0050   std::string KK_reconstruction_name = "KK_reco"; //Used for naming output folder, file and node
0051   std::string KK_output_reco_file;
0052   std::string KK_output_dir;
0053 
0054   std::string Kpi_decay_descriptor = "[D0 -> K^- pi^+]cc"; //See twiki on how to set this
0055   std::string Kpi_reconstruction_name = "Kpi_reco"; //Used for naming output folder, file and node
0056   std::string Kpi_output_reco_file;
0057   std::string Kpi_output_dir;
0058 
0059   std::string Kpi_like_decay_descriptor = "[D0 -> K^+ pi^+]cc"; //See twiki on how to set this
0060   std::string Kpi_like_reconstruction_name = "Kpi_reco_likeSign"; //Used for naming output folder, file and node
0061   std::string Kpi_like_output_reco_file;
0062   std::string Kpi_like_output_dir;
0063 
0064   std::string Kpipi_decay_descriptor = "[D+ -> K^- pi^+ pi^+]cc"; //See twiki on how to set this
0065   std::string Kpipi_reconstruction_name = "Kpipi_reco"; //Used for naming output folder, file and node
0066   std::string Kpipi_output_reco_file;
0067   std::string Kpipi_output_dir;
0068 
0069   std::string Kpipi_like_decay_descriptor = "[D+ -> K^+ pi^+ pi^+]cc"; //See twiki on how to set this
0070   std::string Kpipi_like_reconstruction_name = "Kpipi_reco_likeSign"; //Used for naming output folder, file and node
0071   std::string Kpipi_like_output_reco_file;
0072   std::string Kpipi_like_output_dir;
0073 
0074   std::string KKpi_decay_descriptor = "[D_s+ -> {phi -> K^+ K^-} pi^+]cc"; //See twiki on how to set this
0075   std::string KKpi_reconstruction_name = "KKpi_reco"; //Used for naming output folder, file and node
0076   std::string KKpi_output_reco_file;
0077   std::string KKpi_output_dir;
0078 
0079   std::string pKpi_decay_descriptor = "[Lambda_c+ -> proton^+ K^- pi^+]cc"; //See twiki on how to set this
0080   std::string pKpi_reconstruction_name = "pKpi_reco"; //Used for naming output folder, file and node
0081   std::string pKpi_output_reco_file;
0082   std::string pKpi_output_dir;
0083 
0084   std::string pKpi_like_decay_descriptor = "[Lambda_c+ -> proton^+ K^+ pi^+]cc"; //See twiki on how to set this
0085   std::string pKpi_like_reconstruction_name = "pKpi_reco_likeSign"; //Used for naming output folder, file and node
0086   std::string pKpi_like_output_reco_file;
0087   std::string pKpi_like_output_dir;
0088 
0089   std::string Lambdapi_decay_descriptor = "[Xi- -> {Lambda0 -> proton^+ pi^-} pi^-]cc"; //See twiki on how to set this
0090   std::string Lambdapi_reconstruction_name = "Lambdapi_reco"; //Used for naming output folder, file and node
0091   std::string Lambdapi_output_reco_file;
0092   std::string Lambdapi_output_dir;
0093 
0094   bool use_pid = true;
0095   bool save_tracks_to_DST = false;
0096   bool dont_use_global_vertex = true;
0097   bool require_track_and_vertex_match = true;
0098   bool save_all_vtx_info = true;
0099   bool constrain_phi_mass = true;
0100   bool use_2D_matching = true;
0101   bool get_trigger_info = true;
0102   bool get_detector_info = true;
0103   bool get_dEdx_info = true;
0104   float pid_frac = 0.4;
0105   bool constrain_lambda_mass = true;
0106 };  // namespace HeavyFlavorReco'
0107 
0108 using namespace HeavyFlavorReco;
0109 
0110 void init_kfp_dependencies()
0111 {
0112   //dE/dx needs TRKR_CLUSTER and CYLINDERCELLGEOM_SVTX which need to be in the DST or loaded from a geo file
0113   Fun4AllServer *se = Fun4AllServer::instance();
0114 
0115   GlobalVertexReco* gblvertex = new GlobalVertexReco();
0116   gblvertex->Verbosity(VERBOSITY_HF);
0117   se->registerSubsystem(gblvertex);
0118 
0119 
0120   if (get_trigger_info)
0121   {
0122     TriggerRunInfoReco *triggerruninforeco = new TriggerRunInfoReco();
0123     se->registerSubsystem(triggerruninforeco);
0124   }
0125 }
0126 
0127 void create_hf_directories(std::string reconstruction_name, std::string &final_output_dir, std::string &output_reco_file)
0128 {
0129   std::string output_file_name = kfp_header + reconstruction_name + trailer;
0130   final_output_dir = output_dir + reconstruction_name + "/";
0131   std::string output_reco_dir = final_output_dir + processing_folder;
0132   output_reco_file = output_reco_dir + output_file_name;
0133 
0134   std::string makeDirectory = "mkdir -p " + output_reco_dir;
0135   system(makeDirectory.c_str());
0136 }
0137 
0138 void reconstruct_pipi_mass()
0139 {
0140   Fun4AllServer *se = Fun4AllServer::instance();
0141 
0142   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pipi_reconstruction_name);
0143   kfparticle->Verbosity(INT_MAX);
0144 
0145   kfparticle->setDecayDescriptor(pipi_decay_descriptor);
0146 
0147   kfparticle->usePID(use_pid);
0148   kfparticle->setPIDacceptFraction(pid_frac);
0149   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0150   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0151   kfparticle->getAllPVInfo(save_all_vtx_info);
0152   kfparticle->allowZeroMassTracks();
0153   kfparticle->use2Dmatching(use_2D_matching);
0154   kfparticle->getTriggerInfo(get_trigger_info);
0155   kfparticle->getDetectorInfo(get_detector_info);
0156   kfparticle->saveDST(true);
0157   kfparticle->setContainerName(pipi_reconstruction_name);
0158   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0159 
0160   //PV to SV cuts
0161   kfparticle->constrainToPrimaryVertex(true);
0162   kfparticle->setMotherIPchi2(100);
0163   kfparticle->setFlightDistancechi2(-1.);
0164   kfparticle->setMinDIRA(0.95);
0165   kfparticle->setDecayLengthRange(0.1, FLT_MAX);
0166   kfparticle->setDecayLengthRange_XY(-10000, FLT_MAX);
0167   kfparticle->setDecayTimeRange_XY(-10000, FLT_MAX);
0168   kfparticle->setDecayTimeRange(-10000, FLT_MAX);
0169   kfparticle->setMinDecayTimeSignificance(-1e5);
0170   kfparticle->setMinDecayLengthSignificance(-1e5);
0171   kfparticle->setMinDecayLengthSignificance_XY(-1e5);
0172 
0173   //Track parameters
0174   kfparticle->setMinimumTrackPT(0.0);
0175   kfparticle->setMinimumTrackIPchi2(-1.);
0176   kfparticle->setMinimumTrackIP(-1.);
0177   kfparticle->setMaximumTrackchi2nDOF(100.);
0178   kfparticle->setMinTPChits(20);
0179   kfparticle->setMinMVTXhits(0);
0180   kfparticle->setMinINTThits(0);
0181   //Vertex parameters
0182   kfparticle->setMaximumVertexchi2nDOF(20);
0183   kfparticle->setMaximumDaughterDCA(0.5); //5 mm
0184   kfparticle->setMaximumDaughterDCA_XY(100); //5 mm
0185 
0186   //Parent parameters
0187   kfparticle->setMotherPT(0);
0188   kfparticle->setMinimumMass(0.40); //Check mass ranges
0189   kfparticle->setMaximumMass(0.60);
0190   kfparticle->setMaximumMotherVertexVolume(0.1);
0191 
0192   kfparticle->setOutputName(pipi_output_reco_file);
0193 
0194   se->registerSubsystem(kfparticle);
0195 }
0196 
0197 void reconstruct_Kstar_mass()
0198 {
0199   Fun4AllServer *se = Fun4AllServer::instance();
0200 
0201   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kstar_reconstruction_name);
0202   kfparticle->Verbosity(VERBOSITY_HF);
0203 
0204   kfparticle->setDecayDescriptor(Kstar_decay_descriptor);
0205 
0206   kfparticle->usePID(use_pid);
0207   kfparticle->setPIDacceptFraction(pid_frac);
0208   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0209   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0210   kfparticle->getAllPVInfo(save_all_vtx_info);
0211   kfparticle->allowZeroMassTracks();
0212   kfparticle->use2Dmatching(use_2D_matching);
0213   kfparticle->getTriggerInfo(get_trigger_info);
0214   kfparticle->getDetectorInfo(get_detector_info);
0215   kfparticle->saveDST(save_tracks_to_DST);
0216   kfparticle->saveParticleContainer(false);
0217   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0218 
0219   //PV to SV cuts
0220   kfparticle->constrainToPrimaryVertex(true);
0221   kfparticle->setMotherIPchi2(100);
0222   kfparticle->setFlightDistancechi2(-1.);
0223   kfparticle->setMinDIRA(-1.1);
0224   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0225 
0226   //Track parameters
0227   kfparticle->setMinimumTrackPT(0.0);
0228   kfparticle->setMinimumTrackIPchi2(-1.);
0229   kfparticle->setMinimumTrackIP(-1.);
0230   kfparticle->setMaximumTrackchi2nDOF(100.);
0231   kfparticle->setMinTPChits(25);
0232 
0233   //Vertex parameters
0234   kfparticle->setMaximumVertexchi2nDOF(20);
0235   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0236 
0237   //Parent parameters
0238   kfparticle->setMotherPT(0);
0239   kfparticle->setMinimumMass(0.8); //Check mass ranges
0240   kfparticle->setMaximumMass(1.0);
0241   kfparticle->setMaximumMotherVertexVolume(0.1);
0242 
0243   kfparticle->setOutputName(Kstar_output_reco_file);
0244 
0245   se->registerSubsystem(kfparticle);
0246 }
0247 
0248 void reconstruct_KK_mass()
0249 {
0250   Fun4AllServer *se = Fun4AllServer::instance();
0251 
0252   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(KK_reconstruction_name);
0253   kfparticle->Verbosity(VERBOSITY_HF);
0254 
0255   kfparticle->setDecayDescriptor(KK_decay_descriptor);
0256 
0257   kfparticle->usePID(use_pid);
0258   kfparticle->setPIDacceptFraction(pid_frac);
0259   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0260   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0261   kfparticle->getAllPVInfo(save_all_vtx_info);
0262   kfparticle->allowZeroMassTracks();
0263   kfparticle->use2Dmatching(use_2D_matching);
0264   kfparticle->getTriggerInfo(get_trigger_info);
0265   kfparticle->getDetectorInfo(get_detector_info);
0266   kfparticle->saveDST(save_tracks_to_DST);
0267   kfparticle->saveParticleContainer(false);
0268   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0269 
0270   //PV to SV cuts
0271   kfparticle->constrainToPrimaryVertex(true);
0272   kfparticle->setMotherIPchi2(100);
0273   kfparticle->setFlightDistancechi2(-1.);
0274   kfparticle->setMinDIRA(-1.1);
0275   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0276 
0277   //Track parameters
0278   kfparticle->setMinimumTrackPT(0.0);
0279   kfparticle->setMinimumTrackIPchi2(-1.);
0280   kfparticle->setMinimumTrackIP(-1.);
0281   kfparticle->setMaximumTrackchi2nDOF(100.);
0282   kfparticle->setMinTPChits(25);
0283 
0284   //Vertex parameters
0285   kfparticle->setMaximumVertexchi2nDOF(20);
0286   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0287 
0288   //Parent parameters
0289   kfparticle->setMotherPT(0);
0290   kfparticle->setMinimumMass(0.8); //Check mass ranges
0291   kfparticle->setMaximumMass(1.0);
0292   kfparticle->setMaximumMotherVertexVolume(0.1);
0293 
0294   kfparticle->setOutputName(KK_output_reco_file);
0295 
0296   se->registerSubsystem(kfparticle);
0297 }
0298 
0299 void reconstruct_Kpi_mass()
0300 {
0301   Fun4AllServer *se = Fun4AllServer::instance();
0302 
0303   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpi_reconstruction_name);
0304   kfparticle->Verbosity(VERBOSITY_HF);
0305 
0306   kfparticle->setDecayDescriptor(Kpi_decay_descriptor);
0307 
0308   kfparticle->usePID(use_pid);
0309   kfparticle->setPIDacceptFraction(pid_frac);
0310   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0311   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0312   kfparticle->getAllPVInfo(save_all_vtx_info);
0313   kfparticle->allowZeroMassTracks();
0314   kfparticle->use2Dmatching(use_2D_matching);
0315   kfparticle->getTriggerInfo(get_trigger_info);
0316   kfparticle->getDetectorInfo(get_detector_info);
0317   kfparticle->saveDST(save_tracks_to_DST);
0318   kfparticle->setContainerName(Kpi_reconstruction_name);
0319   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0320 
0321   //PV to SV cuts
0322   kfparticle->constrainToPrimaryVertex(true);
0323   kfparticle->setMotherIPchi2(100);
0324   kfparticle->setFlightDistancechi2(-1.);
0325   kfparticle->setMinDIRA(0.985);
0326   kfparticle->setDecayLengthRange(0.008, FLT_MAX);
0327 
0328   //Track parameters
0329   kfparticle->setMinimumTrackPT(0.2);
0330   kfparticle->setMinimumTrackIPchi2(-1.);
0331   kfparticle->setMinimumTrackIP(-1);
0332   kfparticle->setMaximumTrackchi2nDOF(100.);
0333   kfparticle->setMinTPChits(25);
0334   kfparticle->setMinMVTXhits(3);
0335 
0336   //Vertex parameters
0337   kfparticle->setMaximumVertexchi2nDOF(14);
0338   kfparticle->setMaximumDaughterDCA(0.002); //1 mm
0339 
0340   //Parent parameters
0341   kfparticle->setMotherPT(0.75);
0342   kfparticle->setMinimumMass(1.83);
0343   kfparticle->setMaximumMass(1.89);
0344   kfparticle->setMaximumMotherVertexVolume(0.1);
0345 
0346   kfparticle->setOutputName(Kpi_output_reco_file);
0347 
0348   se->registerSubsystem(kfparticle);
0349 }
0350 
0351 void reconstruct_Kpi_mass_likeSign()
0352 {
0353   Fun4AllServer *se = Fun4AllServer::instance();
0354 
0355   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpi_like_reconstruction_name);
0356   kfparticle->Verbosity(VERBOSITY_HF);
0357 
0358   kfparticle->setDecayDescriptor(Kpi_like_decay_descriptor);
0359 
0360   kfparticle->usePID(use_pid);
0361   kfparticle->setPIDacceptFraction(pid_frac);
0362   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0363   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0364   kfparticle->getAllPVInfo(save_all_vtx_info);
0365   kfparticle->allowZeroMassTracks();
0366   kfparticle->use2Dmatching(use_2D_matching);
0367   kfparticle->getTriggerInfo(get_trigger_info);
0368   kfparticle->getDetectorInfo(get_detector_info);
0369   kfparticle->saveDST(save_tracks_to_DST);
0370   kfparticle->saveParticleContainer(false);
0371   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0372 
0373   //PV to SV cuts
0374   kfparticle->constrainToPrimaryVertex(true);
0375   kfparticle->setMotherIPchi2(100);
0376   kfparticle->setFlightDistancechi2(-1.);
0377   kfparticle->setMinDIRA(-1.1);
0378   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0379 
0380   //Track parameters
0381   kfparticle->setMinimumTrackPT(0.1);
0382   kfparticle->setMinimumTrackIPchi2(-1.);
0383   kfparticle->setMinimumTrackIP(-1);
0384   kfparticle->setMaximumTrackchi2nDOF(100.);
0385   kfparticle->setMinTPChits(25);
0386 
0387   //Vertex parameters
0388   kfparticle->setMaximumVertexchi2nDOF(20);
0389   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0390 
0391   //Parent parameters
0392   kfparticle->setMotherPT(0);
0393   kfparticle->setMinimumMass(1.50);
0394   kfparticle->setMaximumMass(2.20);
0395   kfparticle->setMaximumMotherVertexVolume(0.1);
0396 
0397   kfparticle->setOutputName(Kpi_like_output_reco_file);
0398 
0399   se->registerSubsystem(kfparticle);
0400 }
0401 
0402 void reconstruct_Kpipi_mass_likeSign()
0403 {
0404   Fun4AllServer *se = Fun4AllServer::instance();
0405 
0406   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpipi_like_reconstruction_name);
0407   kfparticle->Verbosity(VERBOSITY_HF);
0408 
0409   kfparticle->setDecayDescriptor(Kpipi_like_decay_descriptor);
0410 
0411   kfparticle->usePID(use_pid);
0412   kfparticle->setPIDacceptFraction(pid_frac);
0413   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0414   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0415   kfparticle->getAllPVInfo(save_all_vtx_info);
0416   kfparticle->allowZeroMassTracks();
0417   kfparticle->use2Dmatching(use_2D_matching);
0418   kfparticle->getTriggerInfo(get_trigger_info);
0419   kfparticle->getDetectorInfo(get_detector_info);
0420   kfparticle->saveDST(save_tracks_to_DST);
0421   kfparticle->saveParticleContainer(false);
0422   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0423 
0424   //PV to SV cuts
0425   kfparticle->constrainToPrimaryVertex(true);
0426   kfparticle->setMotherIPchi2(100);
0427   kfparticle->setFlightDistancechi2(-1.);
0428   kfparticle->setMinDIRA(-1.1);
0429   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0430 
0431   //Track parameters
0432   kfparticle->setMinimumTrackPT(0.1);
0433   kfparticle->setMinimumTrackIPchi2(-1.);
0434   kfparticle->setMinimumTrackIP(-1.);
0435   kfparticle->setMaximumTrackchi2nDOF(100.);
0436   kfparticle->setMinTPChits(25);
0437 
0438   //Vertex parameters
0439   kfparticle->setMaximumVertexchi2nDOF(20);
0440   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0441 
0442   //Parent parameters
0443   kfparticle->setMotherPT(0);
0444   kfparticle->setMinimumMass(1.50); //Check mass ranges
0445   kfparticle->setMaximumMass(2.20);
0446   kfparticle->setMaximumMotherVertexVolume(0.1);
0447 
0448   kfparticle->setOutputName(Kpipi_like_output_reco_file);
0449 
0450   se->registerSubsystem(kfparticle);
0451 }
0452 
0453 void reconstruct_Kpipi_mass()
0454 {
0455   Fun4AllServer *se = Fun4AllServer::instance();
0456 
0457   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpipi_reconstruction_name);
0458   kfparticle->Verbosity(VERBOSITY_HF);
0459 
0460   kfparticle->setDecayDescriptor(Kpipi_decay_descriptor);
0461 
0462   kfparticle->usePID(use_pid);
0463   kfparticle->setPIDacceptFraction(pid_frac);
0464   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0465   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0466   kfparticle->getAllPVInfo(save_all_vtx_info);
0467   kfparticle->allowZeroMassTracks();
0468   kfparticle->use2Dmatching(use_2D_matching);
0469   kfparticle->getTriggerInfo(get_trigger_info);
0470   kfparticle->getDetectorInfo(get_detector_info);
0471   kfparticle->saveDST(save_tracks_to_DST);
0472   kfparticle->saveParticleContainer(false);
0473   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0474 
0475   //PV to SV cuts
0476   kfparticle->constrainToPrimaryVertex(true);
0477   kfparticle->setMotherIPchi2(100);
0478   kfparticle->setFlightDistancechi2(-1.);
0479   kfparticle->setMinDIRA(-1.1);
0480   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0481 
0482   //Track parameters
0483   kfparticle->setMinimumTrackPT(0.1);
0484   kfparticle->setMinimumTrackIPchi2(-1.);
0485   kfparticle->setMinimumTrackIP(-1.);
0486   kfparticle->setMaximumTrackchi2nDOF(100.);
0487   kfparticle->setMinTPChits(25);
0488 
0489   //Vertex parameters
0490   kfparticle->setMaximumVertexchi2nDOF(20);
0491   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0492 
0493   //Parent parameters
0494   kfparticle->setMotherPT(0);
0495   kfparticle->setMinimumMass(1.50); //Check mass ranges
0496   kfparticle->setMaximumMass(2.20);
0497   kfparticle->setMaximumMotherVertexVolume(0.1);
0498 
0499   kfparticle->setOutputName(Kpipi_output_reco_file);
0500 
0501   se->registerSubsystem(kfparticle);
0502 }
0503 
0504 void reconstruct_KKpi_mass()
0505 {
0506   Fun4AllServer *se = Fun4AllServer::instance();
0507 
0508   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(KKpi_reconstruction_name);
0509   kfparticle->Verbosity(VERBOSITY_HF);
0510 
0511   kfparticle->setDecayDescriptor(KKpi_decay_descriptor);
0512 
0513   kfparticle->usePID(use_pid);
0514   kfparticle->setPIDacceptFraction(pid_frac);
0515   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0516   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0517   kfparticle->getAllPVInfo(save_all_vtx_info);
0518   kfparticle->allowZeroMassTracks();
0519   kfparticle->use2Dmatching(true);//(use_2D_matching);
0520   kfparticle->getTriggerInfo(get_trigger_info);
0521   kfparticle->getDetectorInfo(get_detector_info);
0522   kfparticle->saveDST(save_tracks_to_DST);
0523   kfparticle->saveParticleContainer(false);
0524   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0525 
0526   //PV to SV cuts
0527   kfparticle->constrainToPrimaryVertex(true);
0528   kfparticle->setMotherIPchi2(10);
0529   kfparticle->setFlightDistancechi2(-1.);
0530   kfparticle->setMinDIRA(0.5);
0531   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0532 
0533   //Track parameters
0534   kfparticle->setMinimumTrackPT(0.0);
0535   kfparticle->setMinimumTrackIPchi2(-1.);
0536   kfparticle->setMinimumTrackIP(-1);
0537   kfparticle->setMaximumTrackchi2nDOF(100.);
0538   kfparticle->setMinTPChits(25);
0539 
0540   //Vertex parameters
0541   kfparticle->setMaximumVertexchi2nDOF(20);
0542   kfparticle->setMaximumDaughterDCA(0.02); //1 mm
0543 
0544   //Parent parameters
0545   kfparticle->setMotherPT(0);
0546   kfparticle->setMinimumMass(1.50);
0547   kfparticle->setMaximumMass(2.20);
0548   kfparticle->setMaximumMotherVertexVolume(0.1);
0549 
0550   //Intermediate parameters
0551   kfparticle->constrainIntermediateMasses(constrain_phi_mass);
0552 
0553   std::vector<std::pair<float, float>> intermediate_mass_range;
0554   intermediate_mass_range.push_back(make_pair(0.98, 1.05));
0555   kfparticle->setIntermediateMassRange(intermediate_mass_range);
0556 
0557   std::vector<float> intermediate_min_pt = {0.};
0558   kfparticle->setIntermediateMinPT(intermediate_min_pt);
0559 
0560   std::vector<std::pair<float, float>> intermediate_IP_range;
0561   intermediate_IP_range.push_back(make_pair(-1., FLT_MAX));
0562   kfparticle->setIntermediateIPRange(intermediate_IP_range);
0563 
0564   std::vector<std::pair<float, float>> intermediate_IPchi2_range;
0565   intermediate_IPchi2_range.push_back(make_pair(0., 400.));
0566   kfparticle->setIntermediateIPchi2Range(intermediate_IPchi2_range);
0567 
0568   std::vector<float> intermediate_min_dira = {-1.1};
0569   kfparticle->setIntermediateMinDIRA(intermediate_min_dira);
0570 
0571   std::vector<float> intermediate_min_FDchi2 = {-1.};
0572   kfparticle->setIntermediateMinFDchi2(intermediate_min_FDchi2);
0573 
0574   std::vector<float> intermediate_max_vertex_vol = {0.1};
0575   kfparticle->setIntermediateMaxVertexVolume(intermediate_max_vertex_vol);
0576 
0577   kfparticle->setOutputName(KKpi_output_reco_file);
0578 
0579   se->registerSubsystem(kfparticle);
0580 }
0581 
0582 void reconstruct_pKpi_mass()
0583 {
0584   Fun4AllServer *se = Fun4AllServer::instance();
0585 
0586   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pKpi_reconstruction_name);
0587   kfparticle->Verbosity(VERBOSITY_HF);
0588 
0589   kfparticle->setDecayDescriptor(pKpi_decay_descriptor);
0590 
0591   kfparticle->usePID(use_pid);
0592   kfparticle->setPIDacceptFraction(pid_frac);
0593   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0594   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0595   kfparticle->getAllPVInfo(save_all_vtx_info);
0596   kfparticle->allowZeroMassTracks();
0597   kfparticle->use2Dmatching(use_2D_matching);
0598   kfparticle->getTriggerInfo(get_trigger_info);
0599   kfparticle->getDetectorInfo(get_detector_info);
0600   kfparticle->saveDST(save_tracks_to_DST);
0601   kfparticle->saveParticleContainer(false);
0602   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0603 
0604   //PV to SV cuts
0605   kfparticle->constrainToPrimaryVertex(true);
0606   kfparticle->setMotherIPchi2(100);
0607   kfparticle->setFlightDistancechi2(-1.);
0608   kfparticle->setMinDIRA(-1.1);
0609   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0610 
0611   //Track parameters
0612   kfparticle->setMinimumTrackPT(0.2);
0613   kfparticle->setMinimumTrackIPchi2(-1.);
0614   kfparticle->setMinimumTrackIP(-1.);
0615   kfparticle->setMaximumTrackchi2nDOF(100.);
0616   kfparticle->setMinTPChits(25);
0617 
0618   //Vertex parameters
0619   kfparticle->setMaximumVertexchi2nDOF(20);
0620   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0621 
0622   //Parent parameters
0623   kfparticle->setMotherPT(0);
0624   kfparticle->setMinimumMass(2.10); //Check mass ranges
0625   kfparticle->setMaximumMass(2.60);
0626   kfparticle->setMaximumMotherVertexVolume(0.1);
0627 
0628   kfparticle->setOutputName(pKpi_output_reco_file);
0629 
0630   se->registerSubsystem(kfparticle);
0631 }
0632 
0633 void reconstruct_pKpi_mass_likeSign()
0634 {
0635   Fun4AllServer *se = Fun4AllServer::instance();
0636 
0637   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pKpi_like_reconstruction_name);
0638   kfparticle->Verbosity(VERBOSITY_HF);
0639 
0640   kfparticle->setDecayDescriptor(pKpi_like_decay_descriptor);
0641 
0642   kfparticle->usePID(use_pid);
0643   kfparticle->setPIDacceptFraction(pid_frac);
0644   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0645   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0646   kfparticle->getAllPVInfo(save_all_vtx_info);
0647   kfparticle->allowZeroMassTracks();
0648   kfparticle->use2Dmatching(use_2D_matching);
0649   kfparticle->getTriggerInfo(get_trigger_info);
0650   kfparticle->getDetectorInfo(get_detector_info);
0651   kfparticle->saveDST(save_tracks_to_DST);
0652   kfparticle->saveParticleContainer(false);
0653   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0654 
0655   //PV to SV cuts
0656   kfparticle->constrainToPrimaryVertex(true);
0657   kfparticle->setMotherIPchi2(100);
0658   kfparticle->setFlightDistancechi2(-1.);
0659   kfparticle->setMinDIRA(-1.1);
0660   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0661 
0662   //Track parameters
0663   kfparticle->setMinimumTrackPT(0.2);
0664   kfparticle->setMinimumTrackIPchi2(-1.);
0665   kfparticle->setMinimumTrackIP(-1.);
0666   kfparticle->setMaximumTrackchi2nDOF(100.);
0667   kfparticle->setMinTPChits(25);
0668 
0669   //Vertex parameters
0670   kfparticle->setMaximumVertexchi2nDOF(20);
0671   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0672 
0673   //Parent parameters
0674   kfparticle->setMotherPT(0);
0675   kfparticle->setMinimumMass(2.10); //Check mass ranges
0676   kfparticle->setMaximumMass(2.60);
0677   kfparticle->setMaximumMotherVertexVolume(0.1);
0678 
0679   kfparticle->setOutputName(pKpi_like_output_reco_file);
0680 
0681   se->registerSubsystem(kfparticle);
0682 }
0683 
0684 //adding xi and omega
0685 void reconstruct_Lambdapi_mass()
0686 {
0687   Fun4AllServer *se = Fun4AllServer::instance();
0688 
0689   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Lambdapi_reconstruction_name);
0690   kfparticle->Verbosity(VERBOSITY_HF);
0691 
0692   kfparticle->setDecayDescriptor(Lambdapi_decay_descriptor);
0693 
0694   kfparticle->usePID(use_pid);
0695   kfparticle->setPIDacceptFraction(pid_frac);
0696   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0697   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0698   kfparticle->getAllPVInfo(save_all_vtx_info);
0699   kfparticle->allowZeroMassTracks();
0700   kfparticle->use2Dmatching(use_2D_matching);
0701   kfparticle->getTriggerInfo(get_trigger_info);
0702   kfparticle->getDetectorInfo(get_detector_info);
0703   kfparticle->saveDST(save_tracks_to_DST);
0704   kfparticle->setContainerName(Lambdapi_reconstruction_name);
0705   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0706 
0707   //PV to SV cuts
0708   kfparticle->constrainToPrimaryVertex(true);
0709   kfparticle->setMotherIPchi2(100);
0710   kfparticle->setFlightDistancechi2(-1.);
0711   kfparticle->setMinDIRA(-1.1);
0712   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0713 
0714   //Track parameters
0715   kfparticle->setMinimumTrackPT(0.1);
0716   kfparticle->setMinimumTrackIPchi2(-1.);
0717   kfparticle->setMinimumTrackIP(-1.);
0718   kfparticle->setMaximumTrackchi2nDOF(100.);
0719   kfparticle->setMinTPChits(25);
0720 
0721   //Vertex parameters
0722   kfparticle->setMaximumVertexchi2nDOF(20);
0723   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0724 
0725   //Parent parameters
0726   kfparticle->setMotherPT(0);
0727   kfparticle->setMinimumMass(1.2); //Check mass ranges
0728   kfparticle->setMaximumMass(1.5);
0729   kfparticle->setMaximumMotherVertexVolume(0.1);
0730 
0731   //Intermediate parameters
0732   kfparticle->constrainIntermediateMasses(constrain_lambda_mass);
0733 
0734   std::vector<std::pair<float, float>> intermediate_mass_range;
0735   intermediate_mass_range.push_back(make_pair(1.10, 1.12));
0736   kfparticle->setIntermediateMassRange(intermediate_mass_range);
0737 
0738   std::vector<float> intermediate_min_pt = {0.0};
0739   kfparticle->setIntermediateMinPT(intermediate_min_pt);
0740 
0741   std::vector<std::pair<float, float>> intermediate_IP_range;
0742   intermediate_IP_range.push_back(make_pair(-1., FLT_MAX));
0743   kfparticle->setIntermediateIPRange(intermediate_IP_range);
0744 
0745   std::vector<std::pair<float, float>> intermediate_IPchi2_range;
0746   intermediate_IPchi2_range.push_back(make_pair(0., 400.));
0747   kfparticle->setIntermediateIPchi2Range(intermediate_IPchi2_range);
0748 
0749   std::vector<float> intermediate_min_dira = {-1.1};
0750   kfparticle->setIntermediateMinDIRA(intermediate_min_dira);
0751 
0752   std::vector<float> intermediate_min_FDchi2 = {-1.};
0753   kfparticle->setIntermediateMinFDchi2(intermediate_min_FDchi2);
0754 
0755   std::vector<float> intermediate_max_vertex_vol = {1.1};
0756   kfparticle->setIntermediateMaxVertexVolume(intermediate_max_vertex_vol);
0757 
0758   kfparticle->setOutputName(Lambdapi_output_reco_file);
0759 
0760   se->registerSubsystem(kfparticle);
0761 }
0762 
0763 void end_kfparticle(std::string full_file_name, std::string final_path)
0764 {
0765   ifstream file(full_file_name.c_str());
0766   if (file.good())
0767   {
0768     string moveOutput = "mv " + full_file_name + " " + final_path;
0769     system(moveOutput.c_str());
0770   }
0771 }