CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrintEventSetupContent.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: PrintEventSetupContent
5 // Class: PrintEventSetupContent
6 //
14 //
15 // Original Author: Weng Yao
16 // Created: Tue Oct 2 13:49:56 EDT 2007
17 //
18 //
19 
20 // user include files
31 
32 // system include files
33 #include <iostream>
34 #include <map>
35 #include <memory>
36 
37 //
38 // class decleration
39 //
40 
41 namespace edm {
43  public:
44  explicit PrintEventSetupContent(ParameterSet const&);
46 
47  static void fillDescriptions(ConfigurationDescriptions& descriptions);
48 
49  private:
50  virtual void beginJob() override;
51 
52  virtual void analyze(Event const&, EventSetup const&) override;
53  virtual void endJob() override ;
54  virtual void beginRun(Run const&, EventSetup const&) override;
55  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
56 
57  void print(EventSetup const&);
58 
59  // ----------member data ---------------------------
60  std::map<eventsetup::EventSetupRecordKey, unsigned long long > cacheIdentifiers_;
61 };
62 
63 //
64 // constants, enums and typedefs
65 //
66 
67 //
68 // static data member definitions
69 //
70 
71 //
72 // constructors and destructor
73 //
75  //now do what ever initialization is neededEventSetupRecordDataGetter::EventSetupRecordDataGetter(ParameterSet const& iConfig):
76  // getter = new EventSetupRecordDataGetter::EventSetupRecordDataGetter(iConfig);
77  }
78 
80  // do anything here that needs to be done at desctruction time
81  // (e.g. close files, deallocate resources etc.)
82  }
83 
84  //
85  // member functions
86  //
87 
88  // ------------ method called to for each event ------------
89  void
91  print(iSetup);
92  }
93 
94  void
96  print(iSetup);
97  }
98 
99  void
101  print(iSetup);
102  }
103 
104  void
106  typedef std::vector<eventsetup::EventSetupRecordKey> Records;
107  typedef std::vector<eventsetup::DataKey> Data;
108 
109  Records records;
110  Data data;
111  iSetup.fillAvailableRecordKeys(records);
112  int iflag=0;
113 
114  for(Records::iterator itrecords = records.begin(), itrecordsend = records.end();
115  itrecords != itrecordsend; ++itrecords ) {
116 
117  eventsetup::EventSetupRecord const* rec = iSetup.find(*itrecords);
118 
119  if(0 != rec && cacheIdentifiers_[*itrecords] != rec->cacheIdentifier() ) {
120  ++iflag;
121  if(iflag==1) {
122  LogSystem("ESContent") << "\n" << "Changed Record" << "\n " << "<datatype>" << " " << "'label' provider: 'provider label' <provider module type>";
123  }
124  cacheIdentifiers_[*itrecords] = rec->cacheIdentifier();
125  LogAbsolute("ESContent") << itrecords->name() << std::endl;
126 
127  LogAbsolute("ESContent") << " start: " << rec->validityInterval().first().eventID() << " time: " << rec->validityInterval().first().time().value() << std::endl;
128  LogAbsolute("ESContent") << " end: " << rec->validityInterval().last().eventID() << " time: " << rec->validityInterval().last().time().value() << std::endl;
129  rec->fillRegisteredDataKeys(data);
130  for(Data::iterator itdata = data.begin(), itdataend = data.end(); itdata != itdataend; ++itdata){
132  LogAbsolute("ESContent") << " " << itdata->type().name() << " '" << itdata->name().value() << "'" << " provider:'" << cd->label_ << "' " << cd->type_ << std::endl;
133  }
134  }
135  }
136  }
137 
138  //#ifdef THIS_IS_AN_EVENT_EXAMPLE
139  // Handle<ExampleData> pIn;
140  // iEvent.getByLabel("example", pIn);
141  //#endif
142 
143  //#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
144  // ESHandle<SetupData> pSetup;
145  // iSetup.get<SetupRecord>().get(pSetup);
146  //#endif
147 
148  // ------------ method called once each job just before starting event loop ------------
149  void
151  }
152 
153  // ------------ method called once each job just after ending the event loop ------------
154  void
156  }
157 
158  // ------------ method called once each job for validation ------------
159  void
162  descriptions.setComment("Print what data is available in each available EventSetup Record in the job.\n"
163  "As part of the data is the C++ class type, label and which module makes that data.");
164  descriptions.add("printEventSetupContent", desc);
165  }
166 }
167 
168 //define this as a plug-in
unsigned long long cacheIdentifier() const
void fillRegisteredDataKeys(std::vector< DataKey > &oToFill) const
clears the oToFill vector and then fills it with the keys for all registered data keys ...
const EventID & eventID() const
Definition: IOVSyncValue.h:42
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginRun(Run const &, EventSetup const &) override
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:90
const IOVSyncValue & last() const
ComponentDescription const * providerDescription(DataKey const &aKey) const
virtual void beginJob() override
void fillAvailableRecordKeys(std::vector< eventsetup::EventSetupRecordKey > &oToFill) const
clears the oToFill vector and then fills it with the keys for all available records ...
Definition: EventSetup.cc:101
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
std::map< eventsetup::EventSetupRecordKey, unsigned long long > cacheIdentifiers_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const Timestamp & time() const
Definition: IOVSyncValue.h:44
const IOVSyncValue & first() const
virtual void analyze(Event const &, EventSetup const &) override
ValidityInterval const & validityInterval() const
TimeValue_t value() const
Definition: Timestamp.h:56
void print(EventSetup const &)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: Run.h:41
PrintEventSetupContent(ParameterSet const &)