CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::FileInPath Class Reference

#include <FileInPath.h>

Public Types

enum  LocationCode { Unknown = 0, Local = 1, Release = 2, Data = 3 }
 

Public Member Functions

 FileInPath ()
 
 FileInPath (const char *r)
 
 FileInPath (const std::string &r)
 We throw an exception is the referenced file is not found. More...
 
 FileInPath (FileInPath const &other)
 
std::string fullPath () const
 
LocationCode location () const
 Where was the file found? More...
 
FileInPathoperator= (FileInPath const &other)
 
void read (std::istream &is)
 
void readFromParameterSetBlob (std::istream &is)
 
std::string relativePath () const
 
void swap (FileInPath &other)
 
void write (std::ostream &os) const
 
 ~FileInPath ()
 

Static Public Member Functions

static void disableFileLookup ()
 Should only be called while the edmWriteConfigs executable runs. More...
 

Private Member Functions

void getEnvironment ()
 
void initialize_ ()
 

Private Attributes

std::string canonicalFilename_
 
std::string dataTop_
 
std::string localTop_
 
LocationCode location_
 
std::string relativePath_
 
std::string releaseTop_
 
std::string searchPath_
 

Detailed Description

Definition at line 64 of file FileInPath.h.

Member Enumeration Documentation

◆ LocationCode

Enumerator
Unknown 
Local 
Release 
Data 

Definition at line 66 of file FileInPath.h.

66 { Unknown = 0, Local = 1, Release = 2, Data = 3 };

Constructor & Destructor Documentation

◆ FileInPath() [1/4]

edm::FileInPath::FileInPath ( )

Default c'tor does no file-existence check; what file would it check for existence?

Definition at line 104 of file FileInPath.cc.

105  if (s_fileLookupDisabled) {
106  return;
107  }
108  getEnvironment();
109  }

References getEnvironment().

◆ FileInPath() [2/4]

edm::FileInPath::FileInPath ( const std::string &  r)
explicit

We throw an exception is the referenced file is not found.

Definition at line 111 of file FileInPath.cc.

112  if (s_fileLookupDisabled) {
113  return;
114  }
115  getEnvironment();
116  initialize_();
117  }

References getEnvironment(), and initialize_().

◆ FileInPath() [3/4]

edm::FileInPath::FileInPath ( const char *  r)
explicit

Definition at line 119 of file FileInPath.cc.

120  if (s_fileLookupDisabled) {
121  return;
122  }
123  if (r == nullptr) {
124  throw edm::Exception(edm::errors::FileInPathError) << "Relative path must not be null\n";
125  }
126  getEnvironment();
127  initialize_();
128  }

References Exception, edm::errors::FileInPathError, getEnvironment(), initialize_(), and alignCSCRings::r.

◆ FileInPath() [4/4]

edm::FileInPath::FileInPath ( FileInPath const &  other)

Definition at line 130 of file FileInPath.cc.

131  : relativePath_(other.relativePath_),
132  canonicalFilename_(other.canonicalFilename_),
133  location_(other.location_),
134  localTop_(other.localTop_),
135  releaseTop_(other.releaseTop_),
136  dataTop_(other.dataTop_),
137  searchPath_(other.searchPath_) {}

◆ ~FileInPath()

edm::FileInPath::~FileInPath ( )

Definition at line 139 of file FileInPath.cc.

139 {}

Member Function Documentation

◆ disableFileLookup()

void edm::FileInPath::disableFileLookup ( )
static

Should only be called while the edmWriteConfigs executable runs.

Definition at line 437 of file FileInPath.cc.

437 { s_fileLookupDisabled = true; }

◆ fullPath()

std::string edm::FileInPath::fullPath ( ) const

Return a string that can be used to open the referenced file.

Note that operations on this file may fail, including testing for existence. This is because the state of a filesystem is global; other threads, processes, etc., may have removed the file since we checked on its existence at the time of construction of the FileInPath object.

Definition at line 161 of file FileInPath.cc.

161 { return canonicalFilename_; }

References canonicalFilename_.

