Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #7092 #20

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 60 additions & 61 deletions PWGJE/Tasks/phiInJets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ struct phiInJets {
JEhistos.add("Resp_Matrix_MATCHED_rand0", "Resp_Matrix_MATCHED_rand0", HistType::kTHnSparseD, {PtAxis, axisPt, PtAxis, axisPt}); // REC(Phi,Jet), GEN(Phi,Jet)
JEhistos.add("Resp_Matrix_MATCHED_rand1", "Resp_Matrix_MATCHED_rand1", HistType::kTHnSparseD, {PtAxis, axisPt, PtAxis, axisPt}); // REC(Phi,Jet), GEN(Phi,Jet)
JEhistos.add("2DRecToGen", "2DRecToGen", kTH2F, {PtAxis, axisPt});
JEhistos.add("2DRecToGen_constrained", "2DRecToGen_constrained", kTH2F, {PtAxis, axisPt});
JEhistos.add("2DRecToGen_constrained", "2DRecToGen_constrained", kTH2F, {PtAxis, axisPt});
JEhistos.add("2DGenToRec", "2DGenToRec", kTH2F, {PtAxis, axisPt});
JEhistos.add("2DGenToRec_constrained", "2DGenToRec_constrained", kTH2F, {PtAxis, axisPt});
JEhistos.add("2DGenToRec_constrained", "2DGenToRec_constrained", kTH2F, {PtAxis, axisPt});

JEhistos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {PtAxis});
JEhistos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {PtAxis});
Expand Down Expand Up @@ -1032,7 +1032,7 @@ struct phiInJets {
soa::SmallGroups<soa::Join<aod::JMcCollisionLbs, aod::JCollisions>> const& recocolls,
JetMCDTable const& /*mcdjets*/,
JetMCPTable const& mcpjets,
myCompleteJetTracks const& tracks,
myCompleteJetTracks const& tracks,
myCompleteTracks const&,
aod::JMcParticles const& mcParticles)

