CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::RootFile Class Reference

#include <RootFile.h>

Inheritance diagram for edm::RootFile:

Public Types

typedef boost::array< RootTree
*, NumBranchTypes
RootTreePtrArray
 

Public Member Functions

BranchIDListRegistry::collection_type
const & 
branchIDLists ()
 
bool branchListIndexesUnchanged () const
 
void close ()
 
boost::shared_ptr< FileBlockcreateFileBlock () const
 
EventAuxiliary const & eventAux () const
 
EventID const & eventID () const
 
RootTree const & eventTree () const
 
std::string const & file () const
 
FileFormatVersion fileFormatVersion () const
 
IndexIntoFile::EntryType getNextEntryTypeWanted ()
 
bool goToEvent (EventID const &eventID)
 
boost::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
IndexIntoFile::IndexIntoFileItr indexIntoFileIter () const
 
boost::shared_ptr< IndexIntoFileindexIntoFileSharedPtr () const
 
RootTree const & lumiTree () const
 
bool nextEventEntry ()
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 
EventPrincipalreadCurrentEvent (EventPrincipal &cache, boost::shared_ptr< LuminosityBlockPrincipal > lb=boost::shared_ptr< LuminosityBlockPrincipal >())
 
EventPrincipalreadEvent (EventPrincipal &cache, boost::shared_ptr< LuminosityBlockPrincipal > lb=boost::shared_ptr< LuminosityBlockPrincipal >())
 
boost::shared_ptr
< LuminosityBlockPrincipal
readLumi (boost::shared_ptr< LuminosityBlockPrincipal > lbCache)
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
boost::shared_ptr< RunPrincipalreadRun_ (boost::shared_ptr< RunPrincipal > rpCache)
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
void reportOpened (std::string const &inputType)
 
void rewind ()
 
 RootFile (std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, boost::shared_ptr< InputFile > filePtr, boost::shared_ptr< EventSkipperByID > eventSkipperByID, bool skipAnyEvents, int remainingEvents, int remainingLumis, unsigned int treeCacheSize, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunNumber_t const &forcedRunNumber, bool noEventSort, GroupSelectorRules const &groupSelectorRules, bool secondaryFile, boost::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, std::vector< boost::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< boost::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile, std::vector< ProcessHistoryID > &orderedProcessHistoryIDs, bool usingGoToEvent)
 
RootTree const & runTree () const
 
void setAtEventEntry (IndexIntoFile::EntryNumber_t entry)
 
