43 , m_has_intermediates_sPHENIX(
false)
44 , m_constrain_to_vertex_sPHENIX(
false)
45 , m_require_mva(
false)
48 , m_outfile_name(
"outputData.root")
55 , m_has_intermediates_sPHENIX(
false)
56 , m_constrain_to_vertex_sPHENIX(
false)
57 , m_require_mva(
false)
60 , m_outfile_name(
"outputData.root")
74 std::vector<Float_t> MVA_parValues;
75 tie(reader, MVA_parValues) =
initMVA();
81 std::cout <<
"Your track PID, " <<
m_daughter_name[i] <<
"is not in the particle list" << std::endl;
82 std::cout <<
"Check KFParticle_particleList.cxx for a list of available particles" << std::endl;
94 std::vector<KFParticle> mother,
vertex;
95 std::vector<std::vector<KFParticle>> daughters, intermediates;
96 int nPVs, multiplicity;
101 if (check_vertexmap->
size() == 0)
103 if (
Verbosity() >=
VERBOSITY_SOME) std::cout <<
"KFParticle: Event skipped as there are no vertices" << std::endl;
109 if (check_trackmap->
size() == 0)
111 if (
Verbosity() >=
VERBOSITY_SOME) std::cout <<
"KFParticle: Event skipped as there are no tracks" << std::endl;
115 createDecay(topNode, mother, vertex, daughters, intermediates, nPVs, multiplicity);
120 if (mother.size() != 0)
122 for (
unsigned int i = 0; i < mother.size(); ++i)
130 candidateCounter += 1;
132 if (
m_save_output)
fillBranch(topNode, mother[i], vertex[i], daughters[i], intermediates[i], nPVs, multiplicity);
137 printParticles(mother[i], vertex[i], daughters[i], intermediates[i], nPVs, multiplicity);
151 std::cout <<
"KFParticle_sPHENIX object " <<
Name() <<
" finished. Number of canadidates: " << candidateCounter << std::endl;
164 KFParticle chosenVertex,
165 std::vector<KFParticle> daughterParticles,
166 std::vector<KFParticle> intermediateParticles,
167 int numPVs,
int numTracks)
169 std::cout <<
"\n---------------KFParticle candidate information---------------" << std::endl;
171 std::cout <<
"Mother information:" << std::endl;
176 std::cout <<
"Intermediate state information:" << std::endl;
177 for (
unsigned int i = 0; i < intermediateParticles.size(); i++)
183 std::cout <<
"Final track information:" << std::endl;
184 for (
unsigned int i = 0; i < daughterParticles.size(); i++)
191 std::cout <<
"Primary vertex information:" << std::endl;
192 std::cout <<
"(x,y,z) = (" << chosenVertex.GetX() <<
" +/- " << sqrt(chosenVertex.GetCovariance(0, 0)) <<
", ";
193 std::cout << chosenVertex.GetY() <<
" +/- " << sqrt(chosenVertex.GetCovariance(1, 1)) <<
", ";
194 std::cout << chosenVertex.GetZ() <<
" +/- " << sqrt(chosenVertex.GetCovariance(2, 2)) <<
") cm\n"
198 std::cout <<
"The number of primary vertices is: " << numPVs << std::endl;
199 std::cout <<
"The number of tracks in the event is: " << numTracks << std::endl;
201 std::cout <<
"------------------------------------------------------------\n"
207 bool ddCanBeParsed =
true;
209 size_t daughterLocator;
212 std::string intermediate;
213 std::string daughter;
215 std::vector<std::pair<std::string, int>> intermediate_list;
216 std::vector<std::string> intermediates_name;
217 std::vector<int> intermediates_charge;
219 std::vector<std::pair<std::string, int>> daughter_list;
220 std::vector<std::string> daughters_name;
221 std::vector<int> daughters_charge;
224 std::vector<int> m_nTracksFromIntermediates;
226 std::string decayArrow =
"->";
227 std::string chargeIndicator =
"^";
228 std::string startIntermediate =
"{";
229 std::string endIntermediate =
"}";
235 while ((pos = manipulateDecayDescriptor.find(
" ")) != std::string::npos) manipulateDecayDescriptor.replace(pos, 1,
"");
238 std::string checkForCC = manipulateDecayDescriptor.substr(0, 1) + manipulateDecayDescriptor.substr(manipulateDecayDescriptor.size()-3, 3);
239 std::for_each(checkForCC.begin(), checkForCC.end(), [](
char &
c) {
c = ::toupper(
c);});
242 if (checkForCC ==
"[]CC")
244 manipulateDecayDescriptor = manipulateDecayDescriptor.substr(1, manipulateDecayDescriptor.size()-4);
249 size_t findMotherEndPoint = manipulateDecayDescriptor.find(decayArrow);
250 mother = manipulateDecayDescriptor.substr(0, findMotherEndPoint);
252 manipulateDecayDescriptor.erase(0, findMotherEndPoint + decayArrow.length());
255 while ((pos = manipulateDecayDescriptor.find(startIntermediate)) != std::string::npos)
257 size_t findIntermediateStartPoint = manipulateDecayDescriptor.find(startIntermediate, pos);
258 size_t findIntermediateEndPoint = manipulateDecayDescriptor.find(endIntermediate, pos);
259 std::string intermediateDecay = manipulateDecayDescriptor.substr(pos + 1, findIntermediateEndPoint - (pos + 1));
261 intermediate = intermediateDecay.substr(0, intermediateDecay.find(decayArrow));
262 if (
findParticle(intermediate)) intermediates_name.push_back(intermediate.c_str());
263 else ddCanBeParsed =
false;
267 intermediateDecay.erase(0, intermediateDecay.find(decayArrow) + decayArrow.length());
268 while ((daughterLocator = intermediateDecay.find(chargeIndicator)) != std::string::npos)
270 daughter = intermediateDecay.substr(0, daughterLocator);
273 daughters_name.push_back(daughter.c_str());
275 std::string daughterChargeString = intermediateDecay.substr(daughterLocator + 1, 1);
276 if (daughterChargeString ==
"+")
278 daughters_charge.push_back(+1);
280 else if (daughterChargeString ==
"-")
282 daughters_charge.push_back(-1);
284 else if (daughterChargeString ==
"0")
286 daughters_charge.push_back(0);
290 if (
Verbosity() >=
VERBOSITY_MORE) std::cout <<
"The charge of " << daughterChargeString <<
" was not known" << std::endl;
291 ddCanBeParsed =
false;
294 else ddCanBeParsed =
false;
295 intermediateDecay.erase(0, daughterLocator + 2);
298 manipulateDecayDescriptor.erase(findIntermediateStartPoint, findIntermediateEndPoint + 1 - findIntermediateStartPoint);
299 m_nTracksFromIntermediates.push_back(nDaughters);
300 nTracks += nDaughters;
304 while ((daughterLocator = manipulateDecayDescriptor.find(chargeIndicator)) != std::string::npos)
306 daughter = manipulateDecayDescriptor.substr(0, daughterLocator);
309 daughters_name.push_back(daughter.c_str());
310 std::string daughterChargeString = manipulateDecayDescriptor.substr(daughterLocator + 1, 1);
311 if (daughterChargeString ==
"+")
313 daughters_charge.push_back(+1);
315 else if (daughterChargeString ==
"-")
317 daughters_charge.push_back(-1);
319 else if (daughterChargeString ==
"0")
321 daughters_charge.push_back(0);
325 if (
Verbosity() >=
VERBOSITY_MORE) std::cout <<
"The charge of " << daughterChargeString <<
" was not known" << std::endl;
326 ddCanBeParsed =
false;
329 else ddCanBeParsed =
false;
330 manipulateDecayDescriptor.erase(0, daughterLocator + 2);
336 for (
unsigned int i = 0; i < intermediates_name.size(); ++i)
338 trackStart = trackEnd;
339 trackEnd = m_nTracksFromIntermediates[i] + trackStart;
343 for (
int j = trackStart; j < trackEnd; ++j)
345 vtxCharge += daughters_charge[j];
348 intermediates_charge.push_back(vtxCharge);
350 intermediate_list.push_back(std::make_pair(intermediates_name[i], intermediates_charge[i]));
353 for (
int i = 0; i < nTracks; ++i)
355 daughter_list.push_back(std::make_pair(daughters_name[i], daughters_charge[i]));
362 if (intermediates_name.size() > 0)
377 if (
Verbosity() >=
VERBOSITY_SOME) std::cout <<
"KFParticle: Your decay descriptor, " <<
Name() <<
" cannot be parsed" <<
"\nExiting!" << std::endl;
384 bool particleFound =
true;
385 if (!particleList.count(particle))
389 std::cout <<
"The particle, " << particle <<
" is not recognized" << std::endl;
390 std::cout <<
"Check KFParticle_particleList.cc for a list of available particles" << std::endl;
392 particleFound =
false;
395 return particleFound;