Skip to content

Commit a1b053b

Browse files
committed
pass acceptance and parton pdg as parameters optionally
1 parent 264621c commit a1b053b

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed

MC/config/PWGGAJE/trigger/prompt_gamma.C

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ R__ADD_INCLUDE_PATH($O2DPG_ROOT)
1616
/// \author Gustavo Conesa Balbastre (LPSC-IN2P3-CNRS)
1717
/// =================================================
1818

19-
o2::eventgen::Trigger prompt_gamma( )
19+
o2::eventgen::Trigger prompt_gamma( int acceptanceIn = 0, int partonpdgIn = 0 )
2020
{
21-
return [](const std::vector<TParticle>& particles) -> bool {
21+
return [acceptanceIn,partonpdgIn](const std::vector<TParticle>& particles) -> bool {
2222

2323
// for(Int_t ipart = 3; ipart < 10; ipart++)
2424
// {
@@ -34,25 +34,43 @@ o2::eventgen::Trigger prompt_gamma( )
3434
// }
3535

3636
// Get the outgoing 2->2 partons.
37-
// The photon and the associated outgoing parton are in position 5 or 6.
38-
// Note that in PYTHIA6 they are at positions 7 or 8.
39-
TParticle gamma = particles.at(5);
40-
TParticle parton = particles.at(6);
37+
// The photon and the associated outgoing parton are in position 4 or 5.
38+
// Note that in PYTHIA6 they are at positions 6 or 7.
39+
int ig = 4;
40+
int ip = 5;
41+
TParticle gamma = particles.at(ig);
4142
if ( gamma.GetPdgCode() != 22 ) {
42-
gamma = particles.at(6);
43-
parton = particles.at(5);
43+
ig = 5;
44+
ip = 4;
45+
gamma = particles.at(ig);
4446
}
45-
47+
48+
TParticle parton = particles.at(ip);
49+
4650
if ( gamma.GetPdgCode() != 22 )
4751
{
4852
printf("No direct photon found in the parton list!\n");
53+
54+
// for(Int_t ipart = 3; ipart < 10; ipart++)
55+
// {
56+
// TParticle part = particles.at(ipart);
57+
// printf("\t parton %d, PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n", ipart,
58+
// part.GetPdgCode(),
59+
// part.GetStatusCode(),
60+
// part.GetFirstMother(),
61+
// part.Energy(),
62+
// part.Pt(),
63+
// part.Eta(),
64+
// part.Phi()*TMath::RadToDeg());
65+
// }
66+
4967
return false;
5068
}
5169

5270
// Select the flavour of the outgoing parton
5371
//
54-
Int_t partonpdg = 0;
55-
if ( gSystem->Getenv("CONFIG_OUTPARTON_PDG") )
72+
int partonpdg = partonpdgIn;
73+
if ( partonpdg <= 0 && gSystem->Getenv("CONFIG_OUTPARTON_PDG") )
5674
partonpdg = atoi(gSystem->Getenv("CONFIG_OUTPARTON_PDG"));
5775

5876
if ( partonpdg > 0 && partonpdg <= 22 )
@@ -70,26 +88,26 @@ o2::eventgen::Trigger prompt_gamma( )
7088

7189
// Select photons within acceptance
7290
//
73-
Int_t acceptance = 0;
74-
if ( gSystem->Getenv("PARTICLE_ACCEPTANCE") )
91+
int acceptance = acceptanceIn;
92+
if ( acceptance <= 0 && gSystem->Getenv("PARTICLE_ACCEPTANCE") )
7593
acceptance = atoi(gSystem->Getenv("PARTICLE_ACCEPTANCE"));
7694
//printf("Requested acceptance %d\n",acceptance);
7795

7896
if ( detector_acceptance(acceptance, gamma.Phi(),gamma.Eta()) )
7997
{
80-
printf("+++ Accepted event +++ \n");
81-
printf("gamma, PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
98+
//printf("+++ Accepted event +++ \n");
99+
printf("Selected gamma, pos %d, PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",ig,
82100
gamma.GetPdgCode(), gamma.GetStatusCode(), gamma.GetFirstMother(),
83101
gamma.Energy() , gamma.Pt(),
84102
gamma.Eta() , gamma.Phi()*TMath::RadToDeg());
85103

86-
printf("parton, PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
87-
parton.GetPdgCode(), parton.GetStatusCode(), parton.GetFirstMother(),
88-
parton.Energy() , parton.Pt(),
89-
parton.Eta() , parton.Phi()*TMath::RadToDeg());
90-
104+
// printf("Back-to-back parton, pos %d, PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",ip,
105+
// parton.GetPdgCode(), parton.GetStatusCode(), parton.GetFirstMother(),
106+
// parton.Energy() , parton.Pt(),
107+
// parton.Eta() , parton.Phi()*TMath::RadToDeg());
108+
//
91109
// // Check difference in pT and azimuthal angle, it should be 0 and +-180 degrees, respectively.
92-
// printf("parton-photon, Delta E %2.2f, Delta pT %2.2f, Delta eta %2.2f, Delta phi %2.2f\n",
110+
// printf("parton-photon, Delta E %2.2f, Delta pT %2.2f, Delta eta %2.2f, Delta phi %2.2f\n",
93111
// parton.Energy()-gamma.Energy(), parton.Pt() - gamma.Pt(),
94112
// parton.Eta() -gamma.Eta() , parton.Phi()*TMath::RadToDeg()-gamma.Phi()*TMath::RadToDeg());
95113

0 commit comments

Comments
 (0)