Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include <g4main/Fun4AllDstPileupInputManager.h>
0002 
0003 #include <G4_Magnet.C>
0004 #include <G4_Tracking.C>
0005 #include <QA.C>
0006 
0007 #include <FROG.h>
0008 #include <fun4all/Fun4AllDstInputManager.h>
0009 
0010 #include <g4eval/SvtxEvaluator.h>
0011 #include <g4eval/SvtxTruthRecoTableEval.h>
0012 
0013 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
0014 
0015 R__LOAD_LIBRARY(libfun4all.so)
0016 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
0017 
0018 using namespace std;
0019 
0020 /****************************/
0021 /*     MDC2 Reco for MDC2   */
0022 /* Cameron Dean, LANL, 2021 */
0023 /*      cdean@bnl.gov       */
0024 /****************************/
0025 
0026 void CommAnaTrackSelection(vector<string> myInputLists = {"/sphenix/u/rosstom/analysis/FilterEvents/macro/test.root"}, const int nEvents = 10)
0027 {
0028   //Create the server
0029   Fun4AllServer *se = Fun4AllServer::instance();
0030   se->Verbosity(INT_MAX);
0031 
0032   //Add all required input files
0033   for (unsigned int i = 0; i < myInputLists.size(); ++i)
0034   {
0035     Fun4AllInputManager *infile = new Fun4AllDstInputManager("DSTin_" + to_string(i));
0036     infile->fileopen(myInputLists[i]);
0037     se->registerInputManager(infile);
0038   }
0039 
0040   //auto in = new Fun4AllDstInputManager("DSTin1");
0041   //in->fileopen(myInputLists[0]);
0042   //se->registerInputManager(in);
0043 
0044   Enable::MVTX = true;
0045   Enable::INTT = true;
0046   Enable::TPC = true;
0047   Enable::TPC_ABSORBER = true;
0048   Enable::MICROMEGAS=true;
0049   
0050   G4MAGNET::magfield_rescale = 1.;
0051   MagnetInit();
0052   MagnetFieldInit();
0053 
0054   //Mvtx_Cells();
0055   //Intt_Cells();
0056   //TPC_Cells();
0057   //Micromegas_Cells();
0058   
0059   TrackingInit();
0060  
0061   Tracking_Reco_TrackFit(); //PHACTSTrackFitter, cut out this section  
0062 
0063   string decayDescriptor = "[D0 -> K^- pi^+]cc"; 
0064 
0065   KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("CommAnaTrackSelection");
0066   kfparticle->Verbosity(INT_MAX);
0067 
0068   kfparticle->setDecayDescriptor(decayDescriptor);
0069 
0070   kfparticle->doTruthMatching(false);
0071   kfparticle->getDetectorInfo(false);
0072   kfparticle->getCaloInfo(false);
0073   kfparticle->getAllPVInfo(false);
0074   kfparticle->allowZeroMassTracks(true);
0075   kfparticle->saveDST(true);
0076   kfparticle->saveParticleContainer(true);
0077   kfparticle->saveOutput(true); //false in final system, true for debugging
0078 
0079   bool fixToPV = true;
0080   bool useFakePV = false;
0081 
0082   if (useFakePV)
0083   {
0084     fixToPV = false;  //Constraining to a fake PV results in some gibberish variables
0085     kfparticle->useFakePrimaryVertex(true);
0086   }
0087 
0088   if (fixToPV)
0089   {
0090     kfparticle->constrainToPrimaryVertex(true);
0091     kfparticle->setMotherIPchi2(5000);
0092     kfparticle->setFlightDistancechi2(-1.);
0093     kfparticle->setMinDIRA(-1.1);
0094   }
0095 
0096   //Track parameters
0097   kfparticle->setMinimumTrackPT(0.0);
0098   kfparticle->setMinimumTrackIPchi2(-1.0);
0099   kfparticle->setMinimumTrackIP(-0.01);
0100   kfparticle->setMaximumTrackchi2nDOF(200);
0101 
0102   kfparticle->setMaximumVertexchi2nDOF(200);
0103   kfparticle->setMaximumDaughterDCA(1);
0104 
0105   //Parent parameters
0106   kfparticle->setMotherPT(0);
0107   kfparticle->setMinimumMass(1.7);
0108   kfparticle->setMaximumMass(2.1);
0109  
0110   kfparticle->setOutputName("outputKFP.root"); 
0111 
0112   se->registerSubsystem(kfparticle); 
0113 
0114   se->run(nEvents);
0115   
0116   se->End();
0117 
0118   std::cout << "All done" << std::endl;
0119   delete se;
0120   gSystem->Exit(0);
0121 
0122   return;
0123 }