Depends a bit on what you mean by weighted' - more specifally what the wieght is. If what you're looking for is the nucleon overlap, perhaps you want some sort of Glauber calculation - see for examplerunHijing.C’ in THijing [1]
If what you want is to explore a particular part of phase-space, the authors of Pythia has some recommendations on pp. 226 of [2]. Essentially they say that you should replace your event loop with something like
[code] dpT = (pT_high-pT_low) / nBin;
for (Int_t bin = 0; bin < nBin; bin++) {
pythia->SetCKIN(3. bin * dpT + pT_low));
pythia->SetCKIN(4, (bin+1) * dpT + pT_low));
// Now we make some events
for (Int_t ev = 0; ev < nEvents; ev++) {
// Show how far we got every 100’th event.
if (ev % 100 == 0) cout << "Event # " << ev << endl;
// Make one event.
pythia->GenerateEvent();
// Filter out events in first bin that doesn't fall within bin
if (bin == 0 && ((bin+1) * dpT + pT_low) <= pyhtia->GetPARI(17)) {
ev--;
continue;
}
// Maybe you want to have another branch with global event
// information. In that case, you should process that here.
// You can also filter out particles here if you want.
// Now we're ready to fill the tree, and the event is over.
tree->Fill();
}
}
[/code]
The authors also suggest using subroutine PYEVWT [3] but I’m not sure that it’s supported in the ROOT interface (perhaps it should be - it seems like a newer approach with certain advantages).