Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-07 08:10:32

0001 #include <fun4all/Fun4AllServer.h>
0002 
0003 #include <calotrigger/TriggerRunInfoReco.h>
0004 #include <globalvertex/GlobalVertexReco.h>
0005 
0006 #include <kfparticleqa/QAKFParticle.h>
0007 #include <kfparticleqa/QAKFParticleTrackPtAsymmetry.h>
0008 
0009 #pragma GCC diagnostic push
0010 
0011 #pragma GCC diagnostic ignored "-Wundefined-internal"
0012 
0013 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
0014 
0015 #pragma GCC diagnostic pop
0016 
0017 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0018 R__LOAD_LIBRARY(libcalotrigger.so)
0019 R__LOAD_LIBRARY(libkfparticleqa.so)
0020 
0021 namespace HeavyFlavorReco
0022 {
0023   int VERBOSITY_HF = 0;
0024 
0025   bool run_pipi_reco = true;
0026   bool run_ppi_reco = true; // set to true if needed
0027   bool run_KK_reco = false; // set to true if needed
0028   bool run_Kpi_reco = true; // set to true if needed
0029   bool run_Lambdapi_reco = false; // set to true if needed
0030 
0031   std::string output_dir = "./"; //Top dir of where the output nTuples will be written
0032   std::string kfp_header = "outputKFParticle_";
0033   std::string processing_folder = "inReconstruction/";
0034   std::string trailer = ".root";
0035 
0036   // https://wiki.bnl.gov/sPHENIX/index.php/KFParticle
0037   std::string pipi_decay_descriptor = "K_S0 -> pi^+ pi^-"; //See twiki on how to set this
0038   std::string pipi_reconstruction_name = "pipi_reco"; //Used for naming output folder, file and node
0039   std::string pipi_output_reco_file;
0040   std::string pipi_output_dir;
0041 
0042   std::string ppi_decay_descriptor = "[Lambda0 -> proton^+ pi^-]cc"; //See twiki on how to set this
0043   std::string ppi_reconstruction_name = "ppi_reco"; //Used for naming output folder, file and node
0044   std::string ppi_output_reco_file;
0045   std::string ppi_output_dir;
0046 
0047   std::string KK_decay_descriptor = "phi -> K^+ K^-"; //See twiki on how to set this
0048   std::string KK_reconstruction_name = "KK_reco"; //Used for naming output folder, file and node
0049   std::string KK_output_reco_file;
0050   std::string KK_output_dir;
0051 
0052   std::string Kpi_decay_descriptor = "[D0 -> K^- pi^+]cc"; //See twiki on how to set this
0053   std::string Kpi_reconstruction_name = "Kpi_reco"; //Used for naming output folder, file and node
0054   std::string Kpi_output_reco_file;
0055   std::string Kpi_output_dir;
0056 
0057   std::string Lambdapi_decay_descriptor = "[Xi- -> {Lambda0 -> proton^+ pi^-} pi^-]cc"; //See twiki on how to set this
0058   std::string Lambdapi_reconstruction_name = "Lambdapi_reco"; //Used for naming output folder, file and node
0059   std::string Lambdapi_output_reco_file;
0060   std::string Lambdapi_output_dir;
0061 
0062   bool save_kfpntuple = true;
0063   bool use_pid = false;
0064   bool save_tracks_to_DST = true;
0065   bool dont_use_global_vertex = true;
0066   bool require_track_and_vertex_match = true;
0067   bool save_all_vtx_info = true;
0068   bool constrain_phi_mass = true;
0069   bool use_2D_matching = false;
0070   bool get_trigger_info = false;
0071   bool get_detector_info = false; //was true
0072   bool get_dEdx_info = false; //was true
0073   float pid_frac = 0.6;
0074   bool constrain_lambda_mass = true;
0075 
0076   //Used
0077   float lf_cuts_setMinDIRA{0.99};
0078   float lf_cuts_setDecayLengthRange_min{0.05};
0079   float lf_cuts_setMinimumTrackIP_XY{0.05};
0080   float lf_cuts_setMinMVTXhits{1};
0081   float lf_cuts_setMinINTThits{1};
0082   float lf_cuts_setMinTPChits{20};
0083   float lf_cuts_setMaximumVertexchi2nDOF{20};
0084   float lf_cuts_setMaximumDaughterDCA{0.5};
0085 
0086   //Unused
0087   float lf_cuts_setMotherIPchi2{FLT_MAX};
0088   float lf_cuts_setFlightDistancechi2{-1.};
0089   float lf_cuts_setMinDIRA_XY{-1.1};
0090   float lf_cuts_setDecayLengthRange_max{FLT_MAX};
0091   float lf_cuts_setDecayLengthRange_XY_min{-10.};
0092   float lf_cuts_setDecayLengthRange_XY_max{FLT_MAX};
0093   float lf_cuts_setDecayTimeRange_XY_min{-10000};
0094   float lf_cuts_setDecayTimeRange_XY_max{FLT_MAX};
0095   float lf_cuts_setDecayTimeRange_min{-10000};
0096   float lf_cuts_setDecayTimeRange_max{FLT_MAX};
0097   float lf_cuts_setMinDecayTimeSignificance{-1e5};
0098   float lf_cuts_setMinDecayLengthSignificance{-1e5};
0099   float lf_cuts_setMinDecayLengthSignificance_XY{-1e5};
0100   float lf_cuts_setMinimumTrackPT{0.0};
0101   float lf_cuts_setMinimumTrackIPchi2{-1.};
0102   float lf_cuts_setMinimumTrackIPchi2_XY{-1.};
0103   float lf_cuts_setMinimumTrackIP{-1.};
0104   float lf_cuts_setMaximumTrackchi2nDOF{300.};
0105   float lf_cuts_setMaximumDaughterDCA_XY{1};
0106   float lf_cuts_setMotherPT{0};
0107   float lf_cuts_setMaximumMotherVertexVolume{0.1};
0108 };  // namespace HeavyFlavorReco'
0109 
0110 using namespace HeavyFlavorReco;
0111 
0112 void init_kfp_dependencies()
0113 {
0114   //dE/dx needs TRKR_CLUSTER and CYLINDERCELLGEOM_SVTX which need to be in the DST or loaded from a geo file
0115   Fun4AllServer *se = Fun4AllServer::instance();
0116 
0117   GlobalVertexReco* gblvertex = new GlobalVertexReco();
0118   gblvertex->Verbosity(VERBOSITY_HF);
0119   se->registerSubsystem(gblvertex);
0120 
0121 
0122   if (get_trigger_info)
0123   {
0124     TriggerRunInfoReco *triggerruninforeco = new TriggerRunInfoReco();
0125     se->registerSubsystem(triggerruninforeco);
0126   }
0127 }
0128 
0129 void create_hf_directories(std::string reconstruction_name, std::string &final_output_dir, std::string &output_reco_file)
0130 {
0131   std::string output_file_name = kfp_header + reconstruction_name + trailer;
0132   final_output_dir = output_dir + reconstruction_name + "/";
0133   std::string output_reco_dir = final_output_dir + processing_folder;
0134   output_reco_file = output_reco_dir + output_file_name;
0135 
0136   std::string makeDirectory = "mkdir -p " + output_reco_dir;
0137   system(makeDirectory.c_str());
0138 }
0139 
0140 void reconstruct_pipi_mass()
0141 {
0142   Fun4AllServer *se = Fun4AllServer::instance();
0143 
0144   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(pipi_reconstruction_name);
0145   kfparticle->Verbosity(10);
0146 
0147   kfparticle->setDecayDescriptor(pipi_decay_descriptor);
0148 
0149   kfparticle->saveOutput(save_kfpntuple);
0150 
0151   kfparticle->usePID(use_pid);
0152   kfparticle->setPIDacceptFraction(pid_frac);
0153   kfparticle->get_dEdx_info();
0154   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0155   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0156   kfparticle->getAllPVInfo(save_all_vtx_info);
0157   kfparticle->allowZeroMassTracks();
0158   kfparticle->use2Dmatching(use_2D_matching);
0159   kfparticle->getTriggerInfo(get_trigger_info);
0160   kfparticle->getDetectorInfo(get_detector_info);
0161   kfparticle->saveDST(save_tracks_to_DST);
0162   kfparticle->setContainerName(pipi_reconstruction_name);
0163   kfparticle->saveParticleContainer(true);
0164   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0165 
0166   //PV to SV cuts
0167   kfparticle->constrainToPrimaryVertex();
0168   kfparticle->setMotherIPchi2(lf_cuts_setMotherIPchi2);
0169   kfparticle->setFlightDistancechi2(lf_cuts_setFlightDistancechi2);
0170   kfparticle->setMinDIRA(lf_cuts_setMinDIRA);
0171   kfparticle->setMinDIRA_XY(lf_cuts_setMinDIRA_XY);
0172   kfparticle->setDecayLengthRange(lf_cuts_setDecayLengthRange_min, lf_cuts_setDecayLengthRange_max);
0173   kfparticle->setDecayLengthRange_XY(lf_cuts_setDecayLengthRange_XY_min, lf_cuts_setDecayLengthRange_XY_max);
0174   kfparticle->setDecayTimeRange_XY(lf_cuts_setDecayTimeRange_XY_min, lf_cuts_setDecayTimeRange_XY_max);
0175   kfparticle->setDecayTimeRange(lf_cuts_setDecayTimeRange_min, lf_cuts_setDecayTimeRange_max);
0176   kfparticle->setMinDecayTimeSignificance(lf_cuts_setMinDecayTimeSignificance);
0177   kfparticle->setMinDecayLengthSignificance(lf_cuts_setMinDecayLengthSignificance);
0178   kfparticle->setMinDecayLengthSignificance_XY(lf_cuts_setMinDecayLengthSignificance_XY);
0179 
0180   //Track parameters
0181   kfparticle->setMinimumTrackPT(lf_cuts_setMinimumTrackPT);
0182   kfparticle->setMinimumTrackIPchi2(lf_cuts_setMinimumTrackIPchi2);
0183   kfparticle->setMinimumTrackIPchi2_XY(lf_cuts_setMinimumTrackIPchi2_XY);
0184   kfparticle->setMinimumTrackIP(lf_cuts_setMinimumTrackIP);
0185   kfparticle->setMinimumTrackIP_XY(lf_cuts_setMinimumTrackIP_XY);
0186   kfparticle->setMaximumTrackchi2nDOF(lf_cuts_setMaximumTrackchi2nDOF);
0187   kfparticle->setMinMVTXhits(lf_cuts_setMinMVTXhits);
0188   kfparticle->setMinINTThits(lf_cuts_setMinINTThits);
0189   kfparticle->setMinTPChits(lf_cuts_setMinTPChits);
0190 
0191   //Vertex parameters
0192   kfparticle->setMaximumVertexchi2nDOF(lf_cuts_setMaximumVertexchi2nDOF);
0193   kfparticle->setMaximumDaughterDCA(lf_cuts_setMaximumDaughterDCA);
0194   kfparticle->setMaximumDaughterDCA_XY(lf_cuts_setMaximumDaughterDCA_XY);
0195 
0196   //Parent parameters
0197   kfparticle->setMotherPT(lf_cuts_setMotherPT);
0198   kfparticle->setMinimumMass(0.40);
0199   kfparticle->setMaximumMass(0.60);
0200   kfparticle->setMaximumMotherVertexVolume(lf_cuts_setMaximumMotherVertexVolume);
0201   kfparticle->setOutputName(pipi_output_reco_file);
0202 
0203   se->registerSubsystem(kfparticle);
0204 
0205   QAKFParticle *kfpqa = new QAKFParticle("QAKFParticle_K_S0","K_S0",0.4,0.6);
0206   kfpqa->setKFParticleNodeName(pipi_reconstruction_name);
0207   kfpqa->enableTrackPtAsymmetry(true); 
0208   kfpqa->Verbosity(VERBOSITY_HF);
0209   //se->registerSubsystem(kfpqa);
0210 
0211 }
0212 
0213 void reconstruct_KK_mass()
0214 {
0215   Fun4AllServer *se = Fun4AllServer::instance();
0216 
0217   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(KK_reconstruction_name);
0218 
0219   kfparticle->setDecayDescriptor(KK_decay_descriptor);
0220   kfparticle->saveOutput(save_kfpntuple);
0221 
0222   kfparticle->usePID(use_pid);
0223   kfparticle->setPIDacceptFraction(pid_frac);
0224   kfparticle->get_dEdx_info();
0225   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0226   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0227   kfparticle->getAllPVInfo(save_all_vtx_info);
0228   kfparticle->allowZeroMassTracks();
0229   kfparticle->use2Dmatching(use_2D_matching);
0230   kfparticle->getTriggerInfo(get_trigger_info);
0231   kfparticle->getDetectorInfo(get_detector_info);
0232   kfparticle->saveDST(save_tracks_to_DST);
0233   kfparticle->setContainerName(KK_reconstruction_name);
0234   kfparticle->saveParticleContainer(true);
0235   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0236 
0237   //PV to SV cuts
0238   kfparticle->constrainToPrimaryVertex();
0239   kfparticle->setMotherIPchi2(100);
0240   kfparticle->setFlightDistancechi2(-1.);
0241 
0242   //Track parameters
0243   kfparticle->setMinimumTrackPT(0.1);
0244   kfparticle->setMaximumTrackPT(0.7);
0245   kfparticle->setMaximumTrackchi2nDOF(100.);
0246   kfparticle->setMinTPChits(25);
0247   kfparticle->setMinMVTXhits(1);
0248   kfparticle->setMinINTThits(0);
0249 
0250   //Vertex parameters
0251   kfparticle->setMaximumVertexchi2nDOF(20);
0252   kfparticle->setMaximumDaughterDCA(0.05);
0253   kfparticle->setMaximumDaughterDCA_XY(100);
0254 
0255   //Parent parameters
0256   kfparticle->setMotherPT(0);
0257   kfparticle->setMinimumMass(0.98);
0258   kfparticle->setMaximumMass(1.1);
0259   kfparticle->setMaximumMotherVertexVolume(0.1);
0260 
0261   se->registerSubsystem(kfparticle);
0262 
0263   QAKFParticle *kfpqa = new QAKFParticle("QAKFParticle_phi","phi",0.98,1.1);
0264   kfpqa->setKFParticleNodeName(KK_reconstruction_name);
0265   se->registerSubsystem(kfpqa);
0266 }
0267 
0268 void reconstruct_ppi_mass()
0269 {
0270   Fun4AllServer *se = Fun4AllServer::instance();
0271 
0272   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(ppi_reconstruction_name);
0273 
0274   kfparticle->setDecayDescriptor(ppi_decay_descriptor);
0275   kfparticle->saveOutput(save_kfpntuple);
0276 
0277   kfparticle->usePID(use_pid);
0278   kfparticle->setPIDacceptFraction(pid_frac);
0279   kfparticle->get_dEdx_info();
0280   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0281   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0282   kfparticle->getAllPVInfo(save_all_vtx_info);
0283   kfparticle->allowZeroMassTracks();
0284   kfparticle->use2Dmatching(use_2D_matching);
0285   kfparticle->getTriggerInfo(get_trigger_info);
0286   kfparticle->getDetectorInfo(get_detector_info);
0287   kfparticle->saveDST(save_tracks_to_DST);
0288   kfparticle->setContainerName(ppi_reconstruction_name);
0289   kfparticle->saveParticleContainer(true);
0290   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0291 
0292   //PV to SV cuts
0293   kfparticle->constrainToPrimaryVertex();
0294   kfparticle->setMotherIPchi2(lf_cuts_setMotherIPchi2);
0295   kfparticle->setFlightDistancechi2(lf_cuts_setFlightDistancechi2);
0296   kfparticle->setMinDIRA(lf_cuts_setMinDIRA);
0297   kfparticle->setMinDIRA_XY(lf_cuts_setMinDIRA_XY);
0298   kfparticle->setDecayLengthRange(lf_cuts_setDecayLengthRange_min, lf_cuts_setDecayLengthRange_max);
0299   kfparticle->setDecayLengthRange_XY(lf_cuts_setDecayLengthRange_XY_min, lf_cuts_setDecayLengthRange_XY_max);
0300   kfparticle->setDecayTimeRange_XY(lf_cuts_setDecayTimeRange_XY_min, lf_cuts_setDecayTimeRange_XY_max);
0301   kfparticle->setDecayTimeRange(lf_cuts_setDecayTimeRange_min, lf_cuts_setDecayTimeRange_max);
0302   kfparticle->setMinDecayTimeSignificance(lf_cuts_setMinDecayTimeSignificance);
0303   kfparticle->setMinDecayLengthSignificance(lf_cuts_setMinDecayLengthSignificance);
0304   kfparticle->setMinDecayLengthSignificance_XY(lf_cuts_setMinDecayLengthSignificance_XY);
0305 
0306   //Track parameters
0307   kfparticle->setMinimumTrackPT(lf_cuts_setMinimumTrackPT);
0308   kfparticle->setMinimumTrackIPchi2(lf_cuts_setMinimumTrackIPchi2);
0309   kfparticle->setMinimumTrackIPchi2_XY(lf_cuts_setMinimumTrackIPchi2_XY);
0310   kfparticle->setMinimumTrackIP(lf_cuts_setMinimumTrackIP);
0311   kfparticle->setMinimumTrackIP_XY(lf_cuts_setMinimumTrackIP_XY);
0312   kfparticle->setMaximumTrackchi2nDOF(lf_cuts_setMaximumTrackchi2nDOF);
0313   kfparticle->setMinMVTXhits(lf_cuts_setMinMVTXhits);
0314   kfparticle->setMinINTThits(lf_cuts_setMinINTThits);
0315   kfparticle->setMinTPChits(lf_cuts_setMinTPChits);
0316 
0317   //Vertex parameters
0318   kfparticle->setMaximumVertexchi2nDOF(lf_cuts_setMaximumVertexchi2nDOF);
0319   kfparticle->setMaximumDaughterDCA(lf_cuts_setMaximumDaughterDCA);
0320   kfparticle->setMaximumDaughterDCA_XY(lf_cuts_setMaximumDaughterDCA_XY);
0321 
0322   //Parent parameters
0323   kfparticle->setMotherPT(lf_cuts_setMotherPT);
0324   kfparticle->setMinimumMass(1.08);
0325   kfparticle->setMaximumMass(1.15);
0326   kfparticle->setMaximumMotherVertexVolume(lf_cuts_setMaximumMotherVertexVolume);
0327   kfparticle->setOutputName(ppi_output_reco_file);
0328 
0329   se->registerSubsystem(kfparticle);
0330 
0331   QAKFParticle *kfpqa = new QAKFParticle("QAKFParticle_Lambda0","Lambda0",1.08,1.15);
0332   kfpqa->setKFParticleNodeName(ppi_reconstruction_name);
0333   //se->registerSubsystem(kfpqa);
0334 }
0335 
0336 void reconstruct_Kpi_mass()
0337 {
0338   Fun4AllServer *se = Fun4AllServer::instance();
0339 
0340   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Kpi_reconstruction_name);
0341   kfparticle->Verbosity(0);
0342 
0343   kfparticle->setDecayDescriptor(Kpi_decay_descriptor);
0344   kfparticle->saveOutput(save_kfpntuple);
0345 
0346   kfparticle->usePID(use_pid);
0347   kfparticle->setPIDacceptFraction(pid_frac);
0348   kfparticle->get_dEdx_info();
0349   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0350   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0351   kfparticle->getAllPVInfo(save_all_vtx_info);
0352   kfparticle->allowZeroMassTracks();
0353   kfparticle->use2Dmatching(use_2D_matching);
0354   kfparticle->getTriggerInfo(get_trigger_info);
0355   kfparticle->getDetectorInfo(get_detector_info);
0356   kfparticle->saveDST(save_tracks_to_DST);
0357   kfparticle->setContainerName(Kpi_reconstruction_name);
0358   kfparticle->saveParticleContainer(true);
0359   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0360 
0361   //PV to SV cuts
0362   kfparticle->constrainToPrimaryVertex();
0363   //kfparticle->setMotherIPchi2(100);
0364   kfparticle->setMotherIPchi2(FLT_MAX);
0365   kfparticle->setFlightDistancechi2(-1.);
0366   kfparticle->setMinDIRA(0.95);
0367   kfparticle->setMinDIRA_XY(-1.1);
0368   kfparticle->setDecayLengthRange(0., FLT_MAX);
0369   kfparticle->setDecayLengthRange_XY(-10., FLT_MAX);
0370   kfparticle->setDecayTimeRange_XY(-10000, FLT_MAX);
0371   kfparticle->setDecayTimeRange(-10000, FLT_MAX);
0372   kfparticle->setMinDecayTimeSignificance(-1e5);
0373   kfparticle->setMinDecayLengthSignificance(-1e5);
0374   kfparticle->setMinDecayLengthSignificance_XY(-1e5);
0375 
0376   //Track parameters
0377   kfparticle->setMinimumTrackPT(0.0);
0378   kfparticle->setMinimumTrackIPchi2(-1.);
0379   kfparticle->setMinimumTrackIPchi2_XY(-1.);
0380   kfparticle->setMinimumTrackIP(-1.);
0381   kfparticle->setMinimumTrackIP_XY(0.005);
0382   kfparticle->setMaximumTrackchi2nDOF(300.);
0383   kfparticle->setMinMVTXhits(1);
0384   kfparticle->setMinINTThits(1);
0385   kfparticle->setMinTPChits(20);
0386 
0387   //Vertex parameters
0388   kfparticle->setMaximumVertexchi2nDOF(20);
0389   kfparticle->setMaximumDaughterDCA(0.1);
0390   kfparticle->setMaximumDaughterDCA_XY(100);
0391 
0392   //Parent parameters
0393   kfparticle->setMotherPT(0);
0394   kfparticle->setMinimumMass(1.75);
0395   kfparticle->setMaximumMass(1.95);
0396   kfparticle->setMaximumMotherVertexVolume(0.1);
0397   kfparticle->setOutputName(Kpi_output_reco_file);
0398 
0399   se->registerSubsystem(kfparticle);
0400 
0401   QAKFParticle *kfpqa = new QAKFParticle("QAKFParticle_D0","D0",1.75,1.95);
0402   kfpqa->setKFParticleNodeName(Kpi_reconstruction_name);
0403   //se->registerSubsystem(kfpqa);
0404 }
0405 
0406 void reconstruct_Lambdapi_mass()
0407 {
0408   Fun4AllServer *se = Fun4AllServer::instance();
0409 
0410   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX(Lambdapi_reconstruction_name);
0411   kfparticle->Verbosity(VERBOSITY_HF);
0412 
0413   kfparticle->setDecayDescriptor(Lambdapi_decay_descriptor);
0414 
0415   kfparticle->usePID(use_pid);
0416   //kfparticle->setPIDacceptFraction(pid_frac);
0417   kfparticle->dontUseGlobalVertex(dont_use_global_vertex);
0418   kfparticle->requireTrackVertexBunchCrossingMatch(require_track_and_vertex_match);
0419   kfparticle->getAllPVInfo(save_all_vtx_info);
0420   kfparticle->allowZeroMassTracks();
0421   kfparticle->use2Dmatching(use_2D_matching);
0422   kfparticle->getTriggerInfo(get_trigger_info);
0423   kfparticle->getDetectorInfo(get_detector_info);
0424   kfparticle->saveDST(save_tracks_to_DST);
0425   kfparticle->setContainerName(Lambdapi_reconstruction_name);
0426   kfparticle->magFieldFile("FIELDMAP_TRACKING");
0427 
0428   //PV to SV cuts
0429   kfparticle->constrainToPrimaryVertex(true);
0430   kfparticle->setMotherIPchi2(100);
0431   kfparticle->setFlightDistancechi2(-1.);
0432   kfparticle->setMinDIRA(-1.1);
0433   kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
0434 
0435   //Track parameters
0436   kfparticle->setMinimumTrackPT(0.1);
0437   kfparticle->setMaximumTrackchi2nDOF(400.);
0438   kfparticle->setMinTPChits(20);
0439   kfparticle->setMinMVTXhits(1);
0440   kfparticle->setMinINTThits(1);
0441   kfparticle->setMinimumTrackIP_XY(-100.);
0442   kfparticle->setMinimumTrackIPchi2_XY(-1000.);
0443   kfparticle->setMinimumTrackIP(-100.);
0444   kfparticle->setMinimumTrackIPchi2(-1000.);
0445 
0446   //Vertex parameters
0447   kfparticle->setMaximumVertexchi2nDOF(50);
0448   kfparticle->setMaximumDaughterDCA(0.5); //1 mm
0449 
0450   //Parent parameters
0451   kfparticle->setMotherPT(0);
0452   kfparticle->setMinimumMass(1.2); //Check mass ranges
0453   kfparticle->setMaximumMass(1.5);
0454   kfparticle->setMaximumMotherVertexVolume(0.1);
0455 
0456   //Intermediate parameters
0457   kfparticle->constrainIntermediateMasses(constrain_lambda_mass);
0458 
0459   std::vector<std::pair<float, float>> intermediate_mass_range;
0460   intermediate_mass_range.push_back(make_pair(1.08, 1.15));
0461   kfparticle->setIntermediateMassRange(intermediate_mass_range);
0462 
0463   std::vector<float> intermediate_min_pt = {0.0};
0464   kfparticle->setIntermediateMinPT(intermediate_min_pt);
0465 
0466   std::vector<std::pair<float, float>> intermediate_IP_range;
0467   intermediate_IP_range.push_back(make_pair(-1., FLT_MAX));
0468   kfparticle->setIntermediateIPRange(intermediate_IP_range);
0469 
0470   std::vector<std::pair<float, float>> intermediate_IPchi2_range;
0471   intermediate_IPchi2_range.push_back(make_pair(-1., FLT_MAX));
0472   kfparticle->setIntermediateIPchi2Range(intermediate_IPchi2_range);
0473 
0474   std::vector<float> intermediate_min_dira = {-1.1};
0475   kfparticle->setIntermediateMinDIRA(intermediate_min_dira);
0476 
0477   std::vector<float> intermediate_min_FDchi2 = {-1.};
0478   kfparticle->setIntermediateMinFDchi2(intermediate_min_FDchi2);
0479 
0480   std::vector<float> intermediate_max_vertex_vol = {1.1};
0481   kfparticle->setIntermediateMaxVertexVolume(intermediate_max_vertex_vol);
0482 
0483   std::vector<std::pair<float, float>> intermediate_IPxy_range;
0484   intermediate_IPxy_range.push_back(make_pair(-1., FLT_MAX));
0485   kfparticle->setIntermediateIPRange_XY(intermediate_IPxy_range);
0486 
0487   std::vector<std::pair<float, float>> intermediate_IPchi2xy_range;
0488   intermediate_IPchi2xy_range.push_back(make_pair(-1., FLT_MAX));
0489   kfparticle->setIntermediateIPchi2Range_XY(intermediate_IPchi2xy_range);
0490 
0491   kfparticle->setOutputName(Lambdapi_output_reco_file);
0492 
0493   se->registerSubsystem(kfparticle);
0494 }
0495 
0496 void end_kfparticle(std::string full_file_name, std::string final_path)
0497 {
0498   ifstream file(full_file_name.c_str());
0499   if (file.good())
0500   {
0501     string moveOutput = "mv " + full_file_name + " " + final_path;
0502     system(moveOutput.c_str());
0503   }
0504 }