// @(#)root/treeplayer:$Id$
// Author: Axel Naumann, 2011-09-28

/*************************************************************************
 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers and al.        *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TTreeReaderArray.h"

#include "TBranchClones.h"
#include "TBranchElement.h"
#include "TBranchRef.h"
#include "TBranchSTL.h"
#include "TBranchProxyDirector.h"
#include "TClassEdit.h"
#include "TLeaf.h"
#include "TROOT.h"
#include "TStreamerInfo.h"
#include "TStreamerElement.h"
#include "TTreeReader.h"
#include "TGenCollectionProxy.h"
#include "TRegexp.h"

// pin vtable
ROOT::TVirtualCollectionReader::~TVirtualCollectionReader() {}

namespace {
   // Reader interface for clones arrays
   class TClonesReader: public ROOT::TVirtualCollectionReader {
   public:
      ~TClonesReader() {}
      TClonesArray* GetCA(ROOT::TBranchProxy* proxy) {
         if (!proxy->Read()){
            fReadStatus = ROOT::TTreeReaderValueBase::kReadError;
            Error("GetCA()", "Read error in TBranchProxy.");
            return 0;
         }
         fReadStatus = ROOT::TTreeReaderValueBase::kReadSuccess;
         return (TClonesArray*) proxy->GetWhere();
      }
      virtual size_t GetSize(ROOT::TBranchProxy* proxy) {
         TClonesArray *myClonesArray = GetCA(proxy);
         if (myClonesArray){
            return myClonesArray->GetEntries();
         }
         else return 0;
      }
      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx) {
         TClonesArray *myClonesArray = GetCA(proxy);
         if (myClonesArray){
            return myClonesArray->UncheckedAt(idx);
         }
         else return 0;
      }
   };

   // Reader interface for STL
   class TSTLReader: public ROOT::TVirtualCollectionReader {
   public:
      ~TSTLReader() {}
      TVirtualCollectionProxy* GetCP(ROOT::TBranchProxy* proxy) {
         if (!proxy->Read()){
            fReadStatus = ROOT::TTreeReaderValueBase::kReadError;
            Error("GetCP()", "Read error in TBranchProxy.");
            return 0;
         }
         fReadStatus = ROOT::TTreeReaderValueBase::kReadSuccess;
         return (TVirtualCollectionProxy*) proxy->GetCollection();
      }

      virtual size_t GetSize(ROOT::TBranchProxy* proxy) {
         if (!CheckProxy(proxy)) return -1;
         if (!proxy->ReadEntries()) return -1;
         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         return myCollectionProxy->Size();
      }

      Bool_t CheckProxy(ROOT::TBranchProxy *proxy) {
         if (!proxy->Read()) return false;
         if (proxy->IsaPointer()) {
            if (proxy->GetWhere() && *(void**)proxy->GetWhere()){
               ((TGenCollectionProxy*)proxy->GetCollection())->PopProxy();
               ((TGenCollectionProxy*)proxy->GetCollection())->PushProxy(*(void**)proxy->GetWhere());
            }
            else return false;
         }
         return true;
      }

      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx) {
         if (!CheckProxy(proxy)) return 0;
         if (!proxy->Read()) return 0;
         if (!proxy->GetWhere()) return 0;

         if (proxy->GetCollection()->HasPointers()){
            return *(void**)proxy->GetCollection()->At(idx);
         }
         else {
            return proxy->GetCollection()->At(idx);
         }
      }
   };

   class TCollectionLessSTLReader : public ROOT::TVirtualCollectionReader {
   private:
      TVirtualCollectionProxy *localCollection;
      Bool_t proxySet;
      void *lastWhere;
   public:
      TCollectionLessSTLReader(TVirtualCollectionProxy *proxy) : localCollection(proxy), proxySet(false), lastWhere(0) {}

      TVirtualCollectionProxy* GetCP(ROOT::TBranchProxy* proxy) {
         if (!proxy->Read()){
            fReadStatus = ROOT::TTreeReaderValueBase::kReadError;
            Error("GetCP()", "Read error in TBranchProxy.");
            return 0;
         }
         fReadStatus = ROOT::TTreeReaderValueBase::kReadSuccess;
         return localCollection;
      }

      virtual size_t GetSize(ROOT::TBranchProxy* proxy) {
         if (!CheckProxy(proxy)) return -1;
         if (!proxy->ReadEntries()) return -1;
         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         return myCollectionProxy->Size();
      }

      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx) {
         if (!CheckProxy(proxy)) return 0;
         if (!proxy->Read()) return 0;
         if (!proxy->GetWhere()) return 0;

         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         if (myCollectionProxy->HasPointers()){
            return *(void**)myCollectionProxy->At(idx);
         }
         else {
            return myCollectionProxy->At(idx);
         }
      }

      Bool_t CheckProxy(ROOT::TBranchProxy *proxy) {
         if (!proxy->Read()) return false;
         if (!proxySet || lastWhere != proxy->GetWhere()) {
            TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
            if (proxy->GetWhere() && myCollectionProxy){
               myCollectionProxy->PushProxy(proxy->GetWhere());
               proxySet = true;
               lastWhere = proxy->GetWhere();
            }
            else return false;
         }
         return true;
      }
   };


   // Reader interface for leaf list
   // SEE TTreeProxyGenerator.cxx:1319: '//We have a top level raw type'
   class TObjectArrayReader: public ROOT::TVirtualCollectionReader {
   private:
      Int_t basicTypeSize;
   public:
      TObjectArrayReader() : basicTypeSize(-1) { }
      ~TObjectArrayReader() {}
      TVirtualCollectionProxy* GetCP(ROOT::TBranchProxy* proxy) {
         if (!proxy->Read()){
            fReadStatus = ROOT::TTreeReaderValueBase::kReadError;
            Error("GetCP()", "Read error in TBranchProxy.");
            return 0;
         }
         fReadStatus = ROOT::TTreeReaderValueBase::kReadSuccess;
         return (TVirtualCollectionProxy*) proxy->GetCollection();
      }
      virtual size_t GetSize(ROOT::TBranchProxy* proxy) {
         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         return myCollectionProxy->Size();
      }
      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx) {
         if (!proxy->Read()) return 0;

         Int_t objectSize;
         void *array = (void*)proxy->GetStart();

         if (basicTypeSize == -1){
            TClass *myClass = proxy->GetClass();
            if (!myClass){
               Error("At()", "Cannot get class info from branch proxy.");
               return 0;
            }
            objectSize = myClass->GetClassSize();
         }
         else {
            objectSize = basicTypeSize;
         }
         return (void*)((Byte_t*)array + (objectSize * idx));
      }

      void SetBasicTypeSize(Int_t size){
         basicTypeSize = size;
      }
   };

   class TArrayParameterSizeReader : public TObjectArrayReader {
   private:
      TTreeReaderValue<Int_t> indexReader;
   public:
      TArrayParameterSizeReader(TTreeReader *treeReader, const char *branchName) : indexReader(*treeReader, branchName) {}

      virtual size_t GetSize(ROOT::TBranchProxy* /*proxy*/){ return *indexReader; }
   };

   // Reader interface for fixed size arrays
   class TArrayFixedSizeReader : public TObjectArrayReader {
   private:
      Int_t size;

   public:
      TArrayFixedSizeReader(Int_t sizeArg) : size(sizeArg) {}

      virtual size_t GetSize(ROOT::TBranchProxy* /*proxy*/) { return size; }
   };

   class TBasicTypeArrayReader : public ROOT::TVirtualCollectionReader {
   public:
      ~TBasicTypeArrayReader() {}

      TVirtualCollectionProxy* GetCP (ROOT::TBranchProxy *proxy) {
         if (!proxy->Read()){
            fReadStatus = ROOT::TTreeReaderValueBase::kReadError;
            Error("GetCP()", "Read error in TBranchProxy.");
            return 0;
         }
         fReadStatus = ROOT::TTreeReaderValueBase::kReadSuccess;
         return (TVirtualCollectionProxy*) proxy->GetCollection();
      }

      virtual size_t GetSize(ROOT::TBranchProxy* proxy){
         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         return myCollectionProxy->Size();
      }

      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx){
         TVirtualCollectionProxy *myCollectionProxy = GetCP(proxy);
         if (!myCollectionProxy) return 0;
         return (Byte_t*)myCollectionProxy->At(idx) + proxy->GetOffset();
      }
   };

   class TBasicTypeClonesReader : public TClonesReader {
   private:
      Int_t offset;
   public:
      TBasicTypeClonesReader(Int_t offsetArg) : offset(offsetArg) {}

      virtual void* At(ROOT::TBranchProxy* proxy, size_t idx){
         TClonesArray *myClonesArray = GetCA(proxy);
         if (!myClonesArray) return 0;
         return (Byte_t*)myClonesArray->At(idx) + offset;
      }
   };

   class TLeafReader : public ROOT::TVirtualCollectionReader {
   private:
      ROOT::TTreeReaderValueBase *valueReader;
      Int_t elementSize;
   public:
      TLeafReader(ROOT::TTreeReaderValueBase *valueReaderArg) : valueReader(valueReaderArg), elementSize(-1) {}

      virtual size_t GetSize(ROOT::TBranchProxy* /*proxy*/){
         TLeaf *myLeaf = valueReader->GetLeaf();
         return myLeaf ? myLeaf->GetLen() : 0; // Error will be printed by GetLeaf
      }

      virtual void* At(ROOT::TBranchProxy* /*proxy*/, size_t idx){
         ProxyRead();
         void *address = valueReader->GetAddress();
         if (elementSize == -1){
            TLeaf *myLeaf = valueReader->GetLeaf();
            if (!myLeaf) return 0; // Error will be printed by GetLeaf
            elementSize = myLeaf->GetLenType();
         }
         return (Byte_t*)address + (elementSize * idx);
      }

   protected:
      void ProxyRead(){
         valueReader->ProxyRead();
      }
   };

   class TLeafParameterSizeReader : public TLeafReader {
   private:
      TTreeReaderValue<Int_t> sizeReader;
   public:
      TLeafParameterSizeReader(TTreeReader *treeReader, const char *leafName, ROOT::TTreeReaderValueBase *valueReaderArg) : TLeafReader(valueReaderArg), sizeReader(*treeReader, leafName) {}

      virtual size_t GetSize(ROOT::TBranchProxy* /*proxy*/){
         ProxyRead();
         return *sizeReader;
      }
   };
}

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// TTreeReaderArray                                                        //
//                                                                            //
// Extracts array data from a TTree.                                          //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