bool setEntryAtEvent (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool setEntryAtItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool setEntryAtLumi (RunNumber_t run, LuminosityBlockNumber_t lumi)
 
bool setEntryAtRun (RunNumber_t run)
 
void setPosition (IndexIntoFile::IndexIntoFileItr const &position)
 
void setToLastEntry ()
 
bool skipEvents (int &offset)
 
bool wasFirstEventJustRead () const
 
bool wasLastEventJustRead () const
 
int whyNotFastClonable () const
 
 ~RootFile ()
 

Private Member Functions

void dropOnInput (ProductRegistry &reg, GroupSelectorRules const &rules, bool dropDescendants, bool secondaryFile)
 
void fillEventAuxiliary ()
 
void fillHistory ()
 
void fillIndexIntoFile ()
 
boost::shared_ptr
< LuminosityBlockAuxiliary
fillLumiAuxiliary ()
 
boost::shared_ptr< RunAuxiliaryfillRunAuxiliary ()
 
void fillThisEventAuxiliary ()
 
IndexIntoFile::EntryType getEntryTypeWithSkipping ()
 
void initializeDuplicateChecker (std::vector< boost::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< boost::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
 
bool isDuplicateEvent ()
 
boost::shared_ptr< BranchMappermakeBranchMapper (RootTree &rootTree, BranchType const &type) const
 
std::string const & newBranchToOldBranch (std::string const &newBranch) const
 
void overrideRunNumber (RunID &id)
 
void overrideRunNumber (LuminosityBlockID &id)
 
void overrideRunNumber (EventID &id, bool isRealData)
 
void readEntryDescriptionTree ()
 
void readEventHistoryTree ()
 
void readParentageTree ()
 
void setIfFastClonable (int remainingEvents, int remainingLumis)
 
bool skipThisEntry ()
 
RootTreePtrArraytreePointers ()
 
void validateFile (bool secondaryFile, bool usingGoToEvent)
 

Private Attributes

boost::shared_ptr< BranchChildrenbranchChildren_
 
boost::shared_ptr
< BranchIDListRegistry::collection_type
const > 
branchIDLists_
 
boost::shared_ptr
< BranchListIndexes
branchListIndexes_
 
bool branchListIndexesUnchanged_
 
boost::shared_ptr
< DuplicateChecker
duplicateChecker_
 
EventAuxiliary eventAux_
 
TTree * eventHistoryTree_
 
std::vector
< EventProcessHistoryID
eventProcessHistoryIDs_
 
std::vector
< EventProcessHistoryID >
::const_iterator 
eventProcessHistoryIter_
 
boost::shared_ptr
< EventSelectionIDVector
eventSelectionIDs_
 
boost::shared_ptr
< EventSkipperByID
eventSkipperByID_
 
RootTree eventTree_
 
FileID fid_
 
std::string const file_
 
FileFormatVersion fileFormatVersion_
 
boost::shared_ptr< InputFilefilePtr_
 
int forcedRunOffset_
 
boost::array< bool,
NumBranchTypes
hasNewlyDroppedBranch_
 
boost::shared_ptr< Historyhistory_
 
IndexIntoFileindexIntoFile_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
 
boost::shared_ptr< IndexIntoFileindexIntoFileSharedPtr_
 
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
 
std::string const logicalFile_
 
RootTree lumiTree_
 
std::map< std::string,
std::string > 
newBranchToOldBranch_
 
bool noEventSort_
 
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
 
ProcessConfiguration const & processConfiguration_
 
InputSource::ProcessingMode processingMode_
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry_
 
boost::shared_ptr
< ProvenanceAdaptor
provenanceAdaptor_
 
RootTree runTree_
 
bool skipAnyEvents_
 
RootTreePtrArray treePointers_
 
int whyNotFastClonable_
 

Detailed Description

Definition at line 44 of file RootFile.h.

Member Typedef Documentation

Definition at line 46 of file RootFile.h.

Constructor & Destructor Documentation

edm::RootFile::RootFile ( std::string const &  fileName,
ProcessConfiguration const &  processConfiguration,
std::string const &  logicalFileName,
boost::shared_ptr< InputFile filePtr,
boost::shared_ptr< EventSkipperByID eventSkipperByID,
bool  skipAnyEvents,
int  remainingEvents,
int  remainingLumis,
unsigned int  treeCacheSize,
int  treeMaxVirtualSize,
InputSource::ProcessingMode  processingMode,
RunNumber_t const &  forcedRunNumber,
bool  noEventSort,
GroupSelectorRules const &  groupSelectorRules,
bool  secondaryFile,
boost::shared_ptr< DuplicateChecker duplicateChecker,
bool  dropDescendantsOfDroppedProducts,
std::vector< boost::shared_ptr< IndexIntoFile > > const &  indexesIntoFiles,
std::vector< boost::shared_ptr< IndexIntoFile > >::size_type  currentIndexIntoFile,
std::vector< ProcessHistoryID > &  orderedProcessHistoryIDs,
bool  usingGoToEvent 
)

Definition at line 100 of file RootFile.cc.

References edm::IndexIntoFile::begin(), branchChildren_, edm::poolNames::branchIDListBranchName(), branchIDLists_, branchListIndexesUnchanged_, edm::BranchDescription::branchName(), edm::BranchDescription::branchType(), edm::BranchDescription::className(), edm::input::defaultNonEventCacheSize, edm::IndexIntoFile::doneFileInitialization(), dropOnInput(), edm::IndexIntoFile::end(), edm::errors::EventCorruption, edm::poolNames::eventHistoryBranchName(), eventProcessHistoryIDs_, eventProcessHistoryIter_, eventSkipperByID_, edm::FileBlock::EventsOrLumisSelectedByID, eventTree_, edm::hlt::Exception, fid_, file_, fileFormatVersion(), fileFormatVersion_, edm::poolNames::fileFormatVersionBranchName(), edm::poolNames::fileIdentifierBranchName(), filePtr_, edm::errors::FileReadError, edm::fillProductRegistryTransients(), edm::IndexIntoFile::firstAppearanceOrder, forcedRunOffset_, edm::BranchDescription::friendlyClassName(), edm::friendlyname::friendlyName(), edm::input::getEntry(), hasNewlyDroppedBranch_, i, edm::poolNames::idToParameterSetBlobsBranchName(), indexIntoFile_, indexIntoFileBegin_, edm::poolNames::indexIntoFileBranchName(), indexIntoFileEnd_, indexIntoFileIter_, edm::InEvent, initializeDuplicateChecker(), edm::InLumi, edm::InRun, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertCollection(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), lumiTree_, edm::poolNames::metaDataTreeName(), edm::poolNames::moduleDescriptionMapBranchName(), newBranchToOldBranch(), newBranchToOldBranch_, edm::IndexIntoFile::numericalOrder, edm::poolNames::parameterSetMapBranchName(), edm::poolNames::parameterSetsTreeName(), edm::poolNames::processConfigurationBranchName(), edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), CrabTask::prod, edm::poolNames::productDependenciesBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productList(), productRegistry(), productRegistry_, provenanceAdaptor_, CrabTask::pset, readEventHistoryTree(), readParentageTree(), edm::RootTree::resetTraining(), runTree_, setIfFastClonable(), edm::setRefCoreStreamer(), treePointers_, edm::errors::UnimplementedFeature, edm::BranchDescription::updateFriendlyClassName(), edm::BranchIDListHelper::updateFromInput(), validateFile(), and whyNotFastClonable_.

120  :
121  file_(fileName),
122  logicalFile_(logicalFileName),
123  processConfiguration_(processConfiguration),
124  filePtr_(filePtr),
125  eventSkipperByID_(eventSkipperByID),
127  fid_(),
128  indexIntoFileSharedPtr_(new IndexIntoFile),
130  orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
136  skipAnyEvents_(skipAnyEvents),
141  eventAux_(),
142  eventTree_(filePtr_, InEvent, treeMaxVirtualSize, treeCacheSize, input::defaultLearningEntries),
145  treePointers_(),
148  branchIDLists_(),
150  forcedRunOffset_(0),
155  history_(),
156  branchChildren_(new BranchChildren),
157  duplicateChecker_(duplicateChecker),
159 
160  hasNewlyDroppedBranch_.assign(false);
161 
165 
166  // Read the metadata tree.
167  TTree *metaDataTree = dynamic_cast<TTree *>(filePtr_->Get(poolNames::metaDataTreeName().c_str()));
168  if(!metaDataTree)
169  throw edm::Exception(errors::FileReadError) << "Could not find tree " << poolNames::metaDataTreeName()
170  << " in the input file.\n";
171 
172  // To keep things simple, we just read in every possible branch that exists.
173  // We don't pay attention to which branches exist in which file format versions
174 
175  FileFormatVersion *fftPtr = &fileFormatVersion_;
176  if(metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != 0) {
177  TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
178  fft->SetAddress(&fftPtr);
179  input::getEntry(fft, 0);
180  metaDataTree->SetBranchAddress(poolNames::fileFormatVersionBranchName().c_str(), &fftPtr);
181  }
182 
183  setRefCoreStreamer(0, !fileFormatVersion().splitProductIDs(), !fileFormatVersion().productIDIsInt()); // backward compatibility
184 
185  FileID *fidPtr = &fid_;
186  if(metaDataTree->FindBranch(poolNames::fileIdentifierBranchName().c_str()) != 0) {
187  metaDataTree->SetBranchAddress(poolNames::fileIdentifierBranchName().c_str(), &fidPtr);
188  }
189 
190  IndexIntoFile *iifPtr = &indexIntoFile_;
191  if(metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != 0) {
192  metaDataTree->SetBranchAddress(poolNames::indexIntoFileBranchName().c_str(), &iifPtr);
193  }
194 
195  // Need to read to a temporary registry so we can do a translation of the BranchKeys.
196  // This preserves backward compatibility against friendly class name algorithm changes.
197  ProductRegistry inputProdDescReg;
198  ProductRegistry *ppReg = &inputProdDescReg;
199  metaDataTree->SetBranchAddress(poolNames::productDescriptionBranchName().c_str(),(&ppReg));
200 
201  typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
202  PsetMap psetMap;
203  PsetMap *psetMapPtr = &psetMap;
204  if(metaDataTree->FindBranch(poolNames::parameterSetMapBranchName().c_str()) != 0) {
205  //backward compatibility
206  assert(!fileFormatVersion().parameterSetsTree());
207  metaDataTree->SetBranchAddress(poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr);
208  } else {
209  assert(fileFormatVersion().parameterSetsTree());
210  TTree* psetTree = dynamic_cast<TTree *>(filePtr_->Get(poolNames::parameterSetsTreeName().c_str()));
211  if(0 == psetTree) {
212  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parameterSetsTreeName()
213  << " in the input file.\n";
214  }
215  psetTree->SetCacheSize(input::defaultNonEventCacheSize);
216  std::auto_ptr<TTreeCache> treeCache(dynamic_cast<TTreeCache*>(filePtr_->GetCacheRead()));
217  typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
218  IdToBlobs idToBlob;
219  IdToBlobs* pIdToBlob = &idToBlob;
220  psetTree->SetBranchAddress(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
221  if (0 != treeCache.get()) {
222  treeCache->SetEntryRange(0, psetTree->GetEntries());
223  treeCache->AddBranch("*");
224  treeCache->StopLearningPhase();
225  }
226  for(Long64_t i = 0; i != psetTree->GetEntries(); ++i) {
227  psetTree->GetEntry(i);
228  psetMap.insert(idToBlob);
229  }
230  // We own the treeCache_.
231  // We make sure the treeCache_ is detatched from the file,
232  // so that ROOT does not also delete it.
233  filePtr->SetCacheRead(0);
234  }
235 
236  // backward compatibility
238  ProcessHistoryRegistry::collection_type *pHistMapPtr = &pHistMap;
239  if(metaDataTree->FindBranch(poolNames::processHistoryMapBranchName().c_str()) != 0) {
240  metaDataTree->SetBranchAddress(poolNames::processHistoryMapBranchName().c_str(), &pHistMapPtr);
241  }
242 
244  ProcessHistoryRegistry::vector_type *pHistVectorPtr = &pHistVector;
245  if(metaDataTree->FindBranch(poolNames::processHistoryBranchName().c_str()) != 0) {
246  metaDataTree->SetBranchAddress(poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr);
247  }
248 
249  ProcessConfigurationVector procConfigVector;
250  ProcessConfigurationVector* procConfigVectorPtr = &procConfigVector;
251  if(metaDataTree->FindBranch(poolNames::processConfigurationBranchName().c_str()) != 0) {
252  metaDataTree->SetBranchAddress(poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr);
253  }
254 
255  std::auto_ptr<BranchIDListRegistry::collection_type> branchIDListsAPtr(new BranchIDListRegistry::collection_type);
256  BranchIDListRegistry::collection_type *branchIDListsPtr = branchIDListsAPtr.get();
257  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) != 0) {
258  metaDataTree->SetBranchAddress(poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr);
259  }
260 
261  BranchChildren* branchChildrenBuffer = branchChildren_.get();
262  if(metaDataTree->FindBranch(poolNames::productDependenciesBranchName().c_str()) != 0) {
263  metaDataTree->SetBranchAddress(poolNames::productDependenciesBranchName().c_str(), &branchChildrenBuffer);
264  }
265 
266  // backward compatibility
267  std::vector<EventProcessHistoryID> *eventHistoryIDsPtr = &eventProcessHistoryIDs_;
268  if(metaDataTree->FindBranch(poolNames::eventHistoryBranchName().c_str()) != 0) {
269  metaDataTree->SetBranchAddress(poolNames::eventHistoryBranchName().c_str(), &eventHistoryIDsPtr);
270  }
271 
272  if(metaDataTree->FindBranch(poolNames::moduleDescriptionMapBranchName().c_str()) != 0) {
273  if(metaDataTree->GetBranch(poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
274  metaDataTree->SetBranchStatus((poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
275  } else {
276  metaDataTree->SetBranchStatus(poolNames::moduleDescriptionMapBranchName().c_str(), 0);
277  }
278  }
279 
280  // Here we read the metadata tree
281  input::getEntry(metaDataTree, 0);
282 
284 
285  // Here we read the event history tree, if we have one.
287 
289  if(!fileFormatVersion().triggerPathsTracked()) {
290  ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion().parameterSetsByReference());
291  } else {
292  // Merge into the parameter set registry.
293  pset::Registry& psetRegistry = *pset::Registry::instance();
294  for(PsetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) {
295  ParameterSet pset(i->second.pset());
296  pset.setID(i->first);
297  psetRegistry.insertMapped(pset);
298  }
299  }
300  if(!fileFormatVersion().splitProductIDs()) {
301  // Old provenance format input file. Create a provenance adaptor.
302  provenanceAdaptor_.reset(new ProvenanceAdaptor(
303  inputProdDescReg, pHistMap, pHistVector, procConfigVector, psetIdConverter, true));
304  // Fill in the branchIDLists branch from the provenance adaptor
305  branchIDLists_ = provenanceAdaptor_->branchIDLists();
306  } else {
307  if(!fileFormatVersion().triggerPathsTracked()) {
308  // New provenance format, but change in ParameterSet Format. Create a provenance adaptor.
309  provenanceAdaptor_.reset(new ProvenanceAdaptor(
310  inputProdDescReg, pHistMap, pHistVector, procConfigVector, psetIdConverter, false));
311  }
312  // New provenance format input file. The branchIDLists branch was read directly from the input file.
313  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) == 0) {
315  << "Failed to find branchIDLists branch in metaData tree.\n";
316  }
317  branchIDLists_.reset(branchIDListsAPtr.release());
318  }
319 
320  // Merge into the hashed registries.
323 
324  validateFile(secondaryFile, usingGoToEvent);
325 
326  // Read the parentage tree. Old format files are handled internally in readParentageTree().
328 
329  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
331  }
332 
333  initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile);
336  forcedRunOffset_ = forcedRunOffset(forcedRunNumber, indexIntoFileBegin_, indexIntoFileEnd_);
338 
339  // Set product presence information in the product registry.
340  ProductRegistry::ProductList const& pList = inputProdDescReg.productList();
341  for(ProductRegistry::ProductList::const_iterator it = pList.begin(), itEnd = pList.end();
342  it != itEnd; ++it) {
343  BranchDescription const& prod = it->second;
344  treePointers_[prod.branchType()]->setPresence(prod);
345  }
346 
347  fillProductRegistryTransients(procConfigVector, inputProdDescReg);
348 
349  std::auto_ptr<ProductRegistry> newReg(new ProductRegistry);
350 
351  // Do the translation from the old registry to the new one
352  {
353  ProductRegistry::ProductList const& prodList = inputProdDescReg.productList();
354  for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
355  it != itEnd; ++it) {
356  BranchDescription const& prod = it->second;
357  std::string newFriendlyName = friendlyname::friendlyName(prod.className());
358  if(newFriendlyName == prod.friendlyClassName()) {
359  newReg->copyProduct(prod);
360  } else {
361  if(fileFormatVersion().splitProductIDs()) {
363  << "Cannot change friendly class name algorithm without more development work\n"
364  << "to update BranchIDLists. Contact the framework group.\n";
365  }
366  BranchDescription newBD(prod);
367  newBD.updateFriendlyClassName();
368  newReg->copyProduct(newBD);
369  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), prod.branchName()));
370  }
371  }
372  dropOnInput(*newReg, groupSelectorRules, dropDescendants, secondaryFile);
373  // freeze the product registry
374  newReg->setFrozen();
375  productRegistry_.reset(newReg.release());
376  }
377 
378 
379  // Set up information from the product registry.
380  ProductRegistry::ProductList const& prodList = productRegistry()->productList();
381  for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
382  it != itEnd; ++it) {
383  BranchDescription const& prod = it->second;
384  treePointers_[prod.branchType()]->addBranch(it->first, prod,
385  newBranchToOldBranch(prod.branchName()));
386  }
387 
388  // Determine if this file is fast clonable.
389  setIfFastClonable(remainingEvents, remainingLumis);
390 
391  // Update the branch id info.
392  if (!secondaryFile) {
394  }
395 
396  setRefCoreStreamer(true); // backward compatibility
397 
398  // We are done with our initial reading of EventAuxiliary.
401  }
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:239
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:188
boost::shared_ptr< BranchListIndexes > branchListIndexes_
Definition: RootFile.h:186
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:171
void readParentageTree()
Definition: RootFile.cc:443
int whyNotFastClonable_
Definition: RootFile.h:170
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:183
std::map< BranchKey, BranchDescription > ProductList
static bool updateFromInput(BranchIDLists const &bidlists, std::string const &fileName)
RootTree lumiTree_
Definition: RootFile.h:175
void setRefCoreStreamer(bool resetAll=false)
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:184
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:202
IndexIntoFileItr begin(SortOrder sortOrder) const
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:181
boost::shared_ptr< History > history_
Definition: RootFile.h:187
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
detail::ThreadSafeRegistry< ParameterSetID, ParameterSet, ProcessParameterSetIDCache > Registry
Definition: Registry.h:37
void fillProductRegistryTransients(std::vector< ProcessConfiguration > const &pcVec, ProductRegistry const &preg, bool okToRegister=false)
std::vector< EventSelectionID > EventSelectionIDVector
FileFormatVersion fileFormatVersion_
Definition: RootFile.h:158
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:235
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:167
FileID fid_
Definition: RootFile.h:159
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
std::string const logicalFile_
Definition: RootFile.h:154
std::map< key_type, value_type > collection_type
std::vector< BranchListIndex > BranchListIndexes
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:182
bool noEventSort_
Definition: RootFile.h:169
std::string friendlyName(std::string const &iFullName)
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:178
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:217
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:222
bool skipAnyEvents_
Definition: RootFile.h:168
RootTree eventTree_
Definition: RootFile.h:174
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
tuple pset
Definition: CrabTask.py:85
void dropOnInput(ProductRegistry &reg, GroupSelectorRules const &rules, bool dropDescendants, bool secondaryFile)
Definition: RootFile.cc:1484
std::string const & metaDataTreeName()
Definition: BranchType.cc:157
void insertCollection(collection_type const &c)
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:172
tuple prod
Definition: CrabTask.py:87
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
Definition: RootFile.h:185
std::string const & processHistoryBranchName()
Definition: BranchType.cc:187
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
RootTree runTree_
Definition: RootFile.h:176
boost::shared_ptr< IndexIntoFile > indexIntoFileSharedPtr_
Definition: RootFile.h:160
ProcessConfiguration const & processConfiguration_
Definition: RootFile.h:155
void setIfFastClonable(int remainingEvents, int remainingLumis)
Definition: RootFile.cc:469
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:162
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:192
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:163
bool branchListIndexesUnchanged_
Definition: RootFile.h:172
std::vector< value_type > vector_type
RootTreePtrArray treePointers_
Definition: RootFile.h:177
boost::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:179
unsigned int const defaultLearningEntries
Definition: Inputfwd.h:24
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:162
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:167
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
void initializeDuplicateChecker(std::vector< boost::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< boost::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
Definition: RootFile.cc:1468
std::string const & branchIDListBranchName()
Definition: BranchType.cc:197
static ThreadSafeRegistry * instance()
boost::shared_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:190
EventAuxiliary eventAux_
Definition: RootFile.h:173
void resetTraining()
Definition: RootTree.h:81
boost::shared_ptr< BranchIDListRegistry::collection_type const > branchIDLists_
Definition: RootFile.h:180
unsigned int const defaultNonEventCacheSize
Definition: Inputfwd.h:23
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:535
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:157
TTree * eventHistoryTree_
Definition: RootFile.h:184
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:207
void validateFile(bool secondaryFile, bool usingGoToEvent)
Definition: RootFile.cc:939
boost::shared_ptr< ProductRegistry const > productRegistry() const
Definition: RootFile.h:81
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:177
std::string const file_
Definition: RootFile.h:153
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:166
void readEventHistoryTree()
Definition: RootFile.cc:1455
int forcedRunOffset_
Definition: RootFile.h:182
unsigned int const defaultNonEventLearningEntries
Definition: Inputfwd.h:25
edm::RootFile::~RootFile ( )

Definition at line 403 of file RootFile.cc.

403  {
404  }

Member Function Documentation

BranchIDListRegistry::collection_type const& edm::RootFile::branchIDLists ( )
inline

Definition at line 82 of file RootFile.h.

References branchIDLists_.

82 {return *branchIDLists_;}
boost::shared_ptr< BranchIDListRegistry::collection_type const > branchIDLists_
Definition: RootFile.h:180
bool edm::RootFile::branchListIndexesUnchanged ( ) const
inline

Definition at line 94 of file RootFile.h.

References branchListIndexesUnchanged_.

Referenced by createFileBlock().

bool branchListIndexesUnchanged_
Definition: RootFile.h:172
void edm::RootFile::close ( void  )

Definition at line 991 of file RootFile.cc.

References eventHistoryTree_, filePtr_, and treePointers_.

Referenced by python.Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), and python.Vispa.Gui.FindDialog.FindDialog::keyPressEvent().

