KtJet is hosted by Hepforge, IPPP Durham

Example2.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
 * A subjet analysis is then performed on the highest Pt jet

 @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 total energy of event */ std::cout << "Total energy of event: " << ev.getETot() << std::endl; /** Retrieve the final state jets sorted by Pt */ std::vector<KtJet::KtLorentzVector> jets = ev.getJetsPt(); /** Do subjet analysis on highest Pt yet by constructing a new KtEvent from it */ KtJet::KtEvent subjet((*jets.begin()),angle,recom); /** Find y-cut when 3 jets become 2 */ std::cout << "y-cut when three jets become two: " << subjet.getYMerge(2) << std::endl; /** Force subjet into two jets */ subjet.findJetsN(2); /** Retrieve two jets */ std::vector<KtJet::KtLorentzVector> sjets = subjet.getJets(); /** Print out jets 4-momentum and Pt of two subjets*/ std::vector<KtJet::KtLorentzVector>::const_iterator itr = sjets.begin(); for( ; itr != sjets.end() ; ++itr) { std::cout << "Sub Jets 4 vector: " << (*itr).px() << " " << (*itr).py() << " " << (*itr).pz() << " " << (*itr).e() << std::endl; std::cout << "Sub Jets Pt: " << (*itr).perp() << std::endl; } return 0; }
Generated by GNU enscript 1.6.1.