// @(#)root/tree:$Id$
// Author: Marek Biskup   07/06/2005

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

//////////////////////////////////////////////////////////////////////////
//
// A Chain Index
//
//////////////////////////////////////////////////////////////////////////

#include "TChainIndex.h"
#include "TChain.h"
#include "TTreeFormula.h"
#include "TTreeIndex.h"
#include "TFile.h"
#include "TError.h"



//______________________________________________________________________________
void TChainIndex::TChainIndexEntry::SetMinMaxFrom(const TTreeIndex *index )
{
   fMinIndexValue    = index->GetIndexValues()[0];
   fMinIndexValMinor = index->GetIndexValuesMinor()[0];
   fMaxIndexValue    = index->GetIndexValues()[index->GetN() - 1];
   fMaxIndexValMinor = index->GetIndexValuesMinor()[index->GetN() - 1];
}



ClassImp(TChainIndex)

//______________________________________________________________________________
TChainIndex::TChainIndex(): TVirtualIndex()
{
// Default constructor for TChainIndex

   fTree = 0;
   fMajorFormulaParent = fMinorFormulaParent = 0;
}

//______________________________________________________________________________
TChainIndex::TChainIndex(const TTree *T, const char *majorname, const char *minorname)
           : TVirtualIndex()
{
   // Normal constructor for TChainIndex. See TTreeIndex::TTreeIndex for the description of the
   // parameters.
   // The tree must be a TChain.
   // All the index values in the first tree of the chain must be
   // less then any index value in the second one, and so on.
   // If any of those requirements isn't met the object becomes a zombie.
   // If some subtrees don't have indices the indices are created and stored inside this
   // TChainIndex.

   fTree = 0;
   fMajorFormulaParent = fMinorFormulaParent = 0;

   TChain *chain = dynamic_cast<TChain*>(const_cast<TTree*>(T));
   if (!chain) {
      MakeZombie();
      Error("TChainIndex", "Cannot create a TChainIndex."
            " The Tree passed as an argument is not a TChain");
      return;
   }

   fTree               = (TTree*)T;
   fMajorName          = majorname;
   fMinorName          = minorname;
   Int_t i = 0;

   // Go through all the trees and check if they have indeces. If not then build them.
   for (i = 0; i < chain->GetNtrees(); i++) {
      chain->LoadTree((chain->GetTreeOffset())[i]);
      TVirtualIndex *index = chain->GetTree()->GetTreeIndex();

      TChainIndexEntry entry;
      entry.fTreeIndex = 0;

      //if an index already exists, we must check if major/minorname correspond
      //to the major/minor names in this function call
      if (index) {
         if (strcmp(majorname,index->GetMajorName()) || strcmp(minorname,index->GetMinorName())) {
            MakeZombie();
            Error("TChainIndex","Tree in file %s has an index built with majorname=%s and minorname=%s",chain->GetTree()->GetCurrentFile()->GetName(),index->GetMajorName(),index->GetMinorName());
            return;
         }
      }
      if (!index) {
         chain->GetTree()->BuildIndex(majorname, minorname);
         index = chain->GetTree()->GetTreeIndex();
         chain->GetTree()->SetTreeIndex(0);
         entry.fTreeIndex = index;
      }
      if (!index || index->IsZombie() || index->GetN() == 0) {
         DeleteIndices();
         MakeZombie();
         Error("TChainIndex", "Error creating a tree index on a tree in the chain");
         return;
      }

      TTreeIndex *ti_index = dynamic_cast<TTreeIndex*>(index);
      if (ti_index == 0) {
         Error("TChainIndex", "The underlying TTree must have a TTreeIndex but has a %s.",
               index->IsA()->GetName());
         return;
      }

      entry.SetMinMaxFrom(ti_index);
      fEntries.push_back(entry);
   }

   // Check if the indices of different trees are in order. If not then return an error.
   for (i = 0; i < Int_t(fEntries.size() - 1); i++) {
      if( fEntries[i].GetMaxIndexValPair() > fEntries[i+1].GetMinIndexValPair() ) {
         DeleteIndices();
         MakeZombie();
         Error("TChainIndex", "The indices in files of this chain aren't sorted.");
      }
   }
}

