+void AliCollider::SetStable(Int_t id,Int_t mode)
+{
+// Declare whether a particle must be regarded as stable or not.
+// The parameter "id" indicates the Pythia KF particle code, which
+// basically is the PDG particle identifier code.
+// The parameter "mode" indicates the action to be taken.
+//
+// mode = 0 : Particle will be able to decay
+// 1 : Particle will be regarded as stable.
+//
+// In case the user does NOT explicitly invoke this function, the standard
+// Pythia settings for the decay tables are used.
+//
+// When this function is invoked without the "mode" argument, then the
+// default of mode=1 will be used for the specified particle.
+//
+// Notes :
+// -------
+// 1) This function should be invoked after the initialisation call
+// to AliCollider::Init.
+// 2) Due to the internals of Pythia, there is no need to specify particles
+// and their corresponding anti-particles separately as (un)stable.
+// Once a particle has been declared (un)stable, the corresponding
+// anti-particle will be treated in the same way.
+
+ if (mode==0 || mode==1)
+ {
+ Int_t kc=Pycomp(id);
+ Int_t decay=1-mode;
+ if (kc>0)
+ {
+ SetMDCY(kc,1,decay);
+ }
+ else
+ {
+ cout << " *AliCollider::SetStable* Unknown particle code. id = " << id << endl;
+ }
+ }
+ else
+ {
+ cout << " *AliCollider::SetStable* Invalid parameter. mode = " << mode << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliCollider::SelectEvent(Int_t id)
+{
+// Add a particle to the event selection list.
+// The parameter "id" indicates the Pythia KF particle code, which
+// basically is the PDG particle identifier code.
+// In case the user has built a selection list via this procedure, only the
+// events in which one of the particles specified in the list was generated
+// will be kept.
+// The investigation of the generated particles takes place when the complete
+// event is in memory, including all (shortlived) mother particles and resonances.
+// So, the settings of the various particle decay modes have no influence on
+// the event selection described here.
+//
+// If no list has been specified, all events will be accepted.
+//
+// Note : id=0 will delete the selection list.
+//
+// Be aware of the fact that severe selection criteria (i.e. selecting only
+// rare events) may result in long runtimes before an event sample has been
+// obtained.
+//
+ if (!id)
+ {
+ if (fSelections)
+ {
+ delete fSelections;
+ fSelections=0;
+ }
+ }
+ else
+ {
+ Int_t kc=Pycomp(id);
+ if (!fSelections)
+ {
+ fSelections=new TArrayI(1);
+ fSelections->AddAt(kc,0);
+ }
+ else
+ {
+ Int_t exist=0;
+ Int_t size=fSelections->GetSize();
+ for (Int_t i=0; i<size; i++)
+ {
+ if (kc==fSelections->At(i))
+ {
+ exist=1;
+ break;
+ }
+ }
+
+ if (!exist)
+ {
+ fSelections->Set(size+1);
+ fSelections->AddAt(kc,size);
+ }
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::GetSelectionFlag() const
+{
+// Return the value of the selection flag for the total event.
+// When the event passed the selection criteria as specified via
+// SelectEvent() the value 1 is returned, otherwise the value 0 is returned.
+ return fSelect;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::IsSelected()
+{
+// Check whether the generated (sub)event contains one of the particles
+// specified in the selection list via SelectEvent().
+// If this is the case or when no selection list is present, the value 1
+// will be returned, indicating the event is selected to be kept.
+// Otherwise the value 0 will be returned.
+
+ if (!fSelections) return 1;
+
+ Int_t nsel=fSelections->GetSize();
+ Int_t npart=GetN();
+ Int_t kf,kc;
+
+ Int_t select=0;
+ for (Int_t jpart=1; jpart<=npart; jpart++)
+ {
+ kf=GetK(jpart,2);
+ kc=Pycomp(kf);
+ for (Int_t i=0; i<nsel; i++)
+ {
+ if (kc==fSelections->At(i))
+ {
+ select=1;
+ break;
+ }
+ }
+ if (select) break;
+ }
+ return select;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetSpectatorPmin(Float_t pmin)
+{
+// Set minimal momentum in GeV/c for spectator tracks to be stored.
+// Spectator tracks with a momentum below this threshold will not be stored
+// in the (output) event structure.
+// This facility allows to minimise the output file size.
+// Note that when the user wants to boost the event into another reference
+// frame these spectator tracks might have got momenta above the threshold.
+// However, when the spectator tracks were not stored in the event structure
+// in the original frame, there is no way to retreive them anymore.
+ fSpecpmin=pmin;
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliCollider::GetSpectatorPmin() const
+{
+// Provide the minimal spectator momentum in GeV/c.
+ return fSpecpmin;
+}
+///////////////////////////////////////////////////////////////////////////
+TString AliCollider::GetPyname(Int_t kf)
+{
+// Provide the correctly truncated Pythia particle name for PGD code kf
+//
+// The TPythia6::Pyname returned name is copied into a TString and truncated
+// at the first blank to prevent funny trailing characters due to incorrect
+// stripping of empty characters in TPythia6::Pyname.
+// The truncation at the first blank is allowed due to the Pythia convention
+// that particle names never contain blanks.
+ char name[16];
+ TString sname;
+ Pyname(kf,name);
+ sname=name[0];
+ for (Int_t i=1; i<16; i++)
+ {
+ if (name[i]==' ') break;
+ sname=sname+name[i];
+ }
+ return sname;
+}
+///////////////////////////////////////////////////////////////////////////