Skip to content

Commit b1f0bde

Browse files
committed
External generator for QED e+e- production
1 parent 3902396 commit b1f0bde

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
//< Loader macro to run QED background generator from QEDepem.C macro, use it as e.g.
12+
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g external --configKeyValues "GeneratorExternal.fileName=QEDloader.C"
13+
#include <FairLogger.h>
14+
15+
FairGenerator* fg = nullptr;
16+
17+
FairGenerator* QEDLoader()
18+
{
19+
const TString macroName = "QEDepem";
20+
gSystem->Load("libTEPEMGEN");
21+
22+
// the path of the macro to load depends on where it was installed, we assume that its installation
23+
// directory is the same as of the loader macro
24+
std::ostringstream mstr;
25+
mstr << __FILE__;
26+
TString macroFullName = Form("%s/%s.C", gSystem->DirName(mstr.str().c_str()), macroName.Data());
27+
LOG(INFO) << "\nLoading " << macroFullName.Data() << "\n";
28+
29+
gROOT->LoadMacro(macroFullName.Data());
30+
gInterpreter->ProcessLine(Form("%s()", macroName.Data()));
31+
return fg;
32+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
//< Macro to run QED background generator, us it as e.g.
12+
//< o2-sim -n10000 -m PIPE ITS T0 MFT --noemptyevents -g external --configKeyValues "GeneratorExternal.fileName=QEDloader.C"
13+
14+
R__LOAD_LIBRARY(libTEPEMGEN)
15+
16+
o2::eventgen::GeneratorTGenerator* QEDepem()
17+
{
18+
auto& qedParam = o2::eventgen::QEDGenParam::Instance();
19+
auto& diamond = o2::eventgen::InteractionDiamondParam::Instance();
20+
if (qedParam.yMin >= qedParam.yMax) {
21+
LOG(FATAL) << "QEDGenParam.yMin(" << qedParam.yMin << ") >= QEDGenParam.yMax(" << qedParam.yMax << ")";
22+
}
23+
if (qedParam.ptMin >= qedParam.ptMax) {
24+
LOG(FATAL) << "QEDGenParam.ptMin(" << qedParam.ptMin << ") >= QEDGenParam.ptMax(" << qedParam.ptMax << ")";
25+
}
26+
27+
auto genBg = new TGenEpEmv1();
28+
genBg->SetYRange(qedParam.yMin, qedParam.yMax); // Set Y limits
29+
genBg->SetPtRange(qedParam.ptMin, qedParam.ptMax); // Set pt limits (GeV) for e+-: 1MeV corresponds to max R=13.3mm at 5kGaus
30+
genBg->SetOrigin(diamond.position[0], diamond.position[1], diamond.position[2]); // vertex position in space
31+
genBg->SetSigma(diamond.width[0], diamond.width[1], diamond.width[2]); // vertex sigma
32+
genBg->SetTimeOrigin(0.); // vertex position in time
33+
genBg->Init();
34+
35+
// calculate and store X-section
36+
std::ostringstream xstr;
37+
xstr << "QEDGenParam.xSectionQED=" << genBg->GetXSection();
38+
qedParam.updateFromString(xstr.str());
39+
const std::string qedIniFileName = "qedgenparam.ini";
40+
qedParam.writeINI(qedIniFileName, "QEDGenParam");
41+
qedParam.printKeyValues(true);
42+
LOG(INFO) << "Info: QED background generation parameters stored to " << qedIniFileName;
43+
44+
// instance and configure TGenerator interface
45+
auto tgen = new o2::eventgen::GeneratorTGenerator();
46+
tgen->setMomentumUnit(1.); // [GeV/c]
47+
tgen->setEnergyUnit(1.); // [GeV/c]
48+
tgen->setPositionUnit(1.); // [cm]
49+
tgen->setTimeUnit(1.); // [s]
50+
tgen->setTGenerator(genBg);
51+
fg = tgen;
52+
return tgen;
53+
}

0 commit comments

Comments
 (0)