Referenced by Phase1PixelSummaryMap::addNamedBins(), MillePedeAlignmentAlgorithm::addPxbSurvey(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripThresholdBuilder::analyze(), JetCorrectorDemo::analyze(), MuonGeometrySVGTemplate::analyze(), HcalLutAnalyzer::analyze(), PixelRegions::attachedDets(), BeamSpotFakeConditions::BeamSpotFakeConditions(), JetCorrectorDBWriter::beginJob(), ProtonTaggerFilter::beginJob(), omtf::OmtfPacker::beginRun(), omtf::OmtfUnpacker::beginRun(), GoodSeedProducer::beginRun(), HGCalValidator::bookHistograms(), BTagSFProducer::BTagSFProducer(), HcalTPGCoderULUT::buildCoder(), magneticfield::MagGeoBuilder::buildInterpolator(), MagGeoBuilderFromDDD::buildInterpolator(), CaloMiscalibTools::CaloMiscalibTools(), CaloMiscalibToolsMC::CaloMiscalibToolsMC(), GBRForestWriter::categoryEntryType::categoryEntryType(), CTPPSPixelDAQMappingESSourceXML::CompleteFileName(), TotemDAQMappingESSourceXML::CompleteFileName(), createGBRForest(), CSCTFPtLUT::CSCTFPtLUT(), SiStripPopConNoisesHandlerFromDQM::dqmEndJob(), SiStripPopConPedestalsHandlerFromDQM::dqmEndJob(), SiStripPopConBadComponentsHandlerFromDQM::dqmEndJob(), SiStripPopConFEDErrorsHandlerFromDQM::dqmEndJob(), DTOccupancyTestML::dqmEndLuminosityBlock(), dtCalibration::DTTTrigResidualCorrection::DTTTrigResidualCorrection(), ElectronPATIdMVAProducer::ElectronPATIdMVAProducer(), OccupancyPlots::endRun(), ESDataFormatterV4::ESDataFormatterV4(), ESDigiToRaw::ESDigiToRaw(), ESElectronicsMapper::ESElectronicsMapper(), ESIntegrityClient::ESIntegrityClient(), ESPedestalClient::ESPedestalClient(), ESUnpacker::ESUnpacker(), SiStripPI::fillBCArrays(), HGCalTriggerGeometryV9Imp2::fillMaps(), HGCalTriggerGeometryHexLayerBasedImp1::fillMaps(), HGCalTriggerGeometryV9Imp1::fillMaps(), popcon::SiStripPopConHandlerUnitTest< T >::fillObject(), popcon::SiStripPopConHandlerUnitTestGain< T >::fillObject(), popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject(), SiStripPI::fillTotalComponents(), ESTrivialConditionRetriever::getChannelStatusFromConfiguration(), EcalTrivialConditionRetriever::getChannelStatusFromConfiguration(), EcalTrivialConditionRetriever::getMappingFromConfiguration(), SiStripBadStripFromASCIIFile::getNewObject(), SiStripGainFromAsciiFile::getNewObject(), SiStripBadFiberBuilder::getNewObject(), SiStripBadChannelBuilder::getNewObject(), SiStripNoisesFromDBMiscalibrator::getNewObject_withDefaults(), EcalMappingElectronicsHandler::getNewObjects(), EcalTrivialConditionRetriever::getPFRecHitThresholdsFromConfiguration(), EcalTrivialConditionRetriever::getTrgChannelStatusFromConfiguration(), ESTrivialConditionRetriever::getWeightsFromConfiguration(), EcalTrivialConditionRetriever::getWeightsFromConfiguration(), HcalHardcodeCalibrations::HcalHardcodeCalibrations(), HcalLaserEventFilter2012::HcalLaserEventFilter2012(), l1t::HGC3DClusterTMVASelector::HGC3DClusterTMVASelector(), HGCalTriggerTowerGeometryHelper::HGCalTriggerTowerGeometryHelper(), HGCalValidator::HGCalValidator(), PDFWeightsHelper::Init(), gen::EvtGenInterface::init(), l1tpf::corrector::init_(), CandidateBoostedDoubleSecondaryVertexComputer::initialize(), MuonTagger::initialize(), CandidateChargeBTagComputer::initialize(), CombinedMVAV2JetTagComputer::initialize(), ElectronTagger::initialize(), CharmTagger::initialize(), HeavyIonCSVTagger::initialize(), ApeSettingAlgorithm::initialize(), TritonEDFilterT< G, Capabilities >::initializeGlobalCache(), TritonEDProducerT< G, Capabilities >::initializeGlobalCache(), MLPFProducer::initializeGlobalCache(), DeepMETProducer::initializeGlobalCache(), DeepFlavourONNXJetTagsProducer::initializeGlobalCache(), DeepCombinedONNXJetTagsProducer::initializeGlobalCache(), DeepVertexONNXJetTagsProducer::initializeGlobalCache(), DeepDoubleXONNXJetTagsProducer::initializeGlobalCache(), TrackstersMergeProducer::initializeGlobalCache(), BoostedJetONNXJetTagsProducer::initializeGlobalCache(), TrackstersProducer::initializeGlobalCache(), deep_tau::DeepTauBase::initializeGlobalCache(), PileupJetIdProducer::initJetEnergyCorrector(), L1EGammaEECalibrator::L1EGammaEECalibrator(), L1FPGATrackProducer::L1FPGATrackProducer(), L1TGlobalPrescalesVetosESProducer::L1TGlobalPrescalesVetosESProducer(), L1TMuonOverlapParamsESProducer::L1TMuonOverlapParamsESProducer(), CovarianceParameterization::load(), L1MuDTPtaLut::load(), L1MuDTPhiLut::load(), L1MuDTEtaPatternLut::load(), L1MuBMTEtaPatternLut::load(), L1MuDTQualPatternLut::load(), L1MuBMTQualPatternLut::load(), L1MuDTExtLut::load(), L1TMuonBarrelParamsHelper::load_ext(), L1TMuonBarrelParamsHelper::load_phi(), L1TMuonBarrelParamsHelper::load_pt(), DTCCablingMapProducer::LoadModulesToDTCCablingMapFromCSV(), ClusterShapeHitFilter::loadStripLimits(), SiStripFedCablingFakeESSource::make(), jpt::Map::Map(), MaterialBudgetCategorizer::MaterialBudgetCategorizer(), MuonPathAnalyticAnalyzer::MuonPathAnalyticAnalyzer(), MuonPathAnalyzerInChamber::MuonPathAnalyzerInChamber(), MVAJetPuId::MVAJetPuId(), MVAVariableManager< reco::GsfElectron >::MVAVariableManager(), fastsim::NuclearInteraction::NuclearInteraction(), NuclearInteractionSimulator::NuclearInteractionSimulator(), gen::Herwig6Instance::openParticleSpecFile(), OverlapValidation::OverlapValidation(), HcalTBObjectUnpacker::parseCalib(), cond::persistency::parseFipConnectionString(), EcalTrigPrimESProducer::parseTextFile(), EcalTrigTowerConstituentsMapBuilder::parseTextMap(), CaloTowerConstituentsMapBuilder::parseTextMap(), cms::PileupJPTJetIdAlgo::PileupJPTJetIdAlgo(), PixelTemplateSmearerBase::PixelTemplateSmearerBase(), l1tpf::HGC3DClusterEgID::prepareTMVA(), SiPixelFakeCPEGenericErrorParmESSource::produce(), LwtnnESProducer::produce(), SiPixelFakeGainForHLTESSource::produce(), SiPixelFakeGainESSource::produce(), SiPixelFakeGainOfflineESSource::produce(), HepPDTESSource::produce(), SiPixelFakeLorentzAngleESSource::produce(), HcalTPGCoderULUT::produce(), CaloTPGTranscoderULUTs::produce(), MaskedRctInputDigiProducer::produce(), JetCorrectionESSource< Corrector >::produce(), gen::PtYDistributor::PtYDistributor(), gen::Py8InterfaceBase::Py8InterfaceBase(), PYBIND11_MODULE(), QualityTester::QualityTester(), CSCTFPtLUT::readLUT(), CSCSectorReceiverLUT::readLUTsFromFile(), GsfBetheHeitlerUpdator::readParameters(), gen::ReggeGribovPartonMCHadronizer::ReggeGribovPartonMCHadronizer(), RPCCalibSetUp::RPCCalibSetUp(), RPCDBSimSetUp::RPCDBSimSetUp(), TrackQuality::setTrackQuality(), PhiSymmetryCalibration::setUp(), ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), ShiftedPFCandidateProducerForNoPileUpPFMEt::ShiftedPFCandidateProducerForNoPileUpPFMEt(), ShiftedPFCandidateProducerForPFNoPUMEt::ShiftedPFCandidateProducerForPFNoPUMEt(), SiLinearChargeDivider::SiLinearChargeDivider(), SiStripBadModuleByHandBuilder::SiStripBadModuleByHandBuilder(), SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(), SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree(), SiStripQuality::SiStripQuality(), SiStripQualityHotStripIdentifier::SiStripQualityHotStripIdentifier(), TritonOneEDAnalyzer< Capabilities >::TritonOneEDAnalyzer(), TtSemiLepHitFitProducer< LeptonCollection >::TtSemiLepHitFitProducer(), and FWRecoGeometryESProducer::writeTrackerParametersXML().

