CMS 3D CMS Logo

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

#include <RootInputFileSequence.h>

Inheritance diagram for edm::RootInputFileSequence:
edm::RootEmbeddedFileSequence edm::RootPrimaryFileSequence edm::RootSecondaryFileSequence

Public Member Functions

bool containedInCurrentFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
std::shared_ptr
< BranchIDListHelper const > 
fileBranchIDListHelper () const
 
std::shared_ptr
< ProductRegistry const > 
fileProductRegistry () const
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
void readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
void readRun_ (RunPrincipal &runPrincipal)
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
 RootInputFileSequence (ParameterSet const &pset, InputFileCatalog const &catalog)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
 
virtual ~RootInputFileSequence ()
 

Protected Types

typedef std::shared_ptr< RootFileRootFileSharedPtr
 

Protected Member Functions

bool atFirstFile () const
 
bool atLastFile () const
 
std::string const & fallbackFileName () const
 
std::vector< FileCatalogItem >
const & 
fileCatalogItems () const
 
std::string const & fileName () const
 
std::vector< std::shared_ptr
< IndexIntoFile > > const & 
indexesIntoFiles () const
 
void initFile (bool skipBadFiles)
 
void initTheFile (bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
 
std::string const & lfn () const
 
size_t lfnHash () const
 
std::string const & logicalFileName () const
 
bool noFiles () const
 
bool noMoreFiles () const
 
size_t numberOfFiles () const
 
RootFileSharedPtr const & rootFile () const
 
RootFileSharedPtrrootFile ()
 
size_t sequenceNumberOfFile () const
 
void setAtFileSequenceNumber (size_t offset)
 
void setAtFirstFile ()
 
void setAtNextFile ()
 
void setAtPreviousFile ()
 
void setIndexIntoFile (size_t index)
 
void setNoMoreFiles ()
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash)
 
bool usedFallback () const
 

Private Member Functions

virtual void closeFile_ ()=0
 
virtual void initFile_ (bool skipBadFiles)=0
 
virtual RootFileSharedPtr makeRootFile (std::shared_ptr< InputFile > filePtr)=0
 

Private Attributes

InputFileCatalog const & catalog_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIter_
 
std::vector< FileCatalogItem >
::const_iterator const 
fileIterBegin_
 
std::vector< FileCatalogItem >
::const_iterator const 
fileIterEnd_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIterLastOpened_
 
std::unique_ptr
< std::unordered_multimap
< size_t, size_t > > 
findFileForSpecifiedID_
 
std::vector< std::shared_ptr
< IndexIntoFile > > 
indexesIntoFiles_
 
std::string lfn_
 
size_t lfnHash_
 
RootFileSharedPtr rootFile_
 
bool usedFallback_
 

Detailed Description

Definition at line 28 of file RootInputFileSequence.h.

Member Typedef Documentation

typedef std::shared_ptr<RootFile> edm::RootInputFileSequence::RootFileSharedPtr
protected

Definition at line 47 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

edm::RootInputFileSequence::RootInputFileSequence ( ParameterSet const &  pset,
InputFileCatalog const &  catalog 
)
explicit

Definition at line 22 of file RootInputFileSequence.cc.

24  :
26  lfn_("unknown"),
27  lfnHash_(0U),
28  usedFallback_(false),
29  findFileForSpecifiedID_(nullptr),
34  rootFile_(),
36  }
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
#define end
Definition: vmac.h:37
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::unique_ptr< std::unordered_multimap< size_t, size_t > > findFileForSpecifiedID_
#define begin
Definition: vmac.h:30
tuple size
Write out results.
InputFileCatalog const & catalog_
edm::RootInputFileSequence::~RootInputFileSequence ( )
virtual

Definition at line 55 of file RootInputFileSequence.cc.

