Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
#include "DataFormats/Provenance/interface/BranchType.h"

#include <array>
#include <cassert>
#include <cstddef>
#include <iostream>

namespace edm {
  std::ostream& operator<<(std::ostream& os, BranchType const& branchType) {
    os << BranchTypeToString(branchType);
    return os;
  }
  namespace {

    // Suffixes
    std::string const metaData = "MetaData";
    std::string const auxiliary = "Auxiliary";
    std::string const aux = "Aux";  // backward compatibility
    std::string const productStatus = "ProductStatus";
    std::string const branchEntryInfo = "BranchEntryInfo";  // backward compatibility
    std::string const productProvenance = "ProductProvenance";

    std::array<std::string, NumBranchTypes> const branchTypeNames{{"Event", "LuminosityBlock", "Run", "ProcessBlock"}};
    std::size_t constexpr eventLumiRunSize = 3;
    using NameArray = std::array<std::string, eventLumiRunSize>;

    NameArray makeNameArray(std::string const& postfix) {
      static_assert(InEvent == 0);
      static_assert(InLumi == 1);
      static_assert(InRun == 2);
      static_assert(InProcess == 3);
      NameArray ret;
      for (auto i = 0U; i != eventLumiRunSize; ++i) {
        ret[i] = branchTypeNames[i] + postfix;
      }
      return ret;
    }

    const NameArray treeNames{makeNameArray(std::string("s"))};

    const NameArray metaTreeNames{makeNameArray(metaData)};

    // backward compatibility
    const NameArray infoNames{makeNameArray(std::string("StatusInformation"))};

    const NameArray auxiliaryNames{makeNameArray(auxiliary)};

    // backward compatibility
    const NameArray productStatusNames{makeNameArray(productStatus)};

    // backward compatibility
    const NameArray eventEntryInfoNames{makeNameArray(branchEntryInfo)};

    const NameArray productProvenanceNames{makeNameArray(productProvenance)};

    // backward compatibility
    const NameArray auxNames{makeNameArray(aux)};

    std::string const entryDescriptionTree = "EntryDescription";
    std::string const entryDescriptionIDBranch = "Hash";
    std::string const entryDescriptionBranch = "Description";

    std::string const parentageTree = "Parentage";
    std::string const parentageBranch = "Description";

    std::string const metaDataTree = "MetaData";
    std::string const productRegistry = "ProductRegistry";
    std::string const productDependencies = "ProductDependencies";
    std::string const parameterSetMap = "ParameterSetMap";
    std::string const moduleDescriptionMap = "ModuleDescriptionMap";  // Obsolete
    std::string const processHistoryMap = "ProcessHistoryMap";        // Obsolete
    std::string const processHistory = "ProcessHistory";
    std::string const processConfiguration = "ProcessConfiguration";
    std::string const branchIDLists = "BranchIDLists";
    std::string const thinnedAssociationsHelper = "ThinnedAssociationsHelper";
    std::string const fileFormatVersion = "FileFormatVersion";
    std::string const fileIdentifier = "FileIdentifier";
    std::string const fileIndex = "FileIndex";
    std::string const indexIntoFile = "IndexIntoFile";
    std::string const mergeableRunProductMetadata = "MergeableRunProductMetadata";
    std::string const processBlockHelper = "ProcessBlockHelper";
    std::string const eventHistory = "EventHistory";
    std::string const eventBranchMapper = "EventBranchMapper";

    std::string const eventSelections = "EventSelections";
    std::string const branchListIndexes = "BranchListIndexes";
    std::string const eventToProcessBlockIndexes = "EventToProcessBlockIndexes";

    std::string const parameterSetsTree = "ParameterSets";
    std::string const idToParameterSetBlobsBranch = "IdToParameterSetsBlobs";
  }  // namespace

  std::string const& BranchTypeToString(BranchType const& branchType) { return branchTypeNames[branchType]; }