◆ getEnvironment()

void edm::FileInPath::getEnvironment ( void  )
private

Definition at line 331 of file FileInPath.cc.

331  {
332  static std::string const searchPath = removeSymLinksTokens(PathVariableName);
333  if (searchPath.empty()) {
334  throw edm::Exception(edm::errors::FileInPathError) << PathVariableName << " must be defined\n";
335  }
336  searchPath_ = searchPath;
337 
338  static std::string const releaseTop = removeSymLinksSrc(RELEASETOP);
339  releaseTop_ = releaseTop;
340 
341  static std::string const localTop = removeSymLinksSrc(LOCALTOP);
342  localTop_ = localTop;
343 
344  static std::string const dataTop = removeSymLinks(DATATOP);
345  dataTop_ = dataTop;
346 
347  if (releaseTop_.empty()) {
348  // RELEASETOP was not set. This means that the environment is set
349  // for the base release itself. So LOCALTOP actually contains the
350  // location of the base release.
352  localTop_.clear();
353  }
354  if (releaseTop_ == localTop_) {
355  // RELEASETOP is the same as LOCALTOP. This means that the environment is set
356  // for the base release itself. So LOCALTOP actually contains the
357  // location of the base release.
358  localTop_.clear();
359  }
360  }

References dataTop_, Exception, edm::errors::FileInPathError, localTop_, releaseTop_, searchPath_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FileInPath().