55  {
56  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

bool edm::RootInputFileSequence::atFirstFile ( ) const
inlineprotected
bool edm::RootInputFileSequence::atLastFile ( ) const
inlineprotected

Definition at line 54 of file RootInputFileSequence.h.

References fileIter_, and fileIterEnd_.

Referenced by edm::RootPrimaryFileSequence::forwardState(), and edm::RootPrimaryFileSequence::getNextItemType().

54 {return fileIter_ + 1 == fileIterEnd_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator fileIter_
virtual void edm::RootInputFileSequence::closeFile_ ( )
privatepure virtual
bool edm::RootInputFileSequence::containedInCurrentFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 102 of file RootInputFileSequence.cc.

References rootFile().

102  {
103  if(!rootFile()) return false;
104  return rootFile()->containsItem(run, lumi, event);
105  }
tuple lumi
Definition: fjr2json.py:35
RootFileSharedPtr const & rootFile() 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
std::string const& edm::RootInputFileSequence::fallbackFileName ( ) const
inlineprotected

Definition at line 68 of file RootInputFileSequence.h.

References fileIter_.

Referenced by initTheFile().

68 {return fileIter_->fallbackFileName();}
std::vector< FileCatalogItem >::const_iterator fileIter_
std::shared_ptr< BranchIDListHelper const > edm::RootInputFileSequence::fileBranchIDListHelper ( ) const

Definition at line 50 of file RootInputFileSequence.cc.

References assert(), and rootFile().

50  {
51  assert(rootFile());
52  return rootFile()->branchIDListHelper();
53  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
protected

Definition at line 39 of file RootInputFileSequence.cc.

References catalog_, and edm::InputFileCatalog::fileCatalogItems().

Referenced by edm::RootEmbeddedFileSequence::readOneRandom().

39  {
40  return catalog_.fileCatalogItems();
41  }
std::vector< FileCatalogItem > const & fileCatalogItems() const
InputFileCatalog const & catalog_
std::string const& edm::RootInputFileSequence::fileName ( ) const
inlineprotected
std::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::fileProductRegistry ( ) const

Definition at line 44 of file RootInputFileSequence.cc.

References assert(), and rootFile().

44  {
45  assert(rootFile());
46  return rootFile()->productRegistry();
47  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
std::vector<std::shared_ptr<IndexIntoFile> > const& edm::RootInputFileSequence::indexesIntoFiles ( ) const
inlineprotected
void edm::RootInputFileSequence::initFile ( bool  skipBadFiles)
inlineprotected
virtual void edm::RootInputFileSequence::initFile_ ( bool  skipBadFiles)
privatepure virtual
void edm::RootInputFileSequence::initTheFile ( bool  skipBadFiles,
bool  deleteIndexIntoFile,
InputSource input,
char const *  inputTypeName,
InputType  inputType 
)
protected

Definition at line 191 of file RootInputFileSequence.cc.

References cms::Exception::addAdditionalInfo(), cms::Exception::addContext(), cms::Exception::additionalInfo(), assert(), closeFile_(), alignCSCRings::e, relativeConstraints::empty, Exception, cms::Exception::explainSelf(), fallbackFileName(), edm::errors::FallbackFileOpenError, fileIter_, fileIterBegin_, fileIterEnd_, fileIterLastOpened_, fileName(), edm::errors::FileOpenError, indexesIntoFiles_, RPC_Client_on_RootFile::InputFile, lfn_, lfnHash_, logicalFileName(), makeRootFile(), noMoreFiles(), dbtoconf::out, dbtoconf::pfn, edm::InputFile::reportFallbackAttempt(), edm::InputFile::reportSkippedFile(), rootFile_, alignCSCRings::s, setIndexIntoFile(), AlCaHLTBitMon_QueryRunRegistry::string, and usedFallback_.

Referenced by edm::RootSecondaryFileSequence::initFile_(), edm::RootPrimaryFileSequence::initFile_(), and edm::RootEmbeddedFileSequence::initFile_().

195  {
196  // We are really going to close the open file.
197 
199  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
200  if(deleteIndexIntoFile) {
201  indexesIntoFiles_[currentIndexIntoFile].reset();
202  } else {
203  if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
204  }
206  }
207  closeFile_();
208 
209  if(noMoreFiles()) {
210  // No files specified
211  return;
212  }
213 
214  // Check if the logical file name was found.
215  if(fileName().empty()) {
216  // LFN not found in catalog.
218  if(!skipBadFiles) {
219  throw cms::Exception("LogicalFileNameNotFound", "RootFileSequenceBase::initTheFile()\n")
220  << "Logical file name '" << logicalFileName() << "' was not found in the file catalog.\n"
221  << "If you wanted a local file, you forgot the 'file:' prefix\n"
222  << "before the file name in your configuration file.\n";
223  }
224  LogWarning("") << "Input logical file: " << logicalFileName() << " was not found in the catalog, and will be skipped.\n";
225  return;
226  }
227 
228  lfn_ = logicalFileName().empty() ? fileName() : logicalFileName();
229  lfnHash_ = std::hash<std::string>()(lfn_);
230  usedFallback_ = false;
231 
232  // Determine whether we have a fallback URL specified; if so, prepare it;
233  // Only valid if it is non-empty and differs from the original filename.
234  bool hasFallbackUrl = !fallbackFileName().empty() && fallbackFileName() != fileName();
235 
236  std::shared_ptr<InputFile> filePtr;
237  std::list<std::string> originalInfo;
238  try {
239  std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? new InputSource::FileOpenSentry(*input, lfn_, usedFallback_) : nullptr);
240  filePtr = std::make_shared<InputFile>(gSystem->ExpandPathName(fileName().c_str()), " Initiating request to open file ", inputType);
241  }
242  catch (cms::Exception const& e) {
243  if(!skipBadFiles) {
244  if(hasFallbackUrl) {
245  std::ostringstream out;
246  out << e.explainSelf();
247  std::string pfn(gSystem->ExpandPathName(fallbackFileName().c_str()));
249  originalInfo = e.additionalInfo();
250  } else {
252  Exception ex(errors::FileOpenError, "", e);
253  ex.addContext("Calling RootFileSequenceBase::initTheFile()");
254  std::ostringstream out;
255  out << "Input file " << fileName() << " could not be opened.";
256  ex.addAdditionalInfo(out.str());
257  throw ex;
258  }
259  }
260  }
261  if(!filePtr && (hasFallbackUrl)) {
262  try {
263  usedFallback_ = true;
264  std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? new InputSource::FileOpenSentry(*input, lfn_, usedFallback_) : nullptr);
265  std::string fallbackFullName = gSystem->ExpandPathName(fallbackFileName().c_str());
266  filePtr.reset(new InputFile(fallbackFullName.c_str(), " Fallback request to file ", inputType));
267  }
268  catch (cms::Exception const& e) {
269  if(!skipBadFiles) {
272  ex.addContext("Calling RootFileSequenceBase::initTheFile()");
273  std::ostringstream out;
274  out << "Input file " << fileName() << " could not be opened.\n";
275  out << "Fallback Input file " << fallbackFileName() << " also could not be opened.";
276  if (originalInfo.size()) {
277  out << std::endl << "Original exception info is above; fallback exception info is below.";
278  ex.addAdditionalInfo(out.str());
279  for (auto const & s : originalInfo) {
280  ex.addAdditionalInfo(s);
281  }
282  } else {
283  ex.addAdditionalInfo(out.str());
284  }
285  throw ex;
286  }
287  }
288  }
289  if(filePtr) {
290  size_t currentIndexIntoFile = fileIter_ - fileIterBegin_;
291  rootFile_ = makeRootFile(filePtr);
292  assert(rootFile_);
294  setIndexIntoFile(currentIndexIntoFile);
295  rootFile_->reportOpened(inputTypeName);
296  } else {
298  if(!skipBadFiles) {
300  "RootFileSequenceBase::initTheFile(): Input file " << fileName() << " was not found or could not be opened.\n";
301  }
302  LogWarning("") << "Input file: " << fileName() << " was not found or could not be opened, and will be skipped.\n";
303  }
304  }
std::string const & logicalFileName() const
list pfn
Definition: dbtoconf.py:76
std::string const & fileName() const
virtual std::string explainSelf() const
Definition: Exception.cc:146
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
assert(m_qm.get())
std::list< std::string > const & additionalInfo() const
Definition: Exception.cc:195
tuple InputFile
Open Root file and provide MEs ############.
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:86
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:80
virtual RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr)=0
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
tuple out
Definition: dbtoconf.py:99
tuple skipBadFiles
Definition: example_cfg.py:64
virtual void closeFile_()=0
std::string const & fallbackFileName() const
std::string const& edm::RootInputFileSequence::lfn ( ) const
inlineprotected

