我在 C++ 方面不是那么专家,但我尝试制作一个简单的程序来计算和绘制 pythia 在 pp 碰撞(pp -> bbbar)中的 bbbar 对质量不变分布,从 .lhe 文件中获取事件。
现在关于此处附加的程序,我按照以下步骤进行了操作,但直方图中没有显示任何内容..可能是循环中有问题..步骤:
- 预订直方图
- 启动事件循环
- 定义 iBottom 以解释 b 衰减 - 启动粒子循环
- 定义 b , bbar - 启动粒子循环
- 制作轮廓以找到对
- 计算invM。
那么有什么帮助吗?如果有人知道pythia,就知道如何制作这样的程序..
// The program
#include <iostream>
// Header file to access Pythia 8 program elements.
#include "Pythia.h"
// ROOT, for histogramming.
#include "TH1.h"
// ROOT, for interactive graphics.
#include "TVirtualPad.h"
{#include "TApplication.h"
// ROOT, for saving file.
#include "TFile.h"
using namespace Pythia8;
int main(int argc, char* argv[]) {
// Create the ROOT application environment.
TApplication theApp("hist", &argc, argv);
// create Pythia object and set up generation
Pythia pythia;
pythia.readString("PartonLevel:MI = off");
pythia.init("events.lhe");
pythia.readString("Beams:eCM = 14000.");
pythia.readString("PhaseSpace:pTHatMin = 20.");
pythia.init();
// Create file on which histograms can be saved.
TFile* outFile = new TFile("hist.root", "RECREATE");
TH1F *Mbbbar = new TH1F("MbB","MbB invariant mass", 0,0.,2000.);
// Begin event loop. Genera1te event; skip if generation aborted.
for (int iEvent = 0; iEvent<100; ++iEvent)
{
int iBottom = 0;
if(!pythia.next()) continue;
for (int i = 0; i< pythia.event.size(); ++i)
{
if (pythia.event[i].id() == 5) iBottom = i;
// Look for BQuarks among decay products.
vector<int> b, bbar;
for (int i = 0; i< pythia.event.size(); ++i) {
int id = pythia.event[i].id();
if (id == 5) b.push_back(i);
if (id == -5) bbar.push_back(i);
// Check whether pair(s) present.
int N = bbar.size();
int n = b.size();
if (N + n > 1) {
// Fill masses of BQuarks pair.
for (int i1 = 0; i1 < n - 1; ++i1)
for (int i2 = 0; i2 < N - 1; ++i2)
Mbbbar->Fill(
(pythia.event[b[i1]].p() +pythia.event[bbar[i2]].p()).mCalc() );
}
}
}
}
pythia.stat();
Mbbbar->Draw();
std::cout << "\nDouble click on the histogram window to quit.\n";
gPad->WaitPrimitive();
// Save histogram on file and close file.
Mbbbar->Write();
delete outFile;
// Done
return 0;
}
谢谢你,萨菲纳兹