00001 #ifndef FWCore_Framework_FileBlock_h
00002 #define FWCore_Framework_FileBlock_h
00003
00004
00005
00006
00007
00008
00009
00010 #include "DataFormats/Provenance/interface/FileFormatVersion.h"
00011 #include "DataFormats/Provenance/interface/BranchChildren.h"
00012 class TTree;
00013 #include "boost/shared_ptr.hpp"
00014 #include <array>
00015 #include <string>
00016
00017 namespace edm {
00018 class BranchDescription;
00019 class FileBlock {
00020 public:
00021
00022 enum
00023 WhyNotFastClonable {
00024 CanFastClone = 0x0,
00025
00026
00027 NoRootInputSource = 0x1,
00028 ParallelProcesses = (NoRootInputSource << 1),
00029 NotProcessingEvents = (ParallelProcesses << 1),
00030 HasSecondaryFileSequence = (NotProcessingEvents << 1),
00031
00032
00033 FileTooOld = (HasSecondaryFileSequence << 1),
00034 NoEventsInFile = (FileTooOld << 1),
00035 EventsToBeSorted = (NoEventsInFile << 1),
00036 RunOrLumiNotContiguous = (EventsToBeSorted << 1),
00037 EventsOrLumisSelectedByID = (RunOrLumiNotContiguous << 1),
00038 InitialEventsSkipped = (EventsOrLumisSelectedByID << 1),
00039 MaxEventsTooSmall = (InitialEventsSkipped << 1),
00040 MaxLumisTooSmall = (MaxEventsTooSmall << 1),
00041 RunNumberModified = (MaxLumisTooSmall << 1),
00042 DuplicateEventsRemoved = (RunNumberModified << 1),
00043
00044
00045
00046
00047
00048 DisabledInConfigFile = (DuplicateEventsRemoved << 1),
00049 EventSelectionUsed = (DisabledInConfigFile << 1),
00050
00051
00052 OutputMaxEventsTooSmall = (EventSelectionUsed << 1),
00053 SplitLevelMismatch = (OutputMaxEventsTooSmall << 1),
00054 BranchMismatch = (SplitLevelMismatch << 1)
00055 };
00056
00057 FileBlock() :
00058 fileFormatVersion_(),
00059 tree_(0), metaTree_(0),
00060 lumiTree_(0), lumiMetaTree_(0),
00061 runTree_(0), runMetaTree_(0),
00062 whyNotFastClonable_(NoRootInputSource),
00063 hasNewlyDroppedBranch_(),
00064 fileName_(),
00065 branchListIndexesUnchanged_(false),
00066 modifiedIDs_(false),
00067 branchChildren_(new BranchChildren) {}
00068
00069 FileBlock(FileFormatVersion const& version,
00070 TTree const* ev, TTree const* meta,
00071 TTree const* lumi, TTree const* lumiMeta,
00072 TTree const* run, TTree const* runMeta,
00073 int whyNotFastClonable,
00074 std::array<bool, NumBranchTypes> const& hasNewlyDroppedBranch,
00075 std::string const& fileName,
00076 bool branchListIndexesUnchanged,
00077 bool modifiedIDs,
00078 boost::shared_ptr<BranchChildren> branchChildren) :
00079 fileFormatVersion_(version),
00080 tree_(const_cast<TTree*>(ev)),
00081 metaTree_(const_cast<TTree*>(meta)),
00082 lumiTree_(const_cast<TTree*>(lumi)),
00083 lumiMetaTree_(const_cast<TTree*>(lumiMeta)),
00084 runTree_(const_cast<TTree*>(run)),
00085 runMetaTree_(const_cast<TTree*>(runMeta)),
00086 whyNotFastClonable_(whyNotFastClonable),
00087 hasNewlyDroppedBranch_(hasNewlyDroppedBranch),
00088 fileName_(fileName),
00089 branchListIndexesUnchanged_(branchListIndexesUnchanged),
00090 modifiedIDs_(modifiedIDs),
00091 branchChildren_(branchChildren) {}
00092
00093 ~FileBlock() {}
00094
00095 FileFormatVersion const& fileFormatVersion() const {return fileFormatVersion_;}
00096 TTree* tree() const {return tree_;}
00097 TTree* metaTree() const {return metaTree_;}
00098 TTree* lumiTree() const {return lumiTree_;}
00099 TTree* lumiMetaTree() const {return lumiMetaTree_;}
00100 TTree* runTree() const {return runTree_;}
00101 TTree* runMetaTree() const {return runMetaTree_;}
00102
00103 int whyNotFastClonable() const {return whyNotFastClonable_;}
00104 std::array<bool, NumBranchTypes> const& hasNewlyDroppedBranch() const {return hasNewlyDroppedBranch_;}
00105 std::string const& fileName() const {return fileName_;}
00106 bool branchListIndexesUnchanged() const {return branchListIndexesUnchanged_;}
00107 bool modifiedIDs() const {return modifiedIDs_;}
00108
00109 void setNotFastClonable(WhyNotFastClonable const& why) {
00110 whyNotFastClonable_ |= why;
00111 }
00112 BranchChildren const& branchChildren() const { return *branchChildren_; }
00113 void close () {runMetaTree_ = lumiMetaTree_ = metaTree_ = runTree_ = lumiTree_ = tree_ = 0;}
00114
00115 private:
00116 FileFormatVersion fileFormatVersion_;
00117
00118 TTree* tree_;
00119 TTree* metaTree_;
00120 TTree* lumiTree_;
00121 TTree* lumiMetaTree_;
00122 TTree* runTree_;
00123 TTree* runMetaTree_;
00124 int whyNotFastClonable_;
00125 std::array<bool, NumBranchTypes> hasNewlyDroppedBranch_;
00126 std::string fileName_;
00127 bool branchListIndexesUnchanged_;
00128 bool modifiedIDs_;
00129 boost::shared_ptr<BranchChildren> branchChildren_;
00130 };
00131 }
00132 #endif