How to access constituents' ID in FastJet

  • A
  • Thread starter Anterpreet
  • Start date
In summary: Extract the jets with pt < ptmin double ptmax = 0.0; Selector sel_jets_cutoff = SelectorPtMax(ptmax); // Print the jets#include<iostream>#include<fstream>#include "Pythia8/Pythia.h"#include "fastjet/ClusterSequence.hh"#include "fastjet/PseudoJet.hh"#include "fastjet/Selector.hh"using namespace std;using namespace fastjet;int main() {// Set up pythiaPythia pythia;pythia
  • #1
Anterpreet
1
0
TL;DR Summary
How to access constituents' ID in FastJet
Hi,
I am generating p-p collision events using Pythia 8 (8176 version). FastJet is used to cluster these generated particles into jets. I am studying the properties of the constituents of the jet. I can access the properties like pt, phi, rapidity but could not do for PDGID.

I followed http://fastjet.fr/repo/doxygen-3.0.5/09-user__info_8cc_source.html to add additional information of the particle. I successfully accessed the pdgid before clustering into jets but could not access ID of a particle as a jet constituent. Could you please provide any help regarding this ?
(Code used is attached.)

Many thanks in advance,
Anterpreet
 

Attachments

  • Code_jet.docx
    5.7 KB · Views: 200
Physics news on Phys.org
  • #2
#include <iostream>#include "Pythia8/Pythia.h"#include "fastjet/ClusterSequence.hh"#include "fastjet/Selector.hh"using namespace std;using namespace Pythia8;using namespace fastjet; int main() { // Generator. Process selection. LHC initialization. Histogram. Pythia pythia; pythia.readString("Beams:eCM = 13000."); pythia.readString("HardQCD:all = on"); pythia.init(); // Create an output file ofstream outfile; outfile.open("outfile.dat"); // Event loop. Generate event. Skip if error. List first one. for (int iEvent = 0; iEvent < 100; ++iEvent) { if (!pythia.next()) continue; // Get particles in event ParticleData* particleData = &pythia.particleData; vector<PseudoJet> particles; for (int i = 0; i < pythia.event.size(); ++i) { PseudoJet psJet(pythia.event.px(), pythia.event.py(), pythia.event.pz(), pythia.event.e()); psJet.set_user_info(new ParticleInfo(particleData->name(pythia.event.id()), pythia.event.id())); particles.push_back(psJet); } // Construct jets double R = 0.4; JetDefinition jetDef(antikt_algorithm, R); ClusterSequence clusterSeq(particles, jetDef); Selector select_rapidity = SelectorAbsRapMax(3.0); vector<PseudoJet> jets = select_rapidity(sorted_by_pt(clusterSeq.inclusive_jets())); // Print the jets
 
  • #3
#include<iostream>#include<fstream>#include "Pythia8/Pythia.h"#include "fastjet/ClusterSequence.hh"#include "fastjet/PseudoJet.hh"#include "fastjet/Selector.hh"using namespace Pythia8; using namespace std;using namespace fastjet;int main() {// Set up pythiaPythia pythia;pythia.readFile("pythia_pp_events.cmnd");// Initialize pythiapythia.init();// Set up FastJet jet finder double R = 0.4;JetDefinition jet_def(antikt_algorithm, R);// Create an empty vector of pseudojetsvector <PseudoJet> particles;// Event loopfor (int iEvent = 0; iEvent < 10; ++iEvent) { // Generate next event if(!pythia.next()) continue; // Loop over all particles in the event for (int i = 0; i < pythia.event.size(); ++i) { // Require visible particles if(!pythia.event.isFinal()) continue; if(pythia.event.isVisible()) { // Construct a PseudoJet from the complete Pythia particle PseudoJet particleTemp = pythia.event; // Set the user info with PDGID particleTemp.set_user_info(new UserInfo(pythia.event.id())); // Store the PseudoJet in the vector of particles particles.push_back(particleTemp); } } // Create a new instance of a ClusterSequence // and run the clustering algorithm ClusterSequence jetCluster(particles, jet_def); // Extract the jets with pt > 30 GeV double ptmin = 30.0; Selector sel_jets = SelectorPtMin(
 

FAQ: How to access constituents' ID in FastJet

1. How do I access constituents' ID in FastJet?

To access constituents' ID in FastJet, you will need to use the getConstituentID() function. This function takes in the constituent's name as a parameter and returns their unique ID number.

2. Can I access multiple constituents' IDs at once in FastJet?

Yes, you can access multiple constituents' IDs at once in FastJet by using the getConstituentIDs() function. This function takes in an array of constituent names as a parameter and returns an array of their corresponding IDs.

3. Is there a limit to the number of constituents' IDs I can access in FastJet?

No, there is no limit to the number of constituents' IDs you can access in FastJet. You can access as many IDs as needed using the getConstituentIDs() function.

4. Can I access constituents' IDs from a specific group in FastJet?

Yes, you can access constituents' IDs from a specific group in FastJet by using the getGroupConstituentIDs() function. This function takes in the group name as a parameter and returns an array of the constituent IDs in that group.

5. How do I handle errors when accessing constituents' IDs in FastJet?

If there is an error in accessing a constituent's ID, FastJet will return an error message. You can use error handling techniques such as try-catch statements to handle these errors and ensure your code runs smoothly.

Similar threads

Replies
2
Views
2K
Replies
25
Views
2K
Replies
26
Views
7K
Replies
30
Views
3K
Replies
5
Views
2K
Back
Top