Skip to content

Implement setter function to check MC signal from mother to daughter#945

Merged
iarsene merged 9 commits into
AliceO2Group:masterfrom
feisenhu:master
Jul 13, 2022
Merged

Implement setter function to check MC signal from mother to daughter#945
iarsene merged 9 commits into
AliceO2Group:masterfrom
feisenhu:master

Conversation

@feisenhu

@feisenhu feisenhu commented Jul 4, 2022

Copy link
Copy Markdown
Collaborator

Implemented a setter function in the MCprong files to give the option, when defining a MCsignal in the MCSignalLibrary.h to check the MC signal from the mother to the daughter (In time).

Therefore the MC signal needs the mother pdg code as first entry and its daughter as second:
e.g.

  if (!nameStr.compare("LFQdecayToE")) {
    MCProng prong(2, {900, 11}, {true, true}, {false, false}, {0, 0}, {0, 0}, {false, false});
    prong.SetSignalInTime(0, true);                                                    // set direction to check for daughters (true, in time) or for mothers (false, back in time)
    signal = new MCSignal(name, "LF meson  + quarkonia decays into e", {prong}, {-1}); // pi0,eta,eta',rho,omega,phi,jpsi,psi2s mesons
    return signal;
  }

The CheckProng function in MCSignal.h then checks the boolean fCheckGenerationsInTime whether we have to check in the next generation for a mother or daughters.

If we look for daughters, we check if there is one, and if so if it has a pdg code of the next generation.
If it is true it uses the first daughter that fulfils that requirement and sets it as current particle to check for further generations.

(Note: There is no option currently to check multiple daughters in the same generation that would fulfil the MC signal.)

@feisenhu feisenhu requested review from alibuild and iarsene as code owners July 4, 2022 09:07
@feisenhu feisenhu force-pushed the master branch 2 times, most recently from 8ed7b5d to 7f828ff Compare July 4, 2022 09:28
@alibuild

alibuild commented Jul 4, 2022

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 7f828ff at 2022-07-04 11:44:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.h:102:21: error: 'MCProng::fUseANDonSourceBitMap' will be initialized after [-Werror=reorder]
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.h:96:8: error:   'bool MCProng::fCheckGenerationsInTime' [-Werror=reorder]
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.cxx:52:1: error:   when initialized here [-Werror=reorder]
ninja: build stopped: subcommand failed.

Full log here.

@alibuild

alibuild commented Jul 4, 2022

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for a31fd4f at 2022-07-04 14:14:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.h:102:21: error: 'MCProng::fUseANDonSourceBitMap' will be initialized after [-Werror=reorder]
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.h:96:8: error:   'bool MCProng::fCheckGenerationsInTime' [-Werror=reorder]
/sw/SOURCES/O2Physics/945-slc7_x86-64/0/PWGDQ/Core/MCProng.cxx:52:1: error:   when initialized here [-Werror=reorder]
ninja: build stopped: subcommand failed.

Full log here.

Comment thread PWGDQ/Core/MCProng.h Outdated
void SetSources(int generation, uint64_t bits, uint64_t exclude = 0, bool useANDonSourceBits = true);
void SetSourceBit(int generation, int sourceBit, bool exclude = false);
void SetUseANDonSourceBits(int generation, bool option = true);
void SetSignalInTime(int generation, bool intime = false); // set variable to check generations in time or back in time (default)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does not need the first parameter (generation), since the rule to go back in time or in time, holds for the entire prong. So please remove it, only the "intime" parameter is used

Comment thread PWGDQ/Core/MCProng.cxx Outdated
}

//________________________________________________________________________________________________________________
void MCProng::SetSignalInTime(int generation, bool intime /*=false*/)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "generation" parameter is not needed since the "intime" holds for the whole prong history

Comment thread PWGDQ/Core/MCProng.cxx Outdated
Comment on lines +109 to +111
if (generation < 0 || generation >= fNGenerations) {
return;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines can be removed

Comment thread PWGDQ/Core/MCSignal.h
// currentMCParticle = currentMCParticle.template mother0_as<U>();
}
} else {
// make sure that a daughter exists in the stack before moving one generation younger

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here, mentioning that the prong history will move on the branch of the first daughter that matches the PDG requirement

Comment thread PWGDQ/Core/MCSignal.h Outdated
Comment on lines +174 to +176
if (abs(d.pdgCode()) == fProngs[i].fPDGcodes[j + 1]) {
currentMCParticle = d;
break;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you check the absolute of the PDG code, however, the user has the option to choose between checking both charges (using the abs of the PDG code), or not. So the latter situation is overwritten here. Could you fix it? Ideally one should use here the MCProng::TestPDG() since that will take into account automatically these options.

Comment thread PWGDQ/Core/MCSignal.h Outdated
Comment on lines +258 to +261
if (abs(d.pdgCode()) == fProngs[i].fPDGcodes[j + 1]) {
currentMCParticle = d;
break;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above

@feisenhu

Copy link
Copy Markdown
Collaborator Author

@iarsene
Tank you for your feedback.
I have included your comments:

  • removed the generation parameter in the SetSignalInTime() function
  • added a comment for the else {} case, to point out that branch is changing to daughter prong which fulfils the pdg requirement first
  • using the TestPDG() function to check if the daughter PDG is in the next generation
    I now use fProngs[i].TestPDG(j + 1, d.pdgCode()) to check that daughter has correct pdg code.

In case there is something else that I should change please let me know.
kind regards

iarsene
iarsene previously approved these changes Jul 13, 2022
Comment thread PWGDQ/Core/MCSignal.h Outdated
Comment on lines +252 to +255
if (currentMCParticle.has_daughters() && j < fProngs[i].fNGenerations - 1) {
// currentMCParticle = currentMCParticle.template mothers_first_as<U>();
// currentMCParticle = mcStack.iteratorAt(currentMCParticle.mothersIds()[0]);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if statement doesn't do anything, should be removed

@iarsene

iarsene commented Jul 13, 2022

Copy link
Copy Markdown
Collaborator

Hi @feisenhu,
Thanks for the changes. There is just a small issue i still commented on, otherwise I am fine with the changes.

@feisenhu

Copy link
Copy Markdown
Collaborator Author

Hi @feisenhu,
Thanks for the changes. There is just a small issue i still commented on, otherwise I am fine with the changes.

You are right. Thank you for pointing out. :)
I have removed these lines.

@iarsene iarsene merged commit 454d86b into AliceO2Group:master Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants