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