◆ initialize_()

void edm::FileInPath::initialize_ ( )
private

Definition at line 362 of file FileInPath.cc.

362  {
363  if (relativePath_.empty()) {
364  throw edm::Exception(edm::errors::FileInPathError) << "Relative path must not be empty\n";
365  }
366 
367  // Find the file, based on the value of path variable.
368  typedef std::vector<std::string> stringvec_t;
369  stringvec_t pathElements = tokenize(searchPath_, ":");
370  for (auto const& element : pathElements) {
371  // Set the boost::fs path to the current element of
372  // CMSSW_SEARCH_PATH:
373  std::filesystem::path pathPrefix(element);
374 
375  // Does the a file exist? locateFile throws is it finds
376  // something goofy.
377  if (locateFile(pathPrefix, relativePath_)) {
378  // Convert relative path to canonical form, and save it.
379  relativePath_ = std::filesystem::path(relativePath_).lexically_normal().string();
380  //std::filesystem::path(relativePath_).normalize().string();
381 
382  // Save the absolute path.
383  canonicalFilename_ = std::filesystem::absolute(pathPrefix / relativePath_).string();
384  if (canonicalFilename_.empty()) {
386  << "fullPath is empty"
387  << "\nrelativePath() is: " << relativePath_ << "\npath prefix is: " << pathPrefix.string() << '\n';
388  }
389 
390  // From the current path element, find the branch path (basically the path minus the
391  // last directory, e.g. /src or /share):
392  for (std::filesystem::path br = pathPrefix.parent_path();
393  !std::filesystem::weakly_canonical(br).string().empty();
394  br = br.parent_path()) {
395  if (!localTop_.empty()) {
396  // Create a path object for our local path LOCALTOP:
398  // If the branch path matches the local path, the file was found locally:
399  if (br == local_) {
400  location_ = Local;
401  return;
402  }
403  }
404 
405  if (!releaseTop_.empty()) {
406  // Create a path object for our release path RELEASETOP:
408  // If the branch path matches the release path, the file was found in the release:
409  if (br == release_) {
410  location_ = Release;
411  return;
412  }
413  }
414 
415  if (!dataTop_.empty()) {
416  // Create a path object for our data path DATATOP:
418  // If the branch path matches the data path, the file was found in the data area:
419  if (br == data_) {
420  location_ = Data;
421  return;
422  }
423  }
424  }
425  }
426  }
427 
428  // If we got here, we ran out of path elements without finding
429  // what we're looking found.
431  << "edm::FileInPath unable to find file " << relativePath_ << " anywhere in the search path."
432  << "\nThe search path is defined by: " << PathVariableName << "\n${" << PathVariableName
433  << "} is: " << std::getenv(PathVariableName.c_str())
434  << "\nCurrent directory is: " << std::filesystem::current_path().string() << "\n";
435  }

