Project
Loading...
Searching...
No Matches
AnalysisDataModelHelpers.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
15
16std::string str_tolower(std::string s)
17{
18 std::transform(s.begin(), s.end(), s.begin(),
19 [](unsigned char c) { return std::tolower(c); } // correct
20 );
21 return s;
22}
23
24namespace o2::aod::datamodel
25{
26std::string getTreeName(header::DataHeader dh, bool wasAOD)
27{
28 auto description = std::string(dh.dataDescription.str);
29 auto iver = (float)dh.subSpecification;
30
31 // lower case of first part of description
32 auto found = description.find_first_of(':');
33 std::string treeName = str_tolower(description).substr(0, found);
34 if (iver > 0) {
35 treeName += std::string{"_"}.append(std::string(2 - (int)std::log10(iver), '0')).append(std::to_string((int)iver));
36 }
37
38 // add prefix according to origin
39 if (wasAOD || std::ranges::any_of(framework::AODOrigins, [&o = dh.dataOrigin](header::DataOrigin const& origin) { return o == origin; })) {
40 treeName = "O2" + treeName;
41 }
42
43 // exceptions from this
44 auto origin = std::string(dh.dataOrigin.str);
45 if ((origin == "AOD" || wasAOD) && description == "MCCOLLISLABEL") {
46 treeName = "O2mccollisionlabel";
47 }
48
49 return treeName;
50}
51
52} // namespace o2::aod::datamodel
header::DataDescription description
std::string str_tolower(std::string s)
uint32_t c
Definition RawData.h:2
std::string getTreeName(header::DataHeader dh, bool wasAOD)
consteval header::DataOrigin origin()
Definition ASoA.h:368
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
the main header struct
Definition DataHeader.h:620
DataDescription dataDescription
Definition DataHeader.h:638
SubSpecificationType subSpecification
Definition DataHeader.h:658