Project
Loading...
Searching...
No Matches
test_GeneratorService.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#define BOOST_TEST_MODULE Test GeneratorService class
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
20
22using namespace o2::eventgen;
23
24BOOST_AUTO_TEST_CASE(boxgen_novertex)
25{
26 // a simple box generator without any vertex smearing applied
27 GeneratorService service;
28 service.initService("boxgen", "", o2::eventgen::NoVertexOption());
29 auto event = service.generateEvent();
30
31 BOOST_CHECK(event.first.size() > 0);
32
33 auto& header = event.second;
34 BOOST_CHECK(header.GetX() == 0);
35 BOOST_CHECK(header.GetY() == 0);
36 BOOST_CHECK(header.GetZ() == 0);
37 BOOST_CHECK(header.GetT() == 0);
38}
39
40BOOST_AUTO_TEST_CASE(pythia8pp_diamonvertex)
41{
42 // parameter to influence vertex position
43 o2::conf::ConfigurableParam::updateFromString("Diamond.position[0]=1.1; Diamond.width[0]=0.");
44
45 GeneratorService service;
46 // a pythia8 generator with vertex smearing coming from Diamond param
47 service.initService("pythia8pp", "", o2::eventgen::DiamondParamVertexOption());
48 auto event = service.generateEvent();
49
50 BOOST_CHECK(event.first.size() > 0);
51
52 auto& header = event.second;
53 // BOOST_CHECK_CLOSE(header.GetX(), 1.1, 1E-6);
54 // BOOST_CHECK(header.GetX() == 1.1);
55 BOOST_CHECK(header.GetY() != 0.);
56 BOOST_CHECK(header.GetZ() != 0.);
57 BOOST_CHECK(header.GetT() == 0);
58
59 bool invalid = false;
60 BOOST_CHECK(header.getInfo<std::string>(Key::generator, invalid) == "pythia8");
61}
o2::monitoring::tags::Key Key
Definition of the MCTrack class.
static void updateFromString(std::string const &)
A class offering convenient generator configuration and encapsulation of lower level classes....
std::pair< std::vector< MCTrack >, o2::dataformats::MCEventHeader > generateEvent()
void initService(std::string const &generatorName, std::string const &triggerName, VertexOption const &vtxOption)
struct _cl_event * event
Definition glcorearb.h:2982
static constexpr const char * generator
BOOST_AUTO_TEST_CASE(boxgen_novertex)
BOOST_CHECK(tree)