Imperial Analysis
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ICHashTreeProducer.cc
Go to the documentation of this file.
2 #include <memory>
3 #include "TTree.h"
4 #include "Compression.h"
5 #include "FWCore/Framework/interface/Frameworkfwd.h"
6 #include "FWCore/Framework/interface/Event.h"
7 #include "FWCore/Framework/interface/MakerMacros.h"
8 #include "FWCore/ParameterSet/interface/ParameterSet.h"
9 #include "FWCore/ServiceRegistry/interface/Service.h"
10 #include "CommonTools/UtilAlgos/interface/TFileService.h"
12 
13 std::map<std::size_t, std::string> ICHashTreeProducer::unhash_map_;
14 
15 ICHashTreeProducer::ICHashTreeProducer(const edm::ParameterSet& config) {}
16 
18 
19 void ICHashTreeProducer::Add(std::size_t const& id, std::string const& str) {
20  unhash_map_[id] = str;
21 }
22 
23 
24 void ICHashTreeProducer::produce(edm::Event& /*event*/,
25  const edm::EventSetup& /*setup*/) {}
26 
27 void ICHashTreeProducer::beginJob() {}
28 
29 void ICHashTreeProducer::endJob() {
30  edm::Service<TFileService> fs;
31  TTree *tree = fs->make<TTree>("HashTree", "HashTree");
32  fs->file().SetCompressionSettings(ROOT::CompressionSettings(ROOT::kLZMA, 5));
33  ULong64_t id;
34  std::string str;
35  tree->Branch("id", &id);
36  tree->Branch("string", &str);
37  for (auto const& vals : unhash_map_) {
38  id = vals.first;
39  str = vals.second;
40  tree->Fill();
41  }
42 }
43 
44 // define this as a plug-in
DEFINE_FWK_MODULE(ICHashTreeProducer)
ICHashTreeProducer(const edm::ParameterSet &)
static void Add(std::size_t const &id, std::string const &str)