13 using namespace Pythia8;
44 double pTminChargedIn = 0.,
double pTminNeutralIn = 0.)
45 : select(selectIn), etaMax(etaMaxIn), pTminCharged(pTminChargedIn),
46 pTminNeutral(pTminNeutralIn) {}
49 void filter(
Event& event);
52 int size()
const {
return keptPtrs.size();}
53 int index(
int i)
const {
return keptIndx[i];}
56 Particle* particlePtr(
int i) {
return keptPtrs[i];}
57 Particle& particleRef(
int i) {
return *keptPtrs[i];}
60 void list(ostream& os = cout);
66 double etaMax, pTminCharged, pTminNeutral;
70 vector<Particle*> keptPtrs;
78 void EventFilter::filter(
Event& event) {
85 for (
int i = 0; i <
event.size(); ++i) {
88 if (!event[i].isFinal())
continue;
89 if (select == 2 && !event[i].isVisible())
continue;
90 bool isCharged =
event[i].isCharged();
91 if (select == 3 && !isCharged)
continue;
94 if (abs(event[i].eta()) > etaMax)
continue;
97 if (isCharged && event[i].pT() < pTminCharged)
continue;
98 else if (!isCharged && event[i].pT() < pTminNeutral)
continue;
101 keptIndx.push_back( i );
102 keptPtrs.push_back( &event[i] );
113 void EventFilter::list(ostream& os) {
116 os <<
"\n -------- PYTHIA Event Listing (filtered) ------------------"
117 <<
"-----------------------------------------------------------------"
118 <<
"----\n \n no id name status mothers "
119 <<
" daughters colours p_x p_y p_z e "
124 for (
int iKept = 0; iKept < size(); ++iKept) eSum += keptPtrs[iKept]->e();
125 bool useFixed = (eSum < 1e5);
128 for (
int iKept = 0; iKept < size(); ++iKept) {
129 int i = keptIndx[iKept];
133 os << setw(6) << i << setw(10) << pt.id() <<
" " << left
134 << setw(18) << pt.nameWithStatus(18) << right << setw(4)
135 << pt.status() << setw(6) << pt.mother1() << setw(6)
136 << pt.mother2() << setw(6) << pt.daughter1() << setw(6)
137 << pt.daughter2() << setw(6) << pt.col() << setw(6) << pt.acol()
138 << ( (useFixed) ? fixed : scientific ) << setprecision(3)
139 << setw(11) << pt.px() << setw(11) << pt.py() << setw(11)
140 << pt.pz() << setw(11) << pt.e() << setw(11) << pt.m() <<
"\n";
144 os <<
"\n -------- End PYTHIA Event Listing ----------------------------"
145 <<
"-------------------------------------------------------------------"
165 pythia.readString(
"HardQCD:all = on");
166 pythia.readString(
"PhaseSpace:pTHatMin = 100.");
169 pythia.readString(
"Next:numberShowInfo = 0");
170 pythia.readString(
"Next:numberShowProcess = 0");
171 pythia.readString(
"Next:numberShowEvent = 0");
179 double pTminChg = 1.;
185 Hist nCharged(
"selected charged multiplicity", 100, -0.5, 199.5);
186 Hist etaCharged(
"selected charged eta distribution", 100, -5.0, 5.0);
187 Hist pTCharged(
"selected charged pT distribution", 100, 0.0, 50.0);
191 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
194 if (!pythia.next()) {
195 if (++iAbort < nAbort)
continue;
196 cout <<
" Event generation aborted prematurely, owing to error!\n";
201 filter.filter( pythia.event);
204 if (iEvent < nList) {
206 pythia.process.list();
212 nCharged.fill( filter.size() );
213 for (
int i = 0; i < filter.size(); ++i) {
215 etaCharged.fill( filter.particleRef(i).eta() );
216 pTCharged.fill( filter.particlePtr(i)->pT() );
226 cout << nCharged << etaCharged << pTCharged;