//______________________________________________________________________________
void TChainIndex::Append(const TVirtualIndex *index, Bool_t delaySort )
{
   // add an index to this chain
   // if delaySort is kFALSE (default) check if the indices of different trees are in order.

   if (index) {
      const TTreeIndex *ti_index = dynamic_cast<const TTreeIndex*>(index);
      if (ti_index == 0) {
         Error("Append", "The given index is not a TTreeIndex but a %s",
               index->IsA()->GetName());
      }

      TChainIndexEntry entry;
      entry.fTreeIndex = 0;
      entry.SetMinMaxFrom(ti_index);
      fEntries.push_back(entry);
   }

   if (!delaySort) {
      // Check if the indices of different trees are in order. If not then return an error.
      for (Int_t i = 0; i < Int_t(fEntries.size() - 1); i++) {
         if( fEntries[i].GetMaxIndexValPair() > fEntries[i+1].GetMinIndexValPair() ) {
            DeleteIndices();
            MakeZombie();
            Error("Append", "The indices in files of this chain aren't sorted.");
         }
      }
   }
}

//______________________________________________________________________________
void TChainIndex::DeleteIndices()
{
   // Delete all the indices which were built by this object
   for (unsigned int i = 0; i < fEntries.size(); i++) {
      if (fEntries[i].fTreeIndex) {
         if (fTree->GetTree() && fTree->GetTree()->GetTreeIndex() == fEntries[i].fTreeIndex) {
            fTree->GetTree()->SetTreeIndex(0);
            SafeDelete(fEntries[i].fTreeIndex);
         }
         SafeDelete(fEntries[i].fTreeIndex);
      }
   }
}

//______________________________________________________________________________
TChainIndex::~TChainIndex()
{
   // The destructor.
   DeleteIndices();
   if (fTree && fTree->GetTreeIndex() == this)
      fTree->SetTreeIndex(0);
}

//______________________________________________________________________________
std::pair<TVirtualIndex*, Int_t> TChainIndex::GetSubTreeIndex(Long64_t major, Long64_t minor) const
{
   // Returns a TVirtualIndex for a tree which holds the entry with the specified
   // major and minor values and the number of that tree.
   // If the index for that tree was created by this object it's set to the tree.
   // The tree index should be later released using ReleaseSubTreeIndex();

   using namespace std;
   if (fEntries.size() == 0) {
      Warning("GetSubTreeIndex", "No subindices in the chain. The chain is probably empty");
      return make_pair(static_cast<TVirtualIndex*>(0), 0);
   }

   const TChainIndexEntry::IndexValPair_t     indexValue(major, minor);

   if( indexValue < fEntries[0].GetMinIndexValPair() ) {
      Warning("GetSubTreeIndex", "The index value is less than the smallest index values in subtrees");
      return make_pair(static_cast<TVirtualIndex*>(0), 0);
   }

   Int_t treeNo = fEntries.size() - 1;
   for (unsigned int i = 0; i < fEntries.size() - 1; i++) {
      if( indexValue < fEntries[i+1].GetMinIndexValPair() ) {
         treeNo = i;
         break;
      }
   }
   // Double check we found the right range.
   if( indexValue > fEntries[treeNo].GetMaxIndexValPair() ) {
      return make_pair(static_cast<TVirtualIndex*>(0), 0);
   }
   TChain* chain = dynamic_cast<TChain*> (fTree);
   R__ASSERT(chain);
   chain->LoadTree(chain->GetTreeOffset()[treeNo]);
   TVirtualIndex* index =  fTree->GetTree()->GetTreeIndex();
   if (index)
      return make_pair(static_cast<TVirtualIndex*>(index), treeNo);
   else {
      index = fEntries[treeNo].fTreeIndex;
      if (!index) {
         Warning("GetSubTreeIndex", "The tree has no index and the chain index"
                  " doesn't store an index for that tree");
         return make_pair(static_cast<TVirtualIndex*>(0), 0);
      }
      else {
         fTree->GetTree()->SetTreeIndex(index);
         return make_pair(static_cast<TVirtualIndex*>(index), treeNo);
      }
   }
}

