Project
Loading...
Searching...
No Matches
test_TPCWorkflow.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 TPCWorkflow
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include <iomanip>
17#include <ios>
18#include <iostream>
21#include <TFile.h>
22#include <TTree.h>
23
24using namespace o2;
25using namespace o2::dataformats;
26
27BOOST_AUTO_TEST_CASE(TPCWorkflow_types)
28{
29 // check that all types used in the workflow can be written to tree
30 // Background:
31 // strangely enough, std::vector of MCLabelContainer can be serialized in a message
32 // even though std::vector < o2::dataformats::MCTruthContainer < o2::MCCompLabel >>
33 // has not been specified in the LinkDef file. But it can only e serialized to a
34 // tree branch if it has been defined.
36 std::vector<MCLabelContainer> containers;
37 const char* filename = "testTPCWorkflowTypes.root";
38 const char* treename = "testtree";
39 std::unique_ptr<TFile> testFile(TFile::Open(filename, "RECREATE"));
40 std::unique_ptr<TTree> testTree = std::make_unique<TTree>(treename, treename);
41
42 auto* labelsobject = &labels;
43 auto* labelsbranch = testTree->Branch("labels", &labelsobject);
44 auto* containerobject = &containers;
45 auto* containerbranch = testTree->Branch("containers", &containerobject);
46
47 labelsbranch->Fill();
48 containerbranch->Fill();
49
50 testTree.release();
51 testFile->Close();
52}
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_AUTO_TEST_CASE(FlatHisto)
std::string filename()