CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMXMLFileEventSetupAnalyzer.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:
26  explicit DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet & pset);
27  explicit DQMXMLFileEventSetupAnalyzer(int i);
29  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
30  virtual void beginRun(edm::Run const&, edm::EventSetup const&) ;
31  private:
32  bool init_ ;
33  std::string labelToGet_ ;
34  };
35 
36  DQMXMLFileEventSetupAnalyzer::DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps):labelToGet_(ps.getParameter<std::string>("labelToGet")) {
37  init_ = false ;
38  //std::cout << "DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
39  }
40 
42  init_ = false ;
43  //std::cout << "DQMXMLFileEventSetupAnalyzer(int i) " << i << std::endl;
44  }
45 
47  {
48  init_ = false ;
49  //std::cout << "~DQMXMLFileEventSetupAnalyzer" << std::endl;
50  }
51 
53  {
54  return ;
55  }
56 
58  {
59  //std::cout << "DQMXMLFileEventSetupAnalyzer::beginRun()" << std::endl;
60  if(!init_)
61  {
62  init_ = true ;
65  throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd"
66  << "\" does not exist!" << std::endl;
67  }
69  iSetup.get<DQMXMLFileRcd>().get(labelToGet_,rootgeo);
70  //std::cout<<"XML FILE IN MEMORY 1 with label " << labelToGet_ <<std::endl;
71  boost::scoped_ptr<std::vector<unsigned char> > tb1( (*rootgeo).getUncompressedBlob() );
72  //here you can implement the stream for putting the TFile on disk...
73  std::string outfile1("XML1_retrieved.xml") ;
74  ofstream output1(outfile1.c_str()) ;
75  output1.write((const char *)&(*tb1)[0], tb1->size());
76  output1.close() ;
77 
78 // iSetup.get<DQMXMLFileRcd>().get("XML2_mio",rootgeo);
79 // std::cout<<"ROOT FILE IN MEMORY 2"<<std::endl;
80 // boost::scoped_ptr<std::vector<unsigned char> > tb2( (*rootgeo).getUncompressedBlob() );
81 // //here you can implement the stream for putting the TFile on disk...
82 // std::string outfile2("XML2_retrieved.xml") ;
83 // ofstream output2(outfile2.c_str()) ;
84 // output2.write((const char *)&(*tb2)[0], tb2->size());
85 // output2.close() ;
86  // boost::scoped_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
87  }
88  }
89 
91 }
int i
Definition: DBlmapReader.cc:9
DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &pset)
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
heterocontainer::HCTypeTag TypeTag
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:33
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:129