Definition at line 69 of file RootInputFileSequence.h.

References lfn_.

Referenced by edm::RootPrimaryFileSequence::closeFile_().

69 {return lfn_;}
size_t edm::RootInputFileSequence::lfnHash ( ) const
inlineprotected
std::string const& edm::RootInputFileSequence::logicalFileName ( ) const
inlineprotected

Definition at line 67 of file RootInputFileSequence.h.

References fileIter_.

Referenced by initTheFile(), edm::RootSecondaryFileSequence::makeRootFile(), edm::RootPrimaryFileSequence::makeRootFile(), and edm::RootEmbeddedFileSequence::makeRootFile().

67 {return fileIter_->logicalFileName();}
std::vector< FileCatalogItem >::const_iterator fileIter_
virtual RootFileSharedPtr edm::RootInputFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
privatepure virtual
bool edm::RootInputFileSequence::noFiles ( ) const
inlineprotected

Definition at line 56 of file RootInputFileSequence.h.

References fileIterBegin_, and fileIterEnd_.

Referenced by edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence().

56 {return fileIterBegin_ == fileIterEnd_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
bool edm::RootInputFileSequence::noMoreFiles ( ) const
inlineprotected
size_t edm::RootInputFileSequence::numberOfFiles ( ) const
inlineprotected

Definition at line 58 of file RootInputFileSequence.h.

References fileIterBegin_, and fileIterEnd_.

Referenced by edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence().

58 {return fileIterEnd_ - fileIterBegin_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
RootInputFileSequence& edm::RootInputFileSequence::operator= ( RootInputFileSequence const &  )
delete
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 96 of file RootInputFileSequence.cc.

References assert(), and rootFile().

96  {
97  assert(rootFile());
98  rootFile()->readEvent(eventPrincipal);
99  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
void edm::RootInputFileSequence::readLuminosityBlock_ ( LuminosityBlockPrincipal lumiPrincipal)

Definition at line 77 of file RootInputFileSequence.cc.

References assert(), and rootFile().

77  {
78  assert(rootFile());
79  rootFile()->readLuminosityBlock_(lumiPrincipal);
80  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 65 of file RootInputFileSequence.cc.

References assert(), and rootFile().

65  {
66  assert(rootFile());
67  return rootFile()->readLuminosityBlockAuxiliary_();
68  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
void edm::RootInputFileSequence::readRun_ ( RunPrincipal runPrincipal)

Definition at line 71 of file RootInputFileSequence.cc.

References assert(), and rootFile().

71  {
72  assert(rootFile());
73  rootFile()->readRun_(runPrincipal);
74  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
std::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 59 of file RootInputFileSequence.cc.

References assert(), and rootFile().

59  {
60  assert(rootFile());
61  return rootFile()->readRunAuxiliary_();
62  }
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
RootFileSharedPtr const& edm::RootInputFileSequence::rootFile ( ) const
inlineprotected

Definition at line 77 of file RootInputFileSequence.h.

References rootFile_.

Referenced by edm::RootSecondaryFileSequence::closeFile_(), edm::RootEmbeddedFileSequence::closeFile_(), edm::RootPrimaryFileSequence::closeFile_(), containedInCurrentFile(), fileBranchIDListHelper(), fileProductRegistry(), edm::RootPrimaryFileSequence::forwardState(), edm::RootPrimaryFileSequence::getNextItemType(), edm::RootPrimaryFileSequence::goToEvent(), edm::RootSecondaryFileSequence::initAssociationsFromSecondary(), edm::RootPrimaryFileSequence::nextFile(), edm::RootPrimaryFileSequence::previousFile(), readEvent(), edm::RootPrimaryFileSequence::readFile_(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), edm::RootEmbeddedFileSequence::readOneRandom(), edm::RootEmbeddedFileSequence::readOneRandomWithID(), edm::RootEmbeddedFileSequence::readOneSequential(), edm::RootEmbeddedFileSequence::readOneSequentialWithID(), edm::RootEmbeddedFileSequence::readOneSpecified(), readRun_(), readRunAuxiliary_(), edm::RootPrimaryFileSequence::reverseState(), edm::RootPrimaryFileSequence::rewind_(), edm::RootPrimaryFileSequence::rewindFile(), edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence(), edm::RootPrimaryFileSequence::RootPrimaryFileSequence(), edm::RootSecondaryFileSequence::RootSecondaryFileSequence(), setIndexIntoFile(), edm::RootEmbeddedFileSequence::skipEntries(), edm::RootPrimaryFileSequence::skipEvents(), skipToItem(), and skipToItemInNewFile().

77 {return rootFile_;}
RootFileSharedPtr& edm::RootInputFileSequence::rootFile ( )
inlineprotected

Definition at line 78 of file RootInputFileSequence.h.

References rootFile_.

78 {return rootFile_;}
size_t edm::RootInputFileSequence::sequenceNumberOfFile ( ) const
inlineprotected
void edm::RootInputFileSequence::setAtFileSequenceNumber ( size_t  offset)
inlineprotected
void edm::RootInputFileSequence::setAtFirstFile ( )
inlineprotected
void edm::RootInputFileSequence::setAtNextFile ( )
inlineprotected
void edm::RootInputFileSequence::setAtPreviousFile ( )
inlineprotected

Definition at line 64 of file RootInputFileSequence.h.

References fileIter_.

Referenced by edm::RootPrimaryFileSequence::previousFile().

64 {--fileIter_;}
std::vector< FileCatalogItem >::const_iterator fileIter_
void edm::RootInputFileSequence::setIndexIntoFile ( size_t  index)
protected

Definition at line 306 of file RootInputFileSequence.cc.

References cmsHarvester::index, indexesIntoFiles_, and rootFile().

Referenced by initTheFile().

306  {
307  indexesIntoFiles_[index] = rootFile()->indexIntoFileSharedPtr();
308  }
RootFileSharedPtr const & rootFile() const
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void edm::RootInputFileSequence::setNoMoreFiles ( )
inlineprotected

Definition at line 62 of file RootInputFileSequence.h.

References fileIter_, and fileIterEnd_.

Referenced by edm::RootPrimaryFileSequence::skipEvents().

std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator fileIter_
bool edm::RootInputFileSequence::skipToItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
size_t  fileNameHash = 0U,
bool  currentFileFirst = true 
)

Definition at line 160 of file RootInputFileSequence.cc.

References assert(), fileIter_, newFWLiteAna::found, indexesIntoFiles_, initFile(), rootFile(), setAtFileSequenceNumber(), and skipToItemInNewFile().

Referenced by edm::RootEmbeddedFileSequence::readOneRandomWithID(), edm::RootEmbeddedFileSequence::readOneSequentialWithID(), and edm::RootEmbeddedFileSequence::readOneSpecified().

160  {
161  // Attempt to find item in currently open input file.
162  bool found = currentFileFirst && rootFile() && rootFile()->setEntryAtItem(run, lumi, event);
163  if(!found) {
164  // If only one input file, give up now, to save time.
165  if(currentFileFirst && rootFile() && indexesIntoFiles_.size() == 1) {
166  return false;
167  }
168  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
169  typedef std::vector<std::shared_ptr<IndexIntoFile> >::const_iterator Iter;
170  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
171  if(*it && (*it)->containsItem(run, lumi, event)) {
172  // We found it. Close the currently open file, and open the correct one.
173  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
175  if(fileIter_ != currentIter) {
176  initFile(false);
177  }
178  // Now get the item from the correct file.
179  assert(rootFile());
180  found = rootFile()->setEntryAtItem(run, lumi, event);
181  assert(found);
182  return true;
183  }
184  }
185  return (fileNameHash != 0U && skipToItemInNewFile(run, lumi, event, fileNameHash)) || skipToItemInNewFile(run, lumi, event);
186  }
187  return true;
188  }
void initFile(bool skipBadFiles)
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootFileSharedPtr const & rootFile() 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
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)
protected

Definition at line 140 of file RootInputFileSequence.cc.

References assert(), newFWLiteAna::found, indexesIntoFiles_, initFile_(), rootFile(), and setAtFileSequenceNumber().

Referenced by edm::RootEmbeddedFileSequence::readOneSequentialWithID(), and skipToItem().

140  {
141  // Look for item in files not yet opened. We do not have a valid hash of the logical file name.
142  typedef std::vector<std::shared_ptr<IndexIntoFile> >::const_iterator Iter;
143  for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
144  if(!*it) {
145  // File not yet opened.
147  initFile_(false);
148  assert(rootFile());
149  bool found = rootFile()->setEntryAtItem(run, lumi, event);
150  if(found) {
151  return true;
152  }
153  }
154  }
155  // Not found
156  return false;
157  }
void setAtFileSequenceNumber(size_t offset)
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
virtual void initFile_(bool skipBadFiles)=0
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
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
size_t  fileNameHash 
)
protected

Definition at line 108 of file RootInputFileSequence.cc.

References assert(), fileIterBegin_, fileIterEnd_, findFileForSpecifiedID_, newFWLiteAna::found, indexesIntoFiles_, initFile_(), rootFile(), and setAtFileSequenceNumber().

108  {
109  // Look for item in files not yet opened. We have a hash of the logical file name
110  assert(fileNameHash != 0U);
111  // If the lookup table is not yet filled in, fill it.
113  // We use a multimap because there may be hash collisions (Two different LFNs could have the same hash).
114  // We map the hash of the LFN to the index into the list of files.
115  findFileForSpecifiedID_.reset(new std::unordered_multimap<size_t, size_t>);
116  auto hasher = std::hash<std::string>();
117  for(auto fileIter = fileIterBegin_; fileIter != fileIterEnd_; ++fileIter) {
118  findFileForSpecifiedID_->insert(std::make_pair(hasher(fileIter->logicalFileName()), fileIter - fileIterBegin_));
119  }
120  }
121  // Look up the logical file name in the table
122  auto range = findFileForSpecifiedID_->equal_range(fileNameHash);
123  for(auto iter = range.first; iter != range.second; ++iter) {
124  // Don't look in files previously opened, because those have already been searched.
125  if(!indexesIntoFiles_[iter->second]) {
126  setAtFileSequenceNumber(iter->second);
127  initFile_(false);
128  assert(rootFile());
129  bool found = rootFile()->setEntryAtItem(run, lumi, event);
130  if(found) {
131  return true;
132  }
133  }
134  }
135  // Not found
136  return false;
137  }
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
tuple lumi
Definition: fjr2json.py:35
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
assert(m_qm.get())
RootFileSharedPtr const & rootFile() const
virtual void initFile_(bool skipBadFiles)=0
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
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::unique_ptr< std::unordered_multimap< size_t, size_t > > findFileForSpecifiedID_
bool edm::RootInputFileSequence::usedFallback ( ) const
inlineprotected

