Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HFReco.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HFReco.C
2 
3 #pragma GCC diagnostic push
4 
5 #pragma GCC diagnostic ignored "-Wundefined-internal"
6 
7 #include <kfparticle_sphenix/KFParticle_sPHENIX.h>
8 
9 #pragma GCC diagnostic pop
10 
11 R__LOAD_LIBRARY(libkfparticle_sphenix.so)
12 
13 namespace HeavyFlavorReco
14 {
15  // https://wiki.bnl.gov/sPHENIX/index.php/KFParticle
16  string decayDescriptor = "[D0 -> K^- pi^+]cc"; //See twiki on how to set this
17  string reconstructionName = "myTestReco"; //Used for naming output folder, file and node
20  bool runTruthTrigger = false; //Decay Finder
21  bool runTrackEff = false; //HF track efficiency
22  bool getTruthInfo = false; //Add truth matching to output file
23  bool getCaloInfo = false;
24  bool runTracking = false; //Run tracking on DSTs
25  bool buildTruthTable = false;
26  bool runQA = false; //Run QA, needs set up
27  int VERBOSITY = 0;
28 }; // namespace HeavyFlavorReco
29 
30 using namespace HeavyFlavorReco;
31 
33 {
35 
37  kfparticle->Verbosity(1);
38 
40 
41  if (runTrackEff) kfparticle->setTrackMapNodeName("HFSelected_SvtxTrackMap");
42 
43  kfparticle->doTruthMatching(getTruthInfo);
44  kfparticle->getDetectorInfo(false);
45  kfparticle->getCaloInfo(getCaloInfo);
46  kfparticle->getAllPVInfo(false);
47  kfparticle->allowZeroMassTracks(true);
48  kfparticle->saveDST(false);
49  kfparticle->saveParticleContainer(false);
50 
51  bool fixToPV = true;
52  bool useFakePV = true;
53 
54  if (useFakePV)
55  {
56  fixToPV = false; //Constraining to a fake PV results in some gibberish variables
57  kfparticle->useFakePrimaryVertex(true);
58  }
59 
60  if (fixToPV)
61  {
62  kfparticle->constrainToPrimaryVertex(true);
63  kfparticle->setMotherIPchi2(3);
64  kfparticle->setFlightDistancechi2(-1.);
65  kfparticle->setMinDIRA(0.90);
66  kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
67  }
68 
69  //Track parameters
70  kfparticle->setMinimumTrackPT(0.7);
71  kfparticle->setMinimumTrackIPchi2(-1.);
72  kfparticle->setMinimumTrackIP(-1.);
73  kfparticle->setMaximumTrackchi2nDOF(3.);
74 
75  //Vertex parameters
76  kfparticle->setMaximumVertexchi2nDOF(5);
77  kfparticle->setMaximumDaughterDCA(0.005);
78 
79  //Parent parameters
80  kfparticle->setMotherPT(0);
81  kfparticle->setMinimumMass(1.70);
82  kfparticle->setMaximumMass(1.90);
83  kfparticle->setMaximumMotherVertexVolume(0.03);
84 
85  kfparticle->setOutputName(outputRecoFile);
86 
87  se->registerSubsystem(kfparticle);
88 }
89 
90 void myDemoReco()
91 {
93 
95  kfparticle->Verbosity(1);
96 
97  kfparticle->setDecayDescriptor("B_s0 -> {J/psi -> e^+ e^-} {K_S0 -> pi^+ pi^-}");
98  kfparticle->setTrackMapNodeName("HFSelected_SvtxTrackMap");
99 
100  kfparticle->doTruthMatching(true);
101  kfparticle->getCaloInfo(false);
102  kfparticle->allowZeroMassTracks(true);
103  kfparticle->constrainToPrimaryVertex(true);
104  kfparticle->setOutputName("kfparticle_demo.root");
105 
106  //Track parameters
107  kfparticle->setMinimumTrackPT(0.);
108  kfparticle->setMinimumTrackIPchi2(-1.);
109  kfparticle->setMinimumTrackIP(-1.);
110  kfparticle->setMaximumTrackchi2nDOF(90.);
111 
112  //Vertex parameters
113  kfparticle->setMaximumVertexchi2nDOF(90);
114  kfparticle->setMaximumDaughterDCA(0.7);
115 
116  //Parent parameters
117  kfparticle->setMotherPT(0);
118  kfparticle->setMinimumMass(2.0);
119  kfparticle->setMaximumMass(6.0);
120  kfparticle->setMaximumMotherVertexVolume(0.9);
121  kfparticle->setMotherIPchi2(FLT_MAX);
122  kfparticle->setFlightDistancechi2(-1.);
123  kfparticle->setMinDIRA(-1.1);
124  kfparticle->setDecayLengthRange(-1*FLT_MAX, FLT_MAX);
125 
126  //Intermediate parameters
127  std::vector<std::pair<float, float>> intermediate_mass_range;
128  intermediate_mass_range.push_back(make_pair(0.8, 3.5));
129  intermediate_mass_range.push_back(make_pair(0.4, 0.6));
130  kfparticle->setIntermediateMassRange(intermediate_mass_range);
131 
132  std::vector<float> intermediate_min_pt = {0.0, 0.0};
133  kfparticle->setIntermediateMinPT(intermediate_min_pt);
134 
135  std::vector<std::pair<float, float>> intermediate_IP_range;
136  intermediate_IP_range.push_back(make_pair(-1., 5.));
137  intermediate_IP_range.push_back(make_pair(-1., 5.));
138  kfparticle->setIntermediateIPRange(intermediate_IP_range);
139 
140  std::vector<std::pair<float, float>> intermediate_IPchi2_range;
141  intermediate_IPchi2_range.push_back(make_pair(0., 400.));
142  intermediate_IPchi2_range.push_back(make_pair(0., 400.));
143  kfparticle->setIntermediateIPchi2Range(intermediate_IPchi2_range);
144 
145  std::vector<float> intermediate_min_dira = {-1.1, -1.1};
146  kfparticle->setIntermediateMinDIRA(intermediate_min_dira);
147 
148  std::vector<float> intermediate_min_FDchi2 = {-1., -1.};
149  kfparticle->setIntermediateMinFDchi2(intermediate_min_FDchi2);
150 
151  std::vector<float> intermediate_max_vertex_vol = {1.1, 0.9};
152  kfparticle->setIntermediateMaxVertexVolume(intermediate_max_vertex_vol);
153 
154  se->registerSubsystem(kfparticle);
155 }