991  {
992  // Just to play it safe, zero all pointers to objects in the InputFile to be closed.
993  eventHistoryTree_ = 0;
994  for(RootTreePtrArray::iterator it = treePointers_.begin(), itEnd = treePointers_.end(); it != itEnd; ++it) {
995  (*it)->close();
996  (*it) = 0;
997  }
998  filePtr_->Close();
999  filePtr_.reset();
1000  }
RootTreePtrArray treePointers_
Definition: RootFile.h:177
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
TTree * eventHistoryTree_
Definition: RootFile.h:184
boost::shared_ptr< FileBlock > edm::RootFile::createFileBlock ( ) const

Definition at line 519 of file RootFile.cc.

References branchChildren_, branchListIndexesUnchanged(), eventTree_, file_, fileFormatVersion(), hasNewlyDroppedBranch(), lumiTree_, edm::RootTree::metaTree(), runTree_, edm::RootTree::tree(), and whyNotFastClonable().

519  {
520  return boost::shared_ptr<FileBlock>(new FileBlock(fileFormatVersion(),
521  eventTree_.tree(),
523  lumiTree_.tree(),
525  runTree_.tree(),
526  runTree_.metaTree(),
529  file_,
531  branchChildren_));
532  }
boost::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:188
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: RootFile.h:93
bool branchListIndexesUnchanged() const
Definition: RootFile.h:94
RootTree lumiTree_
Definition: RootFile.h:175
TTree const * metaTree() const
Definition: RootTree.h:70
TTree const * tree() const
Definition: RootTree.h:68
int whyNotFastClonable() const
Definition: RootFile.h:92
RootTree eventTree_
Definition: RootFile.h:174
RootTree runTree_
Definition: RootFile.h:176
std::string const file_
Definition: RootFile.h:153
void edm::RootFile::dropOnInput ( ProductRegistry reg,
GroupSelectorRules const &  rules,
bool  dropDescendants,
bool  secondaryFile 
)
private

Definition at line 1484 of file RootFile.cc.

References edm::ProductRegistry::allBranchDescriptions(), branchChildren_, edm::BranchDescription::branchID(), edm::BranchDescription::branchName(), edm::BranchDescription::branchType(), CommonMethods::cp(), drop, file_, hasNewlyDroppedBranch_, edm::InEvent, edm::GroupSelector::initialize(), newBranchToOldBranch(), CrabTask::prod, edm::ProductRegistry::productListUpdator(), edm::GroupSelector::selected(), treePointers_, and edm::BranchDescription::wrappedName().

Referenced by RootFile().

1484  {
1485  // This is the selector for drop on input.
1486  GroupSelector groupSelector;
1487  groupSelector.initialize(rules, reg.allBranchDescriptions());
1488 
1489  ProductRegistry::ProductList& prodList = reg.productListUpdator();
1490  // Do drop on input. On the first pass, just fill in a set of branches to be dropped.
1491  std::set<BranchID> branchesToDrop;
1492  for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
1493  it != itEnd; ++it) {
1494  BranchDescription const& prod = it->second;
1495  if(!groupSelector.selected(prod)) {
1496  if(dropDescendants) {
1497  branchChildren_->appendToDescendants(prod.branchID(), branchesToDrop);
1498  } else {
1499  branchesToDrop.insert(prod.branchID());
1500  }
1501  }
1502  }
1503 
1504  // On this pass, actually drop the branches.
1505  std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1506  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1507  BranchDescription const& prod = it->second;
1508  bool drop = branchesToDrop.find(prod.branchID()) != branchesToDropEnd;
1509  if(drop) {
1510  if(groupSelector.selected(prod)) {
1511  LogWarning("RootFile")
1512  << "Branch '" << prod.branchName() << "' is being dropped from the input\n"
1513  << "of file '" << file_ << "' because it is dependent on a branch\n"
1514  << "that was explicitly dropped.\n";
1515  }
1516  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1517  hasNewlyDroppedBranch_[prod.branchType()] = true;
1518  ProductRegistry::ProductList::iterator icopy = it;
1519  ++it;
1520  prodList.erase(icopy);
1521  } else {
1522  ++it;
1523  }
1524  }
1525 
1526  // Drop on input mergeable run and lumi products, this needs to be invoked for secondary file input
1527  if(secondaryFile) {
1528  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1529  BranchDescription const& prod = it->second;
1530  if(prod.branchType() != InEvent) {
1531  TClass *cp = gROOT->GetClass(prod.wrappedName().c_str());
1532  boost::shared_ptr<EDProduct> dummy(static_cast<EDProduct *>(cp->New()));
1533  if(dummy->isMergeable()) {
1534  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1535  ProductRegistry::ProductList::iterator icopy = it;
1536  ++it;
1537  prodList.erase(icopy);
1538  } else {
1539  ++it;
1540  }
1541  }
1542  else ++it;
1543  }
1544  }
1545  }
boost::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:188
boost::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:171
std::map< BranchKey, BranchDescription > ProductList
tuple prod
Definition: CrabTask.py:87
const int drop
RootTreePtrArray treePointers_
Definition: RootFile.h:177
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:535
std::string const file_
Definition: RootFile.h:153
EventAuxiliary const& edm::RootFile::eventAux ( ) const
inline
EventID const& edm::RootFile::eventID ( ) const
inline

Definition at line 87 of file RootFile.h.

References eventAux(), and edm::EventAuxiliary::id().

Referenced by readCurrentEvent().

87 {return eventAux().id();}
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
EventID const & id() const
RootTree const& edm::RootFile::eventTree ( ) const
inline

Definition at line 88 of file RootFile.h.

References eventTree_.

88 {return eventTree_;}
RootTree eventTree_
Definition: RootFile.h:174
std::string const& edm::RootFile::file ( ) const
inline

Definition at line 80 of file RootFile.h.

References file_.

80 {return file_;}
std::string const file_
Definition: RootFile.h:153
FileFormatVersion edm::RootFile::fileFormatVersion ( ) const
inline
void edm::RootFile::fillEventAuxiliary ( )
private

Definition at line 1022 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventTree_, fillThisEventAuxiliary(), indexIntoFileIter_, and edm::RootTree::setEntryNumber().

Referenced by isDuplicateEvent(), skipEvents(), and skipThisEntry().