Member Data Documentation

InputFileCatalog const& edm::RootInputFileSequence::catalog_
private

Definition at line 80 of file RootInputFileSequence.h.

Referenced by fileCatalogItems().

std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIter_
private
std::vector<FileCatalogItem>::const_iterator const edm::RootInputFileSequence::fileIterBegin_
private
std::vector<FileCatalogItem>::const_iterator const edm::RootInputFileSequence::fileIterEnd_
private
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterLastOpened_
private

Definition at line 88 of file RootInputFileSequence.h.

Referenced by initTheFile().

std::unique_ptr<std::unordered_multimap<size_t, size_t> > edm::RootInputFileSequence::findFileForSpecifiedID_
private

Definition at line 84 of file RootInputFileSequence.h.

Referenced by skipToItemInNewFile().

std::vector<std::shared_ptr<IndexIntoFile> > edm::RootInputFileSequence::indexesIntoFiles_
private
std::string edm::RootInputFileSequence::lfn_
private

Definition at line 81 of file RootInputFileSequence.h.

Referenced by initTheFile(), and lfn().

size_t edm::RootInputFileSequence::lfnHash_
private

Definition at line 82 of file RootInputFileSequence.h.

Referenced by initTheFile(), and lfnHash().

RootFileSharedPtr edm::RootInputFileSequence::rootFile_
private

Definition at line 89 of file RootInputFileSequence.h.

Referenced by initTheFile(), and rootFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 83 of file RootInputFileSequence.h.

Referenced by initTheFile(), and usedFallback().