//______________________________________________________________________________
void TChainIndex::ReleaseSubTreeIndex(TVirtualIndex* index, int treeNo) const
{
   // Releases the tree index got using GetSubTreeIndex. If the index was
   // created by this object it is removed from the current tree, so that it isn't
   // deleted in its destructor.

   if (fEntries[treeNo].fTreeIndex == index) {
      R__ASSERT(fTree->GetTree()->GetTreeIndex() == index);
      fTree->GetTree()->SetTreeIndex(0);
   }
}

//______________________________________________________________________________
Long64_t TChainIndex::GetEntryNumberFriend(const TTree *parent)
{
   // see TTreeIndex::GetEntryNumberFriend for description

   if (!parent) return -3;
   GetMajorFormulaParent(parent);
   GetMinorFormulaParent(parent);
   if (!fMajorFormulaParent || !fMinorFormulaParent) return -1;
   if (!fMajorFormulaParent->GetNdim() || !fMinorFormulaParent->GetNdim()) {
      // The Tree Index in the friend has a pair majorname,minorname
      // not available in the parent Tree T.
      // if the friend Tree has less entries than the parent, this is an error
      Long64_t pentry = parent->GetReadEntry();
      if (pentry >= fTree->GetEntries()) return -2;
      // otherwise we ignore the Tree Index and return the entry number
      // in the parent Tree.
      return pentry;
   }

   // majorname, minorname exist in the parent Tree
   // we find the current values pair majorv,minorv in the parent Tree
   Double_t majord = fMajorFormulaParent->EvalInstance();
   Double_t minord = fMinorFormulaParent->EvalInstance();
   Long64_t majorv = (Long64_t)majord;
   Long64_t minorv = (Long64_t)minord;
   // we check if this pair exist in the index.
   // if yes, we return the corresponding entry number
   // if not the function returns -1
   return fTree->GetEntryNumberWithIndex(majorv,minorv);
}

//______________________________________________________________________________
Long64_t TChainIndex::GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
{
   // See TTreeIndex::GetEntryNumberWithBestIndex for details.

   std::pair<TVirtualIndex*, Int_t> indexAndNumber = GetSubTreeIndex(major, minor);
   if (!indexAndNumber.first) {
      // Error("GetEntryNumberWithBestIndex","no index found");
      return -1;
   }
   else {
      Long64_t rv = indexAndNumber.first->GetEntryNumberWithBestIndex(major, minor);
      ReleaseSubTreeIndex(indexAndNumber.first, indexAndNumber.second);
      TChain* chain = dynamic_cast<TChain*> (fTree);
      R__ASSERT(chain);
      return rv + chain->GetTreeOffset()[indexAndNumber.second];
   }
}

//______________________________________________________________________________
Long64_t TChainIndex::GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
{
   // Returns the entry number with given index values.
   // See TTreeIndex::GetEntryNumberWithIndex for details.

   std::pair<TVirtualIndex*, Int_t> indexAndNumber = GetSubTreeIndex(major, minor);
   if (!indexAndNumber.first) {
      // Error("GetEntryNumberWithIndex","no index found");
      return -1;
   }
   else {
      Long64_t rv = indexAndNumber.first->GetEntryNumberWithIndex(major, minor);
      ReleaseSubTreeIndex(indexAndNumber.first, indexAndNumber.second);
      TChain* chain = dynamic_cast<TChain*> (fTree);
      R__ASSERT(chain);
      if (rv >= 0) {
         return rv + chain->GetTreeOffset()[indexAndNumber.second];
      } else {
         return rv;
      }
   }
}