1022  {
1025  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
RootTree eventTree_
Definition: RootFile.h:174
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
void edm::RootFile::fillHistory ( )
private

Definition at line 1028 of file RootFile.cc.

References branchListIndexes_, edm::poolNames::branchListIndexesBranchName(), ExpressReco_HICollisions_FallBack::e, edm::RootTree::entryNumber(), event(), eventAux(), eventAux_, edm::errors::EventCorruption, edm::poolNames::eventHistoryBranchName(), edm::FileFormatVersion::eventHistoryTree(), eventHistoryTree_, eventProcessHistoryIDs_, eventProcessHistoryIter_, eventSelectionIDs_, edm::poolNames::eventSelectionsBranchName(), eventTree_, edm::hlt::Exception, fileFormatVersion(), edm::RootTree::fillBranchEntry(), edm::input::getEntry(), history_, i, ExpressReco_HICollisions_FallBack::id, edm::lower_bound_all(), edm::FileFormatVersion::noMetaDataTrees(), provenanceAdaptor_, CrabTask::run, edm::EventAuxiliary::setProcessHistoryID(), filterCSVwithJSON::target, and edm::RootTree::tree().

Referenced by fillIndexIntoFile(), and readCurrentEvent().

1028  {
1029  // We could consider doing delayed reading, but because we have to
1030  // store this History object in a different tree than the event
1031  // data tree, this is too hard to do in this first version.
1032 
1033  if(fileFormatVersion().eventHistoryBranch()) {
1034  // Lumi block number was not in EventID for the relevant releases.
1035  EventID id(eventAux().id().run(), 0, eventAux().id().event());
1036  if(eventProcessHistoryIter_->eventID() != id) {
1037  EventProcessHistoryID target(id, ProcessHistoryID());
1039  assert(eventProcessHistoryIter_->eventID() == id);
1040  }
1043  } else if(fileFormatVersion().eventHistoryTree()) {
1044  // for backward compatibility.
1045  History* pHistory = history_.get();
1046  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(poolNames::eventHistoryBranchName().c_str());
1047  if(!eventHistoryBranch) {
1049  << "Failed to find history branch in event history tree.\n";
1050  }
1051  eventHistoryBranch->SetAddress(&pHistory);
1053  eventAux_.setProcessHistoryID(history_->processHistoryID());
1054  eventSelectionIDs_.reset(&history_->eventSelectionIDs(), do_nothing_deleter());
1055  branchListIndexes_.reset(&history_->branchListIndexes(), do_nothing_deleter());
1056  } else if (fileFormatVersion().noMetaDataTrees()) {
1057  // Current format
1059  TBranch* eventSelectionIDBranch = eventTree_.tree()->GetBranch(poolNames::eventSelectionsBranchName().c_str());
1060  assert(eventSelectionIDBranch != 0);
1061  eventTree_.fillBranchEntry(eventSelectionIDBranch, pESV);
1062  BranchListIndexes* pBLI = branchListIndexes_.get();
1063  TBranch* branchListIndexesBranch = eventTree_.tree()->GetBranch(poolNames::branchListIndexesBranchName().c_str());
1064  assert(branchListIndexesBranch != 0);
1065  eventTree_.fillBranchEntry(branchListIndexesBranch, pBLI);
1066  }
1067  if(provenanceAdaptor_) {
1068  eventAux_.setProcessHistoryID(provenanceAdaptor_->convertID(eventAux().processHistoryID()));
1069  for(EventSelectionIDVector::iterator i = eventSelectionIDs_->begin(), e = eventSelectionIDs_->end(); i != e; ++i) {
1070  (*i) = provenanceAdaptor_->convertID(*i);
1071  }
1072  }
1073  if(!fileFormatVersion().splitProductIDs()) {
1074  // old format. branchListIndexes_ must be filled in from the ProvenanceAdaptor.
1075  provenanceAdaptor_->branchListIndexes(*branchListIndexes_);
1076  }
1077  }
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< BranchListIndexes > branchListIndexes_
Definition: RootFile.h:186
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:91
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:184
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:227
boost::shared_ptr< History > history_
Definition: RootFile.h:187
std::vector< EventSelectionID > EventSelectionIDVector
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:167
TTree const * tree() const
Definition: RootTree.h:68
std::vector< BranchListIndex > BranchListIndexes
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:222
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
bool eventHistoryTree() const
RootTree eventTree_
Definition: RootFile.h:174
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Hash< ProcessHistoryType > ProcessHistoryID
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
Definition: RootFile.h:185
EntryNumber const & entryNumber() const
Definition: RootTree.h:47
void fillBranchEntry(TBranch *branch, T *&pbuf)
Definition: RootTree.h:59
void setProcessHistoryID(ProcessHistoryID const &phid)
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:231
boost::shared_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:190
EventAuxiliary eventAux_
Definition: RootFile.h:173
TTree * eventHistoryTree_
Definition: RootFile.h:184
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:166
void edm::RootFile::fillIndexIntoFile ( )
private

Definition at line 720 of file RootFile.cc.

References edm::RootTree::entries(), python.tagInventory::entries, edm::RootTree::entryNumber(), event(), eventAux(), eventAux_, eventTree_, fileFormatVersion(), fillHistory(), fillLumiAuxiliary(), fillRunAuxiliary(), fillThisEventAuxiliary(), edm::find_in_all(), i, indexIntoFile_, edm::RootTree::isValid(), lastEventEntryNumberRead_, edm::EventAuxiliary::luminosityBlock(), edmLumisInFiles::lumis, lumiTree_, edm::RootTree::next(), edm::EventAuxiliary::processHistoryID(), CrabTask::run, edm::EventAuxiliary::run(), getRunRegistry::runs, runTree_, edm::second(), edm::RootTree::setEntryNumber(), edm::IndexIntoFile::setProcessHistoryIDs(), edm::IndexIntoFile::setRunOrLumiEntries(), edm::stable_sort_all(), and edm::IndexIntoFile::unsortedEventNumbers().

Referenced by validateFile().

720  {
721  // This function is for backward compatibility.
722  // If reading a current format file, indexIntoFile_ is read from the input
723  // file and should always be there. Note that the algorithm below will work
724  // sometimes but often fail with the new format introduced in release 3_8_0.
725  // If it ever becomes necessary to rebuild IndexIntoFile from the new format,
726  // probably a separate function should be written to deal with the task.
727  // This is possible just not implemented yet.
728  assert(!fileFormatVersion().hasIndexIntoFile());
729 
730  typedef std::list<LumiItem> LumiList;
731  LumiList lumis; // (declare 1)
732 
733  typedef std::set<LuminosityBlockID> RunLumiSet;
734  RunLumiSet runLumiSet; // (declare 2)
735 
736  typedef std::list<RunItem> RunList;
737  RunList runs; // (declare 5)
738 
739  typedef std::set<RunNumber_t> RunSet;
740  RunSet runSet; // (declare 4)
741 
742  typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
743  RunItemSet runItemSet; // (declare 3)
744 
745  typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
746  PHIDMap phidMap;
747 
748  RunNumber_t prevRun = 0;
749  LuminosityBlockNumber_t prevLumi = 0;
750  ProcessHistoryID prevPhid;
751 
752  indexIntoFile_.unsortedEventNumbers().clear(); // should already be empty, just being careful
754 
755  // First, loop through the event tree.
756  while(eventTree_.next()) {
757  bool newRun = false;
758  bool newLumi = false;
760  fillHistory();
761 
762  // Save the event numbers as we loop through the event auxiliary to avoid
763  // having to read through the event auxiliary again later. These event numbers
764  // are not actually used in this function, but could be needed elsewhere.
766 
767  if (prevPhid != eventAux().processHistoryID() || prevRun != eventAux().run()) {
768  newRun = newLumi = true;
769  } else if(prevLumi != eventAux().luminosityBlock()) {
770  newLumi = true;
771  }
772  prevPhid = eventAux().processHistoryID();
773  prevRun = eventAux().run();
774  prevLumi = eventAux().luminosityBlock();
775  if (newLumi) {
776  lumis.push_back(LumiItem(eventAux().processHistoryID(),
777  eventAux().run(), eventAux().luminosityBlock(), eventTree_.entryNumber())); // (insert 1)
778  runLumiSet.insert(LuminosityBlockID(eventAux().run(), eventAux().luminosityBlock())); // (insert 2)
779  } else {
780  LumiItem& currentLumi = lumis.back();
781  assert(currentLumi.lastEventEntry_ == eventTree_.entryNumber());
782  ++currentLumi.lastEventEntry_;
783  }
784  if (newRun) {
785  // Insert run in list if it is not already there.
786  RunItem item(eventAux().processHistoryID(), eventAux().run());
787  if (runItemSet.insert(item).second) { // (check 3, insert 3)
788  runs.push_back(item); // (insert 5)
789  runSet.insert(eventAux().run()); // (insert 4)
790  phidMap.insert(std::make_pair(eventAux().run(), eventAux().processHistoryID()));
791  }
792  }
793  }
794  // now clean up.
796  eventAux_ = EventAuxiliary();
798 
799  // Loop over run entries and fill information.
800 
801  typedef std::map<RunNumber_t, EntryNumber_t> RunMap;
802  RunMap runMap; // (declare 11)
803 
804  typedef std::vector<RunItem> RunVector;
805  RunVector emptyRuns; // (declare 12)
806 
807  if(runTree_.isValid()) {
808  while(runTree_.next()) {
809  // Note: adjacent duplicates will be skipped without an explicit check.
810  boost::shared_ptr<RunAuxiliary> runAux = fillRunAuxiliary();
811  if (runSet.insert(runAux->run()).second) { // (check 4, insert 4)
812  // This run was not assciated with any events or lumis.
813  emptyRuns.push_back(RunItem(runAux->processHistoryID(), runAux->run())); // (insert 12)
814  }
815  runMap.insert(std::make_pair(runAux->run(), runTree_.entryNumber())); // (insert 11)
816  phidMap.insert(std::make_pair(runAux->run(), runAux->processHistoryID()));
817  }
818  // now clean up.
820  }
821 
822  // Insert the ordered empty runs into the run list.
823  RunItemSortByRun runItemSortByRun;
824  stable_sort_all(emptyRuns, runItemSortByRun);
825 
826  RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
827  for (RunVector::const_iterator i = emptyRuns.begin(), iEnd = emptyRuns.end(); i != iEnd; ++i) {
828  for (; itRuns != endRuns; ++itRuns) {
829  if (runItemSortByRun(*i, *itRuns)) {
830  break;
831  }
832  }
833  runs.insert(itRuns, *i);
834  }
835 
836  // Loop over luminosity block entries and fill information.
837 
838  typedef std::vector<LumiItem> LumiVector;
839  LumiVector emptyLumis; // (declare 7)
840 
841  typedef std::map<LuminosityBlockID, EntryNumber_t> RunLumiMap;
842  RunLumiMap runLumiMap; // (declare 6)
843 
844  if(lumiTree_.isValid()) {
845  while(lumiTree_.next()) {
846  // Note: adjacent duplicates will be skipped without an explicit check.
847  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAux = fillLumiAuxiliary();
848  LuminosityBlockID lumiID = LuminosityBlockID(lumiAux->run(), lumiAux->luminosityBlock());
849  if (runLumiSet.insert(lumiID).second) { // (check 2, insert 2)
850  // This lumi was not associated with any events.
851  // Use the process history ID from the corresponding run. In cases of practical
852  // importance, this should be the correct process history ID, but it is possible
853  // to construct files where this is not the correct process history ID ...
854  PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
855  assert(iPhidMap != phidMap.end());
856  emptyLumis.push_back(LumiItem(iPhidMap->second, lumiAux->run(), lumiAux->luminosityBlock(), -1LL)); // (insert 7)
857  }
858  runLumiMap.insert(std::make_pair(lumiID, lumiTree_.entryNumber()));
859  }
860  // now clean up.
862  }
863 
864  // Insert the ordered empty lumis into the lumi list.
865  LumiItemSortByRunLumi lumiItemSortByRunLumi;
866  stable_sort_all(emptyLumis, lumiItemSortByRunLumi);
867 
868  LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
869  for (LumiVector::const_iterator i = emptyLumis.begin(), iEnd = emptyLumis.end(); i != iEnd; ++i) {
870  for (; itLumis != endLumis; ++itLumis) {
871  if (lumiItemSortByRunLumi(*i, *itLumis)) {
872  break;
873  }
874  }
875  lumis.insert(itLumis, *i);
876  }
877 
878  // Create a map of RunItems that gives the order of first appearance in the list.
879  // Also fill in the vector of process history IDs
880  typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
881  RunCountMap runCountMap; // Declare (17)
882  std::vector<ProcessHistoryID>& phids = indexIntoFile_.setProcessHistoryIDs();
883  assert(phids.empty());
884  std::vector<IndexIntoFile::RunOrLumiEntry>& entries = indexIntoFile_.setRunOrLumiEntries();
885  assert(entries.empty());
886  int rcount = 0;
887  for (RunList::iterator it = runs.begin(), itEnd = runs.end(); it != itEnd; ++it) {
888  RunCountMap::const_iterator countMapItem = runCountMap.find(*it);
889  if (countMapItem == runCountMap.end()) {
890  countMapItem = runCountMap.insert(std::make_pair(*it, rcount)).first; // Insert (17)
891  assert(countMapItem != runCountMap.end());
892  ++rcount;
893  }
894  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, it->phid_);
895  if (phidItem == phids.end()) {
896  phids.push_back(it->phid_);
897  phidItem = phids.end() - 1;
898  }
899  entries.push_back(IndexIntoFile::RunOrLumiEntry(
900  countMapItem->second, // use (17)
901  -1LL,
902  runMap[it->run_], // use (11)
903  phidItem - phids.begin(),
904  it->run_,
905  0U,
906  -1LL,
907  -1LL));
908  }
909 
910  // Create a map of LumiItems that gives the order of first appearance in the list.
911  typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
912  LumiCountMap lumiCountMap; // Declare (19)
913  int lcount = 0;
914  for (LumiList::iterator it = lumis.begin(), itEnd = lumis.end(); it != itEnd; ++it) {
915  RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(it->phid_, it->run_));
916  assert(runCountMapItem != runCountMap.end());
917  LumiCountMap::const_iterator countMapItem = lumiCountMap.find(*it);
918  if (countMapItem == lumiCountMap.end()) {
919  countMapItem = lumiCountMap.insert(std::make_pair(*it, lcount)).first; // Insert (17)
920  assert(countMapItem != lumiCountMap.end());
921  ++lcount;
922  }
923  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, it->phid_);
924  assert(phidItem != phids.end());
925  entries.push_back(IndexIntoFile::RunOrLumiEntry(
926  runCountMapItem->second,
927  countMapItem->second,
928  runLumiMap[LuminosityBlockID(it->run_, it->lumi_)],
929  phidItem - phids.begin(),
930  it->run_,
931  it->lumi_,
932  it->firstEventEntry_,
933  it->lastEventEntry_));
934  }
935  stable_sort_all(entries);
936  }
int i
Definition: DBlmapReader.cc:9
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
RootTree lumiTree_
Definition: RootFile.h:175
EntryNumber const & entries() const
Definition: RootTree.h:48
RunNumber_t run() const
boost::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1101
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
LuminosityBlockNumber_t luminosityBlock() const
U second(std::pair< T, U > const &p)
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
bool next()
Definition: RootTree.h:42
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:178
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
void fillHistory()
Definition: RootFile.cc:1028
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
RootTree runTree_
Definition: RootFile.h:176
EntryNumber const & entryNumber() const
Definition: RootTree.h:47
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
std::vector< EventNumber_t > & unsortedEventNumbers() const
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
boost::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1080
bool isValid() const
Definition: RootTree.cc:62
ProcessHistoryID const & processHistoryID() const
unsigned int RunNumber_t
Definition: EventRange.h:32
EventAuxiliary eventAux_
Definition: RootFile.h:173
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::fillLumiAuxiliary ( )
private

Definition at line 1080 of file RootFile.cc.

References edm::conversion(), fileFormatVersion(), edm::RootTree::fillAux(), lumiTree_, provenanceAdaptor_, and edm::FileFormatVersion::runsAndLumis().

Referenced by fillIndexIntoFile(), and readLuminosityBlockAuxiliary_().

