Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014
00015
00016
00017
00018
00019
00020
00021 #include "FWCore/Framework/interface/ComponentDescription.h"
00022 #include "FWCore/Framework/interface/EDAnalyzer.h"
00023 #include "FWCore/Framework/interface/EventSetup.h"
00024 #include "FWCore/Framework/interface/EventSetupRecord.h"
00025 #include "FWCore/Framework/interface/IOVSyncValue.h"
00026 #include "FWCore/Framework/interface/MakerMacros.h"
00027 #include "FWCore/Framework/interface/ValidityInterval.h"
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00030 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00031
00032
00033 #include <iostream>
00034 #include <map>
00035 #include <memory>
00036
00037
00038
00039
00040
00041 namespace edm {
00042 class PrintEventSetupContent : public EDAnalyzer {
00043 public:
00044 explicit PrintEventSetupContent(ParameterSet const&);
00045 ~PrintEventSetupContent();
00046
00047 static void fillDescriptions(ConfigurationDescriptions& descriptions);
00048
00049 private:
00050 virtual void beginJob();
00051
00052 virtual void analyze(Event const&, EventSetup const&);
00053 virtual void endJob() ;
00054 virtual void beginRun(Run const&, EventSetup const&);
00055 virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&);
00056
00057 void print(EventSetup const&);
00058
00059
00060 std::map<eventsetup::EventSetupRecordKey, unsigned long long > cacheIdentifiers_;
00061 };
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 PrintEventSetupContent::PrintEventSetupContent(ParameterSet const&) {
00075
00076
00077 }
00078
00079 PrintEventSetupContent::~PrintEventSetupContent() {
00080
00081
00082 }
00083
00084
00085
00086
00087
00088
00089 void
00090 PrintEventSetupContent::analyze(Event const&, EventSetup const& iSetup) {
00091 print(iSetup);
00092 }
00093
00094 void
00095 PrintEventSetupContent::beginRun(Run const&, EventSetup const& iSetup){
00096 print(iSetup);
00097 }
00098
00099 void
00100 PrintEventSetupContent::beginLuminosityBlock(LuminosityBlock const&, EventSetup const& iSetup){
00101 print(iSetup);
00102 }
00103
00104 void
00105 PrintEventSetupContent::print (EventSetup const& iSetup) {
00106 typedef std::vector<eventsetup::EventSetupRecordKey> Records;
00107 typedef std::vector<eventsetup::DataKey> Data;
00108
00109 Records records;
00110 Data data;
00111 iSetup.fillAvailableRecordKeys(records);
00112 int iflag=0;
00113
00114 for(Records::iterator itrecords = records.begin(), itrecordsend = records.end();
00115 itrecords != itrecordsend; ++itrecords ) {
00116
00117 eventsetup::EventSetupRecord const* rec = iSetup.find(*itrecords);
00118
00119 if(0 != rec && cacheIdentifiers_[*itrecords] != rec->cacheIdentifier() ) {
00120 ++iflag;
00121 if(iflag==1) {
00122 LogSystem("ESContent") << "\n" << "Changed Record" << "\n " << "<datatype>" << " " << "'label' provider: 'provider label' <provider module type>";
00123 }
00124 cacheIdentifiers_[*itrecords] = rec->cacheIdentifier();
00125 LogAbsolute("ESContent") << itrecords->name() << std::endl;
00126
00127 LogAbsolute("ESContent") << " start: " << rec->validityInterval().first().eventID() << " time: " << rec->validityInterval().first().time().value() << std::endl;
00128 LogAbsolute("ESContent") << " end: " << rec->validityInterval().last().eventID() << " time: " << rec->validityInterval().last().time().value() << std::endl;
00129 rec->fillRegisteredDataKeys(data);
00130 for(Data::iterator itdata = data.begin(), itdataend = data.end(); itdata != itdataend; ++itdata){
00131 edm::eventsetup::ComponentDescription const* cd = rec->providerDescription(*itdata);
00132 LogAbsolute("ESContent") << " " << itdata->type().name() << " '" << itdata->name().value() << "'" << " provider:'" << cd->label_ << "' " << cd->type_ << std::endl;
00133 }
00134 }
00135 }
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 void
00150 PrintEventSetupContent::beginJob() {
00151 }
00152
00153
00154 void
00155 PrintEventSetupContent::endJob() {
00156 }
00157
00158
00159 void
00160 PrintEventSetupContent::fillDescriptions(ConfigurationDescriptions& descriptions) {
00161 ParameterSetDescription desc;
00162 descriptions.setComment("Print what data is available in each available EventSetup Record in the job.\n"
00163 "As part of the data is the C++ class type, label and which module makes that data.");
00164 descriptions.add("printEventSetupContent", desc);
00165 }
00166 }
00167
00168
00169 using edm::PrintEventSetupContent;
00170 DEFINE_FWK_MODULE(PrintEventSetupContent);