00001
00002 #include <iostream>
00003 #include <sstream>
00004 #include <stdio.h>
00005
00006 #include "HepMC/GenEvent.h"
00007 #include "HepMC/IO_GenEvent.h"
00008 #include "HepMC/GenParticle.h"
00009 #include "HepMC/GenVertex.h"
00010 #include "HepMC/IO_AsciiParticles.h"
00011 #include "HepMC/SimpleVector.h"
00012 #include "HepPDT/ParticleData.hh"
00013 #include "CLHEP/Vector/LorentzVector.h"
00014
00015
00016 #include "TH1.h"
00017 #include "TMath.h"
00018 #include "TLorentzVector.h"
00019 #include "TFile.h"
00020
00021
00022 #include "fastjet/PseudoJet.hh"
00023 #include "fastjet/ClusterSequence.hh"
00024 #include "fastjet/JetDefinition.hh"
00025 #include "fastjet/SISConePlugin.hh"
00026
00027
00028 #include "../include/bbbarAnalysis.h"
00029
00030 using namespace std;
00031
00032
00033 bbbarAnalysis::bbbarAnalysis( char *fileName ) :
00034 OutputFileName( fileName )
00035 {
00036 clearCounters();
00037
00038 }
00039
00040
00041 bbbarAnalysis::bbbarAnalysis() :
00042 OutputFileName( "plots_lhcb.root" )
00043 {
00044 clearCounters();
00045
00046 }
00047
00048
00049 bbbarAnalysis::~bbbarAnalysis()
00050 {
00051
00052
00053
00054 }
00055
00056
00057 void bbbarAnalysis::initPlots()
00058 {
00059
00060
00061
00062 hPtmb = new TH1D("hPtmb", "Pt of stable charged particles in MB events",
00063 100, 0., 20.);
00064 hPtbbbar = new TH1D("hPtbbbar", "Pt of stable charged particles in bbbar events",
00065 100, 0., 20.);
00066 hPtbhadr = new TH1D("hPtbhadr", "Pt of B hadrons in bbbar events",
00067 100, 0., 20.);
00068 hEtabhadr = new TH1D("hEtabhadr", "Eta of B hadrons in bbbar events",
00069 100, -10., 10.);
00070 }
00071
00072
00073 void bbbarAnalysis::clearCounters()
00074 {
00075
00076 Bcount = 0;
00077 BcountTotal = 0;
00078
00079 Bdcount = 0;
00080 Bucount = 0;
00081 Bscount = 0;
00082 Barions = 0;
00083
00084 ChargedPartMB = 0;
00085 ChargedPartBBbar = 0;
00086 }
00087
00088
00089 int bbbarAnalysis::Init( double tr_max_eta, double tr_min_pt )
00090 {
00091
00092 m_max_eta=tr_max_eta;
00093
00094
00095 m_min_pt=tr_min_pt;
00096
00097
00098 m_outputFileName = "bbarAnalysis.root";
00099 m_outputRootDir = "bbar";
00100
00101
00102
00103
00104 hPtmb = initHist("hPtmb", "Ptmb", "Pt of stable charged particles in MB events",
00105 100, 0., 20.);
00106 hPtbbbar = initHist("hPtbbbar", "Ptbbbar", "Pt of stable charged particles in bbbar events",
00107 100, 0., 20.);
00108 hPtbhadr = initHist("hPtbhadr", "Ptbhadr", "Pt of B hadrons in bbbar events",
00109 100, 0., 20.);
00110 hEtabhadr = initHist("hEtabhadr", "Etabhadr", "Eta of B hadrons in bbbar events",
00111 100, -10., 10.);
00112
00113
00114 return true;
00115 }
00116
00117
00118 int bbbarAnalysis::Process( HepMC::GenEvent* hepmcevt )
00119 {
00120 getBbbar( hepmcevt );
00121 return true;
00122 }
00123
00124
00125 void bbbarAnalysis::getBbbar(HepMC::GenEvent* evt)
00126 {
00127
00128
00129 HepMC::GenEvent::particle_iterator part;
00130 bool bbbar = false;
00131 bool bhadr = false;
00132
00133
00134 int BcountInEvent = 0;
00135
00136
00137
00138
00139 for (part = evt->particles_begin(); part != evt->particles_end(); part++)
00140 {
00141
00142 int pdgID = (*part)->pdg_id();
00143 int apdgID = abs(pdgID);
00144
00145
00146 if (apdgID == 5) {
00147 bbbar = true;
00148
00149 if ((*part)->status() == 2) BcountInEvent++;
00150 }
00151
00152
00153 if (apdgID == 511) { Bdcount++; bhadr = true; }
00154 if (apdgID == 521) { Bucount++; bhadr = true; }
00155 if (apdgID == 531) { Bscount++; bhadr = true; }
00156
00157
00158 if (apdgID == 5122 || apdgID == 5232 || apdgID == 5132) {
00159 Barions++; bhadr = true; }
00160
00161 double Pt = (*part)->momentum().perp();
00162 double Eta = (*part)->momentum().pseudoRapidity();
00163
00164 if (bhadr) {
00165 hPtbhadr->Fill(Pt);
00166 hEtabhadr->Fill(Eta);
00167 }
00168
00169
00170 if ( !(*part)->end_vertex() && (*part)->status()==1 )
00171
00172 {
00173
00174
00175 if ( chargedParticle(pdgID) )
00176 {
00177 ChargedPartMB++;
00178 hPtmb->Fill(Pt);
00179
00180 if (bbbar) {
00181 ChargedPartBBbar++;
00182 hPtbbbar->Fill(Pt);
00183 }
00184 }
00185
00186 }
00187 }
00188 if (bbbar) { Bcount++; BcountTotal += BcountInEvent/2; }
00189
00190 }
00191