1080  {
1081  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary(new LuminosityBlockAuxiliary);
1082  if(fileFormatVersion().newAuxiliary()) {
1083  LuminosityBlockAuxiliary *pLumiAux = lumiAuxiliary.get();
1084  lumiTree_.fillAux<LuminosityBlockAuxiliary>(pLumiAux);
1085  } else {
1086  LuminosityBlockAux lumiAux;
1087  LuminosityBlockAux *pLumiAux = &lumiAux;
1088  lumiTree_.fillAux<LuminosityBlockAux>(pLumiAux);
1089  conversion(lumiAux, *lumiAuxiliary);
1090  }
1091  if(provenanceAdaptor_) {
1092  lumiAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1093  }
1094  if(lumiAuxiliary->luminosityBlock() == 0 && !fileFormatVersion().runsAndLumis()) {
1095  lumiAuxiliary->id() = LuminosityBlockID(RunNumber_t(1), LuminosityBlockNumber_t(1));
1096  }
1097  return lumiAuxiliary;
1098  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
RootTree lumiTree_
Definition: RootFile.h:175
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
unsigned int RunNumber_t
Definition: EventRange.h:32
boost::shared_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:190
void fillAux(T *&pAux)
Definition: RootTree.h:54
boost::shared_ptr< RunAuxiliary > edm::RootFile::fillRunAuxiliary ( )
private

Definition at line 1101 of file RootFile.cc.

References edm::conversion(), fileFormatVersion(), edm::RootTree::fillAux(), provenanceAdaptor_, and runTree_.

Referenced by fillIndexIntoFile(), and readRunAuxiliary_().

1101  {
1102  boost::shared_ptr<RunAuxiliary> runAuxiliary(new RunAuxiliary);
1103  if(fileFormatVersion().newAuxiliary()) {
1104  RunAuxiliary *pRunAux = runAuxiliary.get();
1105  runTree_.fillAux<RunAuxiliary>(pRunAux);
1106  } else {
1107  RunAux runAux;
1108  RunAux *pRunAux = &runAux;
1109  runTree_.fillAux<RunAux>(pRunAux);
1110  conversion(runAux, *runAuxiliary);
1111  }
1112  if(provenanceAdaptor_) {
1113  runAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1114  }
1115  return runAuxiliary;
1116  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
RootTree runTree_
Definition: RootFile.h:176
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
boost::shared_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:190
void fillAux(T *&pAux)
Definition: RootTree.h:54
void edm::RootFile::fillThisEventAuxiliary ( )
private

Definition at line 1003 of file RootFile.cc.

References edm::conversion(), edm::RootTree::entryNumber(), eventAux(), eventAux_, eventTree_, fileFormatVersion(), edm::RootTree::fillAux(), lastEventEntryNumberRead_, and edm::FileFormatVersion::newAuxiliary().

Referenced by fillEventAuxiliary(), fillIndexIntoFile(), initializeDuplicateChecker(), readCurrentEvent(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), and skipEvents().

1003  {
1005  // Already read.
1006  return;
1007  }
1009  EventAuxiliary *pEvAux = &eventAux_;
1010  eventTree_.fillAux<EventAuxiliary>(pEvAux);
1011  } else {
1012  // for backward compatibility.
1013  EventAux eventAux;
1014  EventAux *pEvAux = &eventAux;
1015  eventTree_.fillAux<EventAux>(pEvAux);
1016  conversion(eventAux, eventAux_);
1017  }
1019  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:178
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
EntryNumber const & entryNumber() const
Definition: RootTree.h:47
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
EventAuxiliary eventAux_
Definition: RootFile.h:173
void fillAux(T *&pAux)
Definition: RootTree.h:54
IndexIntoFile::EntryType edm::RootFile::getEntryTypeWithSkipping ( )
private
IndexIntoFile::EntryType edm::RootFile::getNextEntryTypeWanted ( )

Definition at line 625 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::advanceToNextLumiOrRun(), edm::IndexIntoFile::IndexIntoFileItr::advanceToNextRun(), getEntryTypeWithSkipping(), indexIntoFileIter_, isDuplicateEvent(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, processingMode_, edm::InputSource::Runs, and edm::InputSource::RunsAndLumis.

625  {
627  if(entryType == IndexIntoFile::kEnd) {
628  return IndexIntoFile::kEnd;
629  }
630  if(entryType == IndexIntoFile::kRun) {
631  return IndexIntoFile::kRun;
632  } else if(processingMode_ == InputSource::Runs) {
634  return getNextEntryTypeWanted();
635  }
636  if(entryType == IndexIntoFile::kLumi) {
637  return IndexIntoFile::kLumi;
640  return getNextEntryTypeWanted();
641  }
642  if(isDuplicateEvent()) {
644  return getNextEntryTypeWanted();
645  }
646  return IndexIntoFile::kEvent;
647  }
IndexIntoFile::EntryType getEntryTypeWithSkipping()
Definition: RootFile.cc:598
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:181
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::EntryType getNextEntryTypeWanted()
Definition: RootFile.cc:625
bool isDuplicateEvent()
Definition: RootFile.cc:614
bool edm::RootFile::goToEvent ( EventID const &  eventID)

Definition at line 1193 of file RootFile.cc.

References duplicateChecker_, edm::IndexIntoFile::end(), edm::EventID::event(), edm::IndexIntoFile::fillEventNumbers(), edm::IndexIntoFile::findPosition(), edm::IndexIntoFile::firstAppearanceOrder, indexIntoFile_, indexIntoFileIter_, edm::EventID::luminosityBlock(), noEventSort_, edm::IndexIntoFile::numericalOrder, and edm::EventID::run().

1193  {
1194 
1196 
1197  if (duplicateChecker_) {
1198  duplicateChecker_->disable();
1199  }
1200 
1203 
1204  IndexIntoFile::IndexIntoFileItr iter =
1206 
1207  if (iter == indexIntoFile_.end(sortOrder)) {
1208  return false;
1209  }
1210  indexIntoFileIter_ = iter;
1211  return true;
1212  }
RunNumber_t run() const
Definition: EventID.h:42
EventID const & eventID() const
Definition: RootFile.h:87
EventNumber_t event() const
Definition: EventID.h:44
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
bool noEventSort_
Definition: RootFile.h:169
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
void fillEventNumbers() const
boost::array<bool, NumBranchTypes> const& edm::RootFile::hasNewlyDroppedBranch ( ) const
inline

Definition at line 93 of file RootFile.h.

References hasNewlyDroppedBranch_.

Referenced by createFileBlock().

93 {return hasNewlyDroppedBranch_;}
boost::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:171
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileIter ( ) const

Definition at line 544 of file RootFile.cc.

References indexIntoFileIter_.

544  {
545  return indexIntoFileIter_;
546  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
boost::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr ( ) const
inline

Definition at line 118 of file RootFile.h.

References indexIntoFileSharedPtr_.

118  {
120  }
boost::shared_ptr< IndexIntoFile > indexIntoFileSharedPtr_
Definition: RootFile.h:160
void edm::RootFile::initializeDuplicateChecker ( std::vector< boost::shared_ptr< IndexIntoFile > > const &  indexesIntoFiles,
std::vector< boost::shared_ptr< IndexIntoFile > >::size_type  currentIndexIntoFile 
)
private

Definition at line 1468 of file RootFile.cc.

References duplicateChecker_, eventAux(), eventTree_, fillThisEventAuxiliary(), indexIntoFile_, edm::RootTree::next(), and edm::RootTree::setEntryNumber().

Referenced by RootFile().

1470  {
1471  if(duplicateChecker_) {
1472  if(eventTree_.next()) {
1474  duplicateChecker_->inputFileOpened(eventAux().isRealData(),
1476  indexesIntoFiles,
1477  currentIndexIntoFile);
1478  }
1480  }
1481  }
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
bool next()
Definition: RootTree.h:42
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
bool edm::RootFile::isDuplicateEvent ( )
private

Definition at line 614 of file RootFile.cc.

References duplicateChecker_, edm::EventID::event(), eventAux_, file_, fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), edm::EventAuxiliary::id(), indexIntoFileIter_, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex(), and edm::IndexIntoFile::IndexIntoFileItr::run().

Referenced by getNextEntryTypeWanted().

614  {
616  if (duplicateChecker_.get() == 0) {
617  return false;
618  }
620  return duplicateChecker_->isDuplicateAndCheckActive(indexIntoFileIter_.processHistoryIDIndex(),
622  }
EventNumber_t event() const
Definition: EventID.h:44
void fillEventAuxiliary()
Definition: RootFile.cc:1022
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
LuminosityBlockNumber_t lumi() const
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
EventID const & id() const
EventAuxiliary eventAux_
Definition: RootFile.h:173
std::string const file_
Definition: RootFile.h:153
RootTree const& edm::RootFile::lumiTree ( ) const
inline

Definition at line 89 of file RootFile.h.

References lumiTree_.

89 {return lumiTree_;}
RootTree lumiTree_
Definition: RootFile.h:175
boost::shared_ptr< BranchMapper > edm::RootFile::makeBranchMapper ( RootTree rootTree,
BranchType const &  type 
) const
private

Definition at line 1645 of file RootFile.cc.

References fileFormatVersion(), and productRegistry_.

Referenced by readCurrentEvent(), readLumi(), and readRun_().

1645  {
1646  if(fileFormatVersion().noMetaDataTrees()) {
1647  return makeBranchMapperInRelease390(rootTree);
1648  } else if(fileFormatVersion().splitProductIDs()) {
1649  return makeBranchMapperInRelease300(rootTree);
1650  } else if(fileFormatVersion().perEventProductIDs()) {
1651  return makeBranchMapperInRelease210(rootTree, type);
1652  } else if(fileFormatVersion().eventHistoryTree()) {
1653  return makeBranchMapperInRelease200(rootTree, type, *productRegistry_);
1654  } else {
1655  return makeBranchMapperInRelease180(rootTree, type, *productRegistry_);
1656  }
1657  }
type
Definition: HCALResponse.h:22
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:179
std::string const & edm::RootFile::newBranchToOldBranch ( std::string const &  newBranch) const
private

Definition at line 535 of file RootFile.cc.

References newBranchToOldBranch_.

Referenced by dropOnInput(), and RootFile().

535  {
536  std::map<std::string, std::string>::const_iterator it = newBranchToOldBranch_.find(newBranch);
537  if(it != newBranchToOldBranch_.end()) {
538  return it->second;
539  }
540  return newBranch;
541  }
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:183
bool edm::RootFile::nextEventEntry ( )
inline

Definition at line 116 of file RootFile.h.

References eventTree_, and edm::RootTree::next().

116 {return eventTree_.next();}
bool next()
Definition: RootTree.h:42
RootTree eventTree_
Definition: RootFile.h:174
void edm::RootFile::overrideRunNumber ( RunID id)
private

Definition at line 1424 of file RootFile.cc.

References edm::RunID::firstValidRun(), forcedRunOffset_, and CrabTask::run.

Referenced by readCurrentEvent(), readLuminosityBlockAuxiliary_(), and readRunAuxiliary_().

1424  {
1425  if(forcedRunOffset_ != 0) {
1426  id = RunID(id.run() + forcedRunOffset_);
1427  }
1428  if(id < RunID::firstValidRun()) id = RunID::firstValidRun();
1429  }
static RunID firstValidRun()
Definition: RunID.h:82
int forcedRunOffset_
Definition: RootFile.h:182
void edm::RootFile::overrideRunNumber ( LuminosityBlockID id)
private

Definition at line 1432 of file RootFile.cc.

References edm::RunID::firstValidRun(), forcedRunOffset_, and CrabTask::run.

1432  {
1433  if(forcedRunOffset_ != 0) {
1434  id = LuminosityBlockID(id.run() + forcedRunOffset_, id.luminosityBlock());
1435  }
1436  if(RunID(id.run()) < RunID::firstValidRun()) id = LuminosityBlockID(RunID::firstValidRun().run(), id.luminosityBlock());
1437  }
static RunID firstValidRun()
Definition: RunID.h:82
int forcedRunOffset_
Definition: RootFile.h:182
void edm::RootFile::overrideRunNumber ( EventID id,
bool  isRealData 
)
private

Definition at line 1440 of file RootFile.cc.

References edm::errors::Configuration, event(), edm::hlt::Exception, edm::LuminosityBlockID::firstValidLuminosityBlock(), edm::RunID::firstValidRun(), forcedRunOffset_, and CrabTask::run.

1440  {
1441  if(forcedRunOffset_ != 0) {
1442  if(isRealData) {
1443  throw edm::Exception(errors::Configuration,"RootFile::RootFile()")
1444  << "The 'setRunNumber' parameter of PoolSource cannot be used with real data.\n";
1445  }
1446  id = EventID(id.run() + forcedRunOffset_, id.luminosityBlock(), id.event());
1447  }
1448  if(RunID(id.run()) < RunID::firstValidRun()) {
1450  }
1451  }
static LuminosityBlockID firstValidLuminosityBlock()
static RunID firstValidRun()
Definition: RunID.h:82
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int forcedRunOffset_
Definition: RootFile.h:182
boost::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry ( ) const
inline

Definition at line 81 of file RootFile.h.

References productRegistry_.

Referenced by RootFile().

81 {return productRegistry_;}
boost::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:179
EventPrincipal * edm::RootFile::readCurrentEvent ( EventPrincipal cache,
boost::shared_ptr< LuminosityBlockPrincipal lb = boost::shared_ptr<LuminosityBlockPrincipal>() 
)

Definition at line 1245 of file RootFile.cc.

References printConversionInfo::aux, branchListIndexes_, edm::RootTree::current(), event(), eventAux(), eventAux_, eventID(), eventSelectionIDs_, eventTree_, fileFormatVersion(), filePtr_, edm::EventPrincipal::fillEventPrincipal(), fillHistory(), fillThisEventAuxiliary(), edm::EventAuxiliary::id(), edm::InEvent, edm::EventAuxiliary::isRealData(), makeBranchMapper(), edm::RootTree::makeDelayedReader(), edm::EventAuxiliary::oldLuminosityBlock(), overrideRunNumber(), edm::EventAuxiliary::resetObsoleteInfo(), and CrabTask::run.

Referenced by readEvent().

1245  {
1246  if(!eventTree_.current()) {
1247  return 0;
1248  }
1250  if(!fileFormatVersion().lumiInEventID()) {
1251  //ugly, but will disappear when the backward compatibility is done with schema evolution.
1252  const_cast<EventID&>(eventAux_.id()).setLuminosityBlockNumber(eventAux_.oldLuminosityBlock());
1254  }
1255  fillHistory();
1257 
1258  std::auto_ptr<EventAuxiliary> aux(new EventAuxiliary(eventAux()));
1259  // We're not done ... so prepare the EventPrincipal
1260  cache.fillEventPrincipal(aux,
1261  lb,
1266 
1267  // report event read from file
1268  filePtr_->eventReadFromFile(eventID().run(), eventID().event());
1269  return &cache;
1270  }
EventID const & eventID() const
Definition: RootFile.h:87
bool isRealData() const
boost::shared_ptr< BranchListIndexes > branchListIndexes_
Definition: RootFile.h:186
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::shared_ptr< DelayedReader > makeDelayedReader(FileFormatVersion const &fileFormatVersion) const
Definition: RootTree.cc:129
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
void fillHistory()
Definition: RootFile.cc:1028
LuminosityBlockNumber_t oldLuminosityBlock() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
boost::shared_ptr< EventSelectionIDVector > eventSelectionIDs_
Definition: RootFile.h:185
EventID const & id() const
boost::shared_ptr< BranchMapper > makeBranchMapper(RootTree &rootTree, BranchType const &type) const
Definition: RootFile.cc:1645
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1424
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
EventAuxiliary eventAux_
Definition: RootFile.h:173
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
bool current()
Definition: RootTree.h:44
void edm::RootFile::readEntryDescriptionTree ( )
private

Definition at line 407 of file RootFile.cc.

References edm::poolNames::entryDescriptionBranchName(), edm::poolNames::entryDescriptionIDBranchName(), edm::poolNames::entryDescriptionTreeName(), edm::errors::EventCorruption, edm::hlt::Exception, fileFormatVersion(), filePtr_, edm::errors::FileReadError, edm::input::getEntry(), i, edm::EventEntryDescription::id(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::numEntries(), parents, edm::EventEntryDescription::parents(), edm::Parentage::parents(), and PhysicsTools::registry.

Referenced by readParentageTree().

407  {
408  // Called only for old format files.
409  if(!fileFormatVersion().perEventProductIDs()) return;
410  TTree* entryDescriptionTree = dynamic_cast<TTree*>(filePtr_->Get(poolNames::entryDescriptionTreeName().c_str()));
411  if(!entryDescriptionTree)
412  throw edm::Exception(errors::FileReadError) << "Could not find tree " << poolNames::entryDescriptionTreeName()
413  << " in the input file.\n";
414 
415 
416  EntryDescriptionID idBuffer;
417  EntryDescriptionID* pidBuffer = &idBuffer;
418  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), &pidBuffer);
419 
421 
422  EventEntryDescription entryDescriptionBuffer;
423  EventEntryDescription *pEntryDescriptionBuffer = &entryDescriptionBuffer;
424  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), &pEntryDescriptionBuffer);
425 
426  // Fill in the parentage registry.
428 
429  for(Long64_t i = 0, numEntries = entryDescriptionTree->GetEntries(); i < numEntries; ++i) {
430  input::getEntry(entryDescriptionTree, i);
431  if(idBuffer != entryDescriptionBuffer.id())
432  throw edm::Exception(errors::EventCorruption) << "Corruption of EntryDescription tree detected.\n";
433  oldregistry.insertMapped(entryDescriptionBuffer);
434  Parentage parents;
435  parents.parents() = entryDescriptionBuffer.parents();
436  registry.insertMapped(parents);
437  }
438  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), 0);
439  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), 0);
440  }
int i
Definition: DBlmapReader.cc:9
edm::detail::ThreadSafeRegistry< edm::EntryDescriptionID, edm::EventEntryDescription > EntryDescriptionRegistry
TPRegexp parents
Definition: eve_filter.cc:24
std::string const & entryDescriptionBranchName()
Definition: BranchType.cc:143
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
edm::detail::ThreadSafeRegistry< edm::ParentageID, edm::Parentage > ParentageRegistry
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:184
Hash< EntryDescriptionType > EntryDescriptionID
std::string const & entryDescriptionTreeName()
Definition: BranchType.cc:135
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
std::string const & entryDescriptionIDBranchName()
Definition: BranchType.cc:139
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
static ThreadSafeRegistry * instance()
static Interceptor::Registry registry("Interceptor")
EventPrincipal * edm::RootFile::readEvent ( EventPrincipal cache,
boost::shared_ptr< LuminosityBlockPrincipal lb = boost::shared_ptr<LuminosityBlockPrincipal>() 
)