References beamvalidation::br, canonicalFilename_, Data, dataTop_, Exception, edm::errors::FileInPathError, Local, localTop_, location_, castor_dqm_sourceclient_file_cfg::path, relativePath_, Release, releaseTop_, searchPath_, and edm::tokenize().

Referenced by FileInPath().

◆ location()

FileInPath::LocationCode edm::FileInPath::location ( ) const

◆ operator=()

FileInPath & edm::FileInPath::operator= ( FileInPath const &  other)

Definition at line 141 of file FileInPath.cc.

141  {
143  this->swap(temp);
144  return *this;
145  }

References trackingPlots::other, swap(), and groupFilesInBlocks::temp.

◆ read()

void edm::FileInPath::read ( std::istream &  is)

Read from the given istream, and set contents accordingly. Reading errors are reflected in the state of the stream.

Definition at line 202 of file FileInPath.cc.

202  {
203  std::string vsn;
204  std::string relname;
205  std::string canFilename;
206 #if 1
207  // This #if needed for backward compatibility
208  // for files written before CMSSW_1_5_0_pre3.
209  is >> vsn;
210  if (!is)
211  return;
212  bool oldFormat = (version != vsn);
213  if (oldFormat) {
214  relname = vsn;
215  bool local;
216  is >> local;
217  location_ = (local ? Local : Release);
218  is >> canFilename;
219  } else {
220  // Current format
221  int loc;
222  is >> relname >> loc;
223  location_ = static_cast<FileInPath::LocationCode>(loc);
224  if (location_ != Unknown)
225  is >> canFilename;
226  }
227 #else
228  is >> vsn >> relname >> loc >> canFilename;
229 #endif
230  if (!is)
231  return;
232  relativePath_ = relname;
233  if (location_ == Local) {
234  if (localTop_.empty()) {
235  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << LOCALTOP << " is not set.\n"
236  << "Trying to read Local file: " << canFilename << ".\n";
237  }
238 #if 1
239  // This #if needed for backward compatibility
240  // for files written before CMSSW_1_5_0_pre3.
241  if (oldFormat) {
242  canonicalFilename_ = canFilename;
243  } else
244 #endif
245  canonicalFilename_ = localTop_ + canFilename;
246  } else if (location_ == Release) {
247  if (releaseTop_.empty()) {
248  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << RELEASETOP << " is not set.\n";
249  }
250 #if 1
251  // This #if needed for backward compatibility
252  // for files written before CMSSW_1_5_0_pre3.
253  if (oldFormat) {
254  std::string::size_type pos = canFilename.find(BASE);
255  if (pos == 0) {
256  // Replace the placehoder with the path to the base release (site dependent).
257  canonicalFilename_ = releaseTop_ + canFilename.substr(BASE.size());
258  } else {
259  // Needed for files written before CMSSW_1_2_0_pre2.
260  canonicalFilename_ = canFilename;
261  }
262  } else
263 #endif
264  canonicalFilename_ = releaseTop_ + canFilename;
265  } else if (location_ == Data) {
266  if (dataTop_.empty()) {
267  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << DATATOP << " is not set.\n";
268  }
269  canonicalFilename_ = dataTop_ + canFilename;
270  }
271  }

