Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommAnaTrackSelection.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CommAnaTrackSelection.C
2 
3 #include <G4_Magnet.C>
4 #include <G4_Tracking.C>
5 #include <QA.C>
6 
7 #include <FROG.h>
9 
10 #include <g4eval/SvtxEvaluator.h>
12 
13 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
14 
15 R__LOAD_LIBRARY(libfun4all.so)
16 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
17 
18 using namespace std;
19 
20 /****************************/
21 /* MDC2 Reco for MDC2 */
22 /* Cameron Dean, LANL, 2021 */
23 /* cdean@bnl.gov */
24 /****************************/
25 
26 void CommAnaTrackSelection(vector<string> myInputLists = {"/sphenix/u/rosstom/analysis/FilterEvents/macro/test.root"}, const int nEvents = 10)
27 {
28  //Create the server
30  se->Verbosity(INT_MAX);
31 
32  //Add all required input files
33  for (unsigned int i = 0; i < myInputLists.size(); ++i)
34  {
36  infile->fileopen(myInputLists[i]);
37  se->registerInputManager(infile);
38  }
39 
40  //auto in = new Fun4AllDstInputManager("DSTin1");
41  //in->fileopen(myInputLists[0]);
42  //se->registerInputManager(in);
43 
44  Enable::MVTX = true;
45  Enable::INTT = true;
46  Enable::TPC = true;
47  Enable::TPC_ABSORBER = true;
48  Enable::MICROMEGAS=true;
49 
51  MagnetInit();
53 
54  //Mvtx_Cells();
55  //Intt_Cells();
56  //TPC_Cells();
57  //Micromegas_Cells();
58 
59  TrackingInit();
60 
61  Tracking_Reco_TrackFit(); //PHACTSTrackFitter, cut out this section
62 
63  string decayDescriptor = "[D0 -> K^- pi^+]cc";
64 
65  KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("CommAnaTrackSelection");
66  kfparticle->Verbosity(INT_MAX);
67 
68  kfparticle->setDecayDescriptor(decayDescriptor);
69 
70  kfparticle->doTruthMatching(false);
71  kfparticle->getDetectorInfo(false);
72  kfparticle->getCaloInfo(false);
73  kfparticle->getAllPVInfo(false);
74  kfparticle->allowZeroMassTracks(true);
75  kfparticle->saveDST(true);
76  kfparticle->saveParticleContainer(true);
77  kfparticle->saveOutput(true); //false in final system, true for debugging
78 
79  bool fixToPV = true;
80  bool useFakePV = false;
81 
82  if (useFakePV)
83  {
84  fixToPV = false; //Constraining to a fake PV results in some gibberish variables
85  kfparticle->useFakePrimaryVertex(true);
86  }
87 
88  if (fixToPV)
89  {
90  kfparticle->constrainToPrimaryVertex(true);
91  kfparticle->setMotherIPchi2(5000);
92  kfparticle->setFlightDistancechi2(-1.);
93  kfparticle->setMinDIRA(-1.1);
94  }
95 
96  //Track parameters
97  kfparticle->setMinimumTrackPT(0.0);
98  kfparticle->setMinimumTrackIPchi2(-1.0);
99  kfparticle->setMinimumTrackIP(-0.01);
100  kfparticle->setMaximumTrackchi2nDOF(200);
101 
102  kfparticle->setMaximumVertexchi2nDOF(200);
103  kfparticle->setMaximumDaughterDCA(1);
104 
105  //Parent parameters
106  kfparticle->setMotherPT(0);
107  kfparticle->setMinimumMass(1.7);
108  kfparticle->setMaximumMass(2.1);
109 
110  kfparticle->setOutputName("outputKFP.root");
111 
112  se->registerSubsystem(kfparticle);
113 
114  se->run(nEvents);
115 
116  se->End();
117 
118  std::cout << "All done" << std::endl;
119  delete se;
120  gSystem->Exit(0);
121 
122  return;
123 }