Definition at line 1228 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), eventTree_, forcedRunOffset_, edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::IndexIntoFileItr::lumi(), readCurrentEvent(), CrabTask::run, edm::IndexIntoFile::IndexIntoFileItr::run(), and edm::RootTree::setEntryNumber().

1228  {
1231  // Set the entry in the tree, and read the event at that entry.
1233  EventPrincipal* ep = readCurrentEvent(cache, lb);
1234 
1235  assert(ep != 0);
1236  assert(eventAux().run() == indexIntoFileIter_.run() + forcedRunOffset_);
1237  assert(eventAux().luminosityBlock() == indexIntoFileIter_.lumi());
1238 
1240  return ep;
1241  }
EventPrincipal * readCurrentEvent(EventPrincipal &cache, boost::shared_ptr< LuminosityBlockPrincipal > lb=boost::shared_ptr< LuminosityBlockPrincipal >())
Definition: RootFile.cc:1245
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
LuminosityBlockNumber_t lumi() const
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
int forcedRunOffset_
Definition: RootFile.h:182
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
void edm::RootFile::readEventHistoryTree ( )
private

Definition at line 1455 of file RootFile.cc.

References edm::errors::EventCorruption, eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), edm::hlt::Exception, fileFormatVersion(), filePtr_, and history_.

Referenced by RootFile().

1455  {
1456  // Read in the event history tree, if we have one...
1457  if(fileFormatVersion().eventHistoryTree()) {
1458  history_.reset(new History);
1459  eventHistoryTree_ = dynamic_cast<TTree*>(filePtr_->Get(poolNames::eventHistoryTreeName().c_str()));
1460  if(!eventHistoryTree_) {
1462  << "Failed to find the event history tree.\n";
1463  }
1464  }
1465  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::shared_ptr< History > history_
Definition: RootFile.h:187
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:252
TTree * eventHistoryTree_
Definition: RootFile.h:184
boost::shared_ptr< LuminosityBlockPrincipal > edm::RootFile::readLumi ( boost::shared_ptr< LuminosityBlockPrincipal lbCache)

Definition at line 1381 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), fileFormatVersion(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::InLumi, edm::RootTree::isValid(), edm::IndexIntoFile::kLumi, lumiTree_, makeBranchMapper(), edm::RootTree::makeDelayedReader(), and edm::RootTree::setEntryNumber().

1381  {
1384  // Begin code for backward compatibility before the existence of lumi trees.
1385  if(!lumiTree_.isValid()) {
1387  return lbCache;
1388  }
1389  // End code for backward compatibility before the existence of lumi trees.
1391  lbCache->fillLuminosityBlockPrincipal(makeBranchMapper(lumiTree_, InLumi),
1393  // Read in all the products now.
1394  lbCache->readImmediate();
1396  return lbCache;
1397  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::shared_ptr< DelayedReader > makeDelayedReader(FileFormatVersion const &fileFormatVersion) const
Definition: RootTree.cc:129
RootTree lumiTree_
Definition: RootFile.h:175
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
bool isValid() const
Definition: RootTree.cc:62
boost::shared_ptr< BranchMapper > makeBranchMapper(RootTree &rootTree, BranchType const &type) const
Definition: RootFile.cc:1645
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::readLuminosityBlockAuxiliary_ ( )

Definition at line 1337 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), eventTree_, fileFormatVersion(), filePtr_, fillLumiAuxiliary(), fillThisEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, edm::Timestamp::invalidTimestamp(), edm::RootTree::isValid(), edm::IndexIntoFile::kLumi, fjr2json::lumi, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::LuminosityBlockID::luminosityBlock(), lumiTree_, edm::RootTree::next(), overrideRunNumber(), edm::RootTree::previous(), edm::IndexIntoFile::processHistoryID(), edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex(), edm::LuminosityBlockID::run(), edm::IndexIntoFile::IndexIntoFileItr::run(), edm::RootTree::setEntryNumber(), cond::rpcobgas::time, and edm::EventAuxiliary::time().

1337  {
1340  // Begin code for backward compatibility before the existence of lumi trees.
1341  if(!lumiTree_.isValid()) {
1342  if(eventTree_.next()) {
1344  // back up, so event will not be skipped.
1345  eventTree_.previous();
1346  }
1347 
1349  overrideRunNumber(lumi);
1350  return boost::shared_ptr<LuminosityBlockAuxiliary>(new LuminosityBlockAuxiliary(lumi.run(), lumi.luminosityBlock(), eventAux().time(), Timestamp::invalidTimestamp()));
1351  }
1352  // End code for backward compatibility before the existence of lumi trees.
1354  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary = fillLumiAuxiliary();
1355  assert(lumiAuxiliary->run() == indexIntoFileIter_.run());
1356  assert(lumiAuxiliary->luminosityBlock() == indexIntoFileIter_.lumi());
1357  overrideRunNumber(lumiAuxiliary->id());
1358  filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1359 
1360  if(lumiAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1361  // LuminosityBlockAuxiliary did not contain a timestamp. Take it from the next event.
1362  if(eventTree_.next()) {
1364  // back up, so event will not be skipped.
1365  eventTree_.previous();
1366  }
1367  lumiAuxiliary->setBeginTime(eventAux().time());
1368  lumiAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1369  }
1370  if(fileFormatVersion().processHistorySameWithinRun()) {
1372  assert(lumiAuxiliary->processHistoryID() == phid);
1373  } else {
1375  lumiAuxiliary->setProcessHistoryID(phid);
1376  }
1377  return lumiAuxiliary;
1378  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
tuple lumi
Definition: fjr2json.py:41
RootTree lumiTree_
Definition: RootFile.h:175
Timestamp const & time() const
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
LuminosityBlockNumber_t lumi() const
bool previous()
Definition: RootTree.h:43
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
bool next()
Definition: RootTree.h:42
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
boost::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1080
ProcessHistoryID const & processHistoryID(int i) const
bool isValid() const
Definition: RootTree.cc:62
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1424
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
void edm::RootFile::readParentageTree ( )
private

Definition at line 443 of file RootFile.cc.

References edm::hlt::Exception, fileFormatVersion(), filePtr_, edm::errors::FileReadError, edm::input::getEntry(), i, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::numEntries(), edm::poolNames::parentageBranchName(), edm::poolNames::parentageTreeName(), readEntryDescriptionTree(), and PhysicsTools::registry.

Referenced by RootFile().

443  {
444  if(!fileFormatVersion().splitProductIDs()) {
445  // Old format file.
447  return;
448  }
449  // New format file
450  TTree* parentageTree = dynamic_cast<TTree*>(filePtr_->Get(poolNames::parentageTreeName().c_str()));
451  if(!parentageTree)
452  throw edm::Exception(errors::FileReadError) << "Could not find tree " << poolNames::parentageTreeName()
453  << " in the input file.\n";
454 
455  Parentage parentageBuffer;
456  Parentage *pParentageBuffer = &parentageBuffer;
457  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), &pParentageBuffer);
458 
460 
461  for(Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
462  input::getEntry(parentageTree, i);
463  registry.insertMapped(parentageBuffer);
464  }
465  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), 0);
466  }
int i
Definition: DBlmapReader.cc:9
std::string const & parentageTreeName()
Definition: BranchType.cc:148
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
edm::detail::ThreadSafeRegistry< edm::ParentageID, edm::Parentage > ParentageRegistry
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:184
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
void readEntryDescriptionTree()
Definition: RootFile.cc:407
std::string const & parentageBranchName()
Definition: BranchType.cc:152
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
static ThreadSafeRegistry * instance()
static Interceptor::Registry registry("Interceptor")
boost::shared_ptr< RunPrincipal > edm::RootFile::readRun_ ( boost::shared_ptr< RunPrincipal rpCache)

Definition at line 1320 of file RootFile.cc.