References canonicalFilename_, Data, dataTop_, Exception, edm::errors::FileInPathError, DTRecHitClients_cfi::local, Local, localTop_, location_, relativePath_, Release, releaseTop_, AlCaHLTBitMon_QueryRunRegistry::string, Unknown, and BeamSplash_cfg::version.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), and edm::operator>>().

◆ readFromParameterSetBlob()

void edm::FileInPath::readFromParameterSetBlob ( std::istream &  is)

Definition at line 273 of file FileInPath.cc.

273  {
274  std::string vsn;
275  std::string relname;
276  std::string canFilename;
277  is >> vsn;
278  if (!is)
279  return;
280  bool oldFormat = (version != vsn);
281  if (oldFormat) {
282  relname = vsn;
283  bool local;
284  is >> local;
285  location_ = (local ? Local : Release);
286  is >> canFilename;
287  } else {
288  // Current format
289  int loc;
290  is >> relname >> loc;
291  location_ = static_cast<FileInPath::LocationCode>(loc);
292  if (location_ != Unknown)
293  is >> canFilename;
294  }
295  if (!is)
296  return;
297  relativePath_ = relname;
298  if (location_ == Local) {
299  if (localTop_.empty()) {
300  localTop_ = "@LOCAL";
301  }
302  if (oldFormat) {
303  canonicalFilename_ = canFilename;
304  } else
305  canonicalFilename_ = localTop_ + canFilename;
306  } else if (location_ == Release) {
307  if (releaseTop_.empty()) {
308  releaseTop_ = "@RELEASE";
309  }
310  if (oldFormat) {
311  std::string::size_type pos = canFilename.find(BASE);
312  if (pos == 0) {
313  // Replace the placehoder with the path to the base release (site dependent).
314  canonicalFilename_ = releaseTop_ + canFilename.substr(BASE.size());
315  } else {
316  // Needed for files written before CMSSW_1_2_0_pre2.
317  canonicalFilename_ = canFilename;
318  }
319  } else
320  canonicalFilename_ = releaseTop_ + canFilename;
321  } else if (location_ == Data) {
322  if (dataTop_.empty()) {
323  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << DATATOP << " is not set.\n";
324  }
325  canonicalFilename_ = dataTop_ + canFilename;
326  }
327  }

References canonicalFilename_, Data, dataTop_, Exception, edm::errors::FileInPathError, DTRecHitClients_cfi::local, Local, localTop_, location_, relativePath_, Release, releaseTop_, AlCaHLTBitMon_QueryRunRegistry::string, Unknown, and BeamSplash_cfg::version.

◆ relativePath()

std::string edm::FileInPath::relativePath ( ) const

Return a string containing the canonical form of the relative path. DO NOT USE THIS AS THE FILENAME for any file operations; use fullPath() for that purpose.

Definition at line 157 of file FileInPath.cc.

157 { return relativePath_; }

References relativePath_.

Referenced by PDFWeightsHelper::Init(), and PYBIND11_MODULE().

◆ swap()

void edm::FileInPath::swap ( FileInPath other)

Definition at line 147 of file FileInPath.cc.

147  {
148  relativePath_.swap(other.relativePath_);
149  canonicalFilename_.swap(other.canonicalFilename_);
150  std::swap(location_, other.location_);
151  localTop_.swap(other.localTop_);
152  releaseTop_.swap(other.releaseTop_);
153  dataTop_.swap(other.dataTop_);
154  searchPath_.swap(other.searchPath_);
155  }

References canonicalFilename_, dataTop_, localTop_, location_, trackingPlots::other, relativePath_, releaseTop_, searchPath_, and std::swap().

Referenced by operator=().

◆ write()

void edm::FileInPath::write ( std::ostream &  os) const

Write contents to the given ostream. Writing errors are reflected in the state of the stream.

Definition at line 163 of file FileInPath.cc.