  std::string const& BranchTypeToProductTreeName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return treeNames[branchType];
  }

  std::string BranchTypeToProductTreeName(BranchType const& branchType, std::string const& processName) {
    assert(branchType == InProcess);
    return branchTypeNames[InProcess] + "s" + processName;
  }

  std::string const& BranchTypeToMetaDataTreeName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return metaTreeNames[branchType];
  }

  // backward compatibility
  std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return infoNames[branchType];
  }

  std::string const& BranchTypeToAuxiliaryBranchName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return auxiliaryNames[branchType];
  }

  // backward compatibility
  std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return auxNames[branchType];
  }

  // backward compatibility
  std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return productStatusNames[branchType];
  }

  // backward compatibility
  std::string const& BranchTypeToBranchEntryInfoBranchName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return eventEntryInfoNames[branchType];
  }

  std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& branchType) {
    assert(branchType < eventLumiRunSize);
    return productProvenanceNames[branchType];
  }

  namespace poolNames {

    // EntryDescription tree (1 entry per recorded distinct value of EntryDescription)
    std::string const& entryDescriptionTreeName() { return entryDescriptionTree; }

    std::string const& entryDescriptionIDBranchName() { return entryDescriptionIDBranch; }

    std::string const& entryDescriptionBranchName() { return entryDescriptionBranch; }

    // EntryDescription tree (1 entry per recorded distinct value of EntryDescription)
    std::string const& parentageTreeName() { return parentageTree; }

    std::string const& parentageBranchName() { return parentageBranch; }

    // MetaData Tree (1 entry per file)
    std::string const& metaDataTreeName() { return metaDataTree; }

    // Branch on MetaData Tree
    std::string const& productDescriptionBranchName() { return productRegistry; }

    // Branch on MetaData Tree
    std::string const& productDependenciesBranchName() { return productDependencies; }

    // Branch on MetaData Tree
    std::string const& parameterSetMapBranchName() { return parameterSetMap; }

    // Branch on MetaData Tree // Obsolete
    std::string const& moduleDescriptionMapBranchName() { return moduleDescriptionMap; }

    // Branch on MetaData Tree // Obsolete
    std::string const& processHistoryMapBranchName() { return processHistoryMap; }

    // Branch on MetaData Tree
    std::string const& processHistoryBranchName() { return processHistory; }

    // Branch on MetaData Tree
    std::string const& processConfigurationBranchName() { return processConfiguration; }

    // Branch on MetaData Tree
    std::string const& branchIDListBranchName() { return branchIDLists; }

    // Branch on MetaData Tree
    std::string const& thinnedAssociationsHelperBranchName() { return thinnedAssociationsHelper; }

    // Branch on MetaData Tree
    std::string const& fileFormatVersionBranchName() { return fileFormatVersion; }

    // Branch on MetaData Tree
    std::string const& fileIdentifierBranchName() { return fileIdentifier; }

    // Branch on MetaData Tree
    std::string const& fileIndexBranchName() { return fileIndex; }

    // Branch on MetaData Tree
    std::string const& indexIntoFileBranchName() { return indexIntoFile; }

    // Branch on MetaData Tree
    std::string const& mergeableRunProductMetadataBranchName() { return mergeableRunProductMetadata; }

    // Branch on MetaData Tree
    std::string const& processBlockHelperBranchName() { return processBlockHelper; }

    // Branch on Event History Tree
    std::string const& eventHistoryBranchName() { return eventHistory; }

    // Branches on Events Tree
    std::string const& eventSelectionsBranchName() { return eventSelections; }

    std::string const& branchListIndexesBranchName() { return branchListIndexes; }

    std::string const& eventToProcessBlockIndexesBranchName() { return eventToProcessBlockIndexes; }

    std::string const& parameterSetsTreeName() { return parameterSetsTree; }
    // Branch on ParameterSets Tree
    std::string const& idToParameterSetBlobsBranchName() { return idToParameterSetBlobsBranch; }

    std::string const& eventTreeName() { return treeNames[InEvent]; }

    std::string const& eventMetaDataTreeName() { return metaTreeNames[InEvent]; }

    std::string const& eventHistoryTreeName() { return eventHistory; }
    std::string const& luminosityBlockTreeName() { return treeNames[InLumi]; }
    std::string const& runTreeName() { return treeNames[InRun]; }
  }  // namespace poolNames
}  // namespace edm