141 ndim +=
element->GetArrayDim();
155 }
else if (ndim==1) {
166 result +=
"TMultiArrayType<";
216 fMaxDatamemberType(2),
223 fCurrentListOfTopProxies(&fListOfTopProxies)
240 fMaxDatamemberType(2),
247 fCurrentListOfTopProxies(&fListOfTopProxies)
270 if (desc==
nullptr)
return nullptr;
277 if (!
existing->IsEquivalent( desc ) ) {
300 if (desc==
nullptr)
return;
307 if (!
existing->IsEquivalent( desc ) ) {
352 if (
strstr(classname,
"<")!=
nullptr) {
356 if (
gDebug>=6)
Warning(
"AddForward",
"Forward declaration of templated class not implemented yet.");
357 }
else if (
strcmp(classname,
"string")==0) {
398 Warning(
"TTreeProxyGenerator",
"The branch name \"%s\" is duplicated. Only the first instance \n"
399 "\twill be available directly. The other instance(s) might be available via their complete name\n"
400 "\t(including the name of their mother branche's name).",desc->
GetName());
456 if (
nest == 1) last = i + 1;
459 if (
nest == 0)
return;
554 }
else if (
branch->GetType() == 3) {
557 }
else if (
branch->GetType() == 4) {
568 }
else if (
mom->GetType()!=3 &&
mom->GetType() != 4) {
586 Error(
"AnalyzeBranches",
"Ran out of branches when looking in branch %s, class %s",
589 Error(
"AnalyzeBranches",
"Ran out of branches when looking in class %s, element %s",
595 if (
info->GetClass()->GetCollectionProxy() &&
strcmp(
element->GetName(),
"This")==0) {
728 if (
branch->GetListOfBranches()->GetEntries()) {
747 if (
branch->GetListOfBranches()->GetEntries() == 0) {
820 if (
branch->GetListOfBranches()->GetEntries() == 0) {
898 Error(
"AnalyzeBranch",
899 "Unsupported type for %s (%d).",
930 Error(
"AnalyzeOldLeaf",
"TLeafObject not supported yet");
942 std::vector<Int_t>
maxDim;
947 pos = temp.
Index(
"[");
949 if (pos) temp.
Remove(0,pos);
952 temp =
leaf->GetTitle();
953 pos = temp.
Index(
"[");
955 if (pos) temp.
Remove(0,pos);
968 if (current[0] ==
']') {
979 current = (
char*)
strstr( current,
"[" );
1008 type =
"TArrayProxy<";
1010 type +=
"TMultiArrayType<";
1012 type +=
"TArrayType<";
1034 true,
false,
true ),
1040 true,
false,
true ) );
1110 TIter next( tree->GetListOfBranches() );
1115 const char *classname =
branch->GetClassName();
1116 if (classname &&
strlen(classname)) {
1137 Error(
"AnalyzeTree",
1138 "Introspection of TClonesArray in older file not implemented yet.");
1153 Error(
"AnalyzeTree",
1154 "Introspection of TClonesArray for %s failed.",
branch->GetName());
1185 if (
branch->GetListOfBranches()->GetEntries() == 0 ) {
1212 true,
false,
false ) );
1246 if (tree->GetTree()->GetListOfFriends()) {
1292 }
else if (
topdesc->IsSTL()) {
1473 if (
cname.Length()==0) {
1474 Error(
"AnalyzeTree",
1475 "Introspection of TClonesArray in older file not implemented yet.");
1484 else Error(
"AnalyzeTree",
"missing class for %s.",
branch->GetName());
1495 Error(
"AnalyzeTree",
1496 "Unsupported type for %s %s %d",
1539 Error(
"AnalyzeTree",
"topdesc should not be null in TTreeProxyGenerator::AnalyzeElement.");
1566 if (!cl)
return false;
1600 Error(
"WriteProxy",
"No user script has been specified.");
1607 incPath.Append(
":").Prepend(
" ");
1608 incPath.ReplaceAll(
" -I",
":");
1609 while (
incPath.Index(
" :") != -1 ) {
1663 Error(
"WriteProxy",
"User's script (%s) has no extension! Nothing will be written.",
scriptfunc.Data());
1670 const char *
extensions[] = {
".h",
".hh",
".hpp",
".hxx",
".hPP",
".hXX" };
1673 for (i = 0; i < 6; i++ ) {
1694 for (i = 0; i < 6; i++ ) {
1716 if (
hf ==
nullptr) {
1717 Error(
"WriteProxy",
"Unable to open the file %s for writing.",
1725 fprintf(
hf,
"/////////////////////////////////////////////////////////////////////////\n");
1726 fprintf(
hf,
"// This class has been automatically generated \n");
1727 fprintf(
hf,
"// (at %s by ROOT version %s)\n",
td.AsString(),
gROOT->GetVersion());
1734 fprintf(
hf,
"/////////////////////////////////////////////////////////////////////////\n");
1744 fprintf(
hf,
"#define R__BRANCHPROXY_GENERATOR_VERSION 2\n\n");
1745 fprintf(
hf,
"// ROOT headers needed by the proxy\n");
1752 fprintf(
hf,
"#include <TBranchProxy.h>\n");
1753 fprintf(
hf,
"#include <TBranchProxyDirector.h>\n");
1754 fprintf(
hf,
"#include <TBranchProxyTemplate.h>\n");
1755 fprintf(
hf,
"#include <TFriendProxy.h>\n");
1756 fprintf(
hf,
"using namespace ROOT::Internal;\n");
1757 fprintf(
hf,
"using ROOT::Detail::TBranchProxy;\n");
1760 fprintf(
hf,
"// forward declarations needed by this particular proxy\n");
1763 while ( (current=next()) ) {
1773 fprintf(
hf,
"// Header needed by this particular proxy\n");
1776 while ( (header = next()) ) {
1782 fprintf(
hf,
" // This class defines the list of methods that are directly used by %s,\n",classname.
Data());
1783 fprintf(
hf,
" // and that can be overloaded in the user's script\n");
1796 fprintf(
hf,
" TTree *fChain; //!pointer to the analyzed TTree or TChain\n");
1797 fprintf(
hf,
" TH1 *htemp; //!pointer to the histogram\n");
1798 fprintf(
hf,
" TBranchProxyDirector fDirector; //!Manages the proxys\n\n");
1800 fprintf(
hf,
" // Optional User methods\n");
1801 fprintf(
hf,
" TClass *fClass; // Pointer to this class's description\n");
1804 fprintf(
hf,
"\n // Wrapper class for each unwounded class\n");
1813 fprintf(
hf,
"\n // Wrapper class for each friend TTree\n");
1821 fprintf(
hf,
"\n // Proxy for each of the branches, leaves and friends of the tree\n");
1841 fprintf(
hf,
",\n fClass (TClass::GetClass(\"%s\"))",classname.
Data());
1844 fprintf(
hf,
",\n %-*s(&fDirector,\"%s\")",
1850 fprintf(
hf,
",\n %-*s(&fDirector,tree,%d)",
1858 fprintf(
hf,
" Int_t Version() const override {return 1;}\n");
1859 fprintf(
hf,
" void Begin(::TTree *tree) override;\n");
1860 fprintf(
hf,
" void SlaveBegin(::TTree *tree) override;\n");
1861 fprintf(
hf,
" void Init(::TTree *tree) override;\n");
1862 fprintf(
hf,
" bool Notify() override;\n");
1863 fprintf(
hf,
" bool Process(Long64_t entry) override;\n");
1864 fprintf(
hf,
" void SlaveTerminate() override;\n");
1865 fprintf(
hf,
" void Terminate() override;\n");
1870 fprintf(
hf,
"//inject the user's code\n");
1888 fprintf(
hf,
"#pragma link C++ class %s::%s-;\n",classname.
Data(),
clp->GetName());
1889 if (
clp->GetContainerName().Length()) {
1899 fprintf(
hf,
"#pragma link C++ class %s;\n",classname.
Data());
1905 fprintf(
hf,
" // destructor. Clean up helpers.\n");
1909 fprintf(
hf,
"inline void %s::Init(TTree *tree)\n",classname.
Data());
1911 fprintf(
hf,
"// Set branch addresses\n");
1912 fprintf(
hf,
" if (tree == 0) return;\n");
1914 fprintf(
hf,
" fDirector.SetTree(fChain);\n");
1916 fprintf(
hf,
" htemp = fDirector.CreateHistogram(GetOption());\n");
1928 fprintf(
hf,
" // Called when loading a new file.\n");
1929 fprintf(
hf,
" // Get branch pointers.\n");
1930 fprintf(
hf,
" fDirector.SetTree(fChain);\n");
1939 fprintf(
hf,
"inline void %s::Begin(TTree *tree)\n",classname.
Data());
1941 fprintf(
hf,
" // The Begin() function is called at the start of the query.\n");
1942 fprintf(
hf,
" // When running with PROOF Begin() is only called on the client.\n");
1943 fprintf(
hf,
" // The tree argument is deprecated (on PROOF 0 is passed).\n");
1945 fprintf(
hf,
" TString option = GetOption();\n");
1952 fprintf(
hf,
"inline void %s::SlaveBegin(TTree *tree)\n",classname.
Data());
1954 fprintf(
hf,
" // The SlaveBegin() function is called after the Begin() function.\n");
1955 fprintf(
hf,
" // When running with PROOF SlaveBegin() is called on each slave server.\n");
1956 fprintf(
hf,
" // The tree argument is deprecated (on PROOF 0 is passed).\n");
1966 fprintf(
hf,
"inline bool %s::Process(Long64_t entry)\n",classname.
Data());
1969 fprintf(
hf,
" // The Process() function is called for each entry in the tree (or possibly\n"
1970 " // keyed object in the case of PROOF) to be processed. The entry argument\n"
1971 " // specifies which entry in the currently loaded tree is to be processed.\n"
1972 " // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()\n"
1973 " // to read either all or the required parts of the data. When processing\n"
1974 " // keyed objects with PROOF, the object is already loaded and is available\n"
1975 " // via the fObject pointer.\n"
1977 " // This function should contain the \"body\" of the analysis. It can contain\n"
1978 " // simple or elaborate selection criteria, run algorithms on the data\n"
1979 " // of the event and typically fill histograms.\n\n");
1980 fprintf(
hf,
" // WARNING when a selector is used with a TChain, you must use\n");
1981 fprintf(
hf,
" // the pointer to the current TTree to call GetEntry(entry).\n");
1982 fprintf(
hf,
" // The entry is always the local entry number in the current tree.\n");
1983 fprintf(
hf,
" // Assuming that fChain is the pointer to the TChain being processed,\n");
1984 fprintf(
hf,
" // use fChain->GetTree()->GetEntry(entry).\n");
1987 fprintf(
hf,
" fDirector.SetReadEntry(entry);\n");
2007 fprintf(
hf,
"inline void %s::SlaveTerminate()\n",classname.
Data());
2009 fprintf(
hf,
" // The SlaveTerminate() function is called after all entries or objects\n"
2010 " // have been processed. When running with PROOF SlaveTerminate() is called\n"
2011 " // on each slave server.");
2017 fprintf(
hf,
"inline void %s::Terminate()\n",classname.
Data());
2019 fprintf(
hf,
" // Function called at the end of the event loop.\n");
2020 fprintf(
hf,
" htemp = (TH1*)fObject;\n");
2021 fprintf(
hf,
" Int_t drawflag = (htemp && htemp->GetEntries()>0);\n");
2023 fprintf(
hf,
" if (gPad && !drawflag && !fOption.Contains(\"goff\") && !fOption.Contains(\"same\")) {\n");
2026 fprintf(
hf,
" if (fOption.Contains(\"goff\")) drawflag = false;\n");
2027 fprintf(
hf,
" if (drawflag) htemp->Draw(fOption);\n");
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void ErrorHandler(int level, const char *location, const char *fmt, std::va_list va)
General error handler function. It calls the user set error handler.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
void Debug(Int_t level, const char *fmt,...)
const char * GetRawSymbol() const
Get the real symbol name.
const char * GetTypeName()
Get the name of the type of the data member.
TList * GetListOfTopProxies()
Base class for code generators like TTreeProxyGenerator and TTreeReaderGenerator.
TList fListOfHeaders
List of included headers.
void AddHeader(TClass *cl)
Add a header inclusion request.
TVirtualStreamerInfo * GetStreamerInfo(TBranch *branch, TIter current, TClass *cl)
Return the correct TStreamerInfo of class 'cl' in the list of branches (current) [Assuming these bran...
TVirtualStreamerInfo * GetBaseClass(TStreamerElement *element)
Check if element is a base class and if yes, return the base class.
TTree * fTree
Pointer to the tree.
TString fOptionStr
User options as a string.
TString GetContainedClassName(TBranchElement *branch, TStreamerElement *element, bool ispointer)
Get name of class inside a container.
void AnalyzeTree(TTree *tree)
Analyze a TTree and its (potential) friends.
TBranchProxyClassDescriptor * AddClass(TBranchProxyClassDescriptor *desc)
Add a Class Descriptor.
void AddDescriptor(TBranchProxyDescriptor *desc)
Add a branch descriptor.
void AddPragma(const char *pragma_text)
Add a forward declaration request.
UInt_t AnalyzeOldLeaf(TLeaf *leaf, UInt_t level, TBranchProxyClassDescriptor *topdesc)
Analyze the leaf and populate the `TTreeProxyGenerator or the topdesc with its findings.
UInt_t AnalyzeOldBranch(TBranch *branch, UInt_t level, TBranchProxyClassDescriptor *desc)
Analyze the branch and populate the TTreeProxyGenerator or the topdesc with its findings.
void AnalyzeElement(TBranch *branch, TStreamerElement *element, UInt_t level, TBranchProxyClassDescriptor *desc, const char *path)
Analyze the element and populate the TTreeProxyGenerator or the topdesc with its findings.
TTreeProxyGenerator(TTree *tree, const char *script, const char *fileprefix, const char *option, UInt_t maxUnrolling)
Constructor.
void AddFriend(TFriendProxyDescriptor *desc)
Add Friend descriptor.
void CheckForMissingClass(const char *clname)
Check if the template parameter refers to an enum and/or a missing class (we can't tell those 2 apart...
void ParseOptions()
Parse the options string.
TList * fCurrentListOfTopProxies
void AddForward(TClass *cl)
Add a forward declaration request.
bool NeedToEmulate(TClass *cl, UInt_t level)
Return true if we should create a nested class representing this class.
void AddMissingClassAsEnum(const char *clname, bool isscope)
Generate an enum for a given type if it is not known in the list of class unless the type itself a te...
UInt_t AnalyzeBranches(UInt_t level, TBranchProxyClassDescriptor *topdesc, TBranchElement *branch, TVirtualStreamerInfo *info=nullptr)
Analyze the sub-branch and populate the TTreeProxyGenerator or the topdesc with its findings.
void WriteProxy()
Check whether the file exist and do something useful if it does.
UInt_t fMaxDatamemberType
A Branch for the case of an object.
A TTree is a list of TBranches.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
An array of clone (identical) objects.
TClass * GetClass() const
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
virtual TFile * GetFile() const
A TFriendElement TF describes a TTree object TF in a file.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Collectable string class.
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual const char * GetIncludePath()
Get the list of include path.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual int Unlink(const char *name)
Unlink, i.e.
A TTree represents a columnar dataset.
TDirectory * GetDirectory() const
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
Abstract Interface class describing Streamer information for one class.
@ kUChar
Equal to TDataType's kchar.
TString GetArrayType(TStreamerElement *element, const char *subtype, TTreeProxyGenerator::EContainer container)
static bool R__AddPragmaForClass(TTreeProxyGenerator *gen, TClass *cl)
Add the "pragma C++ class" if needed and return true if it has been added or if it is known to not be...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
bool areEqual(const RULE *r1, const RULE *r2, bool moduloNameOrPattern=false)
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.