Skip to content
Snippets Groups Projects
Commit f5fa0711 authored by Arthur Charles Kraus's avatar Arthur Charles Kraus
Browse files

First changes to WriteReadEnum.cxx

parent 1f8bc2be
No related tags found
No related merge requests found
// Do NOT change. Changes will be lost next time file is generated
#define R__DICTIONARY_FILENAME MyPersClassDict
#define R__NO_DEPRECATION
/*******************************************************************/
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define G__DICTIONARY
#include "ROOT/RConfig.hxx"
#include "TClass.h"
#include "TDictAttributeMap.h"
#include "TInterpreter.h"
#include "TROOT.h"
#include "TBuffer.h"
#include "TMemberInspector.h"
#include "TInterpreter.h"
#include "TVirtualMutex.h"
#include "TError.h"
#ifndef G__ROOT
#define G__ROOT
#endif
#include "RtypesImp.h"
#include "TIsAProxy.h"
#include "TFileMergeInfo.h"
#include <algorithm>
#include "TCollectionProxyInfo.h"
/*******************************************************************/
#include "TDataMember.h"
// Header files passed as explicit arguments
#include "MyPersClass.h"
// Header files passed via #pragma extra_include
// The generated code does not explicitly qualify STL entities
namespace std {} using namespace std;
namespace ROOT {
static TClass *MyEnumClass_Dictionary();
static void MyEnumClass_TClassManip(TClass*);
static void *new_MyEnumClass(void *p = nullptr);
static void *newArray_MyEnumClass(Long_t size, void *p);
static void delete_MyEnumClass(void *p);
static void deleteArray_MyEnumClass(void *p);
static void destruct_MyEnumClass(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MyEnumClass*)
{
::MyEnumClass *ptr = nullptr;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::MyEnumClass));
static ::ROOT::TGenericClassInfo
instance("MyEnumClass", "", 10,
typeid(::MyEnumClass), ::ROOT::Internal::DefineBehavior(ptr, ptr),
&MyEnumClass_Dictionary, isa_proxy, 4,
sizeof(::MyEnumClass) );
instance.SetNew(&new_MyEnumClass);
instance.SetNewArray(&newArray_MyEnumClass);
instance.SetDelete(&delete_MyEnumClass);
instance.SetDeleteArray(&deleteArray_MyEnumClass);
instance.SetDestructor(&destruct_MyEnumClass);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MyEnumClass*)
{
return GenerateInitInstanceLocal(static_cast<::MyEnumClass*>(nullptr));
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal(static_cast<const ::MyEnumClass*>(nullptr)); R__UseDummy(_R__UNIQUE_DICT_(Init));
// Dictionary for non-ClassDef classes
static TClass *MyEnumClass_Dictionary() {
TClass* theClass =::ROOT::GenerateInitInstanceLocal(static_cast<const ::MyEnumClass*>(nullptr))->GetClass();
MyEnumClass_TClassManip(theClass);
return theClass;
}
static void MyEnumClass_TClassManip(TClass* ){
}
} // end of namespace ROOT
namespace ROOT {
static TClass *MyPersClass_Dictionary();
static void MyPersClass_TClassManip(TClass*);
static void *new_MyPersClass(void *p = nullptr);
static void *newArray_MyPersClass(Long_t size, void *p);
static void delete_MyPersClass(void *p);
static void deleteArray_MyPersClass(void *p);
static void destruct_MyPersClass(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MyPersClass*)
{
::MyPersClass *ptr = nullptr;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::MyPersClass));
static ::ROOT::TGenericClassInfo
instance("MyPersClass", "", 16,
typeid(::MyPersClass), ::ROOT::Internal::DefineBehavior(ptr, ptr),
&MyPersClass_Dictionary, isa_proxy, 4,
sizeof(::MyPersClass) );
instance.SetNew(&new_MyPersClass);
instance.SetNewArray(&newArray_MyPersClass);
instance.SetDelete(&delete_MyPersClass);
instance.SetDeleteArray(&deleteArray_MyPersClass);
instance.SetDestructor(&destruct_MyPersClass);
return &instance;
}
TGenericClassInfo *GenerateInitInstance(const ::MyPersClass*)
{
return GenerateInitInstanceLocal(static_cast<::MyPersClass*>(nullptr));
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal(static_cast<const ::MyPersClass*>(nullptr)); R__UseDummy(_R__UNIQUE_DICT_(Init));
// Dictionary for non-ClassDef classes
static TClass *MyPersClass_Dictionary() {
TClass* theClass =::ROOT::GenerateInitInstanceLocal(static_cast<const ::MyPersClass*>(nullptr))->GetClass();
MyPersClass_TClassManip(theClass);
return theClass;
}
static void MyPersClass_TClassManip(TClass* ){
}
} // end of namespace ROOT
namespace ROOT {
// Wrappers around operator new
static void *new_MyEnumClass(void *p) {
return p ? new(p) ::MyEnumClass : new ::MyEnumClass;
}
static void *newArray_MyEnumClass(Long_t nElements, void *p) {
return p ? new(p) ::MyEnumClass[nElements] : new ::MyEnumClass[nElements];
}
// Wrapper around operator delete
static void delete_MyEnumClass(void *p) {
delete (static_cast<::MyEnumClass*>(p));
}
static void deleteArray_MyEnumClass(void *p) {
delete [] (static_cast<::MyEnumClass*>(p));
}
static void destruct_MyEnumClass(void *p) {
typedef ::MyEnumClass current_t;
(static_cast<current_t*>(p))->~current_t();
}
} // end of namespace ROOT for class ::MyEnumClass
namespace ROOT {
// Wrappers around operator new
static void *new_MyPersClass(void *p) {
return p ? new(p) ::MyPersClass : new ::MyPersClass;
}
static void *newArray_MyPersClass(Long_t nElements, void *p) {
return p ? new(p) ::MyPersClass[nElements] : new ::MyPersClass[nElements];
}
// Wrapper around operator delete
static void delete_MyPersClass(void *p) {
delete (static_cast<::MyPersClass*>(p));
}
static void deleteArray_MyPersClass(void *p) {
delete [] (static_cast<::MyPersClass*>(p));
}
static void destruct_MyPersClass(void *p) {
typedef ::MyPersClass current_t;
(static_cast<current_t*>(p))->~current_t();
}
} // end of namespace ROOT for class ::MyPersClass
namespace ROOT {
static TClass *vectorlEMyPersClassgR_Dictionary();
static void vectorlEMyPersClassgR_TClassManip(TClass*);
static void *new_vectorlEMyPersClassgR(void *p = nullptr);
static void *newArray_vectorlEMyPersClassgR(Long_t size, void *p);
static void delete_vectorlEMyPersClassgR(void *p);
static void deleteArray_vectorlEMyPersClassgR(void *p);
static void destruct_vectorlEMyPersClassgR(void *p);
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const vector<MyPersClass>*)
{
vector<MyPersClass> *ptr = nullptr;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<MyPersClass>));
static ::ROOT::TGenericClassInfo
instance("vector<MyPersClass>", -2, "vector", 423,
typeid(vector<MyPersClass>), ::ROOT::Internal::DefineBehavior(ptr, ptr),
&vectorlEMyPersClassgR_Dictionary, isa_proxy, 4,
sizeof(vector<MyPersClass>) );
instance.SetNew(&new_vectorlEMyPersClassgR);
instance.SetNewArray(&newArray_vectorlEMyPersClassgR);
instance.SetDelete(&delete_vectorlEMyPersClassgR);
instance.SetDeleteArray(&deleteArray_vectorlEMyPersClassgR);
instance.SetDestructor(&destruct_vectorlEMyPersClassgR);
instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<MyPersClass> >()));
instance.AdoptAlternate(::ROOT::AddClassAlternate("vector<MyPersClass>","std::vector<MyPersClass, std::allocator<MyPersClass> >"));
return &instance;
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal(static_cast<const vector<MyPersClass>*>(nullptr)); R__UseDummy(_R__UNIQUE_DICT_(Init));
// Dictionary for non-ClassDef classes
static TClass *vectorlEMyPersClassgR_Dictionary() {
TClass* theClass =::ROOT::GenerateInitInstanceLocal(static_cast<const vector<MyPersClass>*>(nullptr))->GetClass();
vectorlEMyPersClassgR_TClassManip(theClass);
return theClass;
}
static void vectorlEMyPersClassgR_TClassManip(TClass* ){
}
} // end of namespace ROOT
namespace ROOT {
// Wrappers around operator new
static void *new_vectorlEMyPersClassgR(void *p) {
return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<MyPersClass> : new vector<MyPersClass>;
}
static void *newArray_vectorlEMyPersClassgR(Long_t nElements, void *p) {
return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<MyPersClass>[nElements] : new vector<MyPersClass>[nElements];
}
// Wrapper around operator delete
static void delete_vectorlEMyPersClassgR(void *p) {
delete (static_cast<vector<MyPersClass>*>(p));
}
static void deleteArray_vectorlEMyPersClassgR(void *p) {
delete [] (static_cast<vector<MyPersClass>*>(p));
}
static void destruct_vectorlEMyPersClassgR(void *p) {
typedef vector<MyPersClass> current_t;
(static_cast<current_t*>(p))->~current_t();
}
} // end of namespace ROOT for class vector<MyPersClass>
namespace {
void TriggerDictionaryInitialization_MyPersClassDict_Impl() {
static const char* headers[] = {
"0",
nullptr
};
static const char* includePaths[] = {
"/cvmfs/atlas.cern.ch/repo/sw/software/25.0/sw/lcg/releases/ROOT/6.28.12-68fe1/x86_64-el9-gcc13-opt/include/",
"/data/akraus/xAODwork/working_attempt/athena-25.0.8/rntuple-enum-debug/src/",
nullptr
};
static const char* fwdDeclCode = R"DICTFWDDCLS(
#line 1 "MyPersClassDict dictionary forward declarations' payload"
#pragma clang diagnostic ignored "-Wkeyword-compat"
#pragma clang diagnostic ignored "-Wignored-attributes"
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
extern int __Cling_AutoLoading_Map;
class MyPersClass;
namespace std{template <typename _Tp> class __attribute__((annotate("$clingAutoload$bits/allocator.h"))) __attribute__((annotate("$clingAutoload$string"))) allocator;
}
class MyEnumClass;
)DICTFWDDCLS";
static const char* payloadCode = R"DICTPAYLOAD(
#line 1 "MyPersClassDict dictionary payload"
#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
/**
* Author: Alaettin Serhan Mete <amete@anl.gov>
*/
#include <vector>
// Dummy Class to define the Enum
class MyEnumClass {
public:
enum MyEnum { ZERO=0, ONE, UNKNOWN };
};
// This is the class that gets persistified
class MyPersClass {
public:
MyPersClass() : m_float(-1.f), m_enum(MyEnumClass::UNKNOWN) { }
MyPersClass(const float fval, const MyEnumClass::MyEnum eval) : m_float(fval), m_enum(eval) { }
float get_float() const { return m_float; }
MyEnumClass::MyEnum get_enum() const { return m_enum; }
private:
float m_float;
MyEnumClass::MyEnum m_enum;
};
// Instantiate all necessary types for the dictionary
namespace {
struct GCCXML_DUMMY_INSTANTIATION {
std::vector<MyPersClass> dummy;
};
}
#undef _BACKWARD_BACKWARD_WARNING_H
)DICTPAYLOAD";
static const char* classesHeaders[] = {
"MyEnumClass", payloadCode, "@",
"MyEnumClass::MyEnum", payloadCode, "@",
"MyPersClass", payloadCode, "@",
nullptr
};
static bool isInitialized = false;
if (!isInitialized) {
TROOT::RegisterModule("MyPersClassDict",
headers, includePaths, payloadCode, fwdDeclCode,
TriggerDictionaryInitialization_MyPersClassDict_Impl, {}, classesHeaders, /*hasCxxModule*/false);
isInitialized = true;
}
}
static struct DictInit {
DictInit() {
TriggerDictionaryInitialization_MyPersClassDict_Impl();
}
} __TheDictionaryInitializer;
}
void TriggerDictionaryInitialization_MyPersClassDict() {
TriggerDictionaryInitialization_MyPersClassDict_Impl();
}
......@@ -2,12 +2,13 @@
* Author: Alaettin Serhan Mete <amete@anl.gov>
*/
#define VERSION 0 // 0: RNTuple, 1: TTree
#define VERSION 1 // 0: RNTuple, 1: TTree
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleModel.hxx>
// #include <ROOT/RNTuple.hxx>
// #include <ROOT/RNTupleModel.hxx>
#include <TFile.h>
#include <TTree.h>
#include "xAODDummyElectron/DummyElectron.h"
#include "MyPersClass.h"
......@@ -15,9 +16,9 @@
#include <string>
#include <vector>
using RNTupleModel = ROOT::Experimental::RNTupleModel;
using RNTupleReader = ROOT::Experimental::RNTupleReader;
using RNTupleWriter = ROOT::Experimental::RNTupleWriter;
//using RNTupleModel = ROOT::Experimental::RNTupleModel;
//using RNTupleReader = ROOT::Experimental::RNTupleReader;
//using RNTupleWriter = ROOT::Experimental::RNTupleWriter;
int main(int argc, char *argv[]) {
// Make sure we have enough arguments
......@@ -30,27 +31,12 @@ int main(int argc, char *argv[]) {
// Write Here
{
if(VERSION == 0) { // RNTuple version
auto model = RNTupleModel::Create();
auto field = model->MakeField<std::vector<MyPersClass>>("foo");
auto ntuple = RNTupleWriter::Recreate(std::move(model), ntupleName, outputName);
for (unsigned i = 0; i < 10; ++i) {
field->clear();
for (unsigned j = 0; j < 10; ++j) {
field->emplace_back(i*j, j<5 ? MyEnumClass::ZERO : MyEnumClass::ONE);
}
ntuple->Fill();
}
} else if(VERSION == 1) { // TTree version
if(VERSION == 1) { // TTree version
TFile* f = TFile::Open(outputName.c_str(), "RECREATE");
TTree* t = new TTree(ntupleName.c_str(), "");
std::vector<MyPersClass> result;
t->Branch("foo", &result);
xAOD::DummyElectron e;
t->Branch("foo", &e);
for (unsigned i = 0; i < 10; ++i) {
result.clear();
for (unsigned j = 0; j < 10; ++j) {
result.emplace_back(i*j, j<5 ? MyEnumClass::ZERO : MyEnumClass::ONE);
}
t->Fill();
}
f->Write();
......@@ -60,10 +46,7 @@ int main(int argc, char *argv[]) {
// Read Here
{
if(VERSION == 0) { // RNTuple version
auto ntuple = RNTupleReader::Open(ntupleName, outputName);
ntuple->Show(9);
} else if (VERSION == 1) { // TTree version
if (VERSION == 1) { // TTree version
TFile* f = TFile::Open(outputName.c_str(), "OPEN");
TTree* t = f->Get<TTree>(ntupleName.c_str());
t->Show(9);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment