#include "TMVA/BDT.h"
#include <iostream>
#include <iomanip>
#include <fstream>



#include "RQ_OBJECT.h"

#include "TROOT.h"
#include "TStyle.h"
#include "TPad.h"
#include "TCanvas.h"
#include "TLine.h"
#include "TFile.h"
#include "TColor.h"
#include "TPaveText.h"
#include "TObjString.h"
#include "TControlBar.h"

#include "TGWindow.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TGNumberEntry.h"

#include "TMVA/DecisionTree.h"
#include "TMVA/Tools.h"
#include "TXMLEngine.h"



TMVA::StatDialogBDT* TMVA::StatDialogBDT::fThis = 0;

void TMVA::StatDialogBDT::SetItree() 
{
   fItree = Int_t(fInput->GetNumber());
}

void TMVA::StatDialogBDT::Redraw() 
{
   UpdateCanvases();
}

void TMVA::StatDialogBDT::Close() 
{
   delete this;
}

TMVA::StatDialogBDT::StatDialogBDT( const TGWindow* p, TString wfile, TString methName, Int_t itree )
   : fMain( 0 ),
     fItree(itree),
     fNtrees(0),
     fCanvas(0),
     fInput(0),
     fButtons(0),
     fDrawButton(0),
     fCloseButton(0),
     fWfile( wfile ),
     fMethName( methName )
{
   UInt_t totalWidth  = 500;
   UInt_t totalHeight = 200;

   fThis = this;

   TMVA::DecisionTreeNode::fgIsTraining=true;

   // read number of decision trees from weight file
   GetNtrees();

   // main frame
   fMain = new TGMainFrame(p, totalWidth, totalHeight, kMainFrame | kVerticalFrame);

   TGLabel *sigLab = new TGLabel( fMain, Form( "Decision tree [%i-%i]",0,fNtrees-1 ) );
   fMain->AddFrame(sigLab, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,5,5));

   fInput = new TGNumberEntry(fMain, (Double_t) fItree,5,-1,(TGNumberFormat::EStyle) 5);
   fMain->AddFrame(fInput, new TGLayoutHints(kLHintsLeft | kLHintsTop,5,5,5,5));
   fInput->Resize(100,24);
   fInput->SetLimits(TGNumberFormat::kNELLimitMinMax,0,fNtrees-1);

   fButtons = new TGHorizontalFrame(fMain, totalWidth,30);

   fCloseButton = new TGTextButton(fButtons,"&Close");
   fButtons->AddFrame(fCloseButton, new TGLayoutHints(kLHintsLeft | kLHintsTop));

   fDrawButton = new TGTextButton(fButtons,"&Draw");
   fButtons->AddFrame(fDrawButton, new TGLayoutHints(kLHintsRight | kLHintsTop,15));
  
   fMain->AddFrame(fButtons,new TGLayoutHints(kLHintsLeft | kLHintsBottom,5,5,5,5));

   fMain->SetWindowName("Decision tree");
   fMain->SetWMPosition(0,0);
   fMain->MapSubwindows();
   fMain->Resize(fMain->GetDefaultSize());
   fMain->MapWindow();

   fInput->Connect("ValueSet(Long_t)","TMVA::StatDialogBDT",this, "SetItree()");

   // doesn't seem to exist .. gives an 'error message' and seems to work just fine without ... :)
   //   fDrawButton->Connect("ValueSet(Long_t)","TGNumberEntry",fInput, "Clicked()");
   fDrawButton->Connect("Clicked()", "TMVA::StatDialogBDT", this, "Redraw()");   

   fCloseButton->Connect("Clicked()", "TMVA::StatDialogBDT", this, "Close()");
}

void TMVA::StatDialogBDT::UpdateCanvases() 
{
   DrawTree( fItree );
}

