00001 
00002 #include <iostream>
00003 #include <stdio.h>
00004 
00005 #include "HepMC/GenEvent.h"
00006 #include "HepMC/IO_GenEvent.h"
00007 #include "HepMC/GenParticle.h"
00008 #include "HepMC/GenVertex.h"
00009 #include "HepMC/IO_AsciiParticles.h"
00010 #include "HepMC/SimpleVector.h"
00011 #include "HepPDT/ParticleData.hh"
00012 #include "CLHEP/Vector/LorentzVector.h"
00013 
00014 
00015 #include "TH1.h"
00016 #include "TH2.h"
00017 #include "TFile.h"
00018 #include "TMath.h"
00019 #include "TLorentzVector.h"
00020 
00021 #include "fastjet/PseudoJet.hh"
00022 #include "fastjet/ClusterSequence.hh"
00023 #include "fastjet/JetDefinition.hh"
00024 #include "fastjet/SISConePlugin.hh"
00025 
00026 
00027 #include "../include/JetAnalysis.h"
00028 
00029 using namespace std;
00030 
00031 
00032 
00033 
00034 JetAnalysis::JetAnalysis()
00035 {
00036 }
00037 
00038 
00039 
00040 
00041 JetAnalysis::~JetAnalysis()
00042 {
00043 }
00044 
00045 
00046 
00047 
00048 int JetAnalysis::Init(double tr_max_eta, double tr_min_pt )
00049 {
00050   m_max_eta = tr_max_eta;       
00051   m_min_pt  = tr_min_pt;        
00052    
00053   m_outputFileName  = "JetAnalysis.root";    
00054   m_outputRootDir   = "Jet";
00055   
00056   
00057   m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00058   m_jet_pt=baseAnalysis::initHist(string("jet_pt"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00059                                  200, 0.,1000.);
00060   m_jet_pt_log=baseAnalysis::initHist(string("jet_pt_logscale"),string("Jet Transverse Momentum -logscale-"),
00061                                              string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00062   m_leadingjet_pt=baseAnalysis::initHist(string("leadingjet_pt"),string("Leading Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00063                                          200, 0.,1000.);
00064   m_leadingjet_pt_log=baseAnalysis::initHist(string("leadingjet_pt_logscale"),string("Leading Jet Transverse Momentum -logscale-"),
00065                                              string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00066   m_secondleadingjet_pt=baseAnalysis::initHist(string("secondleadingjet_pt"),string("Second leading Jet Transverse Momentum"),
00067                                                string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00068   m_secondleadingjet_pt_log=baseAnalysis::initHist(string("secondleadingjet_pt_logscale"),
00069                                                    string("Second leading Jet Transverse Momentum -logscale-"),
00070                                                    string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00071   
00072   m_jet_phi=baseAnalysis::initHist(string("jet_phi"),string("Jet Phi angle"),string("Jet #varphi"), 64, 0., 6.4);
00073   m_jet_eta=baseAnalysis::initHist(string("jet_eta"),string("Jet Pseudo rapidity"),string("Jet #eta"),60, -6., 6.);
00074   
00075   m_charged_particle_multiplicity=baseAnalysis::initHist(string("charged_particle_multiplicity"),string("Number of charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle multiplicity"),50, 0., 500.);
00076 
00077   m_charged_particle_temp_pt=baseAnalysis::initHist(string("Jet_charged_particle_mean_pt"),string("temp histogramm"),string("Jet charged particle mean p_{T}"),200,0,200.); 
00078   m_charged_particle_pt=baseAnalysis::initHist("charged_particle_pt","p_{T} of charged particles with #eta <2.5 and p_{T}>0.5 GeV","p_{T}",25,0,25.); 
00079   m_charged_particle_pt_log=baseAnalysis::initHist("charged_particle_pt_logscale","p_{T} of charged particles with #eta <2.5 and p_{T}>0.5 GeV","p_{T}",25,0,25.); 
00080   m_charged_particle_mean_pt=baseAnalysis::initHist(string("charged_particle_mean_pt"),string("Average p_{T} charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle #bar{p}_{T}"),50, 0., 10.);
00081   m_charged_particle_rms_pt=baseAnalysis::initHist(string("charged_particle_rms_pt"),string("RMS p_{T} charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle #sigma(p_{T})"),50, 0., 10.);
00082   
00083   
00084   m_jet_Deta_leadingJet_secondJet=baseAnalysis::initHist(string("jet_Deta_leadingJet_secondJet"),string("#Delta#eta leading and second leading Jet"),string("#Delta#eta"), 60, 0., 6.);
00085   m_jet_Dphi_leadingJet_secondJet=baseAnalysis::initHist(string("jet_Dphi_leadingJet_secondJet"),string("#Delta#varphi leading and second leading Jet"),string("#Delta#varphi"), 64, 0., 3.2);
00086   m_jet_DR_leadingJet_secondJet=baseAnalysis::initHist(string("jet_DR_leadingJet_secondJet"),string("#DeltaR leading and second leading Jet"),string("#DeltaR"), 60, 0., 15.);
00087   
00088   return true;
00089 }
00090 
00091 
00092 
00093 
00094 
00095 int JetAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00096 {
00097   unsigned int chargeParticlecount=0;  
00098   
00099   
00100   m_charged_particle_temp_pt->Reset();
00101   
00102   
00103   
00104   
00105   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p ) {
00106       
00107     int pid = (*p)->pdg_id();
00108       
00109       
00110 
00111       
00112       
00113       if(!chargedParticle(pid)) continue;
00114       
00115       
00116      if(!IsFinalStateParticle((*p))) continue;
00117 
00118       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00119       m_charged_particle_pt->Fill((*p)->momentum().perp());
00120       m_charged_particle_pt_log->Fill((*p)->momentum().perp());
00121       chargeParticlecount++;
00122       
00123   }
00124   
00125   
00126   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00127   
00128   
00129   
00130   
00131   
00132   m_jet_count->Fill(m_inclusive_jets.size());
00133   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00134   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00135   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00136   
00137   
00138   m_charged_particle_temp_pt->Reset();
00139   
00140   if(m_inclusive_jets.size()){
00141 
00142     for(unsigned int  i=0; i<m_inclusive_jets.size(); i++) {
00143       m_jet_pt->Fill(m_inclusive_jets[i].perp());
00144       m_jet_pt_log->Fill(m_inclusive_jets[i].perp());
00145     }
00146 
00147     m_leadingjet_pt->Fill(m_inclusive_jets[0].perp());
00148     m_leadingjet_pt_log->Fill(m_inclusive_jets[0].perp());
00149     m_secondleadingjet_pt->Fill(m_inclusive_jets[1].perp());
00150     m_secondleadingjet_pt_log->Fill(m_inclusive_jets[1].perp());
00151     m_jet_phi->Fill(m_inclusive_jets[0].phi());
00152     m_jet_eta->Fill(m_inclusive_jets[0].eta());
00153     
00154     CLHEP::HepLorentzVector lv_firstJet(m_inclusive_jets[0].px(), m_inclusive_jets[0].py(), m_inclusive_jets[0].pz(), m_inclusive_jets[0].e());
00155     if(m_inclusive_jets.size() > 1 ) {
00156       CLHEP::HepLorentzVector lv_secondJet(m_inclusive_jets[1].px(), m_inclusive_jets[1].py(), m_inclusive_jets[1].pz(), m_inclusive_jets[1].e());   
00157       m_jet_DR_leadingJet_secondJet->Fill(fabs(lv_firstJet.deltaR(lv_secondJet)));
00158       m_jet_Deta_leadingJet_secondJet->Fill(fabs(lv_firstJet.eta()-lv_secondJet.eta()));
00159       m_jet_Dphi_leadingJet_secondJet->Fill(fabs(lv_firstJet.vect().deltaPhi(lv_secondJet.vect())));
00160     }
00161   }
00162   return true;
00163 }
00164 
00165 
00166 
00167