Skip to content

PWGCF: Added a Monte-Carlo process function for generated and reconstructed data#7940

Merged
victor-gonzalez merged 5 commits intoAliceO2Group:masterfrom
JStaa:master
Oct 10, 2024
Merged

PWGCF: Added a Monte-Carlo process function for generated and reconstructed data#7940
victor-gonzalez merged 5 commits intoAliceO2Group:masterfrom
JStaa:master

Conversation

@JStaa
Copy link
Contributor

@JStaa JStaa commented Oct 10, 2024

No description provided.

JStaa added a commit to JStaa/O2Physics that referenced this pull request Oct 10, 2024
Please consider the following formatting changes to AliceO2Group#7940
Please consider the following formatting changes to AliceO2Group#7940
Comment on lines +310 to +325
auto particle = track.mcParticle();
if (particle.isPhysicalPrimary()) {

if (particle.pdgCode() == 211) { // Pos pions
MCRegistry.fill(HIST("hRecPionP"), particle.pt());
} else if (particle.pdgCode() == -211) { // Neg pions
MCRegistry.fill(HIST("hRecPionN"), particle.pt());
} else if (particle.pdgCode() == 310) { // Pos kaons
MCRegistry.fill(HIST("hRecKaonP"), particle.pt());
} else if (particle.pdgCode() == -310) { // Neg kaons
MCRegistry.fill(HIST("hRecKaonN"), particle.pt());
} else if (particle.pdgCode() == 2212) { // Pos protons
MCRegistry.fill(HIST("hRecProtonP"), particle.pt());
} else if (particle.pdgCode() == -2212) { // Neg protons
MCRegistry.fill(HIST("hRecProtonN"), particle.pt());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest the same processing as for data
For not replicating code, a single function with the common functionality called from both process when appropriate will do the magic

Comment on lines +439 to +462
TLorentzVector Daughter, Associate;
if (TrackPID(Track)[0] == 1.0) { // Kaons
return kTRUE;
} else if (V0Sign(V0) == 1 && TrackPID(Track)[0] == 0.0 && Track.sign() == -1) { // Lambda - Pi_min
const auto& dTrack = V0.template posTrack_as<MyFilteredTracks>();
Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassProton);
Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassPionCharged);
} else if (V0Sign(V0) == -1 && TrackPID(Track)[0] == 0.0 && Track.sign() == 1) { // Antilambda - Pi_plus
const auto& dTrack = V0.template negTrack_as<MyFilteredTracks>();
Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassProton);
Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassPionCharged);
} else if (V0Sign(V0) == 1 && TrackPID(Track)[0] == 2.0 && Track.sign() == 1) { // Lambda - Proton
const auto& dTrack = V0.template negTrack_as<MyFilteredTracks>();
Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassPionCharged);
Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassProton);
} else if (V0Sign(V0) == -1 && TrackPID(Track)[0] == 2.0 && Track.sign() == -1) { // Antilambda - Antiproton
const auto& dTrack = V0.template posTrack_as<MyFilteredTracks>();
Daughter.SetPtEtaPhiM(dTrack.pt(), dTrack.eta(), dTrack.phi(), o2::constants::physics::MassPionCharged);
Associate.SetPtEtaPhiM(Track.pt(), Track.eta(), Track.phi(), o2::constants::physics::MassProton);
}

if ((Daughter + Associate).M() >= massLambda - 4 * DGaussSigma && (Daughter + Associate).M() <= massLambda + 4 * DGaussSigma) {
return kFALSE;
if ((Daughter + Associate).M() >= massLambda - 4 * DGaussSigma && (Daughter + Associate).M() <= massLambda + 4 * DGaussSigma) {
return kFALSE;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider using the functionality on https://github.com/AliceO2Group/O2Physics/blob/master/Common/Core/RecoDecay.h
for extracting the invariant mass instead of using TLorentzVector. It will be much more efficient

@victor-gonzalez victor-gonzalez changed the title Added a Monte-Carlo process function for generated and reconstructed data PWGCF: Added a Monte-Carlo process function for generated and reconstructed data Oct 10, 2024
Copy link
Collaborator

@victor-gonzalez victor-gonzalez left a comment

Choose a reason for hiding this comment

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

I approve it for the time being but, please, have a look at my comments for the next iteration

Also, please, always prefix with PWGCF your commits in this functionality. I did it this time but the next one is on you

@victor-gonzalez victor-gonzalez enabled auto-merge (squash) October 10, 2024 21:41
@victor-gonzalez victor-gonzalez merged commit 875e677 into AliceO2Group:master Oct 10, 2024
mfaggin pushed a commit to mfaggin/O2Physics that referenced this pull request Oct 15, 2024
…ructed data (AliceO2Group#7940)

* Added a configurable for enabling the FakeV0Filter function, as well as processMCGen and processMCRec functions

* Added isPhysicalPrimary() check

* Removed Counter variable and changed a comment

* Please consider the following formatting changes

---------

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
louisemillot pushed a commit to louisemillot/O2Physics that referenced this pull request Nov 26, 2024
…ructed data (AliceO2Group#7940)

* Added a configurable for enabling the FakeV0Filter function, as well as processMCGen and processMCRec functions

* Added isPhysicalPrimary() check

* Removed Counter variable and changed a comment

* Please consider the following formatting changes

---------

Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
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