36 size_t&
pos,
size_t&
len)
const;
40 size_t& pos,
size_t& len)
const;
47 std::vector<PIDDetails>&
out,
83 mf::LogError(
"LEMMixer") <<
"getSecondaryFilename() called a second time. Is the lempart file too short? Aborting";
95 std::vector<PIDDetails>&
out,
101 mf::LogError(
"LEMMixer") <<
"PIDDetails missing from lempart stream. Normally this means that there were never even any slices. Go check your upstream files...";
112 size_t&
pos,
size_t&
len)
const 116 pos = fname.find(
"S");
118 if(pos == std::string::npos) pos = fname.find(
"FA");
119 if(pos == std::string::npos) pos = fname.find(
"R");
121 assert(pos != std::string::npos);
125 const size_t posend = fname.find(
"_", pos);
126 assert(posend != std::string::npos);
133 size_t&
pos,
size_t&
len)
const 136 pos = fname.find(
"_v");
137 assert(pos != std::string::npos);
139 assert(pos != std::string::npos);
140 size_t posend = fname.find(
"_", pos);
153 size_t pos = fname.rfind(
"/");
154 if(pos != std::string::npos) fname = fname.substr(pos+1);
159 pos = fname.find(
"pidpart");
160 assert(pos != std::string::npos);
161 fname.replace(pos, 7,
"lempart");
166 fname = fname.substr(0, pos) +
fLempartRelease + fname.substr(pos+len, std::string::npos);
172 fname = fname.substr(0, pos) +
fLempartVersion + fname.substr(pos+len, std::string::npos);
179 if(fname.size() > 37 &&
180 fname[8] ==
'-' && fname[13] ==
'-' &&
181 fname[18] ==
'-' && fname[23] ==
'-' && fname[36] ==
'-')
182 fname = &fname.c_str()[37];
184 std::vector<std::string> fnames;
188 fnames = i.translateConstraints(
TString::Format(
"file_name %%%s and dataset.tag %s", fname.c_str(),
fUserSAMTag.c_str()).Data());
191 while(!fnames.empty() && fnames.back().empty()) fnames.pop_back();
194 std::cout <<
"Error: no lemsum file found matching " << fname
198 if(fnames.size() > 1){
199 std::cout <<
"Error: multiple lemsums found matching " << fname
221 const int status =
system((
"ifdh_fetch -e nova "+fLempartFilename).c_str());
245 mm.
AddMetadata(
"lempart.file_name", fLempartFilename);
bool fProvidedSecondaryFilename
Detect re-entry into getSecondaryFilename.
void registerSecondaryFileNameProvider(ProviderFunc_ func)
std::string fLempartVersion
Override lempart version to look for.
std::string LEMPartFor(std::string fname) const
Rewrite filename to find the corresponding lempart file.
system("rm -rf microbeam.root")
void FindRelease(const std::string &fname, size_t &pos, size_t &len) const
Locate the release string within the filename.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string const & fileName() const
bool fFromSAM
Are we fetching lempart files from SAM?
bool MixPIDDetails(const std::vector< const std::vector< PIDDetails > * > &pids, std::vector< PIDDetails > &out, const art::PtrRemapper &rm)
Do the actual mixing.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
DEFINE_ART_MODULE(TestTMapFile)
std::string fLempartFilename
If so, this is the file we got.
virtual void respondToOpenInputFile(const art::FileBlock &fb)
Fetch the matching lempart file from SAM.
std::string fLempartRelease
Override lempart release to look for.
void declareMixOp(InputTag const &inputTag, MixFunc< PROD, OPROD > mixFunc, bool outputProduct=true)
void FindVersion(const std::string &fname, size_t &pos, size_t &len) const
Locate the version string within the filename.
T get(std::string const &key) const
static constexpr Double_t mm
assert(nhit_max >=nhit_nbins)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
std::string getSecondaryFilename()
Tell ART what file to mix with.
LEMMixer(const fhicl::ParameterSet &pset, art::MixHelper &helper)