Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:16:12

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 //#include <dstarreco/DstarReco.h>
0015 
0016 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0017 R__LOAD_LIBRARY(libcalotrigger.so)
0018 //R__LOAD_LIBRARY(libDstarReco.so)
0019 
0020 namespace HeavyFlavorReco
0021 {
0022   int VERBOSITY = 0;
0023 
0024   bool run_Kpi_reco = false;
0025   bool run_Kpipi_reco = false;
0026   bool run_KKpi_reco = false; //Note, 2D matching
0027   bool run_pKpi_reco = false;
0028   bool run_pipi_reco = true;
0029   bool run_Kstar_reco = false;
0030   bool run_KK_reco = true;
0031   bool run_ppi_reco = true;
0032   bool run_Dstar_reco = false;
0033 
0034   std::string output_dir = "/sphenix/tg/tg01/hf/mjpeters/LightFlavorProduction/data/"; //Top dir of where the output nTuples will be written
0035   std::string kfp_header = "outputKFParticle_";
0036   std::string processing_folder = "inReconstruction/";
0037   std::string trailer = ".root";
0038 
0039   // https://wiki.bnl.gov/sPHENIX/index.php/KFParticle
0040   std::string pipi_decay_descriptor = "K_S0 -> pi^+ pi^-"; //See twiki on how to set this
0041   std::string pipi_reconstruction_name = "pipi_reco"; //Used for naming output folder, file and node
0042   std::string pipi_output_reco_file;
0043   std::string pipi_output_dir;
0044 
0045   std::string Kstar_decay_descriptor = "[K*0 -> K^+ pi^-]cc"; //See twiki on how to set this
0046   std::string Kstar_reconstruction_name = "Kstar_reco"; //Used for naming output folder, file and node
0047   std::string Kstar_output_reco_file;
0048   std::string Kstar_output_dir;
0049 
0050   std::string KK_decay_descriptor = "phi -> K^+ K^-"; //See twiki on how to set this
0051   std::string KK_reconstruction_name = "KK_reco"; //Used for naming output folder, file and node
0052   std::string KK_output_reco_file;
0053   std::string KK_output_dir;
0054 
0055   std::string ppi_decay_descriptor = "[Lambda0 -> proton^+ pi^-]cc";
0056   std::string ppi_reconstruction_name = "ppi_reco";
0057   std::string ppi_output_reco_file;
0058   std::string ppi_output_dir;
0059 
0060   std::string Kpi_decay_descriptor = "[D0 -> K^- pi^+]cc"; //See twiki on how to set this
0061   std::string Kpi_reconstruction_name = "Kpi_reco"; //Used for naming output folder, file and node
0062   std::string Kpi_output_reco_file;
0063   std::string Kpi_output_dir;
0064 
0065   std::string Kpipi_decay_descriptor = "[D+ -> K^- pi^+ pi^+]cc"; //See twiki on how to set this
0066   std::string Kpipi_reconstruction_name = "Kpipi_reco"; //Used for naming output folder, file and node
0067   std::string Kpipi_output_reco_file;
0068   std::string Kpipi_output_dir;
0069 
0070   std::string KKpi_decay_descriptor = "[D_s+ -> {phi -> K^+ K^-} pi^+]cc"; //See twiki on how to set this
0071   std::string KKpi_reconstruction_name = "KKpi_reco"; //Used for naming output folder, file and node
0072   std::string KKpi_output_reco_file;
0073   std::string KKpi_output_dir;
0074 
0075   std::string pKpi_decay_descriptor = "[Lambda_c+ -> proton^+ K^- pi^+]cc"; //See twiki on how to set this
0076   std::string pKpi_reconstruction_name = "pKpi_reco"; //Used for naming output folder, file and node
0077   std::string pKpi_output_reco_file;
0078   std::string pKpi_output_dir;
0079 
0080   std::string Dstar_reconstruction_name = "Dstar_reco"; //Used for naming output folder, file and node
0081   std::string Dstar_output_reco_file;
0082   std::string Dstar_output_dir;
0083 
0084   bool use_pid = true;
0085   bool save_tracks_to_DST = false;
0086   bool dont_use_global_vertex = true;
0087   bool require_track_and_vertex_match = true;
0088   bool save_all_vtx_info = true;
0089   bool constrain_phi_mass = true;
0090   bool use_2D_matching = false;
0091   bool get_trigger_info = true;
0092   bool get_detector_info = true;
0093   bool get_dEdx_info = true;
0094 };  // namespace HeavyFlavorReco'
0095 
0096 using namespace HeavyFlavorReco;
0097 
0098 void init_kfp_dependencies()
0099 {
0100   //dE/dx needs TRKR_CLUSTER and CYLINDERCELLGEOM_SVTX which need to be in the DST or loaded from a geo file
0101   Fun4AllServer *se = Fun4AllServer::instance();
0102 
0103   GlobalVertexReco* gblvertex = new GlobalVertexReco();
0104   gblvertex->Verbosity(VERBOSITY);
0105   se->registerSubsystem(gblvertex);
0106 
0107 
0108   if (get_trigger_info)
0109   {
0110     TriggerRunInfoReco *triggerruninforeco = new TriggerRunInfoReco();
0111     se->registerSubsystem(triggerruninforeco);
0112   }
0113 }
0114 
0115 void create_hf_directories(std::string reconstruction_name, std::string &final_output_dir, std::string &output_reco_file)
0116 {
0117   std::string output_file_name = kfp_header + reconstruction_name + trailer;
0118   final_output_dir = output_dir + reconstruction_name + "/";
0119   std::string output_reco_dir = final_output_dir + processing_folder;
0120   output_reco_file = output_reco_dir + output_file_name;
0121 
0122   std::string makeDirectory = "mkdir -p " + output_reco_dir;
0123   system(makeDirectory.c_str());
0124 }
0125 
0126 void reconstruct_pipi_mass()
0127 {
0128   Fun4AllServer *se = Fun4AllServer::instance();
0129 
0130   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pipi_reconstruction_name);
0131   kfparticle->Verbosity(VERBOSITY);
0132 
0133   kfparticle->setDecayDescriptor(pipi_decay_descriptor);
0134 
0135   kfparticle->usePID(use_pid);
0136   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0137   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0138   kfparticle->getAllPVInfo(save_all_vtx_info);
0139   kfparticle->allowZeroMassTracks();
0140   kfparticle->use2Dmatching(use_2D_matching);
0141   kfparticle->getTriggerInfo(get_trigger_info);
0142   kfparticle->getDetectorInfo(get_detector_info);
0143   kfparticle->saveDST(save_tracks_to_DST);
0144   kfparticle->saveParticleContainer(false);
0145   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0146 
0147   //PV to SV cuts
0148   kfparticle->constrainToPrimaryVertex(true);
0149   kfparticle->setMotherIPchi2(100);
0150   kfparticle->setFlightDistancechi2(-1.);
0151   kfparticle->setMinDIRA(0.999);
0152   kfparticle->setDecayLengthRange(0.1, FLT_MAX);
0153 
0154   //Track parameters
0155   kfparticle->setMinimumTrackPT(0.0);
0156   kfparticle->setMinimumTrackIPchi2(-1.);
0157   kfparticle->setMinimumTrackIP(-1.);
0158   kfparticle->setMaximumTrackchi2nDOF(100.);
0159   kfparticle->setMinTPChits(25);
0160 
0161   //Vertex parameters
0162   kfparticle->setMaximumVertexchi2nDOF(20);
0163   kfparticle->setMaximumDaughterDCA(0.5); //5 mm
0164 
0165   //Parent parameters
0166   kfparticle->setMotherPT(0);
0167   kfparticle->setMinimumMass(0.40); //Check mass ranges
0168   kfparticle->setMaximumMass(0.60);
0169   kfparticle->setMaximumMotherVertexVolume(0.1);
0170 
0171   kfparticle->setOutputName(pipi_output_reco_file);
0172 
0173   se->registerSubsystem(kfparticle);
0174 }
0175 
0176 void reconstruct_ppi_mass()
0177 {
0178   Fun4AllServer *se = Fun4AllServer::instance();
0179 
0180   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(ppi_reconstruction_name);
0181   kfparticle->Verbosity(VERBOSITY);
0182 
0183   kfparticle->setDecayDescriptor(ppi_decay_descriptor);
0184 
0185   kfparticle->usePID(use_pid);
0186   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0187   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0188   kfparticle->getAllPVInfo(save_all_vtx_info);
0189   kfparticle->allowZeroMassTracks();
0190   kfparticle->use2Dmatching(use_2D_matching);
0191   kfparticle->getTriggerInfo(get_trigger_info);
0192   kfparticle->getDetectorInfo(get_detector_info);
0193   kfparticle->saveDST(save_tracks_to_DST);
0194   kfparticle->saveParticleContainer(false);
0195   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0196 
0197   //PV to SV cuts
0198   kfparticle->constrainToPrimaryVertex(true);
0199   kfparticle->setMotherIPchi2(100);
0200   kfparticle->setFlightDistancechi2(-1.);
0201   kfparticle->setMinDIRA(0.999);
0202   kfparticle->setDecayLengthRange(0.1, FLT_MAX);
0203 
0204   //Track parameters
0205   kfparticle->setMinimumTrackPT(0.0);
0206   kfparticle->setMinimumTrackIPchi2(-1.);
0207   kfparticle->setMinimumTrackIP(-1.);
0208   kfparticle->setMaximumTrackchi2nDOF(100.);
0209   kfparticle->setMinTPChits(25);
0210 
0211   //Vertex parameters
0212   kfparticle->setMaximumVertexchi2nDOF(20);
0213   kfparticle->setMaximumDaughterDCA(0.5); //5 mm
0214 
0215   //Parent parameters
0216   kfparticle->setMotherPT(0);
0217   kfparticle->setMinimumMass(1.0); //Check mass ranges
0218   kfparticle->setMaximumMass(1.2);
0219   kfparticle->setMaximumMotherVertexVolume(0.1);
0220 
0221   kfparticle->setOutputName(ppi_output_reco_file);
0222 
0223   se->registerSubsystem(kfparticle);
0224 }
0225 
0226 void reconstruct_Kstar_mass()
0227 {
0228   Fun4AllServer *se = Fun4AllServer::instance();
0229 
0230   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kstar_reconstruction_name);
0231   kfparticle->Verbosity(VERBOSITY);
0232 
0233   kfparticle->setDecayDescriptor(Kstar_decay_descriptor);
0234 
0235   kfparticle->usePID(use_pid);
0236   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0237   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0238   kfparticle->getAllPVInfo(save_all_vtx_info);
0239   kfparticle->allowZeroMassTracks();
0240   kfparticle->use2Dmatching(use_2D_matching);
0241   kfparticle->getTriggerInfo(get_trigger_info);
0242   kfparticle->getDetectorInfo(get_detector_info);
0243   kfparticle->saveDST(save_tracks_to_DST);
0244   kfparticle->saveParticleContainer(false);
0245   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0246 
0247   //PV to SV cuts
0248   kfparticle->constrainToPrimaryVertex(true);
0249   kfparticle->setMotherIPchi2(100);
0250   kfparticle->setFlightDistancechi2(-1.);
0251   kfparticle->setMinDIRA(-1.1);
0252   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0253 
0254   //Track parameters
0255   kfparticle->setMinimumTrackPT(0.0);
0256   kfparticle->setMinimumTrackIPchi2(-1.);
0257   kfparticle->setMinimumTrackIP(-1.);
0258   kfparticle->setMaximumTrackchi2nDOF(100.);
0259   kfparticle->setMinTPChits(25);
0260 
0261   //Vertex parameters
0262   kfparticle->setMaximumVertexchi2nDOF(20);
0263   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0264 
0265   //Parent parameters
0266   kfparticle->setMotherPT(0);
0267   kfparticle->setMinimumMass(0.8); //Check mass ranges
0268   kfparticle->setMaximumMass(1.0);
0269   kfparticle->setMaximumMotherVertexVolume(0.1);
0270 
0271   kfparticle->setOutputName(Kstar_output_reco_file);
0272 
0273   se->registerSubsystem(kfparticle);
0274 }
0275 
0276 void reconstruct_KK_mass()
0277 {
0278   Fun4AllServer *se = Fun4AllServer::instance();
0279 
0280   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(KK_reconstruction_name);
0281   kfparticle->Verbosity(VERBOSITY);
0282 
0283   kfparticle->setDecayDescriptor(KK_decay_descriptor);
0284 
0285   kfparticle->usePID(use_pid);
0286   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0287   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0288   kfparticle->getAllPVInfo(save_all_vtx_info);
0289   kfparticle->allowZeroMassTracks();
0290   kfparticle->use2Dmatching(use_2D_matching);
0291   kfparticle->getTriggerInfo(get_trigger_info);
0292   kfparticle->getDetectorInfo(get_detector_info);
0293   kfparticle->saveDST(save_tracks_to_DST);
0294   kfparticle->saveParticleContainer(false);
0295   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0296 
0297   //PV to SV cuts
0298   kfparticle->constrainToPrimaryVertex(true);
0299   kfparticle->setMotherIPchi2(100);
0300   kfparticle->setFlightDistancechi2(-1.);
0301   kfparticle->setMinDIRA(-1.1);
0302   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0303 
0304   //Track parameters
0305   kfparticle->setMinimumTrackPT(0.0);
0306   kfparticle->setMinimumTrackIPchi2(-1.);
0307   kfparticle->setMinimumTrackIP(-1.);
0308   kfparticle->setMaximumTrackchi2nDOF(100.);
0309   kfparticle->setMinTPChits(25);
0310 
0311   //Vertex parameters
0312   kfparticle->setMaximumVertexchi2nDOF(20);
0313   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0314 
0315   //Parent parameters
0316   kfparticle->setMotherPT(0);
0317   kfparticle->setMinimumMass(0.9); //Check mass ranges
0318   kfparticle->setMaximumMass(1.1);
0319   kfparticle->setMaximumMotherVertexVolume(0.1);
0320 
0321   kfparticle->setOutputName(KK_output_reco_file);
0322 
0323   se->registerSubsystem(kfparticle);
0324 }
0325 
0326 void reconstruct_Kpi_mass()
0327 {
0328   Fun4AllServer *se = Fun4AllServer::instance();
0329 
0330   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpi_reconstruction_name);
0331   kfparticle->Verbosity(VERBOSITY);
0332 
0333   kfparticle->setDecayDescriptor(Kpi_decay_descriptor);
0334 
0335   kfparticle->usePID(use_pid);
0336   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0337   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0338   kfparticle->getAllPVInfo(save_all_vtx_info);
0339   kfparticle->allowZeroMassTracks();
0340   kfparticle->use2Dmatching(use_2D_matching);
0341   kfparticle->getTriggerInfo(get_trigger_info);
0342   kfparticle->getDetectorInfo(get_detector_info);
0343   kfparticle->saveDST(save_tracks_to_DST);
0344   kfparticle->saveParticleContainer(false);
0345   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0346 
0347   //PV to SV cuts
0348   kfparticle->constrainToPrimaryVertex(true);
0349   kfparticle->setMotherIPchi2(100);
0350   kfparticle->setFlightDistancechi2(-1.);
0351   kfparticle->setMinDIRA(-1.1);
0352   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0353 
0354   //Track parameters
0355   kfparticle->setMinimumTrackPT(0.1);
0356   kfparticle->setMinimumTrackIPchi2(-1.);
0357   kfparticle->setMinimumTrackIP(-1);
0358   kfparticle->setMaximumTrackchi2nDOF(100.);
0359   kfparticle->setMinTPChits(25);
0360 
0361   //Vertex parameters
0362   kfparticle->setMaximumVertexchi2nDOF(20);
0363   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0364 
0365   //Parent parameters
0366   kfparticle->setMotherPT(0);
0367   kfparticle->setMinimumMass(1.50);
0368   kfparticle->setMaximumMass(2.20);
0369   kfparticle->setMaximumMotherVertexVolume(0.1);
0370 
0371   kfparticle->setOutputName(Kpi_output_reco_file);
0372 
0373   se->registerSubsystem(kfparticle);
0374 }
0375 
0376 void reconstruct_Kpipi_mass()
0377 {
0378   Fun4AllServer *se = Fun4AllServer::instance();
0379 
0380   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpipi_reconstruction_name);
0381   kfparticle->Verbosity(VERBOSITY);
0382 
0383   kfparticle->setDecayDescriptor(Kpipi_decay_descriptor);
0384 
0385   kfparticle->usePID(use_pid);
0386   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0387   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0388   kfparticle->getAllPVInfo(save_all_vtx_info);
0389   kfparticle->allowZeroMassTracks();
0390   kfparticle->use2Dmatching(use_2D_matching);
0391   kfparticle->getTriggerInfo(get_trigger_info);
0392   kfparticle->getDetectorInfo(get_detector_info);
0393   kfparticle->saveDST(save_tracks_to_DST);
0394   kfparticle->saveParticleContainer(false);
0395   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0396 
0397   //PV to SV cuts
0398   kfparticle->constrainToPrimaryVertex(true);
0399   kfparticle->setMotherIPchi2(100);
0400   kfparticle->setFlightDistancechi2(-1.);
0401   kfparticle->setMinDIRA(-1.1);
0402   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0403 
0404   //Track parameters
0405   kfparticle->setMinimumTrackPT(0.1);
0406   kfparticle->setMinimumTrackIPchi2(-1.);
0407   kfparticle->setMinimumTrackIP(-1.);
0408   kfparticle->setMaximumTrackchi2nDOF(100.);
0409   kfparticle->setMinTPChits(25);
0410 
0411   //Vertex parameters
0412   kfparticle->setMaximumVertexchi2nDOF(20);
0413   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0414 
0415   //Parent parameters
0416   kfparticle->setMotherPT(0);
0417   kfparticle->setMinimumMass(1.50); //Check mass ranges
0418   kfparticle->setMaximumMass(2.20);
0419   kfparticle->setMaximumMotherVertexVolume(0.1);
0420 
0421   kfparticle->setOutputName(Kpipi_output_reco_file);
0422 
0423   se->registerSubsystem(kfparticle);
0424 }
0425 
0426 void reconstruct_KKpi_mass()
0427 {
0428   Fun4AllServer *se = Fun4AllServer::instance();
0429 
0430   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(KKpi_reconstruction_name);
0431   kfparticle->Verbosity(VERBOSITY);
0432 
0433   kfparticle->setDecayDescriptor(KKpi_decay_descriptor);
0434 
0435   kfparticle->usePID(use_pid);
0436   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0437   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0438   kfparticle->getAllPVInfo(save_all_vtx_info);
0439   kfparticle->allowZeroMassTracks();
0440   kfparticle->use2Dmatching(true);//(use_2D_matching);
0441   kfparticle->getTriggerInfo(get_trigger_info);
0442   kfparticle->getDetectorInfo(get_detector_info);
0443   kfparticle->saveDST(save_tracks_to_DST);
0444   kfparticle->saveParticleContainer(false);
0445   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0446 
0447   //PV to SV cuts
0448   kfparticle->constrainToPrimaryVertex(true);
0449   kfparticle->setMotherIPchi2(10);
0450   kfparticle->setFlightDistancechi2(-1.);
0451   kfparticle->setMinDIRA(0.5);
0452   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0453 
0454   //Track parameters
0455   kfparticle->setMinimumTrackPT(0.0);
0456   kfparticle->setMinimumTrackIPchi2(-1.);
0457   kfparticle->setMinimumTrackIP(-1);
0458   kfparticle->setMaximumTrackchi2nDOF(100.);
0459   kfparticle->setMinTPChits(25);
0460 
0461   //Vertex parameters
0462   kfparticle->setMaximumVertexchi2nDOF(20);
0463   kfparticle->setMaximumDaughterDCA(0.02); //1 mm
0464 
0465   //Parent parameters
0466   kfparticle->setMotherPT(0);
0467   kfparticle->setMinimumMass(1.50);
0468   kfparticle->setMaximumMass(2.20);
0469   kfparticle->setMaximumMotherVertexVolume(0.1);
0470 
0471   //Intermediate parameters
0472   kfparticle->constrainIntermediateMasses(constrain_phi_mass);
0473 
0474   std::vector<std::pair<float, float>> intermediate_mass_range;
0475   intermediate_mass_range.push_back(make_pair(0.98, 1.05));
0476   kfparticle->setIntermediateMassRange(intermediate_mass_range);
0477 
0478   std::vector<float> intermediate_min_pt = {0.};
0479   kfparticle->setIntermediateMinPT(intermediate_min_pt);
0480 
0481   std::vector<std::pair<float, float>> intermediate_IP_range;
0482   intermediate_IP_range.push_back(make_pair(-1., FLT_MAX));
0483   kfparticle->setIntermediateIPRange(intermediate_IP_range);
0484 
0485   std::vector<std::pair<float, float>> intermediate_IPchi2_range;
0486   intermediate_IPchi2_range.push_back(make_pair(0., 400.));
0487   kfparticle->setIntermediateIPchi2Range(intermediate_IPchi2_range);
0488 
0489   std::vector<float> intermediate_min_dira = {-1.1};
0490   kfparticle->setIntermediateMinDIRA(intermediate_min_dira);
0491 
0492   std::vector<float> intermediate_min_FDchi2 = {-1.};
0493   kfparticle->setIntermediateMinFDchi2(intermediate_min_FDchi2);
0494 
0495   std::vector<float> intermediate_max_vertex_vol = {0.1};
0496   kfparticle->setIntermediateMaxVertexVolume(intermediate_max_vertex_vol);
0497 
0498   kfparticle->setOutputName(KKpi_output_reco_file);
0499 
0500   se->registerSubsystem(kfparticle);
0501 }
0502 
0503 void reconstruct_pKpi_mass()
0504 {
0505   Fun4AllServer *se = Fun4AllServer::instance();
0506 
0507   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pKpi_reconstruction_name);
0508   kfparticle->Verbosity(VERBOSITY);
0509 
0510   kfparticle->setDecayDescriptor(pKpi_decay_descriptor);
0511 
0512   kfparticle->usePID(use_pid);
0513   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0514   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0515   kfparticle->getAllPVInfo(save_all_vtx_info);
0516   kfparticle->allowZeroMassTracks();
0517   kfparticle->use2Dmatching(use_2D_matching);
0518   kfparticle->getTriggerInfo(get_trigger_info);
0519   kfparticle->getDetectorInfo(get_detector_info);
0520   kfparticle->saveDST(save_tracks_to_DST);
0521   kfparticle->saveParticleContainer(false);
0522   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0523 
0524   //PV to SV cuts
0525   kfparticle->constrainToPrimaryVertex(true);
0526   kfparticle->setMotherIPchi2(100);
0527   kfparticle->setFlightDistancechi2(-1.);
0528   kfparticle->setMinDIRA(-1.1);
0529   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0530 
0531   //Track parameters
0532   kfparticle->setMinimumTrackPT(0.2);
0533   kfparticle->setMinimumTrackIPchi2(-1.);
0534   kfparticle->setMinimumTrackIP(-1.);
0535   kfparticle->setMaximumTrackchi2nDOF(100.);
0536   kfparticle->setMinTPChits(25);
0537 
0538   //Vertex parameters
0539   kfparticle->setMaximumVertexchi2nDOF(20);
0540   kfparticle->setMaximumDaughterDCA(0.1); //1 mm
0541 
0542   //Parent parameters
0543   kfparticle->setMotherPT(0);
0544   kfparticle->setMinimumMass(2.10); //Check mass ranges
0545   kfparticle->setMaximumMass(2.60);
0546   kfparticle->setMaximumMotherVertexVolume(0.1);
0547 
0548   kfparticle->setOutputName(pKpi_output_reco_file);
0549 
0550   se->registerSubsystem(kfparticle);
0551 }
0552 
0553 void reconstruct_Dstar_mass()
0554 {
0555 /*
0556   Fun4AllServer *se = Fun4AllServer::instance();
0557 
0558   DstarReco *myDstarReco = new DstarReco();
0559   myDstarReco->setOutputName(Dstar_output_reco_file);
0560   se->registerSubsystem(myDstarReco);
0561 */
0562 }
0563 
0564 void end_kfparticle(std::string full_file_name, std::string final_path)
0565 {
0566   ifstream file(full_file_name.c_str());
0567   if (file.good())
0568   {
0569     string moveOutput = "mv " + full_file_name + " " + final_path;
0570     system(moveOutput.c_str());
0571   }
0572 }