File indexing completed on 2024-04-06 12:04:12
0001 #include <vector>
0002 #include <typeinfo>
0003 #include <TFile.h>
0004 #include <TClass.h>
0005 #include <TROOT.h>
0006
0007 using namespace std;
0008
0009 #if defined(__CINT__) && !defined(__MAKECINT__)
0010 class loadFWLite {
0011 public:
0012 loadFWLite() {
0013 gSystem->Load("libFWCoreFWLite");
0014 FWLiteEnabler::enable();
0015 }
0016 };
0017
0018 static loadFWLite lfw;
0019
0020 #if 0
0021 namespace edm {
0022 typedef
0023 edm::Wrapper<vector<int> >
0024 Wrapper<vector<int,allocator<int> > >;
0025 }
0026 #endif
0027 #endif
0028
0029 #include "DataFormats/FWLite/interface/Handle.h"
0030
0031 #if !defined(__CINT__) && !defined(__MAKECINT__)
0032 #include "DataFormats/Common/interface/Wrapper.h"
0033 #endif
0034
0035 void vector_int_cint()
0036 {
0037 gROOT->ProcessLine(".autodict");
0038 const std::type_info& t = edm::Wrapper<vector<int> >::typeInfo();
0039 TClass* tc = TClass::GetClass(t);
0040 std::cout << tc->GetName() << std::endl;
0041
0042 TFile f1("vectorinttest.root");
0043 fwlite::Event ev(&f1);
0044 fwlite::Handle<vector<int> > vip;
0045
0046 for (ev.toBegin(); ! ev.atEnd(); ++ev) {
0047 edm::EventID id = ev.id();
0048 cout << "Run " << id.run() << " event " << id.event() << endl;
0049 vip.getByLabel(ev,"VIP");
0050 for (unsigned int i=0; i != vip.ref().size(); ++i) {
0051 cout <<vip.ref().at(i)<<" ";
0052 }
0053 cout << endl;
0054 }
0055 }