void TMVA::StatDialogBDT::GetNtrees()
{
   if(!fWfile.EndsWith(".xml") ){
      std::ifstream fin( fWfile );
      if (!fin.good( )) { // file not found --> Error
         cout << "*** ERROR: Weight file: " << fWfile << " does not exist" << endl;
         return;
      }
   
      TString dummy = "";
      
      // read total number of trees, and check whether requested tree is in range
      Int_t nc = 0;
      while (!dummy.Contains("NTrees")) { 
         fin >> dummy; 
         nc++; 
         if (nc > 200) {
            cout << endl;
            cout << "*** Huge problem: could not locate term \"NTrees\" in BDT weight file: " 
                 << fWfile << endl;
            cout << "==> panic abort (please contact the TMVA authors)" << endl;
            cout << endl;
            exit(1);
         }
      }
      fin >> dummy; 
      fNtrees = dummy.ReplaceAll("\"","").Atoi();
      fin.close();
   }
   else{
      void* doc = TMVA::gTools().xmlengine().ParseFile(fWfile);
      void* rootnode = TMVA::gTools().xmlengine().DocGetRootElement(doc);
      void* ch = TMVA::gTools().xmlengine().GetChild(rootnode);
      while(ch){
         TString nodeName = TString( TMVA::gTools().xmlengine().GetNodeName(ch) );
         if(nodeName=="Weights") {
            TMVA::gTools().ReadAttr( ch, "NTrees", fNtrees );
            break;
         }
         ch = TMVA::gTools().xmlengine().GetNext(ch);
      }
   }
   cout << "--- Found " << fNtrees << " decision trees in weight file" << endl;

}

//_______________________________________________________________________
void TMVA::StatDialogBDT::DrawNode( TMVA::DecisionTreeNode *n, 
                               Double_t x, Double_t y, 
                               Double_t xscale,  Double_t yscale, TString * vars) 
{
   // recursively puts an entries in the histogram for the node and its daughters
   //
   Float_t xsize=xscale*1.5;
   Float_t ysize=yscale/3;
   if (xsize>0.15) xsize=0.1; //xscale/2;
   if (n->GetLeft() != NULL){
      TLine *a1 = new TLine(x-xscale/4,y-ysize,x-xscale,y-ysize*2);
      a1->SetLineWidth(2);
      a1->Draw();
      DrawNode((TMVA::DecisionTreeNode*) n->GetLeft(), x-xscale, y-yscale, xscale/2, yscale, vars);
   }
   if (n->GetRight() != NULL){
      TLine *a1 = new TLine(x+xscale/4,y-ysize,x+xscale,y-ysize*2);
      a1->SetLineWidth(2);
      a1->Draw();
      DrawNode((TMVA::DecisionTreeNode*) n->GetRight(), x+xscale, y-yscale, xscale/2, yscale, vars  );
   }

   //   TPaveText *t = new TPaveText(x-xscale/2,y-yscale/2,x+xscale/2,y+yscale/2, "NDC");
   TPaveText *t = new TPaveText(x-xsize,y-ysize,x+xsize,y+ysize, "NDC");

   t->SetBorderSize(1);

   t->SetFillStyle(1001);


   Double_t pur=n->GetPurity();
   t->SetFillColor(fColorOffset+Int_t(pur*100));

   char buffer[25];
   sprintf( buffer, "N=%f", n->GetNEvents() );
   if (n->GetNEvents()>0) t->AddText(buffer);
   sprintf( buffer, "S/(S+B)=%4.3f", n->GetPurity() );
   t->AddText(buffer);

   if (n->GetNodeType() == 0){
      if (n->GetCutType()){
         t->AddText(TString(vars[n->GetSelector()]+">"+=::Form("%5.3g",n->GetCutValue())));
      }else{
         t->AddText(TString(vars[n->GetSelector()]+"<"+=::Form("%5.3g",n->GetCutValue())));
      }
   }

   t->Draw();

   return;
}
TMVA::DecisionTree* TMVA::StatDialogBDT::ReadTree( TString* &vars, Int_t itree )
{
   cout << "--- Reading Tree " << itree << " from weight file: " << fWfile << endl;
   TMVA::DecisionTree *d = new TMVA::DecisionTree();
   if(!fWfile.EndsWith(".xml") ){
      std::ifstream fin( fWfile );
      if (!fin.good( )) { // file not found --> Error
         cout << "*** ERROR: Weight file: " << fWfile << " does not exist" << endl;
         return 0;
      }
      
      TString dummy = "";
      
      if (itree >= fNtrees) {
         cout << "*** ERROR: requested decision tree: " << itree 
              << ", but number of trained trees only: " << fNtrees << endl;
         return 0;
      }
      
      // file header with name
      while (!dummy.Contains("#VAR")) fin >> dummy;
      fin >> dummy >> dummy >> dummy; // the rest of header line
      
      // number of variables
      Int_t nVars;
      fin >> dummy >> nVars;
      
      // variable mins and maxes
      vars = new TString[nVars+1]; // last one is if "fisher cut criterium"
      for (Int_t i = 0; i < nVars; i++) fin >> vars[i] >> dummy >> dummy >> dummy >> dummy;
      vars[nVars]="FisherCrit";

      char buffer[20];
      char line[256];
      sprintf(buffer,"Tree %d",itree);

      while (!dummy.Contains(buffer)) {
         fin.getline(line,256);
         dummy = TString(line);
      }

      d->Read(fin);
      
      fin.close();
   }
   else{
     if (itree >= fNtrees) {
         cout << "*** ERROR: requested decision tree: " << itree 
              << ", but number of trained trees only: " << fNtrees << endl;
         return 0;
      }
     Int_t nVars;
      void* doc = TMVA::gTools().xmlengine().ParseFile(fWfile);
      void* rootnode = TMVA::gTools().xmlengine().DocGetRootElement(doc);
      void* ch = TMVA::gTools().xmlengine().GetChild(rootnode);
      while(ch){
         TString nodeName = TString( TMVA::gTools().xmlengine().GetNodeName(ch) );
         if(nodeName=="Variables"){
            TMVA::gTools().ReadAttr( ch, "NVar", nVars);
            vars = new TString[nVars+1]; 
            void* varnode =  TMVA::gTools().xmlengine().GetChild(ch);
            for (Int_t i = 0; i < nVars; i++){
               TMVA::gTools().ReadAttr( varnode, "Expression", vars[i]);
               varnode =  TMVA::gTools().xmlengine().GetNext(varnode);
            }
            vars[nVars]="FisherCrit";
         }
         if(nodeName=="Weights") break;
         ch = TMVA::gTools().xmlengine().GetNext(ch);
      }
      ch = TMVA::gTools().xmlengine().GetChild(ch);
      for (int i=0; i<itree; i++) ch = TMVA::gTools().xmlengine().GetNext(ch);
      d->ReadXML(ch);
   }
   return d;
}

