60 , m_has_intermediates_sPHENIX(
false)
61 , m_constrain_to_vertex_sPHENIX(
false)
62 , m_require_mva(
false)
72 , m_has_intermediates_sPHENIX(
false)
73 , m_constrain_to_vertex_sPHENIX(
false)
74 , m_require_mva(
false)
97 std::vector<Float_t> MVA_parValues;
98 tie(reader, MVA_parValues) =
initMVA();
115 char *calibrationsroot = getenv(
"CALIBRATIONROOT");
116 std::string m_magField =
"sphenix3dtrackingmapxyz.root";
118 if (calibrationsroot !=
nullptr)
125 TFile *fin =
new TFile(m_magField.c_str());
128 TTree *fieldmap = (TTree *) fin->Get(
"fieldmap");
130 TH1F *BzHist =
new TH1F(
"BzHist",
"", 100, 0, 10);
132 int NBFieldEntries = fieldmap->Project(
"BzHist",
"bz",
"x==0 && y==0 && z==0");
134 if (NBFieldEntries != 1)
136 std::cout <<
"Not a single B field value at (0,0,0) in the field map, need to check why" << std::endl;
141 float m_Bz = BzHist->GetMean() * 10;
142 KFParticle::SetField(m_Bz);
153 std::vector<KFParticle> mother,
vertex;
154 std::vector<std::vector<KFParticle>> daughters, intermediates;
160 if (check_vertexmap->
size() == 0)
164 std::cout <<
"KFParticle: Event skipped as there are no vertices" << std::endl;
171 if (check_trackmap->
size() == 0)
175 std::cout <<
"KFParticle: Event skipped as there are no tracks" << std::endl;
180 createDecay(topNode, mother, vertex, daughters, intermediates, nPVs, multiplicity);
184 intermediates = daughters;
191 if (mother.size() != 0)
193 for (
unsigned int i = 0;
i < mother.size(); ++
i)
205 fillBranch(topNode, mother[
i], vertex[i], daughters[i], intermediates[i], nPVs, multiplicity);
214 printParticles(mother[
i], vertex[i], daughters[i], intermediates[i], nPVs, multiplicity);
231 std::cout <<
"KFParticle_sPHENIX object " <<
Name() <<
" finished. Number of candidates: " <<
candidateCounter << std::endl;
245 const std::vector<KFParticle> &daughterParticles,
246 const std::vector<KFParticle> &intermediateParticles,
247 const int numPVs,
const int numTracks)
249 std::cout <<
"\n---------------KFParticle candidate information---------------" << std::endl;
251 std::cout <<
"Mother information:" << std::endl;
256 std::cout <<
"Intermediate state information:" << std::endl;
257 for (
const auto &intermediateParticle : intermediateParticles)
263 std::cout <<
"Final track information:" << std::endl;
264 for (
const auto &daughterParticle : daughterParticles)
271 std::cout <<
"Primary vertex information:" << std::endl;
272 std::cout <<
"(x,y,z) = (" << chosenVertex.
GetX() <<
" +/- " << std::sqrt(chosenVertex.
GetCovariance(0, 0)) <<
", ";
273 std::cout << chosenVertex.
GetY() <<
" +/- " << std::sqrt(chosenVertex.
GetCovariance(1, 1)) <<
", ";
274 std::cout << chosenVertex.
GetZ() <<
" +/- " << std::sqrt(chosenVertex.
GetCovariance(2, 2)) <<
") cm\n"
278 std::cout <<
"The number of primary vertices is: " << numPVs << std::endl;
279 std::cout <<
"The number of tracks in the event is: " << numTracks << std::endl;
281 std::cout <<
"------------------------------------------------------------\n"
287 bool ddCanBeParsed =
true;
289 size_t daughterLocator;
295 std::vector<std::pair<std::string, int>> intermediate_list;
296 std::vector<std::string> intermediates_name;
297 std::vector<int> intermediates_charge;
299 std::vector<std::pair<std::string, int>> daughter_list;
300 std::vector<std::string> daughters_name;
301 std::vector<int> daughters_charge;
304 std::vector<int> m_nTracksFromIntermediates;
312 std::string specialTracks[] = {
"e",
"mu",
"pi",
"K"};
318 while ((pos = manipulateDecayDescriptor.find(
' ')) != std::string::npos)
320 manipulateDecayDescriptor.replace(pos, 1,
"");
324 std::string checkForCC = manipulateDecayDescriptor.substr(0, 1) + manipulateDecayDescriptor.substr(manipulateDecayDescriptor.size() - 3, 3);
325 std::for_each(checkForCC.begin(), checkForCC.end(), [](
char &
c)
326 {
c = ::toupper(
c); });
329 if (checkForCC ==
"[]CC")
331 manipulateDecayDescriptor = manipulateDecayDescriptor.substr(1, manipulateDecayDescriptor.size() - 4);
336 size_t findMotherEndPoint = manipulateDecayDescriptor.find(decayArrow);
337 mother = manipulateDecayDescriptor.substr(0, findMotherEndPoint);
340 ddCanBeParsed =
false;
342 manipulateDecayDescriptor.erase(0, findMotherEndPoint + decayArrow.length());
345 while ((pos = manipulateDecayDescriptor.find(startIntermediate)) != std::string::npos)
347 size_t findIntermediateStartPoint = manipulateDecayDescriptor.find(startIntermediate, pos);
348 size_t findIntermediateEndPoint = manipulateDecayDescriptor.find(endIntermediate, pos);
349 std::string intermediateDecay = manipulateDecayDescriptor.substr(pos + 1, findIntermediateEndPoint - (pos + 1));
351 intermediate = intermediateDecay.substr(0, intermediateDecay.find(decayArrow));
354 intermediates_name.emplace_back(intermediate.c_str());
358 ddCanBeParsed =
false;
363 intermediateDecay.erase(0, intermediateDecay.find(decayArrow) + decayArrow.length());
364 while ((daughterLocator = intermediateDecay.find(chargeIndicator)) != std::string::npos)
366 daughter = intermediateDecay.substr(0, daughterLocator);
367 std::string daughterChargeString = intermediateDecay.substr(daughterLocator + 1, 1);
370 daughter += daughterChargeString;
374 daughters_name.emplace_back(daughter.c_str());
376 if (daughterChargeString ==
"+")
378 daughters_charge.push_back(+1);
380 else if (daughterChargeString ==
"-")
382 daughters_charge.push_back(-1);
384 else if (daughterChargeString ==
"0")
386 daughters_charge.push_back(0);
392 std::cout <<
"The charge of " << daughterChargeString <<
" was not known" << std::endl;
394 ddCanBeParsed =
false;
399 ddCanBeParsed =
false;
401 intermediateDecay.erase(0, daughterLocator + 2);
404 manipulateDecayDescriptor.erase(findIntermediateStartPoint, findIntermediateEndPoint + 1 - findIntermediateStartPoint);
405 m_nTracksFromIntermediates.push_back(nDaughters);
406 nTracks += nDaughters;
410 while ((daughterLocator = manipulateDecayDescriptor.find(chargeIndicator)) != std::string::npos)
412 daughter = manipulateDecayDescriptor.substr(0, daughterLocator);
413 std::string daughterChargeString = manipulateDecayDescriptor.substr(daughterLocator + 1, 1);
416 daughter += daughterChargeString;
420 daughters_name.emplace_back(daughter.c_str());
421 if (daughterChargeString ==
"+")
423 daughters_charge.push_back(+1);
425 else if (daughterChargeString ==
"-")
427 daughters_charge.push_back(-1);
429 else if (daughterChargeString ==
"0")
431 daughters_charge.push_back(0);
437 std::cout <<
"The charge of " << daughterChargeString <<
" was not known" << std::endl;
439 ddCanBeParsed =
false;
444 ddCanBeParsed =
false;
446 manipulateDecayDescriptor.erase(0, daughterLocator + 2);
451 for (
unsigned int i = 0;
i < intermediates_name.size(); ++
i)
453 int trackStart = trackEnd;
454 trackEnd = m_nTracksFromIntermediates[
i] + trackStart;
458 for (
int j = trackStart;
j < trackEnd; ++
j)
460 vtxCharge += daughters_charge[
j];
463 intermediates_charge.push_back(vtxCharge);
465 intermediate_list.emplace_back(intermediates_name[
i], intermediates_charge[i]);
468 for (
int i = 0;
i < nTracks; ++
i)
470 daughter_list.emplace_back(daughters_name[
i], daughters_charge[i]);
477 if (intermediates_name.size() > 0)
489 std::cout <<
"Your decay descriptor can be parsed" << std::endl;
497 std::cout <<
"KFParticle: Your decay descriptor, " <<
Name() <<
" cannot be parsed"
498 <<
"\nExiting!" << std::endl;