49 sorterForJobReportHash(BranchDescription
const*
lh, BranchDescription
const* rh) {
51 lh->fullClassName() < rh->fullClassName() ?
true :
52 lh->fullClassName() > rh->fullClassName() ?
false :
53 lh->moduleLabel() < rh->moduleLabel() ?
true :
54 lh->moduleLabel() > rh->moduleLabel() ?
false :
55 lh->productInstanceName() < rh->productInstanceName() ?
true :
56 lh->productInstanceName() > rh->productInstanceName() ?
false :
57 lh->processName() < rh->processName() ?
true :
64 logicalFile_(logicalFileName),
67 whyNotFastClonable_(om_->whyNotFastClonable()),
68 canFastCloneAux_(!om_->hasNewlyDroppedBranch()[
InEvent]),
69 filePtr_(TFile::Open(file_.c_str(),
"recreate",
"", om_->compressionLevel())),
71 eventEntryNumber_(0LL),
72 lumiEntryNumber_(0LL),
76 parameterSetsTree_(0),
83 eventEntryInfoVector_(),
84 lumiEntryInfoVector_(),
85 runEntryInfoVector_(),
86 pEventEntryInfoVector_(&eventEntryInfoVector_),
87 pLumiEntryInfoVector_(&lumiEntryInfoVector_),
88 pRunEntryInfoVector_(&runEntryInfoVector_),
89 pBranchListIndexes_(0),
90 pEventSelectionIDs_(0),
91 eventTree_(filePtr_,
InEvent, om_->basketSize(), om_->
splitLevel(), om_->treeMaxVirtualSize()),
92 lumiTree_(filePtr_,
InLumi, om_->basketSize(), om_->
splitLevel(), om_->treeMaxVirtualSize()),
93 runTree_(filePtr_,
InRun, om_->basketSize(), om_->
splitLevel(), om_->treeMaxVirtualSize()),
95 dataTypeReported_(
false),
97 branchesWithStoredHistory_() {
138 it->branchDescription_->produced());
155 std::vector<std::string> branchNames;
156 std::vector<BranchDescription const*> branches;
162 branchNames.push_back(it->branchDescription_->branchName());
163 branches.push_back(it->branchDescription_);
166 sort_all(branches, sorterForJobReportHash);
168 std::ostringstream oss;
169 char const underscore =
'_';
170 for(std::vector<BranchDescription const*>::const_iterator it = branches.begin(), itEnd = branches.end(); it != itEnd; ++it) {
177 std::string stringrep = oss.str();
182 std::string moduleName =
"PoolOutputModule";
197 maybeIssueWarning(
int whyNotFastClonable, std::string
const& ifileName, std::string
const& ofileName) {
200 if ((whyNotFastClonable &
208 bool isWarning =
true;
210 message <<
"Fast copying of file " << ifileName <<
" to file " << ofileName <<
" is disabled because:\n";
212 message <<
"a SecondaryFileSequence was specified.\n";
217 message <<
"the input file is in an old format.\n";
222 message <<
"events need to be sorted.\n";
226 message <<
"events or lumis were selected or skipped by ID.\n";
231 message <<
"initial events, lumis or runs were skipped.\n";
236 message <<
"some events were skipped because of duplicate checking.\n";
240 message <<
"some events were not copied because of maxEvents limit.\n";
245 message <<
"some events were not copied because of maxLumis limit.\n";
250 message <<
"parallel processing was specified.\n";
255 message <<
"an EventSelector was specified.\n";
260 message <<
"some events were not copied because of maxEvents output limit.\n";
265 message <<
"the split level or basket size of a branch or branches was modified.\n";
269 message <<
"The format of a data product has changed.\n";
274 LogWarning(
"FastCloningDisabled") << message.str();
276 LogInfo(
"FastCloningDisabled") << message.str();
291 if(remainingEvents >= 0 && remainingEvents < fb.
tree()->GetEntries()) {
308 "Merge failure because input file " <<
file_ <<
" has different ROOT split levels or basket sizes\n" <<
309 "than previous files. To allow merging in splite of this, use the configuration parameter\n" <<
310 "overrideInputFileSplitLevels=cms.untracked.bool(True)\n" <<
311 "in every PoolOutputModule.\n";
331 !reg->anyProductProduced() &&
356 unsigned int const oneK = 1024;
433 <<
"Failed to create a branch for Parentages in the output file";
436 std::set<ParentageID>::const_iterator pidend =
parentageIDs_.end();
472 for(Map::const_iterator
i = procConfigMap.begin(),
e = procConfigMap.end();
i !=
e; ++
i) {
473 procConfigVector.push_back(
i->second);
486 for(Map::const_iterator
i = procHistoryMap.begin(),
e = procHistoryMap.end();
i !=
e; ++
i) {
487 procHistoryVector.push_back(
i->second);
503 std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
504 std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
511 idToBlob.first = it->first;
512 idToBlob.second.pset() = it->second.toString();
523 ProductList& pList =
const_cast<ProductList &
>(pReg.productList());
525 for(ProductList::iterator it = pList.begin(); it != pList.end();) {
528 ProductList::iterator itCopy = it;
584 if(tree && tree->GetNbranches() != 0) {
585 for(Selections::const_iterator
i = branches.
begin(), iEnd = branches.
end();
590 std::string
const&
alias =
592 tree->SetAlias(alias.c_str(), full.c_str());
595 for(; it != itEnd; ++it) {
596 tree->SetAlias((*it).c_str(), full.c_str());
607 std::set<ProductProvenance>& oToFill) {
613 for(std::vector<BranchID>::const_iterator it = parentIDs.begin(), itEnd = parentIDs.end();
619 principal.
getProvenance(info->branchID()).product().produced()) {
620 if(oToFill.insert(*info).second) {
634 std::vector<boost::shared_ptr<EDProduct> > dummies;
640 std::set<ProductProvenance> provenanceToKeep;
643 for(OutputItemList::const_iterator
i = items.begin(), iEnd = items.end();
i != iEnd; ++
i) {
645 BranchID const&
id =
i->branchDescription_->branchID();
648 bool produced =
i->branchDescription_->produced();
652 bool getProd = (produced || !fastCloning ||
667 TClass*
cp = gROOT->GetClass(
i->branchDescription_->wrappedName().c_str());
668 boost::shared_ptr<EDProduct> dummy(static_cast<EDProduct*>(cp->New()));
669 dummies.push_back(dummy);
670 product = dummy.get();
672 i->product_ = product;
676 for(std::set<ProductProvenance>::const_iterator it = provenanceToKeep.begin(), itEnd=provenanceToKeep.end();
681 productProvenanceVecPtr->assign(provenanceToKeep.begin(), provenanceToKeep.end());
683 productProvenanceVecPtr->clear();
EventNumber_t event() const
std::string const & idToParameterSetBlobsBranchName()
std::set< ParentageID > parentageIDs_
void beginInputFile(FileBlock const &fb, int remainingEvents)
LuminosityBlockAuxiliary lumiAux_
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
int const & basketSize() const
SelectionsArray const & keptProducts() const
EventSelectionIDVector const & eventSelectionIDs() const
bool const & overrideInputFileSplitLevels() const
std::string const & parentageTreeName()
std::string const & catalog() const
void writeProcessHistoryRegistry()
void writeOne(EventPrincipal const &e)
std::string & branchName() const
void fillBranches(BranchType const &branchType, Principal const &principal, ProductProvenanceVector *productProvenanceVecPtr)
std::string const & moduleLabel() const
DropMetaData const & dropMetaData() const
void writeProcessConfigurationRegistry()
std::map< BranchKey, BranchDescription > ProductList
bool checkSplitLevelsAndBasketSizes(TTree *inputTree) const
EventID const & id() const
FileFormatVersion const & fileFormatVersion() const
ProductProvenance const * productProvenance() const
int whyNotFastClonable() const
LuminosityBlockAuxiliary const & aux() const
std::string const & fileFormatVersionBranchName()
ProductProvenanceVector * pRunEntryInfoVector_
OutputItemListArray const & selectedOutputItemList() const
std::string const & processName() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName, BranchDescription::MatchMode m)
std::string const & eventSelectionsBranchName()
unsigned int const & maxFileSize() const
void setBranchAliases(TTree *tree, Selections const &branches) const
void setAutoFlush(Long64_t size)
BranchListIndexes const & branchListIndexes() const
bool shouldWeCloseFile() const
bool checkIfFastClonable(TTree *inputTree) const
std::set< BranchID > branchesWithStoredHistory_
std::vector< EventSelectionID > EventSelectionIDVector
void sortVector_Run_Or_Lumi_Entries()
LuminosityBlockNumber_t luminosityBlock() const
std::string const & parameterSetsTreeName()
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
bool wantAllEvents() const
std::vector< BranchID > const & parents() const
ProductProvenanceVector * pLumiEntryInfoVector_
RootOutputTree eventTree_
std::map< key_type, value_type > collection_type
std::vector< BranchListIndex > BranchListIndexes
void writeRun(RunPrincipal const &r)
const_iterator begin() const
void addBranch(std::string const &branchName, std::string const &className, void const *&pProd, int splitLevel, int basketSize, bool produced)
PoolOutputModule const * om_
std::string const & moduleLabel() const
IndexIntoFile::EntryNumber_t eventEntryNumber_
std::string const & productInstanceName() const
ProcessHistoryID const & processHistoryID() const
LuminosityBlockAuxiliary const * pLumiAux_
std::string const & indexIntoFileBranchName()
collection_type::const_iterator const_iterator
std::string const & basketOrder() const
int getFileFormatVersion()
OutputHandle getForOutput(BranchID const &bid, bool getProd) const
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
RunAuxiliary const & aux() const
void setProcessHistoryID(ProcessHistoryID const &phid)
std::string const & metaDataTreeName()
std::string & wrappedName() const
PoolOutputModule::OutputItemList OutputItemList
boost::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
LuminosityBlockNumber_t luminosityBlock() const
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
void writeProductDependencies()
void writeBranchIDListRegistry()
static TTree * makeTTree(TFile *filePtr, std::string const &name, int splitLevel)
int const & whyNotFastClonable() const
std::vector< ProductProvenance > ProductProvenanceVector
std::string const & fullClassName() const
std::string const & processHistoryBranchName()
EventSelectionIDVector const * pEventSelectionIDs_
boost::shared_ptr< ProductProvenance > branchIDToProvenance(BranchID const &bid) const
void writeIndexIntoFile()
void writeFileIdentifier()
eventsetup::produce::Produce produced
BranchChildren const & branchChildren() const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
TTree *const tree() const
int const eventAutoFlushSize() const
std::string toString() const
std::string const & parentageBranchName()
void addAuxiliary(std::string const &branchName, T const *&pAux, int bufSize)
AuxItemArray const & auxItems() const
EDProduct const * wrapper() const
std::set< std::string > const & branchAliases() const
void writeParameterSetRegistry()
void respondToCloseInputFile(FileBlock const &fb)
IndexIntoFile indexIntoFile_
std::string const & productDescriptionBranchName()
IndexIntoFile::EntryNumber_t runEntryNumber_
void insertAncestors(ProductProvenance const &iGetParents, Principal const &principal, bool produced, std::set< ProductProvenance > &oToFill)
std::string const & processConfigurationBranchName()
void writeLuminosityBlock(LuminosityBlockPrincipal const &lb)
TTree * parameterSetsTree_
static void writeTTree(TTree *tree)
ProcessHistoryID const & processHistoryID() const
bool branchListIndexesUnchanged() const
boost::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
EventAuxiliary const * pEventAux_
author Stefano ARGIRO author Bill Tanenbaum
void writeParentageRegistry()
void writeProductDescriptionRegistry()
static ThreadSafeIndexedRegistry * instance()
collection_type & data()
Provide access to the contained collection.
std::string const & productDependenciesBranchName()
const_iterator end() const
boost::shared_ptr< BranchMapper > branchMapperPtr() const
RootOutputFile(PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName)
std::vector< value_type > collection_type
std::string const & branchIDListBranchName()
void setProcessHistoryID(ProcessHistoryID const &phid)
std::string const & branchListIndexesBranchName()
static ThreadSafeRegistry * instance()
void writeFileFormatVersion()
Parentage const & parentage() const
RootOutputTreePtrArray treePointers_
BranchListIndexes const * pBranchListIndexes_
collection_type & data()
Provide access to the contained collection.
void maybeFastCloneTree(bool canFastClone, bool canFastCloneAux, TTree *tree, std::string const &option)
IndexIntoFile::EntryNumber_t lumiEntryNumber_
boost::shared_ptr< TFile > filePtr_
void optimizeBaskets(ULong64_t size)
EventAuxiliary const & aux() const
Provenance getProvenance(BranchID const &bid) const
std::string const & fileIdentifierBranchName()
RunAuxiliary const * pRunAux_
tuple size
Write out results.
EventNumber_t event() const
int const & inputFileCount() const
JobReport::Token reportToken_
std::string createGlobalIdentifier()
std::string const & fileName() const
ParameterSetID selectorConfig() const
ProductProvenanceVector * pEventEntryInfoVector_