Hello,
I have a given list of variables which was created from a ROOT tree Scan. It shows the variables m_mother, m_firstDaughter, m_lastDaughter and m_pdg of the particles which are created by decays. The variables are from the branch called MCParticles. The first decay process looks like this: B -> nu nu & B -> D* lep nu
In the second step the D* decays further into D0 & pi+.
So my task is to do a data selection first and only print out the information of just one certain particle, the pi+ . To do that, my general idea is to look for the pi+'s mother particle first, which is the D* in this case. After looping over all the tracks in an event and finding the D* by identifying its PDG code = 413, I want to do the same loop over the tracks again to find the D*'s daughter particles by looking for particles which have the D* as their mother particle. Here comes my problem: how do I tell the C++ compiler to memorise the line of the list where the D* is? I need the compiler to know where exactly the D* row is so that it can look for its daughter particle by matching the m_mother value.
The output list of the root file after the scan looks like this:
root [1] tree->Scan("MCParticles.m_mother:MCParticles.m_firstDaughter:MCParticles.m_lastDaughter:MCParticles.m_pdg")
***********************************************************************
* Row * Instance * MCParticl * MCParticl * MCParticl * MCParticl *
***********************************************************************
* 0 * 0 * 0 * 2 * 3 * 300553 *
* 0 * 1 * 1 * 4 * 6 * 511 *
* 0 * 2 * 1 * 7 * 8 * -511 *
* 0 * 3 * 2 * 9 * 10 * -413 *
* 0 * 4 * 2 * 0 * 0 * -11 *
* 0 * 5 * 2 * 0 * 0 * 12 *
* 0 * 6 * 3 * 0 * 0 * -12 *
* 0 * 7 * 3 * 0 * 0 * 12 *
* 0 * 8 * 4 * 11 * 12 * -421 *
* 0 * 9 * 4 * 13 * 13 * -211 *
* 0 * 10 * 9 * 14 * 17 * 321 *
* 0 * 11 * 9 * 18 * 20 * -211 *
* 0 * 12 * 10 * 0 * 0 * 2112 *
* 0 * 13 * 11 * 0 * 0 * 14 *
* 0 * 14 * 11 * 21 * 23 * -13 *
* 0 * 15 * 11 * 0 * 0 * 2112 *
* 0 * 16 * 11 * 0 * 0 * 2112 *
* 0 * 17 * 12 * 0 * 0 * 2112 *
* 0 * 18 * 12 * 0 * 0 * 2112 *
* 0 * 19 * 12 * 0 * 0 * 2112 *
* 0 * 20 * 15 * 0 * 0 * -14 *
* 0 * 21 * 15 * 0 * 0 * 12 *
* 0 * 22 * 15 * 0 * 0 * -11 *
* 1 * 0 * 0 * 2 * 3 * 300553 *
* 1 * 1 * 1 * 4 * 6 * -511 *
And this is the code I am currently working on to reduce this list to only the pi+ particle:
StoreArray<PXDCluster> getPionClusters() {
float m_pdg;
float m_firstDaughter;
float m_lastDaughter;
float m_mother;
float m_mass;
StoreArray<MCParticle> m_mcTracks;
for (MCParticle& mcTrack : m_mcTracks) {
if (abs(m_pdg) == 413) {
for (MCParticle& mcTrack : m_mcTracks) {
MCParticle* mother = mcParticle.getMother();
}
} else {
continue;
}
}
for (PXDCluster& pxdcl : mcTrack.getRelationsFrom<PXDCluster>("PXDClusters")) {
if (m_pdg == 413) {
for (MCParticle& mcTrack : m_mcTracks) {
MCParticle* mother = mcParticle.getMother();
}
} else {
continue;
}
}
for (PXDCluster& pxdcl : mcTrack.getRelationsFrom<PXDCluster>("PXDClusters")) {
if (m_pdg == 413) {
std::cout << std::setw(16) << m_firstDaughter << std::setw(16) << m_lastDaughter << std::endl;
if (m_pdg == 211)
{
MCParticle* track = mcTrack.getRelatedFrom<MCParticle>("Tracks");
std::cout << std::setw(16) << m_mother << std::setw(16) << m_pdg << std::setw(16) << m_mass << std::endl;
}
} else {
continue;
}
if (pxdClusterCharge == 0) {
continue;
}
I would be very grateful for any suggestions, hints or help. Thanks in advance!