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