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 <memory>
4 #include <vector>
5 #include <fstream>
6 
20 
21 namespace edmtest {
23  public:
24  explicit DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet & pset);
25  explicit DQMXMLFileEventSetupAnalyzer(int i);
27  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
28  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override ;
29  private:
30  bool init_ ;
32  };
33 
34  DQMXMLFileEventSetupAnalyzer::DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps):labelToGet_(ps.getParameter<std::string>("labelToGet")) {
35  init_ = false ;
36  //std::cout << "DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
37  }
38 
40  init_ = false ;
41  //std::cout << "DQMXMLFileEventSetupAnalyzer(int i) " << i << std::endl;
42  }
43 
45  {
46  init_ = false ;
47  //std::cout << "~DQMXMLFileEventSetupAnalyzer" << std::endl;
48  }
49 
51  {
52  return ;
53  }
54 
56  {
57  //std::cout << "DQMXMLFileEventSetupAnalyzer::beginRun()" << std::endl;
58  if(!init_)
59  {
60  init_ = true ;
63  throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd"
64  << "\" does not exist!" << std::endl;
65  }
67  iSetup.get<DQMXMLFileRcd>().get(labelToGet_,rootgeo);
68  //std::cout<<"XML FILE IN MEMORY 1 with label " << labelToGet_ <<std::endl;
69  std::unique_ptr<std::vector<unsigned char> > tb1( (*rootgeo).getUncompressedBlob() );
70  //here you can implement the stream for putting the TFile on disk...
71  std::string outfile1("XML1_retrieved.xml") ;
72  std::ofstream output1(outfile1.c_str()) ;
73  output1.write((const char *)&(*tb1)[0], tb1->size());
74  output1.close() ;
75 
76 // iSetup.get<DQMXMLFileRcd>().get("XML2_mio",rootgeo);
77 // std::cout<<"ROOT FILE IN MEMORY 2"<<std::endl;
78 // std::unique_ptr<std::vector<unsigned char> > tb2( (*rootgeo).getUncompressedBlob() );
79 // //here you can implement the stream for putting the TFile on disk...
80 // std::string outfile2("XML2_retrieved.xml") ;
81 // std::ofstream output2(outfile2.c_str()) ;
82 // output2.write((const char *)&(*tb2)[0], tb2->size());
83 // output2.close() ;
84  // std::unique_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
85  }
86  }
87 
89 }
int i
Definition: DBlmapReader.cc:9
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
return((rh^lh)&mask)
DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &pset)
int iEvent
Definition: GenABIO.cc:230
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
const T & get() const
Definition: EventSetup.h:56
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
heterocontainer::HCTypeTag TypeTag
volatile std::atomic< bool > shutdown_flag false
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:43
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