CMS 3D CMS Logo

DQMXMLFileEventSetupAnalyzer.cc
Go to the documentation of this file.
1 // C++ common header
2 #include <iostream>
3 #include <memory>
4 #include <vector>
5 #include <fstream>
6 
19 
20 namespace edmtest {
22  public:
24  explicit DQMXMLFileEventSetupAnalyzer(int i);
26  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
27  void beginRun(edm::Run const&, edm::EventSetup const&) override;
28 
29  private:
30  bool init_;
32  };
33 
35  : labelToGet_(ps.getParameter<std::string>("labelToGet")) {
36  init_ = false;
37  //std::cout << "DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
38  }
39 
41  init_ = false;
42  //std::cout << "DQMXMLFileEventSetupAnalyzer(int i) " << i << std::endl;
43  }
44 
46  init_ = false;
47  //std::cout << "~DQMXMLFileEventSetupAnalyzer" << std::endl;
48  }
49 
51 
53  //std::cout << "DQMXMLFileEventSetupAnalyzer::beginRun()" << std::endl;
54  if (!init_) {
55  init_ = true;
59  throw cms::Exception("Record not found") << "Record \"DQMXMLFileRcd"
60  << "\" does not exist!" << std::endl;
61  }
63  iSetup.get<DQMXMLFileRcd>().get(labelToGet_, rootgeo);
64  //std::cout<<"XML FILE IN MEMORY 1 with label " << labelToGet_ <<std::endl;
65  std::unique_ptr<std::vector<unsigned char> > tb1((*rootgeo).getUncompressedBlob());
66  //here you can implement the stream for putting the TFile on disk...
67  std::string outfile1("XML1_retrieved.xml");
68  std::ofstream output1(outfile1.c_str());
69  output1.write((const char*)&(*tb1)[0], tb1->size());
70  output1.close();
71 
72  // iSetup.get<DQMXMLFileRcd>().get("XML2_mio",rootgeo);
73  // std::cout<<"ROOT FILE IN MEMORY 2"<<std::endl;
74  // std::unique_ptr<std::vector<unsigned char> > tb2( (*rootgeo).getUncompressedBlob() );
75  // //here you can implement the stream for putting the TFile on disk...
76  // std::string outfile2("XML2_retrieved.xml") ;
77  // std::ofstream output2(outfile2.c_str()) ;
78  // output2.write((const char *)&(*tb2)[0], tb2->size());
79  // output2.close() ;
80  // std::unique_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
81  }
82  }
83 
85 } // namespace edmtest
edm::eventsetup::heterocontainer::HCTypeTag::findType
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121
mps_fire.i
i
Definition: mps_fire.py:428
skim900GeV_StreamA_MinBiasPD_cfg.output1
output1
Definition: skim900GeV_StreamA_MinBiasPD_cfg.py:212
ESHandle.h
edm::Run
Definition: Run.h:45
edmtest
Definition: AlignPCLThresholdsReader.cc:12
edmtest::DQMXMLFileEventSetupAnalyzer::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQMXMLFileEventSetupAnalyzer.cc:52
DQMStore.h
edmtest::DQMXMLFileEventSetupAnalyzer::DQMXMLFileEventSetupAnalyzer
DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &pset)
Definition: DQMXMLFileEventSetupAnalyzer.cc:34
EDAnalyzer.h
edmtest::DQMXMLFileEventSetupAnalyzer::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
Definition: DQMXMLFileEventSetupAnalyzer.cc:50
FileBlob.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edmtest::DQMXMLFileEventSetupAnalyzer::labelToGet_
std::string labelToGet_
Definition: DQMXMLFileEventSetupAnalyzer.cc:31
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
Run.h
edm::ESHandle
Definition: DTSurvey.h:22
edm::eventsetup::EventSetupRecordKey::TypeTag
heterocontainer::HCTypeTag TypeTag
Definition: EventSetupRecordKey.h:32
DQMXMLFileRcd.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edmtest::DQMXMLFileEventSetupAnalyzer::~DQMXMLFileEventSetupAnalyzer
~DQMXMLFileEventSetupAnalyzer() override
Definition: DQMXMLFileEventSetupAnalyzer.cc:45
Event.h
DQMXMLFileRcd
Definition: DQMXMLFileRcd.h:24
edm::eventsetup::EventSetupRecordKey::type
const TypeTag & type() const
Definition: EventSetupRecordKey.h:40
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
EventSetup.h
Exception.h
ParameterSet.h
event
Definition: event.py:1
edmtest::DQMXMLFileEventSetupAnalyzer
Definition: DQMXMLFileEventSetupAnalyzer.cc:21
edm::Event
Definition: Event.h:73
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edmtest::DQMXMLFileEventSetupAnalyzer::init_
bool init_
Definition: DQMXMLFileEventSetupAnalyzer.cc:30