Skip to content

Commit

Permalink
Add possibility to trigger on generated multiplicity in PYTHIA8
Browse files Browse the repository at this point in the history
  • Loading branch information
fprino authored and ktf committed Sep 6, 2019
1 parent 7734c70 commit 9f66f64
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
48 changes: 47 additions & 1 deletion PYTHIA6/AliPythia6/AliGenPythiaPlus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ AliGenPythiaPlus::AliGenPythiaPlus():
fNewMIS(kFALSE),
fHFoff(kFALSE),
fTriggerParticle(0),
fTriggerEta(0.9),
fTriggerEta(0.9),
fTriggerMultiplicity(0),
fTriggerMultiplicityEta(0),
fTriggerMultiplicityEtaMin(0),
fTriggerMultiplicityEtaMax(0),
fTriggerMultiplicityPtMin(0),
fCountMode(kCountAll),
fHeader(0),
fRL(0),
Expand Down Expand Up @@ -199,6 +204,11 @@ AliGenPythiaPlus::AliGenPythiaPlus(AliPythiaBase* pythia)
fHFoff(kFALSE),
fTriggerParticle(0),
fTriggerEta(0.9),
fTriggerMultiplicity(0),
fTriggerMultiplicityEta(0),
fTriggerMultiplicityEtaMin(0),
fTriggerMultiplicityEtaMax(0),
fTriggerMultiplicityPtMin(0),
fCountMode(kCountAll),
fHeader(0),
fRL(0),
Expand Down Expand Up @@ -883,6 +893,42 @@ Int_t AliGenPythiaPlus::GenerateMB()
}
}

// Check for minimum multiplicity
if (fTriggerMultiplicity > 0) {
Int_t multiplicity = 0;
for (i = 0; i < np; i++) {
TParticle * iparticle = (TParticle *) fParticles.At(i);

Int_t statusCode = iparticle->GetStatusCode();

// Initial state particle
if (statusCode != 1)
continue;
// eta cut
if (fTriggerMultiplicityEta > 0 && TMath::Abs(iparticle->Eta()) > fTriggerMultiplicityEta)
continue;
//multiplicity check for a given eta range
if ((fTriggerMultiplicityEtaMin != fTriggerMultiplicityEtaMax) &&
(iparticle->Eta() < fTriggerMultiplicityEtaMin || iparticle->Eta() > fTriggerMultiplicityEtaMax))
continue;
// pt cut
if (iparticle->Pt() < fTriggerMultiplicityPtMin)
continue;

TParticlePDG* pdgPart = iparticle->GetPDG();
if (pdgPart && pdgPart->Charge() == 0)
continue;

++multiplicity;
}

if (multiplicity < fTriggerMultiplicity) {
delete [] pParent;
return 0;
}
Printf("Triggered on event with multiplicity of %d >= %d", multiplicity, fTriggerMultiplicity);
}

if (fTriggerParticle) {
Bool_t triggered = kFALSE;
for (i = 0; i < np; i++) {
Expand Down
17 changes: 16 additions & 1 deletion PYTHIA6/AliPythia6/AliGenPythiaPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ class AliGenPythiaPlus : public AliGenMC
//---------------------------------------------------------


// Trigger on a minimum multiplicity
virtual void SetTriggerChargedMultiplicity(Int_t multiplicity, Float_t etamax = 0, Float_t ptmin = -1.)
{fTriggerMultiplicity = multiplicity; fTriggerMultiplicityEta = etamax;
fTriggerMultiplicityPtMin = ptmin;}

// Trigger on a minimum multiplicity for a given eta range
virtual void SetTriggerMultiplicityEtaRange(Int_t multiplicity, Float_t etamin = 0., Float_t etamax = 0., Float_t ptmin = -1.)
{fTriggerMultiplicity = multiplicity; fTriggerMultiplicityEtaMin = etamin; fTriggerMultiplicityEtaMax = etamax;
fTriggerMultiplicityPtMin = ptmin;}

// Trigger on a single particle (not related to calorimeter trigger above)
virtual void SetTriggerParticle(Int_t particle = 0, Float_t etamax = 0.9)
{fTriggerParticle = particle; fTriggerEta = etamax;}
Expand Down Expand Up @@ -310,6 +320,11 @@ class AliGenPythiaPlus : public AliGenMC
Bool_t fHFoff; // Flag for switching heafy flavor production off
Int_t fTriggerParticle; // Trigger on this particle ...
Float_t fTriggerEta; // .. within |eta| < fTriggerEta
Int_t fTriggerMultiplicity; // Trigger on events with a minimum charged multiplicity
Float_t fTriggerMultiplicityEta; // in a given eta range
Float_t fTriggerMultiplicityEtaMin; // in a given eta min
Float_t fTriggerMultiplicityEtaMax; // in a given eta max
Float_t fTriggerMultiplicityPtMin; // above this pT
CountMode_t fCountMode; // Options for counting when the event will be finished.
// fCountMode = kCountAll --> All particles that end up in the
// stack are counted
Expand Down Expand Up @@ -354,7 +369,7 @@ class AliGenPythiaPlus : public AliGenMC
AliGenPythiaPlus(const AliGenPythiaPlus &Pythia);
AliGenPythiaPlus & operator=(const AliGenPythiaPlus & rhs);

ClassDef(AliGenPythiaPlus, 5)
ClassDef(AliGenPythiaPlus, 6)

};
#endif
Expand Down

0 comments on commit 9f66f64

Please sign in to comment.