Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
garsoft
Utilities
Metadata
FileCatalogMetadataMPD_service.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Name: FileCatalogMetadataMPD_service.cc.
3
//
4
// Purpose: Art service adds MPD-specific per-job sam metadata.
5
//
6
// This service does not have user-callable methods. Simply
7
// add to an art configuration in services.user block of job
8
// file.
9
//
10
// MPD version based on DUNE version, 7 Nov 2019, T. Junk
11
// DUNE version Created: 3-Dec-2014, T. Yang
12
// Copied FileCatalogMetadataMicroBooNE_service.cc by H. Greenlee
13
//
14
////////////////////////////////////////////////////////////////////////
15
16
#include "
FileCatalogMetadataMPD.h
"
17
#include <stdlib.h>
18
19
//--------------------------------------------------------------------
20
// Constructor.
21
22
util::FileCatalogMetadataMPD::
23
FileCatalogMetadataMPD
(
fhicl::ParameterSet
const
& pset,
art::ActivityRegistry
&
reg
)
24
{
25
// Get parameters.
26
27
fGenerators
= pset.
get
<
std::string
>(
"Generators"
,
""
);
28
fTriggerListVersion
= pset.
get
<
std::string
>(
"TriggerListVersion"
,
""
);
29
fBeamFluxID
= pset.
get
<
std::string
>(
"BeamFluxID"
,
""
);
30
fMCName
= pset.
get
<
std::string
>(
"MCName"
,
""
);
31
fNeutrinoFlavors
= pset.
get
<
std::string
>(
"NeutrinoFlavors"
,
""
);
32
fMiscellaneous
= pset.
get
<
std::string
>(
"Miscellaneous"
,
""
);
33
fGeometryVersion
= pset.
get
<
std::string
>(
"GeometryVersion"
,
""
);
34
fOverlay
= pset.
get
<
std::string
>(
"Overlay"
,
""
);
35
fRunType
= pset.
get
<
std::string
>(
"run_type"
,
""
);
36
fDataTier
= pset.
get
<
std::string
>(
"data_tier"
,
""
);
37
fApplName
= pset.
get
<
std::string
>(
"ApplName"
,
"garsoft"
);
38
fEnvVarVer
= pset.
get
<
std::string
>(
"EnvVarVer"
,
"GARSOFT_VERSION"
);
39
fHornPolarity
= pset.
get
<
std::string
>(
"HornPolarity"
,
""
);
40
41
// Register for callbacks.
42
43
reg.
sPostBeginJob
.watch(
this
, &
FileCatalogMetadataMPD::postBeginJob
);
44
}
45
46
//--------------------------------------------------------------------
47
// PostBeginJob callback.
48
// Insert per-job metadata via FileCatalogMetadata service.
49
void
util::FileCatalogMetadataMPD::postBeginJob
()
50
{
51
// Get art metadata service.
52
53
art::ServiceHandle<art::FileCatalogMetadata>
mds;
54
55
// Add metadata.
56
57
if
(
fGenerators
!=
""
) mds->
addMetadata
(
"DUNE.Generators"
,
fGenerators
);
58
if
(
fGenerators
!=
""
) mds->
addMetadata
(
"DUNE_MC.Generators"
,
fGenerators
);
59
if
(
fTriggerListVersion
!=
""
) mds->
addMetadata
(
"DUNE_MC.trigger-list-version"
,
fTriggerListVersion
);
60
if
(
fBeamFluxID
!=
""
) mds->
addMetadata
(
"DUNE_MC.beam_flux_ID"
,
fBeamFluxID
);
61
if
(
fMCName
!=
""
) mds->
addMetadata
(
"DUNE_MC.name"
,
fMCName
);
62
if
(
fNeutrinoFlavors
!=
""
) mds->
addMetadata
(
"DUNE_MC_neutrino_flavors"
,
fNeutrinoFlavors
);
63
if
(
fMiscellaneous
!=
""
) mds->
addMetadata
(
"DUNE_MC.miscellaneous"
,
fMiscellaneous
);
64
if
(
fGeometryVersion
!=
""
) mds->
addMetadata
(
"DUNE_MC.GeometryVersion"
,
fGeometryVersion
);
65
if
(
fOverlay
!=
""
) mds->
addMetadata
(
"DUNE_MC.Overlay"
,
fOverlay
);
66
if
(
fSystematic
!=
""
) mds->
addMetadata
(
"DUNE_MC.Systematic"
,
fSystematic
);
67
if
(
fRunType
!=
""
) mds->
addMetadata
(
"run_type"
,
fRunType
);
68
if
(
fDataTier
!=
""
) mds->
addMetadata
(
"data_tier"
,
fDataTier
);
// e.g. "reco"
69
if
(
fApplName
!=
""
) mds->
addMetadata
(
"application.family"
,
fApplName
);
// e.g. "garsoft"
70
if
(
fDataTier
!=
""
) mds->
addMetadata
(
"application.name"
,
fDataTier
);
// e.g. "reco"
71
if
(
fEnvVarVer
!=
""
) mds->
addMetadata
(
"application.version"
,
getenv
(
fEnvVarVer
.c_str()));
72
if
(
fHornPolarity
!=
""
) mds->
addMetadata
(
"DUNE_MC.HornPolarity"
,
fHornPolarity
);
73
}
74
75
DEFINE_ART_SERVICE
(
util::FileCatalogMetadataMPD
)
art::ServiceHandle
Definition:
ServiceHandle.h:37
art::ActivityRegistry::sPostBeginJob
GlobalSignal< detail::SignalResponseType::FIFO, void()> sPostBeginJob
Definition:
ActivityRegistry.h:63
util::FileCatalogMetadataMPD::fDataTier
std::string fDataTier
Definition:
FileCatalogMetadataMPD.h:72
util::FileCatalogMetadataMPD::fRunType
std::string fRunType
Definition:
FileCatalogMetadataMPD.h:71
string
std::string string
Definition:
nybbler.cc:12
util::FileCatalogMetadataMPD::fGeometryVersion
std::string fGeometryVersion
Definition:
FileCatalogMetadataMPD.h:69
util::FileCatalogMetadataMPD::fOverlay
std::string fOverlay
Definition:
FileCatalogMetadataMPD.h:70
FileCatalogMetadataMPD.h
util::FileCatalogMetadataMPD::fApplName
std::string fApplName
Definition:
FileCatalogMetadataMPD.h:73
util::FileCatalogMetadataMPD::fSystematic
std::string fSystematic
Definition:
FileCatalogMetadataMPD.h:75
util::FileCatalogMetadataMPD::fNeutrinoFlavors
std::string fNeutrinoFlavors
Definition:
FileCatalogMetadataMPD.h:67
util::FileCatalogMetadataMPD::postBeginJob
void postBeginJob()
Definition:
FileCatalogMetadataMPD_service.cc:49
cet::getenv
std::string getenv(std::string const &name)
Definition:
getenv.cc:15
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
util::FileCatalogMetadataMPD::FileCatalogMetadataMPD
FileCatalogMetadataMPD(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
Definition:
FileCatalogMetadataMPD_service.cc:23
util::FileCatalogMetadataMPD::fHornPolarity
std::string fHornPolarity
Definition:
FileCatalogMetadataMPD.h:76
DEFINE_ART_SERVICE
#define DEFINE_ART_SERVICE(svc)
Definition:
ServiceDefinitionMacros.h:36
util::FileCatalogMetadataMPD::fMiscellaneous
std::string fMiscellaneous
Definition:
FileCatalogMetadataMPD.h:68
art::ActivityRegistry
Definition:
ActivityRegistry.h:52
util::FileCatalogMetadataMPD::fMCName
std::string fMCName
Definition:
FileCatalogMetadataMPD.h:66
art::FileCatalogMetadata::addMetadata
void addMetadata(std::string const &key, std::string const &value)
Definition:
FileCatalogMetadata.cc:78
util::FileCatalogMetadataMPD::fEnvVarVer
std::string fEnvVarVer
Definition:
FileCatalogMetadataMPD.h:74
util::FileCatalogMetadataMPD::fTriggerListVersion
std::string fTriggerListVersion
Definition:
FileCatalogMetadataMPD.h:64
util::FileCatalogMetadataMPD
Definition:
FileCatalogMetadataMPD.h:32
cet::registry_via_id
Definition:
registry_via_id.h:19
util::FileCatalogMetadataMPD::fGenerators
std::string fGenerators
Definition:
FileCatalogMetadataMPD.h:63
util::FileCatalogMetadataMPD::fBeamFluxID
std::string fBeamFluxID
Definition:
FileCatalogMetadataMPD.h:65
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11