ClassImp(TTreeReaderArrayBase)

//______________________________________________________________________________
void ROOT::TTreeReaderArrayBase::CreateProxy()
{
   // Create the proxy object for our branch.
   if (fProxy) {
      return;
   }
   if (!fTreeReader) {
      Error("CreateProxy()", "TTreeReader object not set / available for branch %s!",
            fBranchName.Data());
      return;
   }
   if (!fDict) {
      TBranch* br = fTreeReader->GetTree()->GetBranch(fBranchName);
      const char* brDataType = "{UNDETERMINED}";
      if (br) {
         TDictionary* dictUnused = 0;
         brDataType = GetBranchDataType(br, dictUnused);
      }
      Error("CreateProxy()", "The template argument type T of %s accessing branch %s (which contains data of type %s) is not known to ROOT. You will need to create a dictionary for it.",
            GetDerivedTypeName(), fBranchName.Data(), brDataType);
      return;
   }

   // Access a branch's collection content (not the collection itself)
   // through a proxy.
   // Search for the branchname, determine what it contains, and wire the
   // TBranchProxy representing it to us so we can access its data.

   ROOT::TNamedBranchProxy* namedProxy = fTreeReader->FindProxy(fBranchName);
   if (namedProxy && namedProxy->GetContentDict() == fDict) {
      fProxy = namedProxy->GetProxy();
      if (!fImpl){
         Fatal("CreateProxy()", "No fImpl set!");
      }
      return;
   }


   TDictionary* branchActualType = 0;
   TBranch* branch = fTreeReader->GetTree()->GetBranch(fBranchName);
   TLeaf *myLeaf = NULL;
   if (!branch) {
      if (fBranchName.Contains(".")){
         TRegexp leafNameExpression ("\\.[a-zA-Z0-9_]+$");
         TString leafName (fBranchName(leafNameExpression));
         TString branchName = fBranchName(0, fBranchName.Length() - leafName.Length());
         branch = fTreeReader->GetTree()->GetBranch(branchName);
         if (!branch){
            Error("CreateProxy()", "The tree does not have a branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
            fProxy = 0;
            return;
         }
         else {
            myLeaf = branch->GetLeaf(TString(leafName(1, leafName.Length())));
            if (!myLeaf){
               Error("CreateProxy()", "The tree does not have a branch, nor a sub-branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
               fProxy = 0;
               return;
            }
            else {
               TDictionary *tempDict = TDictionary::GetDictionary(myLeaf->GetTypeName());
               if (!tempDict){
                  Error("CreateProxy()", "Failed to get the dictionary for %s.", myLeaf->GetTypeName());
                  fProxy = 0;
                  return;
               }
               else if (tempDict->IsA() == TDataType::Class() && TDictionary::GetDictionary(((TDataType*)tempDict)->GetTypeName()) == fDict){
                  //fLeafOffset = myLeaf->GetOffset() / 4;
                  branchActualType = fDict;
                  fLeaf = myLeaf;
                  fBranchName = branchName;
                  fLeafName = leafName(1, leafName.Length());
               }
               else {
                  Error("CreateProxy()", "Leaf of type %s cannot be read by TTreeReaderValue<%s>.", myLeaf->GetTypeName(), fDict->GetName());
                  fProxy = 0;
                  return;
               }
            }
         }
      }
      else {
         Error("CreateProxy()", "The tree does not have a branch called %s. You could check with TTree::Print() for available branches.", fBranchName.Data());
         fProxy = 0;
         return;
      }
   }

   // Update named proxy's dictionary
   if (namedProxy && !namedProxy->GetContentDict()) {
      namedProxy->SetContentDict(fDict);
      fProxy = namedProxy->GetProxy();
   }
   else {
      TString membername;

      bool isTopLevel = branch->GetMother() == branch;
      if (!isTopLevel) {
         membername = strrchr(branch->GetName(), '.');
         if (membername.IsNull()) {
            membername = branch->GetName();
         }
      }
      namedProxy = new ROOT::TNamedBranchProxy(fTreeReader->fDirector, branch, membername);
      fTreeReader->GetProxies()->Add(namedProxy);
      fProxy = namedProxy->GetProxy();
   }

   if (!myLeaf){
      TString branchActualTypeName;
      const char* nonCollTypeName = GetBranchContentDataType(branch, branchActualTypeName, branchActualType);
      if (nonCollTypeName) {
         Error("CreateContentProxy()", "The branch %s contains data of type %s, which should be accessed through a TTreeReaderValue< %s >.",
               fBranchName.Data(), nonCollTypeName, nonCollTypeName);
         fProxy = 0;
         return;
      }
      if (!branchActualType) {
         if (branchActualTypeName.IsNull()) {
            Error("CreateContentProxy()", "Cannot determine the type contained in the collection of branch %s. That's weird - please report!",
                  fBranchName.Data());
         } else {
            Error("CreateContentProxy()", "The branch %s contains data of type %s, which does not have a dictionary.",
                  fBranchName.Data(), branchActualTypeName.Data());
         }
         fProxy = 0;
         return;
      }

      if (fDict != branchActualType) {
         Error("CreateContentProxy()", "The branch %s contains data of type %s. It cannot be accessed by a TTreeReaderArray<%s>",
               fBranchName.Data(), branchActualType->GetName(), fDict->GetName());

         // Update named proxy's dictionary
         if (namedProxy && !namedProxy->GetContentDict()) {
            namedProxy->SetContentDict(fDict);
         }

         // fProxy = 0;
         // return;
      }
   }



   // Access a branch's collection content (not the collection itself)
   // through a proxy.
   // Search for the branchname, determine what it contains, and wire the
   // TBranchProxy representing it to us so we can access its data.
   // A proxy for branch must not have been created before (i.e. check
   // fProxies before calling this function!)

   if (myLeaf){
      if (!myLeaf->GetLeafCount()){
         fImpl = new TLeafReader(this);
      }
      else {
         TString leafFullName = myLeaf->GetBranch()->GetName();
         leafFullName += ".";
         leafFullName += myLeaf->GetLeafCount()->GetName();
         fImpl = new TLeafParameterSizeReader(fTreeReader, leafFullName.Data(), this);
      }
   }
   else if (branch->IsA() == TBranchElement::Class()) {
      TBranchElement* branchElement = ((TBranchElement*)branch);

      TStreamerInfo *streamerInfo = branchElement->GetInfo();
      Int_t id = branchElement->GetID();

      if (id >= 0){ // Not root node?
         // Int_t offset = streamerInfo->GetOffsets()[id];
         TStreamerElement *element = (TStreamerElement*)streamerInfo->GetElements()->At(id);
         // Bool_t isPointer = element->IsaPointer();
         // TClass *classPointer = element->GetClassPointer();

         if (element->IsA() == TStreamerSTL::Class()){
            fImpl = new TSTLReader();
         }
         else if (element->IsA() == TStreamerObject::Class()){
            //fImpl = new TObjectArrayReader(); // BArray[12]

            if (element->GetClass() == TClonesArray::Class()){
               fImpl = new TClonesReader();
            }
            else {
               fImpl = new TArrayFixedSizeReader(element->GetArrayLength());
            }
         }
         else if (element->IsA() == TStreamerLoop::Class()) {
            fImpl = new TArrayParameterSizeReader(fTreeReader, branchElement->GetBranchCount()->GetName());
         }
         else if (element->IsA() == TStreamerBasicType::Class()){
            if (branchElement->GetType() == TBranchElement::kSTLMemberNode){
               fImpl = new TBasicTypeArrayReader();
            }
            else if (branchElement->GetType() == TBranchElement::kClonesMemberNode){
               fImpl = new TBasicTypeClonesReader(element->GetOffset());
            }
         }
         else if (element->IsA() == TStreamerBase::Class()){
            fImpl = new TClonesReader();
         }
      }
      else { // We are at root node?
         if (branchElement->GetClass()->GetCollectionProxy()){
            fImpl = new TCollectionLessSTLReader(branchElement->GetClass()->GetCollectionProxy());
         }
      }
   } else if (branch->IsA() == TBranch::Class()) {
      TLeaf *topLeaf = branch->GetLeaf(branch->GetName());
      if (!topLeaf) {
         Error("CreateProxy", "Failed to get the top leaf from the branch");
         return;
      }
      Int_t size = 0;
      TLeaf *sizeLeaf = topLeaf->GetLeafCounter(size);
      if (!sizeLeaf) {
         fImpl = new TArrayFixedSizeReader(size);
      }
      else {
         fImpl = new TArrayParameterSizeReader(fTreeReader, sizeLeaf->GetName());
      }
      ((TObjectArrayReader*)fImpl)->SetBasicTypeSize(((TDataType*)fDict)->Size());
   } else if (branch->IsA() == TBranchClones::Class()) {
      Error("CreateProxy", "Support for branches of type TBranchClones not implemented");
   } else if (branch->IsA() == TBranchObject::Class()) {
      Error("CreateProxy", "Support for branches of type TBranchObject not implemented");
   } else if (branch->IsA() == TBranchSTL::Class()) {
      Error("CreateProxy", "Support for branches of type TBranchSTL not implemented");
      fImpl = new TSTLReader();
   } else if (branch->IsA() == TBranchRef::Class()) {
      Error("CreateProxy", "Support for branches of type TBranchRef not implemented");
   }
}

//______________________________________________________________________________
const char* ROOT::TTreeReaderArrayBase::GetBranchContentDataType(TBranch* branch,
                                                                 TString& contentTypeName,
                                                                 TDictionary* &dict) const
{
   // Access a branch's collection content (not the collection itself)
   // through a proxy.
   // Retrieve the type of data contained in the collection stored by branch;
   // put its dictionary into dict, If there is no dictionary, put its type
   // name into contentTypeName.
   // The contentTypeName is set to NULL if the branch does not
   // contain a collection; in that case, the type of the branch is returned.
   // In all other cases, NULL is returned.

   dict = 0;
   contentTypeName = "";
   if (branch->IsA() == TBranchElement::Class()) {
      TBranchElement* brElement = (TBranchElement*)branch;
      if (brElement->GetType() == 4
          || brElement->GetType() == 3) {
         TVirtualCollectionProxy* collProxy = brElement->GetCollectionProxy();
         if (collProxy) {
            TClass *myClass = collProxy->GetValueClass();
            if (!myClass){
               Error("GetBranchContentDataType()", "Could not get value class.");
               return 0;
            }
            dict = TDictionary::GetDictionary(myClass->GetName());
            if (!dict) dict = TDataType::GetDataType(collProxy->GetType());
         }
         if (!dict) {
            // We don't know the dictionary, thus we need the content's type name.
            // Determine it.
            if (brElement->GetType() == 3) {
               contentTypeName = brElement->GetClonesName();
               dict = TDictionary::GetDictionary(brElement->GetClonesName());
               return 0;
            }
            // STL:
            TClassEdit::TSplitType splitType(brElement->GetClassName());
            int isSTLCont = splitType.IsSTLCont();
            if (!isSTLCont) {
               Error("GetBranchContentDataType()", "Cannot determine STL collection type of %s stored in branch %s", brElement->GetClassName(), branch->GetName());
               return brElement->GetClassName();
            }
            bool isMap = isSTLCont == ROOT::kSTLmap
               || isSTLCont == ROOT::kSTLmultimap;
            if (isMap) contentTypeName = "std::pair< ";
            contentTypeName += splitType.fElements[1];
            if (isMap) {
               contentTypeName += splitType.fElements[2];
               contentTypeName += " >";
            }
            return 0;
         }
         return 0;
      } else if (brElement->GetType() == 31
                 || brElement->GetType() == 41) {
         // it's a member, extract from GetClass()'s streamer info
         TClass* clData = 0;
         EDataType dtData = kOther_t;
         int ExpectedTypeRet = brElement->GetExpectedType(clData, dtData);
         if (ExpectedTypeRet == 0) {
            dict = clData;
            if (!dict) {
               dict = TDataType::GetDataType(dtData);
            }
            if (!dict) {
               Error("GetBranchContentDataType()", "The branch %s contains a data type %d for which the dictionary cannot be retrieved.",
                     branch->GetName(), (int)dtData);
               contentTypeName = TDataType::GetTypeName(dtData);
               return 0;
            }
            return 0;
         } else if (ExpectedTypeRet == 1) {
            int brID = brElement->GetID();
            if (brID == -1) {
               // top
               Error("GetBranchContentDataType()", "The branch %s contains data of type %s for which the dictionary does not exist. It's needed.",
                     branch->GetName(), brElement->GetClassName());
               contentTypeName = brElement->GetClassName();
               return 0;
            }
            // Either the data type name doesn't have an EDataType entry
            // or the streamer info doesn't have a TClass* attached.
            TStreamerElement* element =
               (TStreamerElement*) brElement->GetInfo()->GetElement(brID);
            contentTypeName = element->GetTypeName();
            return 0;
         }
         /* else (ExpectedTypeRet == 2)*/
         // The streamer info entry cannot be found.
         // TBranchElement::GetExpectedType() has already complained.
         return "{CANNOT DETERMINE TBranchElement DATA TYPE}";
      }
      else if (brElement->GetType() == TBranchElement::kLeafNode){
         TStreamerInfo *streamerInfo = brElement->GetInfo();
         Int_t id = brElement->GetID();

         if (id >= 0){
            TStreamerElement *element = (TStreamerElement*)streamerInfo->GetElements()->At(id);

            if (element->IsA() == TStreamerSTL::Class()){
               TClass *myClass = brElement->GetCurrentClass();
               if (!myClass){
                  Error("GetBranchDataType()", "Could not get class from branch element.");
                  return 0;
               }
               TVirtualCollectionProxy *myCollectionProxy = myClass->GetCollectionProxy();
               if (!myCollectionProxy){
                  Error("GetBranchDataType()", "Could not get collection proxy from STL class");
                  return 0;
               }
               dict = myCollectionProxy->GetValueClass();
               if (!dict){
                  Error("GetBranchDataType()", "Could not get valueClass from collectionProxy.");
                  return 0;
               }
               contentTypeName = dict->GetName();
               return 0;
            }
            else if (element->IsA() == TStreamerObject::Class() && !strcmp(element->GetTypeName(), "TClonesArray")){
               if (!fProxy->Setup() || !fProxy->Read()){
                  Error("GetBranchContentDataType()", "Failed to get type from proxy, unable to check type");
                  contentTypeName = "UNKNOWN";
                  dict = 0;
                  return contentTypeName;
               }
               TClonesArray *myArray = (TClonesArray*)fProxy->GetWhere();
               dict = myArray->GetClass();
               contentTypeName = dict->GetName();
               return 0;
            }
            else {
               dict = brElement->GetCurrentClass();
               contentTypeName = brElement->GetTypeName();
               return 0;
            }
         }
         if (brElement->GetCurrentClass() == TClonesArray::Class()){
            contentTypeName = "TClonesArray";
            Warning("GetBranchContentDataType()", "Not able to check type correctness, ignoring check");
            dict = fDict;
         }
         else if (!dict && (branch->GetSplitLevel() == 0 || brElement->GetClass()->GetCollectionProxy())){
            dict = brElement->GetClass()->GetCollectionProxy()->GetValueClass();
            if (dict) contentTypeName = dict->GetName();
            return 0;
         }
         else if (!dict){
            dict = brElement->GetClass();
            contentTypeName = dict->GetName();
            return 0;
         }

         return 0;
      }
      return 0;
   } else if (branch->IsA() == TBranch::Class()
              || branch->IsA() == TBranchObject::Class()
              || branch->IsA() == TBranchSTL::Class()) {
      const char* dataTypeName = branch->GetClassName();
      if ((!dataTypeName || !dataTypeName[0])
          && branch->IsA() == TBranch::Class()) {
         TLeaf *myLeaf = branch->GetLeaf(branch->GetName());
         if (myLeaf){
            TDictionary *myDataType = TDictionary::GetDictionary(myLeaf->GetTypeName());
            if (myDataType && myDataType->IsA() == TDataType::Class()){
               dict = TDataType::GetDataType((EDataType)((TDataType*)myDataType)->GetType());
               contentTypeName = myLeaf->GetTypeName();
               return 0;
            }
         }

         // leaflist. Can't represent.
         Error("GetBranchContentDataType()", "The branch %s was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderValueArray:", branch->GetName());
         TIter iLeaves(branch->GetListOfLeaves());
         TLeaf* leaf = 0;
         while ((leaf = (TLeaf*) iLeaves())) {
            Error("GetBranchContentDataType()", "   %s.%s", branch->GetName(), leaf->GetName());
         }
         return 0;
      }
      if (dataTypeName) dict = TDictionary::GetDictionary(dataTypeName);
      if (branch->IsA() == TBranchSTL::Class()){
         Warning("GetBranchContentDataType()", "Not able to check type correctness, ignoring check");
         dict = fDict;
         return 0;
      }
      return dataTypeName;
   } else if (branch->IsA() == TBranchClones::Class()) {
      dict = TClonesArray::Class();
      return "TClonesArray";
   } else if (branch->IsA() == TBranchRef::Class()) {
      // Can't represent.
      Error("GetBranchContentDataType()", "The branch %s is a TBranchRef and cannot be represented as a C++ type.", branch->GetName());
      return 0;
   } else {
      Error("GetBranchContentDataType()", "The branch %s is of type %s - something that is not handled yet.", branch->GetName(), branch->IsA()->GetName());
      return 0;
   }

   return 0;
}
 TTreeReaderArray.cxx:1
 TTreeReaderArray.cxx:2
 TTreeReaderArray.cxx:3
 TTreeReaderArray.cxx:4
 TTreeReaderArray.cxx:5
 TTreeReaderArray.cxx:6
 TTreeReaderArray.cxx:7
 TTreeReaderArray.cxx:8
 TTreeReaderArray.cxx:9
 TTreeReaderArray.cxx:10
 TTreeReaderArray.cxx:11
 TTreeReaderArray.cxx:12
 TTreeReaderArray.cxx:13
 TTreeReaderArray.cxx:14
 TTreeReaderArray.cxx:15
 TTreeReaderArray.cxx:16
 TTreeReaderArray.cxx:17
 TTreeReaderArray.cxx:18
 TTreeReaderArray.cxx:19
 TTreeReaderArray.cxx:20
 TTreeReaderArray.cxx:21
 TTreeReaderArray.cxx:22
 TTreeReaderArray.cxx:23
 TTreeReaderArray.cxx:24
 TTreeReaderArray.cxx:25
 TTreeReaderArray.cxx:26
 TTreeReaderArray.cxx:27
 TTreeReaderArray.cxx:28
 TTreeReaderArray.cxx:29
 TTreeReaderArray.cxx:30
 TTreeReaderArray.cxx:31
 TTreeReaderArray.cxx:32
 TTreeReaderArray.cxx:33
 TTreeReaderArray.cxx:34
 TTreeReaderArray.cxx:35
 TTreeReaderArray.cxx:36
 TTreeReaderArray.cxx:37
 TTreeReaderArray.cxx:38
 TTreeReaderArray.cxx:39
 TTreeReaderArray.cxx:40
 TTreeReaderArray.cxx:41
 TTreeReaderArray.cxx:42
 TTreeReaderArray.cxx:43
 TTreeReaderArray.cxx:44
 TTreeReaderArray.cxx:45
 TTreeReaderArray.cxx:46
 TTreeReaderArray.cxx:47
 TTreeReaderArray.cxx:48
 TTreeReaderArray.cxx:49
 TTreeReaderArray.cxx:50
 TTreeReaderArray.cxx:51
 TTreeReaderArray.cxx:52
 TTreeReaderArray.cxx:53
 TTreeReaderArray.cxx:54
 TTreeReaderArray.cxx:55
 TTreeReaderArray.cxx:56
 TTreeReaderArray.cxx:57
 TTreeReaderArray.cxx:58
 TTreeReaderArray.cxx:59
 TTreeReaderArray.cxx:60
 TTreeReaderArray.cxx:61
 TTreeReaderArray.cxx:62
 TTreeReaderArray.cxx:63
 TTreeReaderArray.cxx:64
 TTreeReaderArray.cxx:65
 TTreeReaderArray.cxx:66
 TTreeReaderArray.cxx:67
 TTreeReaderArray.cxx:68
 TTreeReaderArray.cxx:69
 TTreeReaderArray.cxx:70
 TTreeReaderArray.cxx:71
 TTreeReaderArray.cxx:72
 TTreeReaderArray.cxx:73
 TTreeReaderArray.cxx:74
 TTreeReaderArray.cxx:75
 TTreeReaderArray.cxx:76
 TTreeReaderArray.cxx:77
 TTreeReaderArray.cxx:78
 TTreeReaderArray.cxx:79
 TTreeReaderArray.cxx:80
 TTreeReaderArray.cxx:81
 TTreeReaderArray.cxx:82
 TTreeReaderArray.cxx:83
 TTreeReaderArray.cxx:84
 TTreeReaderArray.cxx:85
 TTreeReaderArray.cxx:86
 TTreeReaderArray.cxx:87
 TTreeReaderArray.cxx:88
 TTreeReaderArray.cxx:89
 TTreeReaderArray.cxx:90
 TTreeReaderArray.cxx:91
 TTreeReaderArray.cxx:92
 TTreeReaderArray.cxx:93
 TTreeReaderArray.cxx:94
 TTreeReaderArray.cxx:95
 TTreeReaderArray.cxx:96
 TTreeReaderArray.cxx:97
 TTreeReaderArray.cxx:98
 TTreeReaderArray.cxx:99
 TTreeReaderArray.cxx:100
 TTreeReaderArray.cxx:101
 TTreeReaderArray.cxx:102
 TTreeReaderArray.cxx:103
 TTreeReaderArray.cxx:104
 TTreeReaderArray.cxx:105
 TTreeReaderArray.cxx:106
 TTreeReaderArray.cxx:107
 TTreeReaderArray.cxx:108
 TTreeReaderArray.cxx:109
 TTreeReaderArray.cxx:110
 TTreeReaderArray.cxx:111
 TTreeReaderArray.cxx:112
 TTreeReaderArray.cxx:113
 TTreeReaderArray.cxx:114
 TTreeReaderArray.cxx:115
 TTreeReaderArray.cxx:116
 TTreeReaderArray.cxx:117
 TTreeReaderArray.cxx:118
 TTreeReaderArray.cxx:119
 TTreeReaderArray.cxx:120
 TTreeReaderArray.cxx:121
 TTreeReaderArray.cxx:122
 TTreeReaderArray.cxx:123
 TTreeReaderArray.cxx:124
 TTreeReaderArray.cxx:125
 TTreeReaderArray.cxx:126
 TTreeReaderArray.cxx:127
 TTreeReaderArray.cxx:128
 TTreeReaderArray.cxx:129
 TTreeReaderArray.cxx:130
 TTreeReaderArray.cxx:131
 TTreeReaderArray.cxx:132
 TTreeReaderArray.cxx:133
 TTreeReaderArray.cxx:134
 TTreeReaderArray.cxx:135
 TTreeReaderArray.cxx:136
 TTreeReaderArray.cxx:137
 TTreeReaderArray.cxx:138
 TTreeReaderArray.cxx:139
 TTreeReaderArray.cxx:140
 TTreeReaderArray.cxx:141
 TTreeReaderArray.cxx:142
 TTreeReaderArray.cxx:143
 TTreeReaderArray.cxx:144
 TTreeReaderArray.cxx:145
 TTreeReaderArray.cxx:146
 TTreeReaderArray.cxx:147
 TTreeReaderArray.cxx:148
 TTreeReaderArray.cxx:149
 TTreeReaderArray.cxx:150
 TTreeReaderArray.cxx:151
 TTreeReaderArray.cxx:152
 TTreeReaderArray.cxx:153
 TTreeReaderArray.cxx:154
 TTreeReaderArray.cxx:155
 TTreeReaderArray.cxx:156
 TTreeReaderArray.cxx:157
 TTreeReaderArray.cxx:158
 TTreeReaderArray.cxx:159
 TTreeReaderArray.cxx:160
 TTreeReaderArray.cxx:161
 TTreeReaderArray.cxx:162
 TTreeReaderArray.cxx:163
 TTreeReaderArray.cxx:164
 TTreeReaderArray.cxx:165
 TTreeReaderArray.cxx:166
 TTreeReaderArray.cxx:167
 TTreeReaderArray.cxx:168
 TTreeReaderArray.cxx:169
 TTreeReaderArray.cxx:170
 TTreeReaderArray.cxx:171
 TTreeReaderArray.cxx:172
 TTreeReaderArray.cxx:173
 TTreeReaderArray.cxx:174
 TTreeReaderArray.cxx:175
 TTreeReaderArray.cxx:176
 TTreeReaderArray.cxx:177
 TTreeReaderArray.cxx:178
 TTreeReaderArray.cxx:179
 TTreeReaderArray.cxx:180
 TTreeReaderArray.cxx:181
 TTreeReaderArray.cxx:182
 TTreeReaderArray.cxx:183
 TTreeReaderArray.cxx:184
 TTreeReaderArray.cxx:185
 TTreeReaderArray.cxx:186
 TTreeReaderArray.cxx:187
 TTreeReaderArray.cxx:188
 TTreeReaderArray.cxx:189
 TTreeReaderArray.cxx:190
 TTreeReaderArray.cxx:191
 TTreeReaderArray.cxx:192
 TTreeReaderArray.cxx:193
 TTreeReaderArray.cxx:194
 TTreeReaderArray.cxx:195
 TTreeReaderArray.cxx:196
 TTreeReaderArray.cxx:197
 TTreeReaderArray.cxx:198
 TTreeReaderArray.cxx:199
 TTreeReaderArray.cxx:200
 TTreeReaderArray.cxx:201
 TTreeReaderArray.cxx:202
 TTreeReaderArray.cxx:203
 TTreeReaderArray.cxx:204
 TTreeReaderArray.cxx:205
 TTreeReaderArray.cxx:206
 TTreeReaderArray.cxx:207
 TTreeReaderArray.cxx:208
 TTreeReaderArray.cxx:209
 TTreeReaderArray.cxx:210
 TTreeReaderArray.cxx:211
 TTreeReaderArray.cxx:212
 TTreeReaderArray.cxx:213
 TTreeReaderArray.cxx:214
 TTreeReaderArray.cxx:215
 TTreeReaderArray.cxx:216
 TTreeReaderArray.cxx:217
 TTreeReaderArray.cxx:218
 TTreeReaderArray.cxx:219
 TTreeReaderArray.cxx:220
 TTreeReaderArray.cxx:221
 TTreeReaderArray.cxx:222
 TTreeReaderArray.cxx:223
 TTreeReaderArray.cxx:224
 TTreeReaderArray.cxx:225
 TTreeReaderArray.cxx:226
 TTreeReaderArray.cxx:227
 TTreeReaderArray.cxx:228
 TTreeReaderArray.cxx:229
 TTreeReaderArray.cxx:230
 TTreeReaderArray.cxx:231
 TTreeReaderArray.cxx:232
 TTreeReaderArray.cxx:233
 TTreeReaderArray.cxx:234
 TTreeReaderArray.cxx:235
 TTreeReaderArray.cxx:236
 TTreeReaderArray.cxx:237
 TTreeReaderArray.cxx:238
 TTreeReaderArray.cxx:239
 TTreeReaderArray.cxx:240
 TTreeReaderArray.cxx:241
 TTreeReaderArray.cxx:242
 TTreeReaderArray.cxx:243
 TTreeReaderArray.cxx:244
 TTreeReaderArray.cxx:245
 TTreeReaderArray.cxx:246
 TTreeReaderArray.cxx:247
 TTreeReaderArray.cxx:248
 TTreeReaderArray.cxx:249
 TTreeReaderArray.cxx:250
 TTreeReaderArray.cxx:251
 TTreeReaderArray.cxx:252
 TTreeReaderArray.cxx:253
 TTreeReaderArray.cxx:254
 TTreeReaderArray.cxx:255
 TTreeReaderArray.cxx:256
 TTreeReaderArray.cxx:257
 TTreeReaderArray.cxx:258
 TTreeReaderArray.cxx:259
 TTreeReaderArray.cxx:260
 TTreeReaderArray.cxx:261
 TTreeReaderArray.cxx:262
 TTreeReaderArray.cxx:263
 TTreeReaderArray.cxx:264
 TTreeReaderArray.cxx:265
 TTreeReaderArray.cxx:266
 TTreeReaderArray.cxx:267
 TTreeReaderArray.cxx:268
 TTreeReaderArray.cxx:269
 TTreeReaderArray.cxx:270
 TTreeReaderArray.cxx:271
 TTreeReaderArray.cxx:272
 TTreeReaderArray.cxx:273
 TTreeReaderArray.cxx:274
 TTreeReaderArray.cxx:275
 TTreeReaderArray.cxx:276
 TTreeReaderArray.cxx:277
 TTreeReaderArray.cxx:278
 TTreeReaderArray.cxx:279
 TTreeReaderArray.cxx:280
 TTreeReaderArray.cxx:281
 TTreeReaderArray.cxx:282
 TTreeReaderArray.cxx:283
 TTreeReaderArray.cxx:284
 TTreeReaderArray.cxx:285
 TTreeReaderArray.cxx:286
 TTreeReaderArray.cxx:287
 TTreeReaderArray.cxx:288
 TTreeReaderArray.cxx:289
 TTreeReaderArray.cxx:290
 TTreeReaderArray.cxx:291
 TTreeReaderArray.cxx:292
 TTreeReaderArray.cxx:293
 TTreeReaderArray.cxx:294
 TTreeReaderArray.cxx:295
 TTreeReaderArray.cxx:296
 TTreeReaderArray.cxx:297
 TTreeReaderArray.cxx:298
 TTreeReaderArray.cxx:299
 TTreeReaderArray.cxx:300
 TTreeReaderArray.cxx:301
 TTreeReaderArray.cxx:302
 TTreeReaderArray.cxx:303
 TTreeReaderArray.cxx:304
 TTreeReaderArray.cxx:305
 TTreeReaderArray.cxx:306
 TTreeReaderArray.cxx:307
 TTreeReaderArray.cxx:308
 TTreeReaderArray.cxx:309
 TTreeReaderArray.cxx:310
 TTreeReaderArray.cxx:311
 TTreeReaderArray.cxx:312
 TTreeReaderArray.cxx:313
 TTreeReaderArray.cxx:314
 TTreeReaderArray.cxx:315
 TTreeReaderArray.cxx:316
 TTreeReaderArray.cxx:317
 TTreeReaderArray.cxx:318
 TTreeReaderArray.cxx:319
 TTreeReaderArray.cxx:320
 TTreeReaderArray.cxx:321
 TTreeReaderArray.cxx:322
 TTreeReaderArray.cxx:323
 TTreeReaderArray.cxx:324
 TTreeReaderArray.cxx:325
 TTreeReaderArray.cxx:326
 TTreeReaderArray.cxx:327
 TTreeReaderArray.cxx:328
 TTreeReaderArray.cxx:329
 TTreeReaderArray.cxx:330
 TTreeReaderArray.cxx:331
 TTreeReaderArray.cxx:332
 TTreeReaderArray.cxx:333
 TTreeReaderArray.cxx:334
 TTreeReaderArray.cxx:335
 TTreeReaderArray.cxx:336
 TTreeReaderArray.cxx:337
 TTreeReaderArray.cxx:338
 TTreeReaderArray.cxx:339
 TTreeReaderArray.cxx:340
 TTreeReaderArray.cxx:341
 TTreeReaderArray.cxx:342
 TTreeReaderArray.cxx:343
 TTreeReaderArray.cxx:344
 TTreeReaderArray.cxx:345
 TTreeReaderArray.cxx:346
 TTreeReaderArray.cxx:347
 TTreeReaderArray.cxx:348
 TTreeReaderArray.cxx:349
 TTreeReaderArray.cxx:350
 TTreeReaderArray.cxx:351
 TTreeReaderArray.cxx:352
 TTreeReaderArray.cxx:353
 TTreeReaderArray.cxx:354
 TTreeReaderArray.cxx:355
 TTreeReaderArray.cxx:356
 TTreeReaderArray.cxx:357
 TTreeReaderArray.cxx:358
 TTreeReaderArray.cxx:359
 TTreeReaderArray.cxx:360
 TTreeReaderArray.cxx:361
 TTreeReaderArray.cxx:362
 TTreeReaderArray.cxx:363
 TTreeReaderArray.cxx:364
 TTreeReaderArray.cxx:365
 TTreeReaderArray.cxx:366
 TTreeReaderArray.cxx:367
 TTreeReaderArray.cxx:368
 TTreeReaderArray.cxx:369
 TTreeReaderArray.cxx:370
 TTreeReaderArray.cxx:371
 TTreeReaderArray.cxx:372
 TTreeReaderArray.cxx:373
 TTreeReaderArray.cxx:374
 TTreeReaderArray.cxx:375
 TTreeReaderArray.cxx:376
 TTreeReaderArray.cxx:377
 TTreeReaderArray.cxx:378
 TTreeReaderArray.cxx:379
 TTreeReaderArray.cxx:380
 TTreeReaderArray.cxx:381
 TTreeReaderArray.cxx:382
 TTreeReaderArray.cxx:383
 TTreeReaderArray.cxx:384
 TTreeReaderArray.cxx:385
 TTreeReaderArray.cxx:386
 TTreeReaderArray.cxx:387
 TTreeReaderArray.cxx:388
 TTreeReaderArray.cxx:389
 TTreeReaderArray.cxx:390
 TTreeReaderArray.cxx:391
 TTreeReaderArray.cxx:392
 TTreeReaderArray.cxx:393
 TTreeReaderArray.cxx:394
 TTreeReaderArray.cxx:395
 TTreeReaderArray.cxx:396
 TTreeReaderArray.cxx:397
 TTreeReaderArray.cxx:398
 TTreeReaderArray.cxx:399
 TTreeReaderArray.cxx:400
 TTreeReaderArray.cxx:401
 TTreeReaderArray.cxx:402
 TTreeReaderArray.cxx:403
 TTreeReaderArray.cxx:404
 TTreeReaderArray.cxx:405
 TTreeReaderArray.cxx:406
 TTreeReaderArray.cxx:407
 TTreeReaderArray.cxx:408
 TTreeReaderArray.cxx:409
 TTreeReaderArray.cxx:410
 TTreeReaderArray.cxx:411
 TTreeReaderArray.cxx:412
 TTreeReaderArray.cxx:413
 TTreeReaderArray.cxx:414
 TTreeReaderArray.cxx:415
 TTreeReaderArray.cxx:416
 TTreeReaderArray.cxx:417
 TTreeReaderArray.cxx:418
 TTreeReaderArray.cxx:419
 TTreeReaderArray.cxx:420
 TTreeReaderArray.cxx:421
 TTreeReaderArray.cxx:422
 TTreeReaderArray.cxx:423
 TTreeReaderArray.cxx:424
 TTreeReaderArray.cxx:425
 TTreeReaderArray.cxx:426
 TTreeReaderArray.cxx:427
 TTreeReaderArray.cxx:428
 TTreeReaderArray.cxx:429
 TTreeReaderArray.cxx:430
 TTreeReaderArray.cxx:431
 TTreeReaderArray.cxx:432
 TTreeReaderArray.cxx:433
 TTreeReaderArray.cxx:434
 TTreeReaderArray.cxx:435
 TTreeReaderArray.cxx:436
 TTreeReaderArray.cxx:437
 TTreeReaderArray.cxx:438
 TTreeReaderArray.cxx:439
 TTreeReaderArray.cxx:440
 TTreeReaderArray.cxx:441
 TTreeReaderArray.cxx:442
 TTreeReaderArray.cxx:443
 TTreeReaderArray.cxx:444
 TTreeReaderArray.cxx:445
 TTreeReaderArray.cxx:446
 TTreeReaderArray.cxx:447
 TTreeReaderArray.cxx:448
 TTreeReaderArray.cxx:449
 TTreeReaderArray.cxx:450
 TTreeReaderArray.cxx:451
 TTreeReaderArray.cxx:452
 TTreeReaderArray.cxx:453
 TTreeReaderArray.cxx:454
 TTreeReaderArray.cxx:455
 TTreeReaderArray.cxx:456
 TTreeReaderArray.cxx:457
 TTreeReaderArray.cxx:458
 TTreeReaderArray.cxx:459
 TTreeReaderArray.cxx:460
 TTreeReaderArray.cxx:461
 TTreeReaderArray.cxx:462
 TTreeReaderArray.cxx:463
 TTreeReaderArray.cxx:464
 TTreeReaderArray.cxx:465
 TTreeReaderArray.cxx:466
 TTreeReaderArray.cxx:467
 TTreeReaderArray.cxx:468
 TTreeReaderArray.cxx:469
 TTreeReaderArray.cxx:470
 TTreeReaderArray.cxx:471
 TTreeReaderArray.cxx:472
 TTreeReaderArray.cxx:473
 TTreeReaderArray.cxx:474
 TTreeReaderArray.cxx:475
 TTreeReaderArray.cxx:476
 TTreeReaderArray.cxx:477
 TTreeReaderArray.cxx:478
 TTreeReaderArray.cxx:479
 TTreeReaderArray.cxx:480
 TTreeReaderArray.cxx:481
 TTreeReaderArray.cxx:482
 TTreeReaderArray.cxx:483
 TTreeReaderArray.cxx:484
 TTreeReaderArray.cxx:485
 TTreeReaderArray.cxx:486
 TTreeReaderArray.cxx:487
 TTreeReaderArray.cxx:488
 TTreeReaderArray.cxx:489
 TTreeReaderArray.cxx:490
 TTreeReaderArray.cxx:491
 TTreeReaderArray.cxx:492
 TTreeReaderArray.cxx:493
 TTreeReaderArray.cxx:494
 TTreeReaderArray.cxx:495
 TTreeReaderArray.cxx:496
 TTreeReaderArray.cxx:497
 TTreeReaderArray.cxx:498
 TTreeReaderArray.cxx:499
 TTreeReaderArray.cxx:500
 TTreeReaderArray.cxx:501
 TTreeReaderArray.cxx:502
 TTreeReaderArray.cxx:503
 TTreeReaderArray.cxx:504
 TTreeReaderArray.cxx:505
 TTreeReaderArray.cxx:506
 TTreeReaderArray.cxx:507
 TTreeReaderArray.cxx:508
 TTreeReaderArray.cxx:509
 TTreeReaderArray.cxx:510
 TTreeReaderArray.cxx:511
 TTreeReaderArray.cxx:512
 TTreeReaderArray.cxx:513
 TTreeReaderArray.cxx:514
 TTreeReaderArray.cxx:515
 TTreeReaderArray.cxx:516
 TTreeReaderArray.cxx:517
 TTreeReaderArray.cxx:518
 TTreeReaderArray.cxx:519
 TTreeReaderArray.cxx:520
 TTreeReaderArray.cxx:521
 TTreeReaderArray.cxx:522
 TTreeReaderArray.cxx:523
 TTreeReaderArray.cxx:524
 TTreeReaderArray.cxx:525
 TTreeReaderArray.cxx:526
 TTreeReaderArray.cxx:527
 TTreeReaderArray.cxx:528
 TTreeReaderArray.cxx:529
 TTreeReaderArray.cxx:530
 TTreeReaderArray.cxx:531
 TTreeReaderArray.cxx:532
 TTreeReaderArray.cxx:533
 TTreeReaderArray.cxx:534
 TTreeReaderArray.cxx:535
 TTreeReaderArray.cxx:536
 TTreeReaderArray.cxx:537
 TTreeReaderArray.cxx:538
 TTreeReaderArray.cxx:539
 TTreeReaderArray.cxx:540
 TTreeReaderArray.cxx:541
 TTreeReaderArray.cxx:542
 TTreeReaderArray.cxx:543
 TTreeReaderArray.cxx:544
 TTreeReaderArray.cxx:545
 TTreeReaderArray.cxx:546
 TTreeReaderArray.cxx:547
 TTreeReaderArray.cxx:548
 TTreeReaderArray.cxx:549
 TTreeReaderArray.cxx:550
 TTreeReaderArray.cxx:551
 TTreeReaderArray.cxx:552
 TTreeReaderArray.cxx:553
 TTreeReaderArray.cxx:554
 TTreeReaderArray.cxx:555
 TTreeReaderArray.cxx:556
 TTreeReaderArray.cxx:557
 TTreeReaderArray.cxx:558
 TTreeReaderArray.cxx:559
 TTreeReaderArray.cxx:560
 TTreeReaderArray.cxx:561
 TTreeReaderArray.cxx:562
 TTreeReaderArray.cxx:563
 TTreeReaderArray.cxx:564
 TTreeReaderArray.cxx:565
 TTreeReaderArray.cxx:566
 TTreeReaderArray.cxx:567
 TTreeReaderArray.cxx:568
 TTreeReaderArray.cxx:569
 TTreeReaderArray.cxx:570
 TTreeReaderArray.cxx:571
 TTreeReaderArray.cxx:572
 TTreeReaderArray.cxx:573
 TTreeReaderArray.cxx:574
 TTreeReaderArray.cxx:575
 TTreeReaderArray.cxx:576
 TTreeReaderArray.cxx:577
 TTreeReaderArray.cxx:578
 TTreeReaderArray.cxx:579
 TTreeReaderArray.cxx:580
 TTreeReaderArray.cxx:581
 TTreeReaderArray.cxx:582
 TTreeReaderArray.cxx:583
 TTreeReaderArray.cxx:584
 TTreeReaderArray.cxx:585
 TTreeReaderArray.cxx:586
 TTreeReaderArray.cxx:587
 TTreeReaderArray.cxx:588
 TTreeReaderArray.cxx:589
 TTreeReaderArray.cxx:590
 TTreeReaderArray.cxx:591
 TTreeReaderArray.cxx:592
 TTreeReaderArray.cxx:593
 TTreeReaderArray.cxx:594
 TTreeReaderArray.cxx:595
 TTreeReaderArray.cxx:596
 TTreeReaderArray.cxx:597
 TTreeReaderArray.cxx:598
 TTreeReaderArray.cxx:599
 TTreeReaderArray.cxx:600
 TTreeReaderArray.cxx:601
 TTreeReaderArray.cxx:602
 TTreeReaderArray.cxx:603
 TTreeReaderArray.cxx:604
 TTreeReaderArray.cxx:605
 TTreeReaderArray.cxx:606
 TTreeReaderArray.cxx:607
 TTreeReaderArray.cxx:608
 TTreeReaderArray.cxx:609
 TTreeReaderArray.cxx:610
 TTreeReaderArray.cxx:611
 TTreeReaderArray.cxx:612
 TTreeReaderArray.cxx:613
 TTreeReaderArray.cxx:614
 TTreeReaderArray.cxx:615
 TTreeReaderArray.cxx:616
 TTreeReaderArray.cxx:617
 TTreeReaderArray.cxx:618
 TTreeReaderArray.cxx:619
 TTreeReaderArray.cxx:620
 TTreeReaderArray.cxx:621
 TTreeReaderArray.cxx:622
 TTreeReaderArray.cxx:623
 TTreeReaderArray.cxx:624
 TTreeReaderArray.cxx:625
 TTreeReaderArray.cxx:626
 TTreeReaderArray.cxx:627
 TTreeReaderArray.cxx:628
 TTreeReaderArray.cxx:629
 TTreeReaderArray.cxx:630
 TTreeReaderArray.cxx:631
 TTreeReaderArray.cxx:632
 TTreeReaderArray.cxx:633
 TTreeReaderArray.cxx:634
 TTreeReaderArray.cxx:635
 TTreeReaderArray.cxx:636
 TTreeReaderArray.cxx:637
 TTreeReaderArray.cxx:638
 TTreeReaderArray.cxx:639
 TTreeReaderArray.cxx:640
 TTreeReaderArray.cxx:641
 TTreeReaderArray.cxx:642
 TTreeReaderArray.cxx:643
 TTreeReaderArray.cxx:644
 TTreeReaderArray.cxx:645
 TTreeReaderArray.cxx:646
 TTreeReaderArray.cxx:647
 TTreeReaderArray.cxx:648
 TTreeReaderArray.cxx:649
 TTreeReaderArray.cxx:650
 TTreeReaderArray.cxx:651
 TTreeReaderArray.cxx:652
 TTreeReaderArray.cxx:653
 TTreeReaderArray.cxx:654
 TTreeReaderArray.cxx:655
 TTreeReaderArray.cxx:656
 TTreeReaderArray.cxx:657
 TTreeReaderArray.cxx:658
 TTreeReaderArray.cxx:659
 TTreeReaderArray.cxx:660
 TTreeReaderArray.cxx:661
 TTreeReaderArray.cxx:662
 TTreeReaderArray.cxx:663
 TTreeReaderArray.cxx:664
 TTreeReaderArray.cxx:665
 TTreeReaderArray.cxx:666
 TTreeReaderArray.cxx:667
 TTreeReaderArray.cxx:668
 TTreeReaderArray.cxx:669
 TTreeReaderArray.cxx:670
 TTreeReaderArray.cxx:671
 TTreeReaderArray.cxx:672
 TTreeReaderArray.cxx:673
 TTreeReaderArray.cxx:674
 TTreeReaderArray.cxx:675
 TTreeReaderArray.cxx:676
 TTreeReaderArray.cxx:677
 TTreeReaderArray.cxx:678
 TTreeReaderArray.cxx:679
 TTreeReaderArray.cxx:680
 TTreeReaderArray.cxx:681
 TTreeReaderArray.cxx:682
 TTreeReaderArray.cxx:683
 TTreeReaderArray.cxx:684
 TTreeReaderArray.cxx:685
 TTreeReaderArray.cxx:686
 TTreeReaderArray.cxx:687
 TTreeReaderArray.cxx:688
 TTreeReaderArray.cxx:689
 TTreeReaderArray.cxx:690
 TTreeReaderArray.cxx:691
 TTreeReaderArray.cxx:692
 TTreeReaderArray.cxx:693
 TTreeReaderArray.cxx:694
 TTreeReaderArray.cxx:695
 TTreeReaderArray.cxx:696
 TTreeReaderArray.cxx:697
 TTreeReaderArray.cxx:698
 TTreeReaderArray.cxx:699
 TTreeReaderArray.cxx:700
 TTreeReaderArray.cxx:701
 TTreeReaderArray.cxx:702
 TTreeReaderArray.cxx:703
 TTreeReaderArray.cxx:704
 TTreeReaderArray.cxx:705
 TTreeReaderArray.cxx:706
 TTreeReaderArray.cxx:707
 TTreeReaderArray.cxx:708
 TTreeReaderArray.cxx:709
 TTreeReaderArray.cxx:710
 TTreeReaderArray.cxx:711
 TTreeReaderArray.cxx:712
 TTreeReaderArray.cxx:713
 TTreeReaderArray.cxx:714
 TTreeReaderArray.cxx:715
 TTreeReaderArray.cxx:716
 TTreeReaderArray.cxx:717
 TTreeReaderArray.cxx:718
 TTreeReaderArray.cxx:719
 TTreeReaderArray.cxx:720
 TTreeReaderArray.cxx:721
 TTreeReaderArray.cxx:722
 TTreeReaderArray.cxx:723
 TTreeReaderArray.cxx:724
 TTreeReaderArray.cxx:725
 TTreeReaderArray.cxx:726
 TTreeReaderArray.cxx:727
 TTreeReaderArray.cxx:728
 TTreeReaderArray.cxx:729
 TTreeReaderArray.cxx:730
 TTreeReaderArray.cxx:731
 TTreeReaderArray.cxx:732
 TTreeReaderArray.cxx:733
 TTreeReaderArray.cxx:734
 TTreeReaderArray.cxx:735
 TTreeReaderArray.cxx:736
 TTreeReaderArray.cxx:737
 TTreeReaderArray.cxx:738
 TTreeReaderArray.cxx:739
 TTreeReaderArray.cxx:740
 TTreeReaderArray.cxx:741
 TTreeReaderArray.cxx:742
 TTreeReaderArray.cxx:743
 TTreeReaderArray.cxx:744
 TTreeReaderArray.cxx:745
 TTreeReaderArray.cxx:746
 TTreeReaderArray.cxx:747
 TTreeReaderArray.cxx:748
 TTreeReaderArray.cxx:749
 TTreeReaderArray.cxx:750
 TTreeReaderArray.cxx:751
 TTreeReaderArray.cxx:752
 TTreeReaderArray.cxx:753
 TTreeReaderArray.cxx:754
 TTreeReaderArray.cxx:755
 TTreeReaderArray.cxx:756
 TTreeReaderArray.cxx:757
 TTreeReaderArray.cxx:758
 TTreeReaderArray.cxx:759
 TTreeReaderArray.cxx:760
 TTreeReaderArray.cxx:761
 TTreeReaderArray.cxx:762
 TTreeReaderArray.cxx:763
 TTreeReaderArray.cxx:764
 TTreeReaderArray.cxx:765
 TTreeReaderArray.cxx:766
 TTreeReaderArray.cxx:767
 TTreeReaderArray.cxx:768
 TTreeReaderArray.cxx:769
 TTreeReaderArray.cxx:770
 TTreeReaderArray.cxx:771
 TTreeReaderArray.cxx:772