File indexing completed on 2024-04-06 12:19:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0035 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0036 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0037 #include "FWCore/ServiceRegistry/interface/ServiceMaker.h"
0038 #include "FWCore/Utilities/interface/EDMException.h"
0039 #include "FWCore/Utilities/interface/FileInPath.h"
0040
0041 #include "TFile.h"
0042
0043 namespace edm {
0044 namespace service {
0045
0046 class FixMissingStreamerInfos {
0047 public:
0048 FixMissingStreamerInfos(ParameterSet const&, ActivityRegistry&);
0049 static void fillDescriptions(ConfigurationDescriptions&);
0050
0051 private:
0052 FileInPath fileInPath_;
0053 };
0054
0055 FixMissingStreamerInfos::FixMissingStreamerInfos(ParameterSet const& pset, edm::ActivityRegistry&)
0056 : fileInPath_(pset.getUntrackedParameter<FileInPath>("fileInPath")) {
0057 auto tFile = TFile::Open(fileInPath_.fullPath().c_str());
0058 if (!tFile || tFile->IsZombie()) {
0059 throw cms::Exception("FixMissingStreamerInfo")
0060 << "Failed opening file containing missing StreamerInfos: " << fileInPath_.fullPath();
0061 }
0062 tFile->Close();
0063 }
0064
0065 void FixMissingStreamerInfos::fillDescriptions(ConfigurationDescriptions& descriptions) {
0066 ParameterSetDescription desc;
0067 desc.addUntracked<FileInPath>("fileInPath");
0068 descriptions.add("FixMissingStreamerInfos", desc);
0069 }
0070 }
0071 }
0072
0073 using namespace edm::service;
0074 DEFINE_FWK_SERVICE(FixMissingStreamerInfos);