CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BTagPerformaceRootProducerFromSQLITE.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: BTagPerformaceRootProducerFromSQLITE
4 // Class: BTagPerformaceRootProducerFromSQLITE
5 //
13 //
14 // Original Author: "Salvatore Rappoccio"
15 // Created: Thu Feb 11 14:21:59 CST 2010
16 // $Id: BTagPerformaceRootProducerFromSQLITE.cc,v 1.3 2010/06/04 18:04:31 srappocc Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
29 
32 
34 
37 
41 
44 
46 
47 
48 
49 //
50 // class declaration
51 //
52 
54  public:
57 
58 
59  private:
60  virtual void beginJob() ;
61  virtual void analyze(const edm::Event&, const edm::EventSetup&);
62  virtual void endJob() ;
63 
64  // ----------member data ---------------------------
65  std::vector<std::string> names_;
67  std::auto_ptr<fwlite::RecordWriter> writer_;
69 };
70 
71 //
72 // constants, enums and typedefs
73 //
74 
75 //
76 // static data member definitions
77 //
78 
79 //
80 // constructors and destructor
81 //
83  names_(iConfig.getParameter< std::vector<std::string> >("names"))
84 {
85 }
86 
87 
89 {
90 }
91 
92 
93 //
94 // member functions
95 //
96 
97 // ------------ method called to for each event ------------
98 void
100 {
101 
102  std::cout << "Hello from BTagPerformaceRootProducerFromSQLITE!" << std::endl;
103  if(recWatcher_.check(iSetup)) {
105 
106  if(! writer_.get()) {
108  TFile * f = &(fs->file());
109  writer_ = std::auto_ptr<fwlite::RecordWriter>(new fwlite::RecordWriter(r.key().name(), f ));
110  }
112 
113  for( size_t i=0; i<names_.size(); i++ )
114  {
116  std::cout <<" Studying performance with label " << names_.at(i) <<std::endl;
117  r.get( names_.at(i), perfH );
118  const BtagPerformance & perf = *(perfH.product());
119 
120  writer_->update(&(perf.payload()), typeid(PerformancePayload),names_.at(i).c_str());
121  writer_->update(&(perf.workingPoint()), typeid(PerformanceWorkingPoint),names_.at(i).c_str());
122  }
124  r.validityInterval().first().time()));
125  }
126 }
127 
128 
129 // ------------ method called once each job just before starting event loop ------------
130 void
132 {
133 }
134 
135 // ------------ method called once each job just after ending the event loop ------------
136 void
138  /*if(writer_.get()) {
139  writer_->fill(edm::ESRecordAuxiliary(lastValue_.eventID(),
140  lastValue_.time()));
141  writer_->write();
142  } */
143 }
144 
145 //define this as a plug-in
int i
Definition: DBlmapReader.cc:9
virtual const PerformanceWorkingPoint & workingPoint() const
const EventID & eventID() const
Definition: IOVSyncValue.h:42
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const IOVSyncValue & last() const
int iEvent
Definition: GenABIO.cc:243
edm::ESWatcher< BTagPerformanceRecord > recWatcher_
void get(HolderT &iHolder) const
double f[11][100]
TFile & file() const
return opened TFile
Definition: TFileService.h:23
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const Timestamp & time() const
Definition: IOVSyncValue.h:44
tuple cout
Definition: gather_cfg.py:121
const IOVSyncValue & first() const
ValidityInterval const & validityInterval() const
virtual const PerformancePayload & payload() const