|
| 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