ktjet is hosted by Hepforge, IPPP Durham

Example1.cxx

/** 
 * Example of running KtJet in inclusive mode 
 * PP events (4)
 * Angular distance scheme (1)
 * Recombination scheme E (1)
 * 4 vectors are read in from a txt file in format of
 * px py pz E

 @author J.Couchman
*/

#include <iostream>
#include <fstream> #include <string> /** Need to include these KtJet Headers */ #include "KtJet/KtEvent.h" #include "KtJet/KtLorentzVector.h" int main(){ /** Open input file */ const char* filename = "inputParticles.dat"; std::ifstream infile(filename); if (!infile) { std::cerr << "Unable to open file!!!!" << filename << std::endl; return -1; } /** Make a std::vector of KtJet::KtLorentzVectors which will be the input particles */ std::vector<KtJet::KtLorentzVector> avec; /** read in 4-vectors and fill std::vector */ double value[4]; while(infile >> value[0]){ infile >> value[1]; infile >> value[2]; infile >> value[3]; KtJet::KtLorentzVector p(value[0],value[1],value[2],value[3]); avec.push_back(p); } /** set KtEvent flags */ int type = 4; // PP int angle = 1; //Angular int recom = 1; // E double rparameter = 1.0; /** Construct the KtEvent object */ KtJet::KtEvent ev(avec,type,angle,recom,rparameter); /** Print out the number of final state jets */ std::cout << "Number of final state jets: " << ev.getNJets() << std::endl; /** Retrieve the final state jets from KtEvent sorted by Et*/ std::vector<KtJet::KtLorentzVector> jets = ev.getJetsEt(); /** Print out jets 4-momentum and Pt */ std::vector<KtJet::KtLorentzVector>::const_iterator itr = jets.begin(); for( ; itr != jets.end() ; ++itr) { std::cout << "Jets 4 vector: " << (*itr).px() << " " << (*itr).py() << " " << (*itr).pz() << " " << (*itr).e() << std::endl; std::cout << "Jets Pt: " << (*itr).perp() << std::endl; } return 0; }
Generated by GNU enscript 1.6.1.