//______________________________________________________________________________
TTreeFormula *TChainIndex::GetMajorFormulaParent(const TTree *parent)
{
   // return a pointer to the TreeFormula corresponding to the majorname in parent tree T

   if (!fMajorFormulaParent) {
      TTree::TFriendLock friendlock(fTree, TTree::kFindLeaf | TTree::kFindBranch | TTree::kGetBranch | TTree::kGetLeaf);
      fMajorFormulaParent = new TTreeFormula("MajorP",fMajorName.Data(),const_cast<TTree*>(parent));
      fMajorFormulaParent->SetQuickLoad(kTRUE);
   }
   if (fMajorFormulaParent->GetTree() != parent) {
      fMajorFormulaParent->SetTree(const_cast<TTree*>(parent));
      fMajorFormulaParent->UpdateFormulaLeaves();
   }
   return fMajorFormulaParent;
}

//______________________________________________________________________________
TTreeFormula *TChainIndex::GetMinorFormulaParent(const TTree *parent)
{
   // return a pointer to the TreeFormula corresponding to the minorname in parent tree T

   if (!fMinorFormulaParent) {
      // Prevent TTreeFormula from finding any of the branches in our TTree even if it
      // is a friend of the parent TTree.
      TTree::TFriendLock friendlock(fTree, TTree::kFindLeaf | TTree::kFindBranch | TTree::kGetBranch | TTree::kGetLeaf);
      fMinorFormulaParent = new TTreeFormula("MinorP",fMinorName.Data(),const_cast<TTree*>(parent));
      fMinorFormulaParent->SetQuickLoad(kTRUE);
   }
   if (fMinorFormulaParent->GetTree() != parent) {
      fMinorFormulaParent->SetTree(const_cast<TTree*>(parent));
      fMinorFormulaParent->UpdateFormulaLeaves();
   }

   return fMinorFormulaParent;
}

//______________________________________________________________________________
void TChainIndex::UpdateFormulaLeaves(const TTree *parent)
{
   // Updates the parent formulae.
   // Called by TChain::LoadTree when the parent chain changes it's tree.
   if (fMajorFormulaParent) {
      // Prevent TTreeFormula from finding any of the branches in our TTree even if it
      // is a friend of the parent TTree.
      TTree::TFriendLock friendlock(fTree, TTree::kFindLeaf | TTree::kFindBranch | TTree::kGetBranch | TTree::kGetLeaf);
      if (parent) fMajorFormulaParent->SetTree((TTree*)parent);
      fMajorFormulaParent->UpdateFormulaLeaves();
   }
   if (fMinorFormulaParent) {
      if (parent) fMinorFormulaParent->SetTree((TTree*)parent);
      fMinorFormulaParent->UpdateFormulaLeaves();
   }
}