References fileFormatVersion(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::InRun, edm::RootTree::isValid(), edm::IndexIntoFile::kRun, makeBranchMapper(), edm::RootTree::makeDelayedReader(), and runTree_.

1320  {
1323  // Begin code for backward compatibility before the existence of run trees.
1324  if(!runTree_.isValid()) {
1326  return rpCache;
1327  }
1328  // End code for backward compatibility before the existence of run trees.
1330  // Read in all the products now.
1331  rpCache->readImmediate();
1333  return rpCache;
1334  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
boost::shared_ptr< DelayedReader > makeDelayedReader(FileFormatVersion const &fileFormatVersion) const
Definition: RootTree.cc:129
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
RootTree runTree_
Definition: RootFile.h:176
bool isValid() const
Definition: RootTree.cc:62
boost::shared_ptr< BranchMapper > makeBranchMapper(RootTree &rootTree, BranchType const &type) const
Definition: RootFile.cc:1645
boost::shared_ptr< RunAuxiliary > edm::RootFile::readRunAuxiliary_ ( )

Definition at line 1278 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), eventTree_, fileFormatVersion(), filePtr_, fillRunAuxiliary(), fillThisEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, edm::Timestamp::invalidTimestamp(), edm::RootTree::isValid(), edm::IndexIntoFile::kRun, edm::RootTree::next(), overrideRunNumber(), edm::RootTree::previous(), edm::IndexIntoFile::processHistoryID(), edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex(), edm::FileFormatVersion::processHistorySameWithinRun(), edm::RunID::run(), CrabTask::run, edm::IndexIntoFile::IndexIntoFileItr::run(), runTree_, edm::RootTree::setEntryNumber(), cond::rpcobgas::time, and edm::EventAuxiliary::time().

1278  {
1281  // Begin code for backward compatibility before the existence of run trees.
1282  if(!runTree_.isValid()) {
1283  // prior to the support of run trees.
1284  // RunAuxiliary did not contain a valid timestamp. Take it from the next event.
1285  if(eventTree_.next()) {
1287  // back up, so event will not be skipped.
1288  eventTree_.previous();
1289  }
1291  overrideRunNumber(run);
1292  return boost::shared_ptr<RunAuxiliary>(new RunAuxiliary(run.run(), eventAux().time(), Timestamp::invalidTimestamp()));
1293  }
1294  // End code for backward compatibility before the existence of run trees.
1296  boost::shared_ptr<RunAuxiliary> runAuxiliary = fillRunAuxiliary();
1297  assert(runAuxiliary->run() == indexIntoFileIter_.run());
1298  overrideRunNumber(runAuxiliary->id());
1299  filePtr_->reportInputRunNumber(runAuxiliary->run());
1300  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1301  // RunAuxiliary did not contain a valid timestamp. Take it from the next event.
1302  if(eventTree_.next()) {
1304  // back up, so event will not be skipped.
1305  eventTree_.previous();
1306  }
1307  runAuxiliary->setBeginTime(eventAux().time());
1308  runAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1309  }
1312  assert(runAuxiliary->processHistoryID() == phid);
1313  } else {
1314  runAuxiliary->setProcessHistoryID(phid);
1315  }
1316  return runAuxiliary;
1317  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
Timestamp const & time() const
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
boost::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1101
bool previous()
Definition: RootTree.h:43
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
bool next()
Definition: RootTree.h:42
EventAuxiliary const & eventAux() const
Definition: RootFile.h:83
RootTree eventTree_
Definition: RootFile.h:174
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
RootTree runTree_
Definition: RootFile.h:176
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
bool processHistorySameWithinRun() const
ProcessHistoryID const & processHistoryID(int i) const
bool isValid() const
Definition: RootTree.cc:62
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1424
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
void edm::RootFile::reportOpened ( std::string const &  inputType)

Definition at line 977 of file RootFile.cc.

References edm::RootTree::branchNames(), eventTree_, edm::FileID::fid(), fid_, filePtr_, label, and logicalFile_.

977  {
978  // Report file opened.
979  std::string const label = "source";
980  std::string moduleName = "PoolSource";
981  filePtr_->inputFileOpened(
982  logicalFile_,
983  inputType,
984  moduleName,
985  label,
986  fid_.fid(),
988  }
const std::string & label
Definition: MVAComputer.cc:186
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:50
FileID fid_
Definition: RootFile.h:159
std::string const logicalFile_
Definition: RootFile.h:154
std::string const & fid() const
Definition: FileID.h:19
RootTree eventTree_
Definition: RootFile.h:174
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:156
void edm::RootFile::rewind ( )
inline

Definition at line 104 of file RootFile.h.

References eventTree_, indexIntoFileBegin_, indexIntoFileIter_, lumiTree_, edm::RootTree::rewind(), and runTree_.

104  {
106  eventTree_.rewind();
107  lumiTree_.rewind();
108  runTree_.rewind();
109  }
RootTree lumiTree_
Definition: RootFile.h:175
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
RootTree eventTree_
Definition: RootFile.h:174
RootTree runTree_
Definition: RootFile.h:176
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:163
void rewind()
Definition: RootTree.h:45
RootTree const& edm::RootFile::runTree ( ) const
inline

Definition at line 90 of file RootFile.h.

References runTree_.

Referenced by validateFile().

90 {return runTree_;}
RootTree runTree_
Definition: RootFile.h:176
void edm::RootFile::setAtEventEntry ( IndexIntoFile::EntryNumber_t  entry)

Definition at line 1273 of file RootFile.cc.

References eventTree_, and edm::RootTree::setEntryNumber().

1273  {
1275  }
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
RootTree eventTree_
Definition: RootFile.h:174
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
bool edm::RootFile::setEntryAtEvent ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)

Definition at line 1400 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventTree_, edm::IndexIntoFile::findEventPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1400  {
1402  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1404  return true;
1405  }
tuple lumi
Definition: fjr2json.py:41
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
RootTree eventTree_
Definition: RootFile.h:174
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
bool edm::RootFile::setEntryAtItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)
inline

Definition at line 96 of file RootFile.h.

References setEntryAtEvent(), setEntryAtLumi(), and setEntryAtRun().

96  {
98  }
tuple lumi
Definition: fjr2json.py:41
bool setEntryAtRun(RunNumber_t run)
Definition: RootFile.cc:1416
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1408
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: RootFile.cc:1400
bool edm::RootFile::setEntryAtLumi ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 1408 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::IndexIntoFile::findLumiPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, lumiTree_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1408  {
1410  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1412  return true;
1413  }
tuple lumi
Definition: fjr2json.py:41
RootTree lumiTree_
Definition: RootFile.h:175
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
bool edm::RootFile::setEntryAtRun ( RunNumber_t  run)

Definition at line 1416 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::IndexIntoFile::findRunPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, runTree_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1416  {
1418  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1420  return true;
1421  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
RootTree runTree_
Definition: RootFile.h:176
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
void edm::RootFile::setIfFastClonable ( int  remainingEvents,
int  remainingLumis 
)
private

Definition at line 469 of file RootFile.cc.

References duplicateChecker_, edm::FileBlock::DuplicateEventsRemoved, edm::RootTree::entries(), edm::FileBlock::EventsToBeSorted, eventTree_, fileFormatVersion(), edm::FileBlock::FileTooOld, edm::IndexIntoFile::firstAppearanceOrder, edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFile_, indexIntoFileBegin_, indexIntoFileEnd_, edm::FileBlock::InitialEventsSkipped, edm::IndexIntoFile::iterationWillBeInEntryOrder(), edm::IndexIntoFile::kEvent, lumiTree_, edm::FileBlock::MaxEventsTooSmall, edm::FileBlock::MaxLumisTooSmall, edm::FileBlock::NoEventsInFile, noEventSort_, edm::FileBlock::NotProcessingEvents, edm::IndexIntoFile::numericalOrder, processingMode_, edm::InputSource::RunsLumisAndEvents, skipAnyEvents_, and whyNotFastClonable_.

Referenced by RootFile().

469  {
470  if(!fileFormatVersion().splitProductIDs()) {
472  return;
473  }
476  return;
477  }
478  // Find entry for first event in file
479  IndexIntoFile::IndexIntoFileItr it = indexIntoFileBegin_;
480  while(it != indexIntoFileEnd_ && it.getEntryType() != IndexIntoFile::kEvent) {
481  ++it;
482  }
483  if(it == indexIntoFileEnd_) {
485  return;
486  }
487 
488  // From here on, record all reasons we can't fast clone.
493  }
494  if(skipAnyEvents_) {
496  }
497  if(remainingEvents >= 0 && eventTree_.entries() > remainingEvents) {
499  }
500  if(remainingLumis >= 0 && lumiTree_.entries() > remainingLumis) {
502  }
503  // We no longer fast copy the EventAuxiliary branch, so there
504  // is no longer any need to disable fast copying because the run
505  // number is being modified. Also, this check did not work anyway
506  // because this function is called before forcedRunOffset_ is set.
507 
508  // if(forcedRunOffset_ != 0) {
509  // whyNotFastClonable_ += FileBlock::RunNumberModified;
510  // }
511  if(duplicateChecker_ &&
512  !duplicateChecker_->checkDisabled() &&
513  !duplicateChecker_->noDuplicatesInFile()) {
515  }
516  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
int whyNotFastClonable_
Definition: RootFile.h:170
RootTree lumiTree_
Definition: RootFile.h:175
EntryNumber const & entries() const
Definition: RootTree.h:48
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:181
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
bool noEventSort_
Definition: RootFile.h:169
bool skipAnyEvents_
Definition: RootFile.h:168
RootTree eventTree_
Definition: RootFile.h:174
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:163
void edm::RootFile::setPosition ( IndexIntoFile::IndexIntoFileItr const &  position)

Definition at line 549 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::copyPosition(), and indexIntoFileIter_.

549  {
551  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
void edm::RootFile::setToLastEntry ( )
inline

Definition at line 110 of file RootFile.h.

References indexIntoFileEnd_, and indexIntoFileIter_.

110  {
112  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
bool edm::RootFile::skipEvents ( int &  offset)

Definition at line 1119 of file RootFile.cc.

References duplicateChecker_, edm::EventID::event(), eventAux_, eventSkipperByID_, eventTree_, file_, fillEventAuxiliary(), fillThisEventAuxiliary(), edm::EventAuxiliary::id(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::invalidRun, evf::evtn::offset(), edm::RootTree::resetTraining(), edm::RootTree::setEntryNumber(), edm::IndexIntoFile::IndexIntoFileItr::skipEventBackward(), and edm::IndexIntoFile::IndexIntoFileItr::skipEventForward().

1119  {
1120  while (offset > 0 && indexIntoFileIter_ != indexIntoFileEnd_) {
1121 
1122  int phIndexOfSkippedEvent = IndexIntoFile::invalidIndex;
1123  RunNumber_t runOfSkippedEvent = IndexIntoFile::invalidRun;
1126 
1127  indexIntoFileIter_.skipEventForward(phIndexOfSkippedEvent,
1128  runOfSkippedEvent,
1129  lumiOfSkippedEvent,
1130  skippedEventEntry);
1131 
1132  // At the end of the file and there were no more events to skip
1133  if (skippedEventEntry == IndexIntoFile::invalidEntry) break;
1134 
1135  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1136  eventTree_.setEntryNumber(skippedEventEntry);
1138  if (eventSkipperByID_->skipIt(runOfSkippedEvent, lumiOfSkippedEvent, eventAux_.id().event())) {
1139  continue;
1140  }
1141  }
1142  if(duplicateChecker_ &&
1143  !duplicateChecker_->checkDisabled() &&
1144  !duplicateChecker_->noDuplicatesInFile()) {
1145 
1146  eventTree_.setEntryNumber(skippedEventEntry);
1148  if (duplicateChecker_->isDuplicateAndCheckActive(phIndexOfSkippedEvent,
1149  runOfSkippedEvent,
1150  lumiOfSkippedEvent,
1151  eventAux_.id().event(),
1152  file_)) {
1153  continue;
1154  }
1155  }
1156  --offset;
1157  }
1158 
1159  while(offset < 0) {
1160 
1161  if(duplicateChecker_) {
1162  duplicateChecker_->disable();
1163  }
1164 
1165  int phIndexOfEvent = IndexIntoFile::invalidIndex;
1168  EntryNumber_t eventEntry = IndexIntoFile::invalidEntry;
1169 
1170  indexIntoFileIter_.skipEventBackward(phIndexOfEvent,
1171  runOfEvent,
1172  lumiOfEvent,
1173  eventEntry);
1174 
1175  if (eventEntry == IndexIntoFile::invalidEntry) break;
1176 
1177  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1178  eventTree_.setEntryNumber(eventEntry);
1180  if (eventSkipperByID_->skipIt(runOfEvent, lumiOfEvent, eventAux_.id().event())) {
1181  continue;
1182  }
1183  }
1184  ++offset;
1185  }
1186 
1188 
1190  }
EventNumber_t event() const
Definition: EventID.h:44
static int const invalidIndex
void fillEventAuxiliary()
Definition: RootFile.cc:1022
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
long long EntryNumber_t
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
static RunNumber_t const invalidRun
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
RootTree eventTree_
Definition: RootFile.h:174
unsigned int offset(bool)
static EntryNumber_t const invalidEntry
static LuminosityBlockNumber_t const invalidLumi
EventID const & id() const
unsigned int RunNumber_t
Definition: EventRange.h:32
EventAuxiliary eventAux_
Definition: RootFile.h:173
void fillThisEventAuxiliary()
Definition: RootFile.cc:1003
void resetTraining()
Definition: RootTree.h:81
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:157
std::string const file_
Definition: RootFile.h:153
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
are no more events in the current run or lumi.
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:148
bool edm::RootFile::skipThisEntry ( )
private

Definition at line 554 of file RootFile.cc.

References edm::EventID::event(), eventAux_, eventSkipperByID_, fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), edm::EventAuxiliary::id(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kRun, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::IndexIntoFile::IndexIntoFileItr::peekAheadAtLumi(), edm::IndexIntoFile::IndexIntoFileItr::run(), and edm::IndexIntoFile::IndexIntoFileItr::skipLumiInRun().

Referenced by getEntryTypeWithSkipping().

554  {
556  return false;
557  }
558  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
559 
560  // See first if the entire lumi or run is skipped, so we won't have to read the event Auxiliary in that case.
562  return true;
563  }
564 
565  // The Lumi is not skipped. If this is an event, see if the event is skipped.
570  eventAux_.id().event())) {
571  return true;
572  }
573  }
574 
575  // Skip runs with no lumis if either lumisToSkip or lumisToProcess have been set to select lumis
577  eventSkipperByID_->skippingLumis()) {
578  IndexIntoFile::IndexIntoFileItr iterLumi = indexIntoFileIter_;
579 
580  // There are no lumis in this run, not even ones we will skip
581  if (iterLumi.peekAheadAtLumi() == IndexIntoFile::invalidLumi) {
582  return true;
583  }
584  // If we get here there are lumis in the run, check to see if we are skipping all of them
585  do {
586  if (!eventSkipperByID_->skipIt(iterLumi.run(), iterLumi.peekAheadAtLumi(), 0U)) {
587  return false;
588  }
589  }
590  while(iterLumi.skipLumiInRun());
591  return true;
592  }
593  }
594  return false;
595  }
EventNumber_t event() const
Definition: EventID.h:44
void fillEventAuxiliary()
Definition: RootFile.cc:1022
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
LuminosityBlockNumber_t lumi() const
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:164
static LuminosityBlockNumber_t const invalidLumi
EventID const & id() const
EventAuxiliary eventAux_
Definition: RootFile.h:173
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:157
RootTreePtrArray& edm::RootFile::treePointers ( )
inlineprivate

