#include #include #include #include class Data { public: unsigned int entry; unsigned int twoTimesEntry; TComplex value; double normOfValue; std::vector values; double normOfSum; ClassDef(Data, 2) }; #pragma read sourceClass="Data" version="[1]" targetClass="Data" \ source="unsigned int entry" target="twoTimesEntry" \ code="{ twoTimesEntry = 2 * onfile.entry; }" #pragma read sourceClass="Data" version="[1]" targetClass="Data" \ source="TComplex value" target="normOfValue" \ code="{ normOfValue = onfile.value.Rho2(); }" #pragma read sourceClass="Data" version="[1]" targetClass="Data" \ source="std::vector values" target="normOfSum" \ code="{ TComplex sum; for (size_t i=0; iGetObject("tree", tree); Data* pData = NULL; tree->SetBranchAddress("data", &pData); for (unsigned int i=0; i<10; ++i) { tree->GetEntry(i); std::cout << "tree entry " << pData->entry << " contains " << pData->values.size() << " entries, " << "the entry number times two is " << pData->twoTimesEntry << ", " << "the norm of the value is " << pData->normOfValue << ", " << "the norm of the sum of the values is " << pData->normOfSum << std::endl; } file->Close(); delete file; }