Project
Loading...
Searching...
No Matches
testCachingTF1.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 CachingTF1
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
17#include <TFile.h>
18
19BOOST_AUTO_TEST_CASE(CachingTF1_test)
20{
21 std::string s("std::pow(x, 1.2)*std::exp(-x/3.)");
22 o2::math_utils::CachingTF1 func("testfunction", s.c_str(), 0, 100.);
23 const int kNPoints = 500;
24 func.SetNpx(kNPoints);
25 BOOST_CHECK(func.getIntegralVector().size() == 0);
26
27 BOOST_CHECK(func.GetRandom() > 0);
28 auto f = TFile::Open("tmpTF1Cache.root", "recreate");
30 f->WriteTObject(&func, "func");
31 f->Close();
32 // open for reading and verify that integral was cached
33 f = TFile::Open("tmpTF1Cache.root");
35 volatile auto func2 = (o2::math_utils::CachingTF1*)f->Get("func");
36 BOOST_CHECK(func2);
37 BOOST_CHECK(func2->getIntegralVector().size() == kNPoints + 1);
38
39 // check reference
40 auto& ref = *func2;
41 BOOST_CHECK(ref.getIntegralVector().size() == kNPoints + 1);
42}
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
GLenum func
Definition glcorearb.h:778
GLdouble f
Definition glcorearb.h:310
GLint ref
Definition glcorearb.h:291
BOOST_AUTO_TEST_CASE(CachingTF1_test)
BOOST_CHECK(tree)