FileCatalogMetadataDUNE_service.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Name: FileCatalogMetadataDUNE_service.cc.
3 //
4 // Purpose: Art service adds DUNE-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 // Created: 3-Dec-2014, T. Yang
11 // Copied FileCatalogMetadataMicroBooNE_service.cc by H. Greenlee
12 //
13 ////////////////////////////////////////////////////////////////////////
14 
17 
18  //--------------------------------------------------------------------
19  // Constructor.
20 
23  {
24  // Get parameters.
25 
26  fMCGenerators = pset.get<std::string>("MCGenerators","");
27  fMCOscillationP = pset.get<std::string>("MCOscillationP","");
28  fMCTriggerListVersion = pset.get<std::string>("MCTriggerListVersion","");
29  fMCBeamEnergy = pset.get<std::string>("MCBeamEnergy","");
30  fMCBeamFluxID = pset.get<std::string>("MCBeamFluxID","");
31  fMCName = pset.get<std::string>("MCName","");
32  fMCDetectorType = pset.get<std::string>("MCDetectorType","");
33  fMCNeutrinoFlavors = pset.get<std::string>("MCNeutrinoFlavors","");
34  fMCMassHierarchy = pset.get<std::string>("MCMassHierarchy","");
35  fMCMiscellaneous = pset.get<std::string>("MCMiscellaneous","");
36  fMCGeometryVersion = pset.get<std::string>("MCGeometryVersion","");
37  fMCOverlay = pset.get<std::string>("MCOverlay","");
38  fDataRunMode = pset.get<std::string>("DataRunMode","");
39  fDataDetectorType = pset.get<std::string>("DataDetectorType","");
40  fDataName = pset.get<std::string>("DataName","");
41  fStageName = pset.get<std::string>("StageName","");
42  // Register for callbacks.
43 
45  }
46 
47  //--------------------------------------------------------------------
48  // PostBeginJob callback.
49  // Insert per-job metadata via FileCatalogMetadata service.
51  {
52  // Get art metadata service.
53 
55 
56  // Add metadata.
57 
58  if (fMCGenerators!="") mds->addMetadata("lbneMCGenerators", fMCGenerators);
59  if (fMCOscillationP!="") mds->addMetadata("lbneMCOscillationP", fMCOscillationP);
60  if (fMCTriggerListVersion!="") mds->addMetadata("lbneMCTriggerListVersion", fMCTriggerListVersion);
61  if (fMCBeamEnergy!="") mds->addMetadata("lbneMCBeamEnergy", fMCBeamEnergy);
62  if (fMCBeamFluxID!="") mds->addMetadata("lbneMCBeamFluxID", fMCBeamFluxID);
63  if (fMCName!="") mds->addMetadata("lbneMCName", fMCName);
64  if (fMCDetectorType!="") mds->addMetadata("lbneMCDetectorType", fMCDetectorType);
65  if (fMCNeutrinoFlavors!="") mds->addMetadata("lbneMCNeutrinoFlavors", fMCNeutrinoFlavors);
66  if (fMCMassHierarchy!="") mds->addMetadata("lbneMCMassHierarchy", fMCMassHierarchy);
67  if (fMCMiscellaneous!="") mds->addMetadata("lbneMCMiscellaneous", fMCMiscellaneous);
68  if (fMCGeometryVersion!="") mds->addMetadata("lbneMCGeometryVersion", fMCGeometryVersion);
69  if (fMCOverlay!="") mds->addMetadata("lbneMCOverlay", fMCOverlay);
70  if (fDataRunMode!="") mds->addMetadata("lbneDataRunMode", fDataRunMode);
71  if (fDataDetectorType!="") mds->addMetadata("lbneDataDetectorType", fDataDetectorType);
72  if (fDataName!="") mds->addMetadata("lbneDataName", fDataName);
73  if (fStageName!="") mds->addMetadata("StageName",fStageName);
74  }
75 
GlobalSignal< detail::SignalResponseType::FIFO, void()> sPostBeginJob
std::string string
Definition: nybbler.cc:12
T get(std::string const &key) const
Definition: ParameterSet.h:271
FileCatalogMetadataDUNE(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
#define DEFINE_ART_SERVICE(svc)
void addMetadata(std::string const &key, std::string const &value)