//_______________________________________________________________________
void TMVA::StatDialogBDT::DrawTree( Int_t itree )
{
   TString *vars;   
   TMVA::DecisionTree* d = ReadTree( vars, itree );
   if (d == 0) return;

   UInt_t   depth = d->GetTotalTreeDepth();
   Double_t ystep = 1.0/(depth + 1.0);

   cout << "--- Tree depth: " << depth << endl;

   TStyle* TMVAStyle   = gROOT->GetStyle("Plain"); // our style is based on Plain



   Double_t r[2]    = {1., 0.};
   Double_t g[2]    = {0., 0.};
   Double_t b[2]    = {0., 1.};
   Double_t stop[2] = {0., 1.0};
   fColorOffset = TColor::CreateGradientColorTable(2, stop, r, g, b, 100);

   Int_t MyPalette[100];
   for (int i=0;i<100;i++) MyPalette[i] = fColorOffset+i;
   TMVAStyle->SetPalette(100, MyPalette);
   


   Int_t   canvasColor = TMVAStyle->GetCanvasColor(); // backup

   TString cbuffer = Form( "Reading weight file: %s", fWfile.Data() );
   TString tbuffer = Form( "Decision Tree no.: %d", itree );
   if (!fCanvas) fCanvas = new TCanvas( "c1", cbuffer, 200, 0, 1000, 600 ); 
   else          fCanvas->Clear();
   fCanvas->Draw();   

   DrawNode( (TMVA::DecisionTreeNode*)d->GetRoot(), 0.5, 1.-0.5*ystep, 0.25, ystep ,vars);
  
   // make the legend
   Double_t yup=0.99;
   Double_t ydown=yup-ystep/2.5;
   Double_t dy= ystep/2.5 * 0.2;
 
   TPaveText *whichTree = new TPaveText(0.85,ydown,0.98,yup, "NDC");
   whichTree->SetBorderSize(1);
   whichTree->SetFillStyle(1001);
   whichTree->SetFillColor( TColor::GetColor( "#ffff33" ) );
   whichTree->AddText( tbuffer );
   whichTree->Draw();

   TPaveText *signalleaf = new TPaveText(0.02,ydown ,0.15,yup, "NDC");
   signalleaf->SetBorderSize(1);
   signalleaf->SetFillStyle(1001);
   signalleaf->SetFillColor( kSigColorF );
   signalleaf->AddText("Pure Signal Nodes");
   signalleaf->SetTextColor( kSigColorT );
   signalleaf->Draw();

   ydown = ydown - ystep/2.5 -dy;
   yup   = yup - ystep/2.5 -dy;
   TPaveText *backgroundleaf = new TPaveText(0.02,ydown,0.15,yup, "NDC");
   backgroundleaf->SetBorderSize(1);
   backgroundleaf->SetFillStyle(1001);
   backgroundleaf->SetFillColor( kBkgColorF );

   backgroundleaf->AddText("Pure Backgr. Nodes");
   backgroundleaf->SetTextColor( kBkgColorT );
   backgroundleaf->Draw();


   fCanvas->Update();
   TString fname = Form("plots/%s_%i", fMethName.Data(), itree );
   cout << "--- Creating image: " << fname << endl;
   TMVAGlob::imgconv( fCanvas, fname );   

   TMVAStyle->SetCanvasColor( canvasColor );
}   
      
