CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RootOutputFile.cc
Go to the documentation of this file.
1 
3 
5 
33 
34 #include "TROOT.h"
35 #include "TTree.h"
36 #include "TFile.h"
37 #include "TClass.h"
38 #include "Rtypes.h"
39 
40 #include <algorithm>
41 #include <iomanip>
42 #include <sstream>
43 
44 
45 namespace edm {
46 
47  namespace {
48  bool
49  sorterForJobReportHash(BranchDescription const* lh, BranchDescription const* rh) {
50  return
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 :
58  false;
59  }
60  }
61 
62  RootOutputFile::RootOutputFile(PoolOutputModule* om, std::string const& fileName, std::string const& logicalFileName) :
63  file_(fileName),
64  logicalFile_(logicalFileName),
65  reportToken_(0),
66  om_(om),
67  whyNotFastClonable_(om_->whyNotFastClonable()),
68  canFastCloneAux_(!om_->hasNewlyDroppedBranch()[InEvent]),
69  filePtr_(TFile::Open(file_.c_str(), "recreate", "", om_->compressionLevel())),
70  fid_(),
71  eventEntryNumber_(0LL),
72  lumiEntryNumber_(0LL),
73  runEntryNumber_(0LL),
74  indexIntoFile_(),
75  metaDataTree_(0),
76  parameterSetsTree_(0),
77  parentageTree_(0),
78  lumiAux_(),
79  runAux_(),
80  pEventAux_(0),
81  pLumiAux_(&lumiAux_),
82  pRunAux_(&runAux_),
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()),
94  treePointers_(),
95  dataTypeReported_(false),
96  parentageIDs_(),
97  branchesWithStoredHistory_() {
98 
99  if (-1 != om->eventAutoFlushSize()) {
101  }
103  pEventAux_, om_->auxItems()[InEvent].basketSize_);
105  pEventEntryInfoVector_, om_->auxItems()[InEvent].basketSize_);
107  pEventSelectionIDs_, om_->auxItems()[InEvent].basketSize_);
109  pBranchListIndexes_, om_->auxItems()[InEvent].basketSize_);
110 
112  pLumiAux_, om_->auxItems()[InLumi].basketSize_);
114  pLumiEntryInfoVector_, om_->auxItems()[InLumi].basketSize_);
115 
117  pRunAux_, om_->auxItems()[InRun].basketSize_);
119  pRunEntryInfoVector_, om_->auxItems()[InRun].basketSize_);
120 
122  treePointers_[InLumi] = &lumiTree_;
123  treePointers_[InRun] = &runTree_;
124 
125  for(int i = InEvent; i < NumBranchTypes; ++i) {
126  BranchType branchType = static_cast<BranchType>(i);
127  RootOutputTree *theTree = treePointers_[branchType];
128  for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[branchType].begin(),
129  itEnd = om_->selectedOutputItemList()[branchType].end();
130  it != itEnd; ++it) {
131  BranchDescription const& desc = *it->branchDescription_;
132  desc.init();
133  theTree->addBranch(desc.branchName(),
134  desc.wrappedName(),
135  it->product_,
136  it->splitLevel_,
137  it->basketSize_,
138  it->branchDescription_->produced());
139  //make sure we always store product registry info for all branches we create
140  branchesWithStoredHistory_.insert(it->branchID());
141  }
142  }
143  // Don't split metadata tree or event description tree
147 
149 
150  // For the Job Report, get a vector of branch names in the "Events" tree.
151  // Also create a hash of all the branch names in the "Events" tree
152  // in a deterministic order, except use the full class name instead of the friendly class name.
153  // To avoid extra string copies, we create a vector of pointers into the product registry,
154  // and use a custom comparison operator for sorting.
155  std::vector<std::string> branchNames;
156  std::vector<BranchDescription const*> branches;
157  branchNames.reserve(om_->selectedOutputItemList()[InEvent].size());
158  branches.reserve(om->selectedOutputItemList()[InEvent].size());
159  for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[InEvent].begin(),
160  itEnd = om_->selectedOutputItemList()[InEvent].end();
161  it != itEnd; ++it) {
162  branchNames.push_back(it->branchDescription_->branchName());
163  branches.push_back(it->branchDescription_);
164  }
165  // Now sort the branches for the hash.
166  sort_all(branches, sorterForJobReportHash);
167  // Now, make a concatenated string.
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) {
171  BranchDescription const& bd = **it;
172  oss << bd.fullClassName() << underscore
173  << bd.moduleLabel() << underscore
174  << bd.productInstanceName() << underscore
175  << bd.processName() << underscore;
176  }
177  std::string stringrep = oss.str();
178  cms::Digest md5alg(stringrep);
179 
180  // Register the output file with the JobReport service
181  // and get back the token for it.
182  std::string moduleName = "PoolOutputModule";
183  Service<JobReport> reportSvc;
184  reportToken_ = reportSvc->outputFileOpened(
185  file_, logicalFile_, // PFN and LFN
186  om_->catalog(), // catalog
187  moduleName, // module class name
188  om_->moduleLabel(), // module label
189  fid_.fid(), // file id (guid)
190  std::string(), // data type (not yet known, so string is empty).
191  md5alg.digest().toString(), // branch hash
192  branchNames); // branch names being written
193  }
194 
195  namespace {
196  void
197  maybeIssueWarning(int whyNotFastClonable, std::string const& ifileName, std::string const& ofileName) {
198 
199  // No message if fast cloning was deliberately disabled, or if there are no events to copy anyway.
200  if ((whyNotFastClonable &
202  return;
203  }
204 
205  // There will be a message stating every reason that fast cloning was not possible.
206  // If at one or more of the reasons was because of something the user explicitly specified (e.g. event selection, skipping events),
207  // or if the input file was in an old format, the message will be informational. Otherwise, the message will be a warning.
208  bool isWarning = true;
209  std::ostringstream message;
210  message << "Fast copying of file " << ifileName << " to file " << ofileName << " is disabled because:\n";
211  if((whyNotFastClonable & FileBlock::HasSecondaryFileSequence) != 0) {
212  message << "a SecondaryFileSequence was specified.\n";
213  whyNotFastClonable &= ~(FileBlock::HasSecondaryFileSequence);
214  isWarning = false;
215  }
216  if((whyNotFastClonable & FileBlock::FileTooOld) != 0) {
217  message << "the input file is in an old format.\n";
218  whyNotFastClonable &= ~(FileBlock::FileTooOld);
219  isWarning = false;
220  }
221  if((whyNotFastClonable & FileBlock::EventsToBeSorted) != 0) {
222  message << "events need to be sorted.\n";
223  whyNotFastClonable &= ~(FileBlock::EventsToBeSorted);
224  }
225  if((whyNotFastClonable & FileBlock::EventsOrLumisSelectedByID) != 0) {
226  message << "events or lumis were selected or skipped by ID.\n";
227  whyNotFastClonable &= ~(FileBlock::EventsOrLumisSelectedByID);
228  isWarning = false;
229  }
230  if((whyNotFastClonable & FileBlock::InitialEventsSkipped) != 0) {
231  message << "initial events, lumis or runs were skipped.\n";
232  whyNotFastClonable &= ~(FileBlock::InitialEventsSkipped);
233  isWarning = false;
234  }
235  if((whyNotFastClonable & FileBlock::DuplicateEventsRemoved) != 0) {
236  message << "some events were skipped because of duplicate checking.\n";
237  whyNotFastClonable &= ~(FileBlock::DuplicateEventsRemoved);
238  }
239  if((whyNotFastClonable & FileBlock::MaxEventsTooSmall) != 0) {
240  message << "some events were not copied because of maxEvents limit.\n";
241  whyNotFastClonable &= ~(FileBlock::MaxEventsTooSmall);
242  isWarning = false;
243  }
244  if((whyNotFastClonable & FileBlock::MaxLumisTooSmall) != 0) {
245  message << "some events were not copied because of maxLumis limit.\n";
246  whyNotFastClonable &= ~(FileBlock::MaxLumisTooSmall);
247  isWarning = false;
248  }
249  if((whyNotFastClonable & FileBlock::ParallelProcesses) != 0) {
250  message << "parallel processing was specified.\n";
251  whyNotFastClonable &= ~(FileBlock::ParallelProcesses);
252  isWarning = false;
253  }
254  if((whyNotFastClonable & FileBlock::EventSelectionUsed) != 0) {
255  message << "an EventSelector was specified.\n";
256  whyNotFastClonable &= ~(FileBlock::EventSelectionUsed);
257  isWarning = false;
258  }
259  if((whyNotFastClonable & FileBlock::OutputMaxEventsTooSmall) != 0) {
260  message << "some events were not copied because of maxEvents output limit.\n";
261  whyNotFastClonable &= ~(FileBlock::OutputMaxEventsTooSmall);
262  isWarning = false;
263  }
264  if((whyNotFastClonable & FileBlock::SplitLevelMismatch) != 0) {
265  message << "the split level or basket size of a branch or branches was modified.\n";
266  whyNotFastClonable &= ~(FileBlock::SplitLevelMismatch);
267  }
268  if((whyNotFastClonable & FileBlock::BranchMismatch) != 0) {
269  message << "The format of a data product has changed.\n";
270  whyNotFastClonable &= ~(FileBlock::BranchMismatch);
271  }
272  assert(whyNotFastClonable == FileBlock::CanFastClone);
273  if (isWarning) {
274  LogWarning("FastCloningDisabled") << message.str();
275  } else {
276  LogInfo("FastCloningDisabled") << message.str();
277  }
278  }
279  }
280 
281  void RootOutputFile::beginInputFile(FileBlock const& fb, int remainingEvents) {
282 
283  // Reset per input file information
285  canFastCloneAux_ = false;
286 
287  if(fb.tree() != 0) {
288 
290 
291  if(remainingEvents >= 0 && remainingEvents < fb.tree()->GetEntries()) {
293  }
294 
296  if(!match) {
298  // We may be fast copying. We must disable fast copying if the split levels
299  // or basket sizes do not match.
301  } else {
302  // We are using the input split levels and basket sizes from the first input file
303  // for copied output branches. In this case, we throw an exception if any branches
304  // have different split levels or basket sizes in a subsequent input file.
305  // If the mismatch is in the first file, there is a bug somewhere, so we assert.
306  assert(om_->inputFileCount() > 1);
307  throw Exception(errors::MismatchedInputFiles, "RootOutputFile::beginInputFile()") <<
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";
312  }
313  }
314 
315  // Since this check can be time consuming, we do it only if we would otherwise fast clone.
317  if(!eventTree_.checkIfFastClonable(fb.tree())) {
319  }
320  }
321  // We now check if we can fast copy the auxiliary branches.
322  // We can do so only if we can otherwise fast copy,
323  // the input file has the current format (these branches are in the Events Tree),
324  // there are no newly dropped or produced products,
325  // and the branch list indexes do not need modification.
331  !reg->anyProductProduced() &&
333 
334  // Report the fast copying status.
335  Service<JobReport> reportSvc;
336  reportSvc->reportFastCopyingStatus(reportToken_, fb.fileName(), whyNotFastClonable_ == FileBlock::CanFastClone);
337  } else {
339  }
340 
342 
343  // Possibly issue warning or informational message if we haven't fast cloned.
344  if(fb.tree() != 0 && whyNotFastClonable_ != FileBlock::CanFastClone) {
345  maybeIssueWarning(whyNotFastClonable_, fb.fileName(), file_);
346  }
347  }
348 
353  }
354 
356  unsigned int const oneK = 1024;
357  Long64_t size = filePtr_->GetSize()/oneK;
358  return(size >= om_->maxFileSize());
359  }
360 
362  // Auxiliary branch
363  pEventAux_ = &e.aux();
364 
365  // Because getting the data may cause an exception to be thrown we want to do that
366  // first before writing anything to the file about this event
367  // NOTE: pEventAux_, pBranchListIndexes_, pEventSelectionIDs_, and pEventEntryInfoVector_
368  // must be set before calling fillBranches since they get written out in that routine.
369  assert(pEventAux_->processHistoryID() == e.processHistoryID());
371 
372  // Note: The EventSelectionIDVector should have a one to one correspondence with the processes in the process history.
373  // Therefore, a new entry should be added if and only if the current process has been added to the process history,
374  // which is done if and only if there is a produced product.
377  if (reg->anyProductProduced() || !om_->wantAllEvents()) {
378  esids.push_back(om_->selectorConfig());
379  }
380  pEventSelectionIDs_ = &esids;
382 
383  // Add the dataType to the job report if it hasn't already been done
384  if(!dataTypeReported_) {
385  Service<JobReport> reportSvc;
386  std::string dataType("MC");
387  if(pEventAux_->isRealData()) dataType = "Data";
388  reportSvc->reportDataType(reportToken_, dataType);
389  dataTypeReported_ = true;
390  }
391 
392  // Add event to index
395 
396  // Report event written
397  Service<JobReport> reportSvc;
398  reportSvc->eventWrittenToFile(reportToken_, e.id().run(), e.id().event());
399  }
400 
402  // Auxiliary branch
403  // NOTE: lumiAux_ must be filled before calling fillBranches since it gets written out in that routine.
404  lumiAux_ = lb.aux();
405  // Use the updated process historyID
407  // Add lumi to index.
411  lumiTree_.optimizeBaskets(10ULL*1024*1024);
412  }
413 
415  // Auxiliary branch
416  // NOTE: runAux_ must be filled before calling fillBranches since it gets written out in that routine.
417  runAux_ = r.aux();
418  // Use the updated process historyID
420  // Add run to index.
422  ++runEntryNumber_;
424  runTree_.optimizeBaskets(10ULL*1024*1024);
425  }
426 
428  Parentage const* desc(0);
429 
430  if(!parentageTree_->Branch(poolNames::parentageBranchName().c_str(),
431  &desc, om_->basketSize(), 0))
433  << "Failed to create a branch for Parentages in the output file";
434 
436  std::set<ParentageID>::const_iterator pidend = parentageIDs_.end();
437  for(ParentageRegistry::const_iterator i = ptReg.begin(), e = ptReg.end(); i != e; ++i) {
438  if(parentageIDs_.find(i->first) != pidend) {
439  desc = &(i->second);
440  parentageTree_->Fill();
441  }
442  }
443  }
444 
446  FileFormatVersion fileFormatVersion(getFileFormatVersion());
447  FileFormatVersion* pFileFmtVsn = &fileFormatVersion;
448  TBranch* b = metaDataTree_->Branch(poolNames::fileFormatVersionBranchName().c_str(), &pFileFmtVsn, om_->basketSize(), 0);
449  assert(b);
450  b->Fill();
451  }
452 
454  FileID* fidPtr = &fid_;
455  TBranch* b = metaDataTree_->Branch(poolNames::fileIdentifierBranchName().c_str(), &fidPtr, om_->basketSize(), 0);
456  assert(b);
457  b->Fill();
458  }
459 
462  IndexIntoFile* iifPtr = &indexIntoFile_;
463  TBranch* b = metaDataTree_->Branch(poolNames::indexIntoFileBranchName().c_str(), &iifPtr, om_->basketSize(), 0);
464  assert(b);
465  b->Fill();
466  }
467 
470  Map const& procConfigMap = ProcessConfigurationRegistry::instance()->data();
471  ProcessConfigurationVector procConfigVector;
472  for(Map::const_iterator i = procConfigMap.begin(), e = procConfigMap.end(); i != e; ++i) {
473  procConfigVector.push_back(i->second);
474  }
475  sort_all(procConfigVector);
476  ProcessConfigurationVector* p = &procConfigVector;
477  TBranch* b = metaDataTree_->Branch(poolNames::processConfigurationBranchName().c_str(), &p, om_->basketSize(), 0);
478  assert(b);
479  b->Fill();
480  }
481 
484  Map const& procHistoryMap = ProcessHistoryRegistry::instance()->data();
485  ProcessHistoryVector procHistoryVector;
486  for(Map::const_iterator i = procHistoryMap.begin(), e = procHistoryMap.end(); i != e; ++i) {
487  procHistoryVector.push_back(i->second);
488  }
489  ProcessHistoryVector* p = &procHistoryVector;
490  TBranch* b = metaDataTree_->Branch(poolNames::processHistoryBranchName().c_str(), &p, om_->basketSize(), 0);
491  assert(b);
492  b->Fill();
493  }
494 
497  TBranch* b = metaDataTree_->Branch(poolNames::branchIDListBranchName().c_str(), &p, om_->basketSize(), 0);
498  assert(b);
499  b->Fill();
500  }
501 
503  std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
504  std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
505  TBranch* b = parameterSetsTree_->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(),&pIdToBlob,om_->basketSize(), 0);
506 
508  itEnd = pset::Registry::instance()->end();
509  it != itEnd;
510  ++it) {
511  idToBlob.first = it->first;
512  idToBlob.second.pset() = it->second.toString();
513 
514  b->Fill();
515  }
516  }
517 
519  // Make a local copy of the ProductRegistry, removing any transient or pruned products.
520  typedef ProductRegistry::ProductList ProductList;
522  ProductRegistry pReg(reg->productList());
523  ProductList& pList = const_cast<ProductList &>(pReg.productList());
524  std::set<BranchID>::iterator end = branchesWithStoredHistory_.end();
525  for(ProductList::iterator it = pList.begin(); it != pList.end();) {
526  if(branchesWithStoredHistory_.find(it->second.branchID()) == end) {
527  // avoid invalidating iterator on deletion
528  ProductList::iterator itCopy = it;
529  ++it;
530  pList.erase(itCopy);
531 
532  } else {
533  ++it;
534  }
535  }
536 
537  ProductRegistry* ppReg = &pReg;
538  TBranch* b = metaDataTree_->Branch(poolNames::productDescriptionBranchName().c_str(), &ppReg, om_->basketSize(), 0);
539  assert(b);
540  b->Fill();
541  }
543  BranchChildren& pDeps = const_cast<BranchChildren&>(om_->branchChildren());
544  BranchChildren* ppDeps = &pDeps;
545  TBranch* b = metaDataTree_->Branch(poolNames::productDependenciesBranchName().c_str(), &ppDeps, om_->basketSize(), 0);
546  assert(b);
547  b->Fill();
548  }
549 
551  metaDataTree_->SetEntries(-1);
554 
556 
557  // Create branch aliases for all the branches in the
558  // events/lumis/runs trees. The loop is over all types of data
559  // products.
560  for(int i = InEvent; i < NumBranchTypes; ++i) {
561  BranchType branchType = static_cast<BranchType>(i);
563  treePointers_[branchType]->writeTree();
564  }
565 
566  // close the file -- mfp
567  // Just to play it safe, zero all pointers to objects in the TFile to be closed.
569  for(RootOutputTreePtrArray::iterator it = treePointers_.begin(), itEnd = treePointers_.end(); it != itEnd; ++it) {
570  (*it)->close();
571  (*it) = 0;
572  }
573  filePtr_->Close();
574  filePtr_.reset();
575 
576  // report that file has been closed
577  Service<JobReport> reportSvc;
578  reportSvc->outputFileClosed(reportToken_);
579 
580  }
581 
582  void
583  RootOutputFile::setBranchAliases(TTree* tree, Selections const& branches) const {
584  if(tree && tree->GetNbranches() != 0) {
585  for(Selections::const_iterator i = branches.begin(), iEnd = branches.end();
586  i != iEnd; ++i) {
587  BranchDescription const& pd = **i;
588  std::string const& full = pd.branchName() + "obj";
589  if(pd.branchAliases().empty()) {
590  std::string const& alias =
591  (pd.productInstanceName().empty() ? pd.moduleLabel() : pd.productInstanceName());
592  tree->SetAlias(alias.c_str(), full.c_str());
593  } else {
594  std::set<std::string>::const_iterator it = pd.branchAliases().begin(), itEnd = pd.branchAliases().end();
595  for(; it != itEnd; ++it) {
596  tree->SetAlias((*it).c_str(), full.c_str());
597  }
598  }
599  }
600  }
601  }
602 
603  void
605  Principal const& principal,
606  bool produced,
607  std::set<ProductProvenance>& oToFill) {
609  assert(produced || om_->dropMetaData() != PoolOutputModule::DropPrior);
611  BranchMapper const& iMapper = *principal.branchMapperPtr();
612  std::vector<BranchID> const& parentIDs = iGetParents.parentage().parents();
613  for(std::vector<BranchID>::const_iterator it = parentIDs.begin(), itEnd = parentIDs.end();
614  it != itEnd; ++it) {
615  branchesWithStoredHistory_.insert(*it);
616  boost::shared_ptr<ProductProvenance> info = iMapper.branchIDToProvenance(*it);
617  if(info) {
619  principal.getProvenance(info->branchID()).product().produced()) {
620  if(oToFill.insert(*info).second) {
621  //haven't seen this one yet
622  insertAncestors(*info, principal, produced, oToFill);
623  }
624  }
625  }
626  }
627  }
628 
630  BranchType const& branchType,
631  Principal const& principal,
632  ProductProvenanceVector* productProvenanceVecPtr) {
633 
634  std::vector<boost::shared_ptr<EDProduct> > dummies;
635 
636  bool const fastCloning = (branchType == InEvent) && (whyNotFastClonable_ == FileBlock::CanFastClone);
637 
639 
640  std::set<ProductProvenance> provenanceToKeep;
641 
642  // Loop over EDProduct branches, fill the provenance, and write the branch.
643  for(OutputItemList::const_iterator i = items.begin(), iEnd = items.end(); i != iEnd; ++i) {
644 
645  BranchID const& id = i->branchDescription_->branchID();
646  branchesWithStoredHistory_.insert(id);
647 
648  bool produced = i->branchDescription_->produced();
649  bool keepProvenance = om_->dropMetaData() == PoolOutputModule::DropNone ||
652  bool getProd = (produced || !fastCloning ||
653  treePointers_[branchType]->uncloned(i->branchDescription_->branchName()));
654 
655  EDProduct const* product = 0;
656  OutputHandle const oh = principal.getForOutput(id, getProd);
657  if(keepProvenance && oh.productProvenance()) {
658  provenanceToKeep.insert(*oh.productProvenance());
659  assert(principal.branchMapperPtr());
660  insertAncestors(*oh.productProvenance(), principal, produced, provenanceToKeep);
661  }
662  product = oh.wrapper();
663  if(getProd) {
664  if(product == 0) {
665  // No product with this ID is in the event.
666  // Add a null product.
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();
671  }
672  i->product_ = product;
673  }
674  }
675 
676  for(std::set<ProductProvenance>::const_iterator it = provenanceToKeep.begin(), itEnd=provenanceToKeep.end();
677  it != itEnd; ++it) {
678  parentageIDs_.insert(it->parentageID());
679  }
680 
681  productProvenanceVecPtr->assign(provenanceToKeep.begin(), provenanceToKeep.end());
682  treePointers_[branchType]->fillTree();
683  productProvenanceVecPtr->clear();
684  }
685 
686 }
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:239
std::set< ParentageID > parentageIDs_
int i
Definition: DBlmapReader.cc:9
bool isRealData() const
void beginInputFile(FileBlock const &fb, int remainingEvents)
LuminosityBlockAuxiliary lumiAux_
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:108
int const & basketSize() const
SelectionsArray const & keptProducts() const
Definition: OutputModule.h:57
EventSelectionIDVector const & eventSelectionIDs() const
bool const & overrideInputFileSplitLevels() const
std::string const & parentageTreeName()
Definition: BranchType.cc:148
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
Definition: FileBlock.h:91
ProductProvenance const * productProvenance() const
Definition: OutputHandle.h:97
int whyNotFastClonable() const
Definition: FileBlock.h:99
RunNumber_t run() const
LuminosityBlockAuxiliary const & aux() const
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:202
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()
Definition: BranchType.cc:227
bool int lh
Definition: SSEVec.h:37
unsigned int const & maxFileSize() const
void setBranchAliases(TTree *tree, Selections const &branches) const
MD5Result digest() const
Definition: Digest.cc:188
void setAutoFlush(Long64_t size)
BranchListIndexes const & branchListIndexes() const
bool shouldWeCloseFile() const
bool checkIfFastClonable(TTree *inputTree) const
BranchType
Definition: BranchType.h:11
std::set< BranchID > branchesWithStoredHistory_
std::vector< EventSelectionID > EventSelectionIDVector
void sortVector_Run_Or_Lumi_Entries()
LuminosityBlockNumber_t luminosityBlock() const
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:235
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
bool wantAllEvents() const
Definition: OutputModule.h:66
std::vector< BranchID > const & parents() const
Definition: Parentage.h:39
ProductProvenanceVector * pLumiEntryInfoVector_
RootOutputTree eventTree_
std::map< key_type, value_type > collection_type
std::vector< BranchListIndex > BranchListIndexes
void writeRun(RunPrincipal const &r)
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
Definition: Principal.h:116
iterator end()
Definition: Selections.h:367
LuminosityBlockAuxiliary const * pLumiAux_
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:217
collection_type::const_iterator const_iterator
std::string const & basketOrder() const
Definition: GenABIO.cc:193
int getFileFormatVersion()
std::string logicalFile_
OutputHandle getForOutput(BranchID const &bid, bool getProd) const
Definition: Principal.cc:523
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::string const & BranchTypeToBranchEntryInfoBranchName(BranchType const &branchType)
Definition: BranchType.cc:120
iterator begin()
Definition: Selections.h:366
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:43
void setProcessHistoryID(ProcessHistoryID const &phid)
#define end
Definition: vmac.h:38
std::string const & metaDataTreeName()
Definition: BranchType.cc:157
std::string & wrappedName() const
PoolOutputModule::OutputItemList OutputItemList
boost::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: FileBlock.h:100
LuminosityBlockNumber_t luminosityBlock() const
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
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()
Definition: BranchType.cc:187
EventSelectionIDVector const * pEventSelectionIDs_
boost::shared_ptr< ProductProvenance > branchIDToProvenance(BranchID const &bid) const
Definition: BranchMapper.cc:44
eventsetup::produce::Produce produced
Definition: ESProducts.cc:21
BranchChildren const & branchChildren() const
Definition: OutputModule.h:64
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
TTree *const tree() const
Definition: FileBlock.h:92
int const eventAutoFlushSize() const
RootOutputTree runTree_
std::string toString() const
Definition: Digest.cc:87
std::string const & parentageBranchName()
Definition: BranchType.cc:152
void addAuxiliary(std::string const &branchName, T const *&pAux, int bufSize)
double b
Definition: hdecay.h:120
AuxItemArray const & auxItems() const
string message
Definition: argparse.py:126
EDProduct const * wrapper() const
Definition: OutputHandle.h:89
std::set< std::string > const & branchAliases() const
void respondToCloseInputFile(FileBlock const &fb)
IndexIntoFile indexIntoFile_
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:162
IndexIntoFile::EntryNumber_t runEntryNumber_
void insertAncestors(ProductProvenance const &iGetParents, Principal const &principal, bool produced, std::set< ProductProvenance > &oToFill)
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:192
void writeLuminosityBlock(LuminosityBlockPrincipal const &lb)
static void writeTTree(TTree *tree)
ProcessHistoryID const & processHistoryID() const
bool branchListIndexesUnchanged() const
Definition: FileBlock.h:102
boost::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: OutputModule.h:58
EventAuxiliary const * pEventAux_
author Stefano ARGIRO author Bill Tanenbaum
RunAuxiliary runAux_
void writeProductDescriptionRegistry()
static ThreadSafeIndexedRegistry * instance()
collection_type & data()
Provide access to the contained collection.
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:167
boost::shared_ptr< BranchMapper > branchMapperPtr() const
Definition: Principal.h:139
RootOutputFile(PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName)
std::string const & branchIDListBranchName()
Definition: BranchType.cc:197
void setProcessHistoryID(ProcessHistoryID const &phid)
Definition: RunAuxiliary.h:36
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:231
static ThreadSafeRegistry * instance()
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_
RootOutputTree lumiTree_
boost::shared_ptr< TFile > filePtr_
void optimizeBaskets(ULong64_t size)
EventAuxiliary const & aux() const
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:538
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:207
RunAuxiliary const * pRunAux_
tuple size
Write out results.
EventNumber_t event() const
RunNumber_t run() const
Definition: RunAuxiliary.h:41
int const & inputFileCount() const
JobReport::Token reportToken_
std::string createGlobalIdentifier()
std::string const & fileName() const
Definition: FileBlock.h:101
ParameterSetID selectorConfig() const
Definition: OutputModule.h:84
ProductProvenanceVector * pEventEntryInfoVector_