163  {
164  if (location_ == Unknown) {
165  os << version << ' ' << relativePath_ << ' ' << location_;
166  } else if (location_ == Local) {
167  // Guarantee a site independent value by stripping $LOCALTOP.
168  if (localTop_.empty()) {
169  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << LOCALTOP << " is not set.\n";
170  }
172  if (pos != 0) {
174  << "Path " << canonicalFilename_ << " is not in the local release area " << localTop_ << "\n";
175  }
176  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(localTop_.size());
177  } else if (location_ == Release) {
178  // Guarantee a site independent value by stripping $RELEASETOP.
179  if (releaseTop_.empty()) {
180  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << RELEASETOP << " is not set.\n";
181  }
183  if (pos != 0) {
185  << "Path " << canonicalFilename_ << " is not in the base release area " << releaseTop_ << "\n";
186  }
187  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(releaseTop_.size());
188  } else if (location_ == Data) {
189  // Guarantee a site independent value by stripping $DATATOP.
190  if (dataTop_.empty()) {
191  throw edm::Exception(edm::errors::FileInPathError) << "Environment Variable " << DATATOP << " is not set.\n";
192  }
194  if (pos != 0) {
196  << "Path " << canonicalFilename_ << " is not in the data area " << dataTop_ << "\n";
197  }
198  os << version << ' ' << relativePath_ << ' ' << location_ << ' ' << canonicalFilename_.substr(dataTop_.size());
199  }
200  }

References canonicalFilename_, Data, dataTop_, Exception, edm::errors::FileInPathError, Local, localTop_, location_, relativePath_, Release, releaseTop_, Unknown, and BeamSplash_cfg::version.

Referenced by pkg.AbstractPkg::generate(), and edm::operator<<().

Member Data Documentation

◆ canonicalFilename_

std::string edm::FileInPath::canonicalFilename_
private

Definition at line 114 of file FileInPath.h.

Referenced by fullPath(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

◆ dataTop_

std::string edm::FileInPath::dataTop_
private

Definition at line 118 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

◆ localTop_

std::string edm::FileInPath::localTop_
private

Definition at line 116 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

◆ location_

LocationCode edm::FileInPath::location_
private

Definition at line 115 of file FileInPath.h.

Referenced by initialize_(), location(), read(), readFromParameterSetBlob(), swap(), and write().

◆ relativePath_

std::string edm::FileInPath::relativePath_
private

Definition at line 113 of file FileInPath.h.

Referenced by initialize_(), read(), readFromParameterSetBlob(), relativePath(), swap(), and write().

◆ releaseTop_

std::string edm::FileInPath::releaseTop_
private

Definition at line 117 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), read(), readFromParameterSetBlob(), swap(), and write().

◆ searchPath_

std::string edm::FileInPath::searchPath_
private

Definition at line 119 of file FileInPath.h.

Referenced by getEnvironment(), initialize_(), and swap().

edm::FileInPath::swap
void swap(FileInPath &other)
Definition: FileInPath.cc:147
edm::FileInPath::dataTop_
std::string dataTop_
Definition: FileInPath.h:118
edm::FileInPath::canonicalFilename_
std::string canonicalFilename_
Definition: FileInPath.h:114
edm::FileInPath::getEnvironment
void getEnvironment()
Definition: FileInPath.cc:331
edm::FileInPath::Release
Definition: FileInPath.h:66
edm::FileInPath::localTop_
std::string localTop_
Definition: FileInPath.h:116
pos
Definition: PixelAliasList.h:18
edm::FileInPath::location_
LocationCode location_
Definition: FileInPath.h:115
edm::errors::FileInPathError
Definition: EDMException.h:48
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::FileInPath::Local
Definition: FileInPath.h:66
edm::tokenize
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:52
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::FileInPath::releaseTop_
std::string releaseTop_
Definition: FileInPath.h:117
edm::FileInPath::searchPath_
std::string searchPath_
Definition: FileInPath.h:119
trackingPlots.other
other
Definition: trackingPlots.py:1460
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
beamvalidation.br
br
Definition: beamvalidation.py:398
edm::FileInPath::Data
Definition: FileInPath.h:66
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::FileInPath::initialize_
void initialize_()
Definition: FileInPath.cc:362
edm::FileInPath::Unknown
Definition: FileInPath.h:66
Exception
Definition: hltDiff.cc:245
edm::FileInPath::relativePath_
std::string relativePath_
Definition: FileInPath.h:113
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
edm::FileInPath::FileInPath
FileInPath()
Definition: FileInPath.cc:104