CMS 3D CMS Logo

DQMReferenceHistogramRootFileEventSetupAnalyzer.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:
28  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
29  void beginRun(edm::Run const&, edm::EventSetup const&) override;
30 
31  private:
32  bool init_;
33  };
34 
36  const edm::ParameterSet& ps) {
37  init_ = false;
38  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
39  }
40 
42  init_ = false;
43  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer(int i) " << i << std::endl;
44  }
45 
47  init_ = false;
48  //std::cout << "~DQMReferenceHistogramRootFileEventSetupAnalyzer" << std::endl;
49  }
50 
52  const edm::EventSetup& iSetup) {
53  return;
54  }
55 
57  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun()" << std::endl;
58  if (!init_) {
59  init_ = true;
61  edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMReferenceHistogramRootFileRcd"));
63  throw cms::Exception("Record not found") << "Record \"DQMReferenceHistogramRootFileRcd"
64  << "\" does not exist!" << std::endl;
65  }
67  iSetup.get<DQMReferenceHistogramRootFileRcd>().get(rootgeo);
68  //std::cout<<"ROOT FILE IN MEMORY"<<std::endl;
69  std::unique_ptr<std::vector<unsigned char> > tb((*rootgeo).getUncompressedBlob());
70  // char filename[128];
71  // sprintf(filename, "mem:%p,%ul", &(*tb)[0], (unsigned long) tb->size());
72  // edm::Service<DQMStore>()->open(filename, false, "", "Reference");
73 
74  //here you can implement the stream for putting the TFile on disk...
75  std::string outfile("dqmreference.root");
76  std::ofstream output(outfile.c_str());
77  output.write((const char*)&(*tb)[0], tb->size());
78  output.close();
79 
81  dqm->open(outfile, false, "", "Reference");
82  remove(outfile.c_str());
83 
84  std::vector<MonitorElement*> mes = dqm->getAllContents("");
85  // for (std::vector<MonitorElement *>::iterator i = mes.begin(), e = mes.end(); i != e; ++i)
86  // std::cout << "ME '" << (*i)->getFullname() << "'\n";
87 
88  //std::cout<<"SIZE FILE = "<<tb->size()<<std::endl;
89  }
90  }
91 
93 } // 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
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::Run
Definition: Run.h:45
edmtest
Definition: AlignPCLThresholdsReader.cc:12
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::DQMReferenceHistogramRootFileEventSetupAnalyzer
DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet &pset)
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:35
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
EDAnalyzer.h
DQMReferenceHistogramRootFileRcd
Definition: DQMReferenceHistogramRootFileRcd.h:24
FileBlob.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
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
dqm::legacy::DQMStore
Definition: DQMStore.h:727
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:51
Service.h
Run.h
edm::ESHandle
Definition: DTSurvey.h:22
edm::eventsetup::EventSetupRecordKey::TypeTag
heterocontainer::HCTypeTag TypeTag
Definition: EventSetupRecordKey.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::~DQMReferenceHistogramRootFileEventSetupAnalyzer
~DQMReferenceHistogramRootFileEventSetupAnalyzer() override
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:46
Event.h
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:23
edm::eventsetup::EventSetupRecordKey::type
const TypeTag & type() const
Definition: EventSetupRecordKey.h:40
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:56
edm::EventSetup
Definition: EventSetup.h:57
DQMReferenceHistogramRootFileRcd.h
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:21
get
#define get
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:24
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::init_
bool init_
Definition: DQMReferenceHistogramRootFileEventSetupAnalyzer.cc:32
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:219
EventSetup.h
Exception.h
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:351
dqm
Definition: DQMStore.h:18
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27