Definition at line 127 of file RootFile.h.

References treePointers_.

127 {return treePointers_;}
RootTreePtrArray treePointers_
Definition: RootFile.h:177
void edm::RootFile::validateFile ( bool  secondaryFile,
bool  usingGoToEvent 
)
private

Definition at line 939 of file RootFile.cc.

References edm::createGlobalIdentifier(), duplicateChecker_, edm::IndexIntoFile::empty(), edm::RootTree::entries(), python.tagInventory::entries, edm::errors::EventCorruption, eventTree_, edm::hlt::Exception, fid_, fileFormatVersion(), edm::IndexIntoFile::fillEventNumbersOrEntries(), fillIndexIntoFile(), edm::IndexIntoFile::fixIndexes(), indexIntoFile_, edm::FileID::isValid(), edm::RootTree::isValid(), noEventSort_, orderedProcessHistoryIDs_, runTree(), edm::IndexIntoFile::setEventFinder(), and edm::IndexIntoFile::setNumberOfEvents().

Referenced by RootFile().

939  {
940  if(!fid_.isValid()) {
941  fid_ = FileID(createGlobalIdentifier());
942  }
943  if(!eventTree_.isValid()) {
945  "'Events' tree is corrupted or not present\n" << "in the input file.\n";
946  }
947 
948  if (fileFormatVersion().hasIndexIntoFile()) {
949  if (runTree().entries() > 0) {
950  assert(!indexIntoFile_.empty());
951  }
952  }
953  else {
954  assert(indexIntoFile_.empty());
956  }
957 
960  indexIntoFile_.setEventFinder(boost::shared_ptr<IndexIntoFile::EventFinder>(new RootFileEventFinder(eventTree_)));
961  // We fill the event numbers explicitly if we need to find events in closed files,
962  // such as for secondary files (or secondary sources) or if duplicate checking across files.
963  bool needEventNumbers = false;
964  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
965  if (secondaryFile || needIndexesForDuplicateChecker || usingGoToEvent) {
966  needEventNumbers = true;
967  }
968  bool needEventEntries = false;
969  if (secondaryFile || !noEventSort_) {
970  // We need event entries for sorting or for secondary files or sources.
971  needEventEntries = true;
972  }
973  indexIntoFile_.fillEventNumbersOrEntries(needEventNumbers, needEventEntries);
974  }
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:91
bool empty() const
True if no runs, lumis, or events are in the file.
EntryNumber const & entries() const
Definition: RootTree.h:48
FileID fid_
Definition: RootFile.h:159
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:189
bool noEventSort_
Definition: RootFile.h:169
RootTree const & runTree() const
Definition: RootFile.h:90
RootTree eventTree_
Definition: RootFile.h:174
bool isValid() const
Definition: FileID.h:18
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:161
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
bool isValid() const
Definition: RootTree.cc:62
void setEventFinder(boost::shared_ptr< EventFinder > ptr) const
void fillIndexIntoFile()
Definition: RootFile.cc:720
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:162
void setNumberOfEvents(EntryNumber_t nevents) const
std::string createGlobalIdentifier()
bool edm::RootFile::wasFirstEventJustRead ( ) const

Definition at line 657 of file RootFile.cc.

References indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, fjr2json::lumi, CrabTask::run, and edm::IndexIntoFile::IndexIntoFileItr::skipEventBackward().

657  {
658  IndexIntoFile::IndexIntoFileItr itr(indexIntoFileIter_);
659  int phIndex;
662  IndexIntoFile::EntryNumber_t eventEntry;
663  itr.skipEventBackward(phIndex,
664  run,
665  lumi,
666  eventEntry);
667  itr.skipEventBackward(phIndex,
668  run,
669  lumi,
670  eventEntry);
671  return eventEntry == IndexIntoFile::invalidEntry;
672  }
tuple lumi
Definition: fjr2json.py:41
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
long long EntryNumber_t
static EntryNumber_t const invalidEntry
unsigned int RunNumber_t
Definition: EventRange.h:32
bool edm::RootFile::wasLastEventJustRead ( ) const

Definition at line 650 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::advanceToEvent(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileIter_, and edm::IndexIntoFile::kEnd.

650  {
651  IndexIntoFile::IndexIntoFileItr itr(indexIntoFileIter_);
652  itr.advanceToEvent();
653  return itr.getEntryType() == IndexIntoFile::kEnd;
654  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:165
int edm::RootFile::whyNotFastClonable ( ) const
inline

Definition at line 92 of file RootFile.h.

References whyNotFastClonable_.

Referenced by createFileBlock().

92 {return whyNotFastClonable_;}
int whyNotFastClonable_
Definition: RootFile.h:170

Member Data Documentation

boost::shared_ptr<BranchChildren> edm::RootFile::branchChildren_
private

Definition at line 188 of file RootFile.h.

Referenced by createFileBlock(), dropOnInput(), and RootFile().

boost::shared_ptr<BranchIDListRegistry::collection_type const> edm::RootFile::branchIDLists_
private

Definition at line 180 of file RootFile.h.

Referenced by branchIDLists(), and RootFile().

boost::shared_ptr<BranchListIndexes> edm::RootFile::branchListIndexes_
private

Definition at line 186 of file RootFile.h.

Referenced by fillHistory(), and readCurrentEvent().

bool edm::RootFile::branchListIndexesUnchanged_
private

Definition at line 172 of file RootFile.h.

Referenced by branchListIndexesUnchanged(), and RootFile().

boost::shared_ptr<DuplicateChecker> edm::RootFile::duplicateChecker_
private
EventAuxiliary edm::RootFile::eventAux_
private
TTree* edm::RootFile::eventHistoryTree_
private

Definition at line 184 of file RootFile.h.

Referenced by close(), fillHistory(), and readEventHistoryTree().

std::vector<EventProcessHistoryID> edm::RootFile::eventProcessHistoryIDs_
private

Definition at line 166 of file RootFile.h.

Referenced by fillHistory(), and RootFile().

std::vector<EventProcessHistoryID>::const_iterator edm::RootFile::eventProcessHistoryIter_
private

Definition at line 167 of file RootFile.h.

Referenced by fillHistory(), and RootFile().

boost::shared_ptr<EventSelectionIDVector> edm::RootFile::eventSelectionIDs_
private

Definition at line 185 of file RootFile.h.

Referenced by fillHistory(), and readCurrentEvent().

boost::shared_ptr<EventSkipperByID> edm::RootFile::eventSkipperByID_
private

Definition at line 157 of file RootFile.h.

Referenced by RootFile(), skipEvents(), and skipThisEntry().

RootTree edm::RootFile::eventTree_
private
FileID edm::RootFile::fid_
private

Definition at line 159 of file RootFile.h.

Referenced by reportOpened(), RootFile(), and validateFile().

std::string const edm::RootFile::file_
private

Definition at line 153 of file RootFile.h.

Referenced by createFileBlock(), dropOnInput(), file(), isDuplicateEvent(), RootFile(), and skipEvents().

FileFormatVersion edm::RootFile::fileFormatVersion_
private

Definition at line 158 of file RootFile.h.

Referenced by fileFormatVersion(), and RootFile().

boost::shared_ptr<InputFile> edm::RootFile::filePtr_
private
int edm::RootFile::forcedRunOffset_
private

Definition at line 182 of file RootFile.h.

Referenced by overrideRunNumber(), readEvent(), and RootFile().

boost::array<bool, NumBranchTypes> edm::RootFile::hasNewlyDroppedBranch_
private

Definition at line 171 of file RootFile.h.

Referenced by dropOnInput(), hasNewlyDroppedBranch(), and RootFile().

boost::shared_ptr<History> edm::RootFile::history_
private

Definition at line 187 of file RootFile.h.

Referenced by fillHistory(), and readEventHistoryTree().

IndexIntoFile& edm::RootFile::indexIntoFile_
private
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileBegin_
private

Definition at line 163 of file RootFile.h.

Referenced by rewind(), RootFile(), and setIfFastClonable().

IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileEnd_
private
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileIter_
private
boost::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr_
private

Definition at line 160 of file RootFile.h.

Referenced by indexIntoFileSharedPtr().

IndexIntoFile::EntryNumber_t edm::RootFile::lastEventEntryNumberRead_
private

Definition at line 178 of file RootFile.h.

Referenced by fillIndexIntoFile(), and fillThisEventAuxiliary().

std::string const edm::RootFile::logicalFile_
private

Definition at line 154 of file RootFile.h.

Referenced by reportOpened().

RootTree edm::RootFile::lumiTree_
private
std::map<std::string, std::string> edm::RootFile::newBranchToOldBranch_
private

Definition at line 183 of file RootFile.h.

Referenced by newBranchToOldBranch(), and RootFile().

bool edm::RootFile::noEventSort_
private

Definition at line 169 of file RootFile.h.

Referenced by goToEvent(), setIfFastClonable(), and validateFile().

std::vector<ProcessHistoryID>& edm::RootFile::orderedProcessHistoryIDs_
private

Definition at line 162 of file RootFile.h.

Referenced by validateFile().

ProcessConfiguration const& edm::RootFile::processConfiguration_
private

Definition at line 155 of file RootFile.h.

InputSource::ProcessingMode edm::RootFile::processingMode_
private

Definition at line 181 of file RootFile.h.

Referenced by getNextEntryTypeWanted(), and setIfFastClonable().

boost::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry_
private

Definition at line 179 of file RootFile.h.

Referenced by makeBranchMapper(), productRegistry(), and RootFile().

boost::shared_ptr<ProvenanceAdaptor> edm::RootFile::provenanceAdaptor_
private

Definition at line 190 of file RootFile.h.

Referenced by fillHistory(), fillLumiAuxiliary(), fillRunAuxiliary(), and RootFile().

RootTree edm::RootFile::runTree_
private
bool edm::RootFile::skipAnyEvents_
private

Definition at line 168 of file RootFile.h.

Referenced by setIfFastClonable().

RootTreePtrArray edm::RootFile::treePointers_
private

Definition at line 177 of file RootFile.h.

Referenced by close(), dropOnInput(), RootFile(), and treePointers().

int edm::RootFile::whyNotFastClonable_
private

Definition at line 170 of file RootFile.h.

Referenced by RootFile(), setIfFastClonable(), and whyNotFastClonable().