CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMReferenceHistogramRootFileEventSetupAnalyzer.cc
Go to the documentation of this file.
1 // C++ common header
2 #include <iostream>
3 #include <vector>
4 #include <fstream>
5 
6 // Boost headers
7 #include "boost/scoped_ptr.hpp"
8 
22 
23 namespace edmtest {
25  public:
29  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
30  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override ;
31  private:
32  bool init_ ;
33  };
34 
36  init_ = false ;
37  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
38  }
39 
41  init_ = false ;
42  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer(int i) " << i << std::endl;
43  }
44 
46  {
47  init_ = false ;
48  //std::cout << "~DQMReferenceHistogramRootFileEventSetupAnalyzer" << std::endl;
49  }
50 
52  {
53  return ;
54  }
55 
57  {
58  //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun()" << std::endl;
59  if(!init_)
60  {
61  init_ = true ;
64  throw cms::Exception ("Record not found") << "Record \"DQMReferenceHistogramRootFileRcd"
65  << "\" does not exist!" << std::endl;
66  }
68  iSetup.get<DQMReferenceHistogramRootFileRcd>().get(rootgeo);
69  //std::cout<<"ROOT FILE IN MEMORY"<<std::endl;
70  boost::scoped_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
71  // char filename[128];
72  // sprintf(filename, "mem:%p,%ul", &(*tb)[0], (unsigned long) tb->size());
73  // edm::Service<DQMStore>()->open(filename, false, "", "Reference");
74 
75  //here you can implement the stream for putting the TFile on disk...
76  std::string outfile("dqmreference.root") ;
77  std::ofstream output(outfile.c_str()) ;
78  output.write((const char *)&(*tb)[0], tb->size());
79  output.close() ;
80 
82  dqm->open(outfile, false, "", "Reference");
83  remove(outfile.c_str());
84 
85  std::vector<MonitorElement *> mes = dqm->getAllContents("");
86  // for (std::vector<MonitorElement *>::iterator i = mes.begin(), e = mes.end(); i != e; ++i)
87  // std::cout << "ME '" << (*i)->getFullname() << "'\n";
88 
89  //std::cout<<"SIZE FILE = "<<tb->size()<<std::endl;
90  }
91  }
92 
94 }
int i
Definition: DBlmapReader.cc:9
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1836
list outfile
Definition: EdgesToViz.py:91
int iEvent
Definition: GenABIO.cc:243
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
DEFINE_FWK_MODULE(DQMReferenceHistogramRootFileEventSetupAnalyzer)
const T & get() const
Definition: EventSetup.h:55
return(e1-e2)*(e1-e2)+dp *dp
heterocontainer::HCTypeTag TypeTag
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2632
volatile std::atomic< bool > shutdown_flag false
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:41
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125