// ========================================================================================


// intermediate GUI
void TMVA::BDT( const TString& fin  )
{
   // --- read the available BDT weight files

   // destroy all open cavases
   TMVAGlob::DestroyCanvases(); 

   // checks if file with name "fin" is already open, and if not opens one
   TFile* file = TMVAGlob::OpenFile( fin );  

   TDirectory* dir = file->GetDirectory( "Method_BDT" );
   if (!dir) {
      cout << "*** Error in macro \"BDT.C\": cannot find directory \"Method_BDT\" in file: " << fin << endl;
      return;
   }

   // read all directories
   TIter next( dir->GetListOfKeys() );
   TKey *key(0);   
   std::vector<TString> methname;   
   std::vector<TString> path;   
   std::vector<TString> wfile;   
   while ((key = (TKey*)next())) {
      TDirectory* mdir = dir->GetDirectory( key->GetName() );
      if (!mdir) {
         cout << "*** Error in macro \"BDT.C\": cannot find sub-directory: " << key->GetName() 
              << " in directory: " << dir->GetName() << endl;
         return;
      }

      // retrieve weight file name and path
      TObjString* strPath = (TObjString*)mdir->Get( "TrainingPath" );
      TObjString* strWFile = (TObjString*)mdir->Get( "WeightFileName" );
      if (!strPath || !strWFile) {
         cout << "*** Error in macro \"BDT.C\": could not find TObjStrings \"TrainingPath\" and/or \"WeightFileName\" *** " << endl;
         cout << "*** Maybe you are using TMVA >= 3.8.15 with an older training target file ? *** " << endl;
         return;
      }

      methname.push_back( key->GetName() );
      path    .push_back( strPath->GetString() );
      wfile   .push_back( strWFile->GetString() );
   }

   // create the control bar
   TControlBar* cbar = new TControlBar( "vertical", "Choose weight file:", 50, 50 );
   BDT_Global__cbar.push_back(cbar);

   for (UInt_t im=0; im<path.size(); im++) {
      TString fname = path[im];
      if (fname[fname.Length()-1] != '/') fname += "/";
      fname += wfile[im];
      TString macro = Form( "TMVA::BDT(0,\"%s\",\"%s\")", fname.Data(), methname[im].Data() );
      cbar->AddButton( fname, macro, "Plot decision trees from this weight file", "button" );
   }

   // *** problems with this button in ROOT 5.19 ***
   #if ROOT_VERSION_CODE < ROOT_VERSION(5,19,0)
   cbar->AddButton( "Close", Form("BDT_DeleteTBar(%i)", BDT_Global__cbar.size()-1), "Close this control bar", "button" );
   #endif
   // **********************************************

   // set the style 
   cbar->SetTextColor("blue");

   // draw
   cbar->Show();   
}

void TMVA::BDT_DeleteTBar(int i)
{
   // destroy all open canvases
   StatDialogBDT::Delete();
   TMVAGlob::DestroyCanvases();

   delete BDT_Global__cbar[i];
   BDT_Global__cbar[i] = 0;
}

// input: - No. of tree
//        - the weight file from which the tree is read
void TMVA::BDT( Int_t itree, TString wfile , TString methName , Bool_t useTMVAStyle  ) 
{
   // destroy possibly existing dialog windows and/or canvases
   StatDialogBDT::Delete();
   TMVAGlob::DestroyCanvases(); 

   // quick check if weight file exist
   if(!wfile.EndsWith(".xml") ){
      std::ifstream fin( wfile );
      if (!fin.good( )) { // file not found --> Error
         cout << "*** ERROR: Weight file: " << wfile << " does not exist" << endl;
         return;
      }
   }
   std::cout << "test1";
   // set style and remove existing canvas'
   TMVAGlob::Initialize( useTMVAStyle );

   StatDialogBDT* gGui = new StatDialogBDT( gClient->GetRoot(), wfile, methName, itree );

   gGui->DrawTree( itree );

   gGui->RaiseDialog();
}

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