//______________________________________________________________________________
void TChainIndex::SetTree(const TTree *T)
{
   // See TTreeIndex::SetTree.

   R__ASSERT(fTree == 0 || fTree == T || T==0);
}

 TChainIndex.cxx:1
 TChainIndex.cxx:2
 TChainIndex.cxx:3
 TChainIndex.cxx:4
 TChainIndex.cxx:5
 TChainIndex.cxx:6
 TChainIndex.cxx:7
 TChainIndex.cxx:8
 TChainIndex.cxx:9
 TChainIndex.cxx:10
 TChainIndex.cxx:11
 TChainIndex.cxx:12
 TChainIndex.cxx:13
 TChainIndex.cxx:14
 TChainIndex.cxx:15
 TChainIndex.cxx:16
 TChainIndex.cxx:17
 TChainIndex.cxx:18
 TChainIndex.cxx:19
 TChainIndex.cxx:20
 TChainIndex.cxx:21
 TChainIndex.cxx:22
 TChainIndex.cxx:23
 TChainIndex.cxx:24
 TChainIndex.cxx:25
 TChainIndex.cxx:26
 TChainIndex.cxx:27
 TChainIndex.cxx:28
 TChainIndex.cxx:29
 TChainIndex.cxx:30
 TChainIndex.cxx:31
 TChainIndex.cxx:32
 TChainIndex.cxx:33
 TChainIndex.cxx:34
 TChainIndex.cxx:35
 TChainIndex.cxx:36
 TChainIndex.cxx:37
 TChainIndex.cxx:38
 TChainIndex.cxx:39
 TChainIndex.cxx:40
 TChainIndex.cxx:41
 TChainIndex.cxx:42
 TChainIndex.cxx:43
 TChainIndex.cxx:44
 TChainIndex.cxx:45
 TChainIndex.cxx:46
 TChainIndex.cxx:47
 TChainIndex.cxx:48
 TChainIndex.cxx:49
 TChainIndex.cxx:50
 TChainIndex.cxx:51
 TChainIndex.cxx:52
 TChainIndex.cxx:53
 TChainIndex.cxx:54
 TChainIndex.cxx:55
 TChainIndex.cxx:56
 TChainIndex.cxx:57
 TChainIndex.cxx:58
 TChainIndex.cxx:59
 TChainIndex.cxx:60
 TChainIndex.cxx:61
 TChainIndex.cxx:62
 TChainIndex.cxx:63
 TChainIndex.cxx:64
 TChainIndex.cxx:65
 TChainIndex.cxx:66
 TChainIndex.cxx:67
 TChainIndex.cxx:68
 TChainIndex.cxx:69
 TChainIndex.cxx:70
 TChainIndex.cxx:71
 TChainIndex.cxx:72
 TChainIndex.cxx:73
 TChainIndex.cxx:74
 TChainIndex.cxx:75
 TChainIndex.cxx:76
 TChainIndex.cxx:77
 TChainIndex.cxx:78
 TChainIndex.cxx:79
 TChainIndex.cxx:80
 TChainIndex.cxx:81
 TChainIndex.cxx:82
 TChainIndex.cxx:83
 TChainIndex.cxx:84
 TChainIndex.cxx:85
 TChainIndex.cxx:86
 TChainIndex.cxx:87
 TChainIndex.cxx:88
 TChainIndex.cxx:89
 TChainIndex.cxx:90
 TChainIndex.cxx:91
 TChainIndex.cxx:92
 TChainIndex.cxx:93
 TChainIndex.cxx:94
 TChainIndex.cxx:95
 TChainIndex.cxx:96
 TChainIndex.cxx:97
 TChainIndex.cxx:98
 TChainIndex.cxx:99
 TChainIndex.cxx:100
 TChainIndex.cxx:101
 TChainIndex.cxx:102
 TChainIndex.cxx:103
 TChainIndex.cxx:104
 TChainIndex.cxx:105
 TChainIndex.cxx:106
 TChainIndex.cxx:107
 TChainIndex.cxx:108
 TChainIndex.cxx:109
 TChainIndex.cxx:110
 TChainIndex.cxx:111
 TChainIndex.cxx:112
 TChainIndex.cxx:113
 TChainIndex.cxx:114
 TChainIndex.cxx:115
 TChainIndex.cxx:116
 TChainIndex.cxx:117
 TChainIndex.cxx:118
 TChainIndex.cxx:119
 TChainIndex.cxx:120
 TChainIndex.cxx:121
 TChainIndex.cxx:122
 TChainIndex.cxx:123
 TChainIndex.cxx:124
 TChainIndex.cxx:125
 TChainIndex.cxx:126
 TChainIndex.cxx:127
 TChainIndex.cxx:128
 TChainIndex.cxx:129
 TChainIndex.cxx:130
 TChainIndex.cxx:131
 TChainIndex.cxx:132
 TChainIndex.cxx:133
 TChainIndex.cxx:134
 TChainIndex.cxx:135
 TChainIndex.cxx:136
 TChainIndex.cxx:137
 TChainIndex.cxx:138
 TChainIndex.cxx:139
 TChainIndex.cxx:140
 TChainIndex.cxx:141
 TChainIndex.cxx:142
 TChainIndex.cxx:143
 TChainIndex.cxx:144
 TChainIndex.cxx:145
 TChainIndex.cxx:146
 TChainIndex.cxx:147
 TChainIndex.cxx:148
 TChainIndex.cxx:149
 TChainIndex.cxx:150
 TChainIndex.cxx:151
 TChainIndex.cxx:152
 TChainIndex.cxx:153
 TChainIndex.cxx:154
 TChainIndex.cxx:155
 TChainIndex.cxx:156
 TChainIndex.cxx:157
 TChainIndex.cxx:158
 TChainIndex.cxx:159
 TChainIndex.cxx:160
 TChainIndex.cxx:161
 TChainIndex.cxx:162
 TChainIndex.cxx:163
 TChainIndex.cxx:164
 TChainIndex.cxx:165
 TChainIndex.cxx:166
 TChainIndex.cxx:167
 TChainIndex.cxx:168
 TChainIndex.cxx:169
 TChainIndex.cxx:170
 TChainIndex.cxx:171
 TChainIndex.cxx:172
 TChainIndex.cxx:173
 TChainIndex.cxx:174
 TChainIndex.cxx:175
 TChainIndex.cxx:176
 TChainIndex.cxx:177
 TChainIndex.cxx:178
 TChainIndex.cxx:179
 TChainIndex.cxx:180
 TChainIndex.cxx:181
 TChainIndex.cxx:182
 TChainIndex.cxx:183
 TChainIndex.cxx:184
 TChainIndex.cxx:185
 TChainIndex.cxx:186
 TChainIndex.cxx:187
 TChainIndex.cxx:188
 TChainIndex.cxx:189
 TChainIndex.cxx:190
 TChainIndex.cxx:191
 TChainIndex.cxx:192
 TChainIndex.cxx:193
 TChainIndex.cxx:194
 TChainIndex.cxx:195
 TChainIndex.cxx:196
 TChainIndex.cxx:197
 TChainIndex.cxx:198
 TChainIndex.cxx:199
 TChainIndex.cxx:200
 TChainIndex.cxx:201
 TChainIndex.cxx:202
 TChainIndex.cxx:203
 TChainIndex.cxx:204
 TChainIndex.cxx:205
 TChainIndex.cxx:206
 TChainIndex.cxx:207
 TChainIndex.cxx:208
 TChainIndex.cxx:209
 TChainIndex.cxx:210
 TChainIndex.cxx:211
 TChainIndex.cxx:212
 TChainIndex.cxx:213
 TChainIndex.cxx:214
 TChainIndex.cxx:215
 TChainIndex.cxx:216
 TChainIndex.cxx:217
 TChainIndex.cxx:218
 TChainIndex.cxx:219
 TChainIndex.cxx:220
 TChainIndex.cxx:221
 TChainIndex.cxx:222
 TChainIndex.cxx:223
 TChainIndex.cxx:224
 TChainIndex.cxx:225
 TChainIndex.cxx:226
 TChainIndex.cxx:227
 TChainIndex.cxx:228
 TChainIndex.cxx:229
 TChainIndex.cxx:230
 TChainIndex.cxx:231
 TChainIndex.cxx:232
 TChainIndex.cxx:233
 TChainIndex.cxx:234
 TChainIndex.cxx:235
 TChainIndex.cxx:236
 TChainIndex.cxx:237
 TChainIndex.cxx:238
 TChainIndex.cxx:239
 TChainIndex.cxx:240
 TChainIndex.cxx:241
 TChainIndex.cxx:242
 TChainIndex.cxx:243
 TChainIndex.cxx:244
 TChainIndex.cxx:245
 TChainIndex.cxx:246
 TChainIndex.cxx:247
 TChainIndex.cxx:248
 TChainIndex.cxx:249
 TChainIndex.cxx:250
 TChainIndex.cxx:251
 TChainIndex.cxx:252
 TChainIndex.cxx:253
 TChainIndex.cxx:254
 TChainIndex.cxx:255
 TChainIndex.cxx:256
 TChainIndex.cxx:257
 TChainIndex.cxx:258
 TChainIndex.cxx:259
 TChainIndex.cxx:260
 TChainIndex.cxx:261
 TChainIndex.cxx:262
 TChainIndex.cxx:263
 TChainIndex.cxx:264
 TChainIndex.cxx:265
 TChainIndex.cxx:266
 TChainIndex.cxx:267
 TChainIndex.cxx:268
 TChainIndex.cxx:269
 TChainIndex.cxx:270
 TChainIndex.cxx:271
 TChainIndex.cxx:272
 TChainIndex.cxx:273
 TChainIndex.cxx:274
 TChainIndex.cxx:275
 TChainIndex.cxx:276
 TChainIndex.cxx:277
 TChainIndex.cxx:278
 TChainIndex.cxx:279
 TChainIndex.cxx:280
 TChainIndex.cxx:281
 TChainIndex.cxx:282
 TChainIndex.cxx:283
 TChainIndex.cxx:284
 TChainIndex.cxx:285
 TChainIndex.cxx:286
 TChainIndex.cxx:287
 TChainIndex.cxx:288
 TChainIndex.cxx:289
 TChainIndex.cxx:290
 TChainIndex.cxx:291
 TChainIndex.cxx:292
 TChainIndex.cxx:293
 TChainIndex.cxx:294
 TChainIndex.cxx:295
 TChainIndex.cxx:296
 TChainIndex.cxx:297
 TChainIndex.cxx:298
 TChainIndex.cxx:299
 TChainIndex.cxx:300
 TChainIndex.cxx:301
 TChainIndex.cxx:302
 TChainIndex.cxx:303
 TChainIndex.cxx:304
 TChainIndex.cxx:305
 TChainIndex.cxx:306
 TChainIndex.cxx:307
 TChainIndex.cxx:308
 TChainIndex.cxx:309
 TChainIndex.cxx:310
 TChainIndex.cxx:311
 TChainIndex.cxx:312
 TChainIndex.cxx:313
 TChainIndex.cxx:314
 TChainIndex.cxx:315
 TChainIndex.cxx:316
 TChainIndex.cxx:317
 TChainIndex.cxx:318
 TChainIndex.cxx:319
 TChainIndex.cxx:320
 TChainIndex.cxx:321
 TChainIndex.cxx:322
 TChainIndex.cxx:323
 TChainIndex.cxx:324
 TChainIndex.cxx:325
 TChainIndex.cxx:326
 TChainIndex.cxx:327
 TChainIndex.cxx:328
 TChainIndex.cxx:329
 TChainIndex.cxx:330
 TChainIndex.cxx:331
 TChainIndex.cxx:332
 TChainIndex.cxx:333
 TChainIndex.cxx:334
 TChainIndex.cxx:335
 TChainIndex.cxx:336
 TChainIndex.cxx:337
 TChainIndex.cxx:338
 TChainIndex.cxx:339
 TChainIndex.cxx:340
 TChainIndex.cxx:341
 TChainIndex.cxx:342
 TChainIndex.cxx:343
 TChainIndex.cxx:344
 TChainIndex.cxx:345
 TChainIndex.cxx:346
 TChainIndex.cxx:347
 TChainIndex.cxx:348
 TChainIndex.cxx:349
 TChainIndex.cxx:350
 TChainIndex.cxx:351
 TChainIndex.cxx:352
 TChainIndex.cxx:353
 TChainIndex.cxx:354
 TChainIndex.cxx:355
 TChainIndex.cxx:356
 TChainIndex.cxx:357
 TChainIndex.cxx:358
 TChainIndex.cxx:359
 TChainIndex.cxx:360
 TChainIndex.cxx:361
 TChainIndex.cxx:362
 TChainIndex.cxx:363
 TChainIndex.cxx:364
 TChainIndex.cxx:365
 TChainIndex.cxx:366
 TChainIndex.cxx:367
 TChainIndex.cxx:368
 TChainIndex.cxx:369
 TChainIndex.cxx:370
 TChainIndex.cxx:371
 TChainIndex.cxx:372
 TChainIndex.cxx:373
 TChainIndex.cxx:374
 TChainIndex.cxx:375
 TChainIndex.cxx:376
 TChainIndex.cxx:377
 TChainIndex.cxx:378
 TChainIndex.cxx:379
 TChainIndex.cxx:380
 TChainIndex.cxx:381
 TChainIndex.cxx:382
 TChainIndex.cxx:383
 TChainIndex.cxx:384
 TChainIndex.cxx:385
 TChainIndex.cxx:386