Expand Down Expand Up @@ -1114,62 +1114,62 @@ struct phiInJets {

if (fabs(mcParticle.pdgCode()) == GenPID) {
bool skip = false;
double phi_dgth_px[2]={0};
double phi_dgth_py[2]={0};
double phi_dgth_pz[2]={0};
bool good_daughter[2]={false};
int dgth_index=0;
double phi_dgth_px[2] = {0};
double phi_dgth_py[2] = {0};
double phi_dgth_pz[2] = {0};
bool good_daughter[2] = {false};
int dgth_index = 0;
// First we check for Forced BR
// if we check for Phi
if (!cfgIsKstar) {
if (mcParticle.has_daughters())
for (auto& dgth : mcParticle.daughters_as<aod::JMcParticles>()){
if (fabs(dgth.pdgCode()) != 321){
for (auto& dgth : mcParticle.daughters_as<aod::JMcParticles>()) {
if (fabs(dgth.pdgCode()) != 321) {
skip = true;
break;
}
for (const auto& track : tracks){
auto trk = track.track_as<myCompleteTracks>();
if (!trackSelection(trk))
continue;
if (cfgSimPID) {
if (!trackPID(trk, true))
continue;
}
if(track.globalIndex()==dgth.globalIndex()){
phi_dgth_px[dgth_index]=track.px();
phi_dgth_py[dgth_index]=track.py();
phi_dgth_pz[dgth_index]=track.pz();
good_daughter[dgth_index]=true;
dgth_index++;
}
}
}
break;
}
for (const auto& track : tracks) {
auto trk = track.track_as<myCompleteTracks>();
if (!trackSelection(trk))
continue;
if (cfgSimPID) {
if (!trackPID(trk, true))
continue;
}
if (track.globalIndex() == dgth.globalIndex()) {
phi_dgth_px[dgth_index] = track.px();
phi_dgth_py[dgth_index] = track.py();
phi_dgth_pz[dgth_index] = track.pz();
good_daughter[dgth_index] = true;
dgth_index++;
}
}
}
} else {
if (mcParticle.has_daughters())
for (auto& dgth : mcParticle.daughters_as<aod::JMcParticles>())
if (fabs(dgth.pdgCode()) != 321 || fabs(dgth.pdgCode()) != 211)
skip = true;
}

if (skip && cfgBR)
continue;

int goodjets = 0;
double jetpt_mcd = 0;
double jetpt_mcp = 0;
double jetpt_mcp = 0;
TLorentzVector lResonance;
TLorentzVector lResonance_REC;
TLorentzVector lDecayDaughter1_REC;
TLorentzVector lDecayDaughter2_REC;
TLorentzVector lResonance_REC;
TLorentzVector lDecayDaughter1_REC;
TLorentzVector lDecayDaughter2_REC;
lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e());
lDecayDaughter1_REC.SetXYZM(phi_dgth_px[0],phi_dgth_py[0],phi_dgth_pz[0], massKa);
lDecayDaughter2_REC.SetXYZM(phi_dgth_px[1],phi_dgth_py[1],phi_dgth_pz[1], massKa);
lResonance_REC = lDecayDaughter1_REC + lDecayDaughter2_REC;
if (cDebugLevel > 0)
if(good_daughter[0] && good_daughter[1])
std::cout<<"Reconstructed level phi pT: "<<lResonance_REC.Pt()<<std::endl;
lDecayDaughter1_REC.SetXYZM(phi_dgth_px[0], phi_dgth_py[0], phi_dgth_pz[0], massKa);
lDecayDaughter2_REC.SetXYZM(phi_dgth_px[1], phi_dgth_py[1], phi_dgth_pz[1], massKa);
lResonance_REC = lDecayDaughter1_REC + lDecayDaughter2_REC;
if (cDebugLevel > 0)
if (good_daughter[0] && good_daughter[1])
std::cout << "Reconstructed level phi pT: " << lResonance_REC.Pt() << std::endl;

bool jetFlag = false;
for (int i = 0; i < mcp_pt.size(); i++) {
double phidiff = TVector2::Phi_mpi_pi(mcp_phi[i] - lResonance.Phi());
Expand All @@ -1178,23 +1178,23 @@ struct phiInJets {
if (R < cfgjetR) {
jetFlag = true;
jetpt_mcp = mcp_pt[i];
jetpt_mcd = mcd_pt[i];
jetpt_mcd = mcd_pt[i];
goodjets++;
}
}
if (cfgSingleJet){
if (goodjets > 1){
if (cfgSingleJet) {
if (goodjets > 1) {
jetpt_mcp = DistinguishJetsMC(mcp_pt, mcp_phi, mcp_eta, lResonance);
jetpt_mcd = DistinguishJetsMC(mcd_pt, mcd_phi, mcd_eta, lResonance_REC);
}
}
jetpt_mcd = DistinguishJetsMC(mcd_pt, mcd_phi, mcd_eta, lResonance_REC);
}
}

if (jetFlag) {

JEhistos.fill(HIST("2DGenToRec"), lResonance.Pt(), jetpt_mcp);
// //check constrained eff
if(good_daughter[0] && good_daughter[1] && lResonance_REC.Pt()>0 && lResonance_REC.Pt()<20.0 && jetpt_mcd>8 && jetpt_mcd<200)
JEhistos.fill(HIST("2DGenToRec_constrained"), lResonance.Pt(), jetpt_mcp);
JEhistos.fill(HIST("2DGenToRec"), lResonance.Pt(), jetpt_mcp);
// //check constrained eff
if (good_daughter[0] && good_daughter[1] && lResonance_REC.Pt() > 0 && lResonance_REC.Pt() < 20.0 && jetpt_mcd > 8 && jetpt_mcd < 200)
JEhistos.fill(HIST("2DGenToRec_constrained"), lResonance.Pt(), jetpt_mcp);

JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D"), lResonance.M());
if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3)
Expand Down Expand Up @@ -1403,21 +1403,20 @@ struct phiInJets {
std::cout << "******************************************" << std::endl;
}
JEhistos.fill(HIST("Resp_Matrix_MATCHED"), lResonance.Pt(), jetpt_mcd, mothers1Pt[0], jetpt_mcp);
unsigned int seed = static_cast<unsigned int>(std::chrono::system_clock::now().time_since_epoch().count());
unsigned int seed = static_cast<unsigned int>(std::chrono::system_clock::now().time_since_epoch().count());
int dice = rand_r(&seed) % 2;
if (dice > 0)
JEhistos.fill(HIST("Resp_Matrix_MATCHED_rand0"), lResonance.Pt(), jetpt_mcd, mothers1Pt[0], jetpt_mcp);
else
JEhistos.fill(HIST("Resp_Matrix_MATCHED_rand1"), lResonance.Pt(), jetpt_mcd, mothers1Pt[0], jetpt_mcp);

JEhistos.fill(HIST("2DRecToGen"), lResonance.Pt(), jetpt_mcd);
//check constrained eff
if(mothers1Pt[0]>0 && mothers1Pt[0]<20.0 && jetpt_mcp>8 && jetpt_mcp<200)
JEhistos.fill(HIST("2DRecToGen_constrained"), lResonance.Pt(), jetpt_mcd);

JEhistos.fill(HIST("2DRecToGen"), lResonance.Pt(), jetpt_mcd);
// check constrained eff
if (mothers1Pt[0] > 0 && mothers1Pt[0] < 20.0 && jetpt_mcp > 8 && jetpt_mcp < 200)
JEhistos.fill(HIST("2DRecToGen_constrained"), lResonance.Pt(), jetpt_mcd);
}
//Fill 3D Invariant mass distributions

// Fill 3D Invariant mass distributions
if (jetFlag) {
JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M());
if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3)
Expand Down
Loading