Project
Loading...
Searching...
No Matches
aodMerger.h
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#include <TString.h>
13
14const char* removeVersionSuffix(const char* treeName)
15{
16 // remove version suffix, e.g. O2v0_001 becomes O2v0
17 // it is also intended that O2track_iu becomes O2track
18 static TString tmp;
19 tmp = treeName;
20 if (auto pos = tmp.First('_'); pos >= 0) {
21 tmp.Remove(pos);
22 }
23 return tmp;
24}
25
26const char* getTableName(const char* branchName, const char* treeName)
27{
28 // Syntax for branchName:
29 // fIndex<Table>[_<Suffix>]
30 // fIndexArray<Table>[_<Suffix>]
31 // fIndexSlice<Table>[_<Suffix>]
32 // if <Table> is empty it is a self index and treeName is used as table name
33 static TString tableName;
34 tableName = branchName;
35 if (tableName.BeginsWith("fIndexArray") || tableName.BeginsWith("fIndexSlice")) {
36 tableName.Remove(0, 11);
37 } else {
38 tableName.Remove(0, 6);
39 }
40 if (tableName.First("_") >= 0) {
41 tableName.Remove(tableName.First("_"));
42 }
43 if (tableName.Length() == 0) {
44 return removeVersionSuffix(treeName);
45 }
46 tableName.Remove(tableName.Length() - 1); // remove s
47 tableName.ToLower();
48 tableName = "O2" + tableName;
49 // printf("%s --> %s\n", branchName, tableName.Data());
50 return tableName;
51}
uint16_t pos
Definition RawData.h:3
const char * getTableName(const char *branchName, const char *treeName)
Definition aodMerger.h:26
const char * removeVersionSuffix(const char *treeName)
Definition aodMerger.h:14