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