Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-19 01:43:26

0001 #include "DataFormats/Provenance/interface/BranchType.h"
0002 
0003 #include <array>
0004 #include <cassert>
0005 #include <cstddef>
0006 #include <iostream>
0007 
0008 namespace edm {
0009   std::ostream& operator<<(std::ostream& os, BranchType const& branchType) {
0010     os << BranchTypeToString(branchType);
0011     return os;
0012   }
0013   namespace {
0014 
0015     // Suffixes
0016     std::string const metaData = "MetaData";
0017     std::string const auxiliary = "Auxiliary";
0018     std::string const aux = "Aux";  // backward compatibility
0019     std::string const productStatus = "ProductStatus";
0020     std::string const branchEntryInfo = "BranchEntryInfo";  // backward compatibility
0021     std::string const productProvenance = "ProductProvenance";
0022 
0023     std::array<std::string, NumBranchTypes> const branchTypeNames{{"Event", "LuminosityBlock", "Run", "ProcessBlock"}};
0024     std::size_t constexpr eventLumiRunSize = 3;
0025     using NameArray = std::array<std::string, eventLumiRunSize>;
0026 
0027     NameArray makeNameArray(std::string const& postfix) {
0028       static_assert(InEvent == 0);
0029       static_assert(InLumi == 1);
0030       static_assert(InRun == 2);
0031       static_assert(InProcess == 3);
0032       NameArray ret;
0033       for (auto i = 0U; i != eventLumiRunSize; ++i) {
0034         ret[i] = branchTypeNames[i] + postfix;
0035       }
0036       return ret;
0037     }
0038 
0039     const NameArray treeNames{makeNameArray(std::string("s"))};
0040 
0041     const NameArray metaTreeNames{makeNameArray(metaData)};
0042 
0043     // backward compatibility
0044     const NameArray infoNames{makeNameArray(std::string("StatusInformation"))};
0045 
0046     const NameArray auxiliaryNames{makeNameArray(auxiliary)};
0047 
0048     // backward compatibility
0049     const NameArray productStatusNames{makeNameArray(productStatus)};
0050 
0051     // backward compatibility
0052     const NameArray eventEntryInfoNames{makeNameArray(branchEntryInfo)};
0053 
0054     const NameArray productProvenanceNames{makeNameArray(productProvenance)};
0055 
0056     // backward compatibility
0057     const NameArray auxNames{makeNameArray(aux)};
0058 
0059     std::string const entryDescriptionTree = "EntryDescription";
0060     std::string const entryDescriptionIDBranch = "Hash";
0061     std::string const entryDescriptionBranch = "Description";
0062 
0063     std::string const parentageTree = "Parentage";
0064     std::string const parentageBranch = "Description";
0065 
0066     std::string const metaDataTree = "MetaData";
0067     std::string const productRegistry = "ProductRegistry";
0068     std::string const productDependencies = "ProductDependencies";
0069     std::string const parameterSetMap = "ParameterSetMap";
0070     std::string const moduleDescriptionMap = "ModuleDescriptionMap";  // Obsolete
0071     std::string const processHistoryMap = "ProcessHistoryMap";        // Obsolete
0072     std::string const processHistory = "ProcessHistory";
0073     std::string const processConfiguration = "ProcessConfiguration";
0074     std::string const branchIDLists = "BranchIDLists";
0075     std::string const thinnedAssociationsHelper = "ThinnedAssociationsHelper";
0076     std::string const fileFormatVersion = "FileFormatVersion";
0077     std::string const fileIdentifier = "FileIdentifier";
0078     std::string const fileIndex = "FileIndex";
0079     std::string const indexIntoFile = "IndexIntoFile";
0080     std::string const mergeableRunProductMetadata = "MergeableRunProductMetadata";
0081     std::string const processBlockHelper = "ProcessBlockHelper";
0082     std::string const eventHistory = "EventHistory";
0083     std::string const eventBranchMapper = "EventBranchMapper";
0084 
0085     std::string const eventSelections = "EventSelections";
0086     std::string const branchListIndexes = "BranchListIndexes";
0087     std::string const eventToProcessBlockIndexes = "EventToProcessBlockIndexes";
0088 
0089     std::string const parameterSetsTree = "ParameterSets";
0090     std::string const idToParameterSetBlobsBranch = "IdToParameterSetsBlobs";
0091   }  // namespace
0092 
0093   std::string const& BranchTypeToString(BranchType const& branchType) { return branchTypeNames[branchType]; }
0094 
0095   std::string const& BranchTypeToProductTreeName(BranchType const& branchType) {
0096     assert(branchType < eventLumiRunSize);
0097     return treeNames[branchType];
0098   }
0099 
0100   std::string BranchTypeToProductTreeName(BranchType const& branchType, std::string const& processName) {
0101     assert(branchType == InProcess);
0102     return branchTypeNames[InProcess] + "s" + processName;
0103   }
0104 
0105   std::string const& BranchTypeToMetaDataTreeName(BranchType const& branchType) {
0106     assert(branchType < eventLumiRunSize);
0107     return metaTreeNames[branchType];
0108   }
0109 
0110   // backward compatibility
0111   std::string const& BranchTypeToInfoTreeName(BranchType const& branchType) {
0112     assert(branchType < eventLumiRunSize);
0113     return infoNames[branchType];
0114   }
0115 
0116   std::string const& BranchTypeToAuxiliaryBranchName(BranchType const& branchType) {
0117     assert(branchType < eventLumiRunSize);
0118     return auxiliaryNames[branchType];
0119   }
0120 
0121   // backward compatibility
0122   std::string const& BranchTypeToAuxBranchName(BranchType const& branchType) {
0123     assert(branchType < eventLumiRunSize);
0124     return auxNames[branchType];
0125   }
0126 
0127   // backward compatibility
0128   std::string const& BranchTypeToProductStatusBranchName(BranchType const& branchType) {
0129     assert(branchType < eventLumiRunSize);
0130     return productStatusNames[branchType];
0131   }
0132 
0133   // backward compatibility
0134   std::string const& BranchTypeToBranchEntryInfoBranchName(BranchType const& branchType) {
0135     assert(branchType < eventLumiRunSize);
0136     return eventEntryInfoNames[branchType];
0137   }
0138 
0139   std::string const& BranchTypeToProductProvenanceBranchName(BranchType const& branchType) {
0140     assert(branchType < eventLumiRunSize);
0141     return productProvenanceNames[branchType];
0142   }
0143 
0144   namespace poolNames {
0145 
0146     // EntryDescription tree (1 entry per recorded distinct value of EntryDescription)
0147     std::string const& entryDescriptionTreeName() { return entryDescriptionTree; }
0148 
0149     std::string const& entryDescriptionIDBranchName() { return entryDescriptionIDBranch; }
0150 
0151     std::string const& entryDescriptionBranchName() { return entryDescriptionBranch; }
0152 
0153     // EntryDescription tree (1 entry per recorded distinct value of EntryDescription)
0154     std::string const& parentageTreeName() { return parentageTree; }
0155 
0156     std::string const& parentageBranchName() { return parentageBranch; }
0157 
0158     // MetaData Tree (1 entry per file)
0159     std::string const& metaDataTreeName() { return metaDataTree; }
0160 
0161     // Branch on MetaData Tree
0162     std::string const& productDescriptionBranchName() { return productRegistry; }
0163 
0164     // Branch on MetaData Tree
0165     std::string const& productDependenciesBranchName() { return productDependencies; }
0166 
0167     // Branch on MetaData Tree
0168     std::string const& parameterSetMapBranchName() { return parameterSetMap; }
0169 
0170     // Branch on MetaData Tree // Obsolete
0171     std::string const& moduleDescriptionMapBranchName() { return moduleDescriptionMap; }
0172 
0173     // Branch on MetaData Tree // Obsolete
0174     std::string const& processHistoryMapBranchName() { return processHistoryMap; }
0175 
0176     // Branch on MetaData Tree
0177     std::string const& processHistoryBranchName() { return processHistory; }
0178 
0179     // Branch on MetaData Tree
0180     std::string const& processConfigurationBranchName() { return processConfiguration; }
0181 
0182     // Branch on MetaData Tree
0183     std::string const& branchIDListBranchName() { return branchIDLists; }
0184 
0185     // Branch on MetaData Tree
0186     std::string const& thinnedAssociationsHelperBranchName() { return thinnedAssociationsHelper; }
0187 
0188     // Branch on MetaData Tree
0189     std::string const& fileFormatVersionBranchName() { return fileFormatVersion; }
0190 
0191     // Branch on MetaData Tree
0192     std::string const& fileIdentifierBranchName() { return fileIdentifier; }
0193 
0194     // Branch on MetaData Tree
0195     std::string const& fileIndexBranchName() { return fileIndex; }
0196 
0197     // Branch on MetaData Tree
0198     std::string const& indexIntoFileBranchName() { return indexIntoFile; }
0199 
0200     // Branch on MetaData Tree
0201     std::string const& mergeableRunProductMetadataBranchName() { return mergeableRunProductMetadata; }
0202 
0203     // Branch on MetaData Tree
0204     std::string const& processBlockHelperBranchName() { return processBlockHelper; }
0205 
0206     // Branch on Event History Tree
0207     std::string const& eventHistoryBranchName() { return eventHistory; }
0208 
0209     // Branches on Events Tree
0210     std::string const& eventSelectionsBranchName() { return eventSelections; }
0211 
0212     std::string const& branchListIndexesBranchName() { return branchListIndexes; }
0213 
0214     std::string const& eventToProcessBlockIndexesBranchName() { return eventToProcessBlockIndexes; }
0215 
0216     std::string const& parameterSetsTreeName() { return parameterSetsTree; }
0217     // Branch on ParameterSets Tree
0218     std::string const& idToParameterSetBlobsBranchName() { return idToParameterSetBlobsBranch; }
0219 
0220     std::string const& eventTreeName() { return treeNames[InEvent]; }
0221 
0222     std::string const& eventMetaDataTreeName() { return metaTreeNames[InEvent]; }
0223 
0224     std::string const& eventHistoryTreeName() { return eventHistory; }
0225     std::string const& luminosityBlockTreeName() { return treeNames[InLumi]; }
0226     std::string const& runTreeName() { return treeNames[InRun]; }
0227   }  // namespace poolNames
0228 }  // namespace edm