// @(#)root/tmva $Id$
// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : VariableTransformBase                                                 *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Implementation (see header for description)                               *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Peter Speckmayer <Peter.Speckmayer@cern.ch>  - CERN, Switzerland          *
 *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         *
 *      MPI-K Heidelberg, Germany                                                 *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#include <iomanip>
#include <algorithm>
#include <exception>
#include <stdexcept>
#include <set>
#include <cassert>

#include "TMath.h"
#include "TVectorD.h"
#include "TH1.h"
#include "TH2.h"
#include "TProfile.h"

#include "TMVA/VariableTransformBase.h"
#include "TMVA/Ranking.h"
#include "TMVA/Config.h"
#include "TMVA/Tools.h"
#include "TMVA/Version.h"

#ifndef ROOT_TMVA_MsgLogger
#include "TMVA/MsgLogger.h"
#endif

ClassImp(TMVA::VariableTransformBase)

//_______________________________________________________________________
TMVA::VariableTransformBase::VariableTransformBase( DataSetInfo& dsi,
                                                    Types::EVariableTransform tf,
                                                    const TString& trfName )
   : TObject(),
     fDsi(dsi),
     fDsiOutput(NULL),
     fTransformedEvent(0),
     fBackTransformedEvent(0),
     fVariableTransform(tf),
     fEnabled( kTRUE ),
     fCreated( kFALSE ),
     fNormalise( kFALSE ),
     fTransformName(trfName),
     fVariableTypesAreCounted(false),
     fNVariables(0),
     fNTargets(0),
     fNSpectators(0),
     fSortGet(kTRUE),
     fTMVAVersion(TMVA_VERSION_CODE),
     fLogger( 0 )
{
   // standard constructor
   fLogger = new MsgLogger(this, kINFO);
   for (UInt_t ivar = 0; ivar < fDsi.GetNVariables(); ivar++) {
      fVariables.push_back( VariableInfo( fDsi.GetVariableInfo(ivar) ) );
   }
   for (UInt_t itgt = 0; itgt < fDsi.GetNTargets(); itgt++) {
      fTargets.push_back( VariableInfo( fDsi.GetTargetInfo(itgt) ) );
   }
   for (UInt_t ispct = 0; ispct < fDsi.GetNSpectators(); ispct++) {
      fTargets.push_back( VariableInfo( fDsi.GetSpectatorInfo(ispct) ) );
   }
}

//_______________________________________________________________________
TMVA::VariableTransformBase::~VariableTransformBase()
{
   if (fTransformedEvent!=0)     delete fTransformedEvent;
   if (fBackTransformedEvent!=0) delete fBackTransformedEvent;
   // destructor
   delete fLogger;
}

//_______________________________________________________________________
void TMVA::VariableTransformBase::SelectInput( const TString& _inputVariables, Bool_t putIntoVariables  )
{
   // select the variables/targets/spectators which serve as input to the transformation
   TString inputVariables = _inputVariables;

   // unselect all variables first
   fGet.clear();       

   UInt_t nvars  = GetNVariables();
   UInt_t ntgts  = GetNTargets();
   UInt_t nspcts = GetNSpectators();

   typedef std::set<Int_t> SelectedIndices;

   SelectedIndices varIndices;
   SelectedIndices tgtIndices;
   SelectedIndices spctIndices;

   if (inputVariables == "") // default is all variables and all targets 
   {                         //   (the default can be changed by decorating this member function in the implementations)
      inputVariables = "_V_,_T_";
   }

   TList* inList = gTools().ParseFormatLine( inputVariables, "," );
   TListIter inIt(inList);
   while (TObjString* os = (TObjString*)inIt()) {

      TString variables = os->GetString();

      if( variables.BeginsWith("_") && variables.EndsWith("_") ) { // special symbol (keyword)
	 variables.Remove( 0,1); // remove first "_"
	 variables.Remove( variables.Length()-1,1 ); // remove last "_"

	 if( variables.BeginsWith("V") ) {       // variables
	    variables.Remove(0,1); // remove "V"
	    if( variables.Length() == 0 ){
	       for( UInt_t ivar = 0; ivar < nvars; ++ivar ) {
		  fGet.push_back( std::pair<Char_t,UInt_t>('v',ivar) );
		  varIndices.insert( ivar );
	       }
	    } else {
	       UInt_t idx = variables.Atoi();
	       if( idx >= nvars )
		  Log() << kFATAL << "You selected variable with index : " << idx << " of only " << nvars << " variables." << Endl;
	       fGet.push_back( std::pair<Char_t,UInt_t>('v',idx) );
	       varIndices.insert( idx );
	    }
	 }else if( variables.BeginsWith("T") ) {       // targets
	    variables.Remove(0,1); // remove "T"
	    if( variables.Length() == 0 ){
	       for( UInt_t itgt = 0; itgt < ntgts; ++itgt ) {
		  fGet.push_back( std::pair<Char_t,UInt_t>('t',itgt) );
		  tgtIndices.insert( itgt );
	       }
	    } else {
	       UInt_t idx = variables.Atoi();
	       if( idx >= ntgts )
		  Log() << kFATAL << "You selected target with index : " << idx << " of only " << ntgts << " targets." << Endl;
	       fGet.push_back( std::pair<Char_t,UInt_t>('t',idx) );
	       tgtIndices.insert( idx );
	    }
	 }else if( variables.BeginsWith("S") ) {       // spectators
	    variables.Remove(0,1); // remove "S"
	    if( variables.Length() == 0 ){
	       for( UInt_t ispct = 0; ispct < nspcts; ++ispct ) {
		  fGet.push_back( std::pair<Char_t,UInt_t>('s',ispct) );
		  spctIndices.insert( ispct );
	       }
	    } else {
	       UInt_t idx = variables.Atoi();
	       if( idx >= nspcts )
		  Log() << kFATAL << "You selected spectator with index : " << idx << " of only " << nspcts << " spectators." << Endl;
	       fGet.push_back( std::pair<Char_t,UInt_t>('s',idx) );
	       spctIndices.insert( idx );
	    }
	 }else if( TString("REARRANGE").BeginsWith(variables) ) {       // toggle rearrange sorting (take sort order given in the options)
	    ToggleInputSortOrder( kFALSE );
	    if( !fSortGet )
	       Log() << kINFO << "Variable rearrangement set true: Variable order given in transformation option is used for input to transformation!" << Endl;

	 }
      }else{ // no keyword, ... user provided variable labels
	 Int_t numIndices = varIndices.size()+tgtIndices.size()+spctIndices.size();
	 for( UInt_t ivar = 0; ivar < nvars; ++ivar ) { // search all variables
	    if( fDsi.GetVariableInfo( ivar ).GetLabel() == variables ) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('v',ivar) );
	       varIndices.insert( ivar );
	       break;
	    }
	 }
	 for( UInt_t itgt = 0; itgt < ntgts; ++itgt ) { // search all targets
	    if( fDsi.GetTargetInfo( itgt ).GetLabel() == variables ) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('t',itgt) );
	       tgtIndices.insert( itgt );
	       break;
	    }
	 }
	 for( UInt_t ispct = 0; ispct < nspcts; ++ispct ) { // search all spectators
	    if( fDsi.GetSpectatorInfo( ispct ).GetLabel() == variables ) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('s',ispct) );
	       spctIndices.insert( ispct );
	       break;
	    }
	 }
	 Int_t numIndicesEndOfLoop = varIndices.size()+tgtIndices.size()+spctIndices.size();
	 if( numIndicesEndOfLoop == numIndices )
	    Log() << kWARNING << "Error at parsing the options for the variable transformations: Variable/Target/Spectator '" << variables.Data() << "' not found." << Endl;
	 numIndices = numIndicesEndOfLoop;
      }
   }


   if( putIntoVariables ) {
      Int_t idx = 0;
      for( SelectedIndices::iterator it = varIndices.begin(), itEnd = varIndices.end(); it != itEnd; ++it ) {
	 fPut.push_back( std::pair<Char_t,UInt_t>('v',idx) );
	 ++idx;
      }
      for( SelectedIndices::iterator it = tgtIndices.begin(), itEnd = tgtIndices.end(); it != itEnd; ++it ) {
	 fPut.push_back( std::pair<Char_t,UInt_t>('t',idx) );
	 ++idx;
      }
      for( SelectedIndices::iterator it = spctIndices.begin(), itEnd = spctIndices.end(); it != itEnd; ++it ) {
	 fPut.push_back( std::pair<Char_t,UInt_t>('s',idx) );
	 ++idx;
      }
   }else {
      for( SelectedIndices::iterator it = varIndices.begin(), itEnd = varIndices.end(); it != itEnd; ++it ) {
	 Int_t idx = (*it);
	 fPut.push_back( std::pair<Char_t,UInt_t>('v',idx) );
      }
      for( SelectedIndices::iterator it = tgtIndices.begin(), itEnd = tgtIndices.end(); it != itEnd; ++it ) {
	 Int_t idx = (*it);
	 fPut.push_back( std::pair<Char_t,UInt_t>('t',idx) );
      }
      for( SelectedIndices::iterator it = spctIndices.begin(), itEnd = spctIndices.end(); it != itEnd; ++it ) {
	 Int_t idx = (*it);
	 fPut.push_back( std::pair<Char_t,UInt_t>('s',idx) );
      }

      // if sorting is turned on, fGet should have the indices sorted as fPut has them.
      if( fSortGet ) {
	 fGet.clear();
	 fGet.assign( fPut.begin(), fPut.end() );
      }
   }


   Log() << kINFO << "Transformation, Variable selection : " << Endl;

   // choose the new dsi for output if present, if not, take the common one
   const DataSetInfo* outputDsiPtr = (fDsiOutput? &(*fDsiOutput) : &fDsi );


   
   ItVarTypeIdx itGet = fGet.begin(), itGetEnd = fGet.end();
   ItVarTypeIdx itPut = fPut.begin(); // , itPutEnd = fPut.end();
   for( ; itGet != itGetEnd; ++itGet ) {
      TString inputTypeString  = "?";

      Char_t inputType = (*itGet).first;
      Int_t inputIdx  = (*itGet).second;

      TString inputLabel = "NOT FOND";
      if( inputType == 'v' ) {
	 inputLabel = fDsi.GetVariableInfo( inputIdx ).GetLabel();
	 inputTypeString = "variable";
      }
      else if( inputType == 't' ){
	 inputLabel = fDsi.GetTargetInfo( inputIdx ).GetLabel();
	 inputTypeString = "target";
      }
      else if( inputType == 's' ){
	 inputLabel = fDsi.GetSpectatorInfo( inputIdx ).GetLabel();
	 inputTypeString = "spectator";
      }

      TString outputTypeString  = "?";

      Char_t outputType = (*itPut).first;
      Int_t outputIdx  = (*itPut).second;

      TString outputLabel = "NOT FOUND";
      if( outputType == 'v' ) {
	 outputLabel = outputDsiPtr->GetVariableInfo( outputIdx ).GetLabel();
	 outputTypeString = "variable";
      }
      else if( outputType == 't' ){
	 outputLabel = outputDsiPtr->GetTargetInfo( outputIdx ).GetLabel();
	 outputTypeString = "target";
      }
      else if( outputType == 's' ){
	 outputLabel = outputDsiPtr->GetSpectatorInfo( outputIdx ).GetLabel();
	 outputTypeString = "spectator";
      }


      Log() << kINFO << "Input : " << inputTypeString.Data() << " '" << inputLabel.Data() << "' (index=" << inputIdx << ").   <---> "
	    <<          "Output : " << outputTypeString.Data() << " '" << outputLabel.Data() << "' (index=" << outputIdx << ")." << Endl;

      ++itPut;
   }
}


//_______________________________________________________________________
Bool_t TMVA::VariableTransformBase::GetInput( const Event* event, std::vector<Float_t>& input, std::vector<Char_t>& mask, Bool_t backTransformation ) const
{
   // select the values from the event

   ItVarTypeIdxConst itEntry;
   ItVarTypeIdxConst itEntryEnd;

   if( backTransformation && !fPut.empty() ){
      itEntry = fPut.begin();
      itEntryEnd = fPut.end();
   }
   else {
      itEntry = fGet.begin();
      itEntryEnd = fGet.end();
   }

   input.clear();
   mask.clear();
   Bool_t hasMaskedEntries = kFALSE;
//   event->Print(std::cout);
   for( ; itEntry != itEntryEnd; ++itEntry ) {
      Char_t type = (*itEntry).first;
      Int_t  idx  = (*itEntry).second;

      try{
	 switch( type ) {
	 case 'v':
	    input.push_back( event->GetValue(idx) );
	    break;
	 case 't':
	    input.push_back( event->GetTarget(idx) );
	    break;
	 case 's':
	    input.push_back( event->GetSpectator(idx) );
	    break;
	 default:
	    Log() << kFATAL << "VariableTransformBase/GetInput : unknown type '" << type << "'." << Endl;
	 }
	 mask.push_back(kFALSE);
      }
      catch(std::out_of_range& /* excpt */ ){ // happens when an event is transformed which does not yet have the targets calculated (in the application phase)
	 input.push_back(0.f);
	 mask.push_back(kTRUE);
	 hasMaskedEntries = kTRUE;
      }
   }
   return hasMaskedEntries;
}

//_______________________________________________________________________
void TMVA::VariableTransformBase::SetOutput( Event* event, std::vector<Float_t>& output, std::vector<Char_t>& mask, const Event* oldEvent, Bool_t backTransformation ) const
{
   // select the values from the event
   
   std::vector<Float_t>::iterator itOutput = output.begin();
   std::vector<Char_t>::iterator  itMask   = mask.begin();

   if( oldEvent )
      event->CopyVarValues( *oldEvent );

   try {

      ItVarTypeIdxConst itEntry;
      ItVarTypeIdxConst itEntryEnd;

      if( backTransformation || fPut.empty() ){ // as in GetInput, but the other way round (from fPut for transformation, from fGet for backTransformation)
	 itEntry = fGet.begin();
	 itEntryEnd = fGet.end();
      }
      else {
	 itEntry = fPut.begin();
	 itEntryEnd = fPut.end();
      }


      for( ; itEntry != itEntryEnd; ++itEntry ) {

	 if( (*itMask) ){ // if the value is masked
	    continue;
	 }

	 Char_t type = (*itEntry).first;
	 Int_t  idx  = (*itEntry).second;
	 if (itOutput == output.end()) Log() << kFATAL << "Read beyond array boundaries in VariableTransformBase::SetOutput"<<Endl;
	 Float_t value = (*itOutput);

	 switch( type ) {
	 case 'v':
	    event->SetVal( idx, value );
	    break;
	 case 't':
	    event->SetTarget( idx, value );
	    break;
	 case 's':
	    event->SetSpectator( idx, value );
	    break;
	 default:
	    Log() << kFATAL << "VariableTransformBase/GetInput : unknown type '" << type << "'." << Endl;
	 }
	 if( !(*itMask) ) ++itOutput;
    ++itMask;

      }
   }catch( std::exception& except ){
      Log() << kFATAL << "VariableTransformBase/SetOutput : exception/" << except.what() << Endl;
      throw;
   }
}


//_______________________________________________________________________
void TMVA::VariableTransformBase::CountVariableTypes( UInt_t& nvars, UInt_t& ntgts, UInt_t& nspcts ) const
{
   // count variables, targets and spectators
   if( fVariableTypesAreCounted ){
      nvars = fNVariables;
      ntgts = fNTargets;
      nspcts = fNSpectators;
      return;
   }

   nvars = ntgts = nspcts = 0;

   for( ItVarTypeIdxConst itEntry = fGet.begin(), itEntryEnd = fGet.end(); itEntry != itEntryEnd; ++itEntry ) {
	 Char_t type = (*itEntry).first;

	 switch( type ) {
	 case 'v':
	    nvars++;
	    break;
	 case 't':
	    ntgts++;
	    break;
	 case 's':
	    nspcts++;
	    break;
	 default:
	    Log() << kFATAL << "VariableTransformBase/GetVariableTypeNumbers : unknown type '" << type << "'." << Endl;
	 }
   }

   fNVariables = nvars;
   fNTargets = ntgts;
   fNSpectators = nspcts;

   fVariableTypesAreCounted = true;
}


//_______________________________________________________________________
void TMVA::VariableTransformBase::CalcNorm( const std::vector<const Event*>& events ) 
{
   // TODO --> adapt to variable,target,spectator selection
   // method to calculate minimum, maximum, mean, and RMS for all
   // variables used in the MVA

   if (!IsCreated()) return;

   const UInt_t nvars = GetNVariables();
   const UInt_t ntgts = GetNTargets();

   UInt_t nevts = events.size();

   TVectorD x2( nvars+ntgts ); x2 *= 0;
   TVectorD x0( nvars+ntgts ); x0 *= 0;   

   Double_t sumOfWeights = 0;
   for (UInt_t ievt=0; ievt<nevts; ievt++) {
      const Event* ev = events[ievt];

      Double_t weight = ev->GetWeight();
      sumOfWeights += weight;
      for (UInt_t ivar=0; ivar<nvars; ivar++) {
         Double_t x = ev->GetValue(ivar);
         if (ievt==0) {
            Variables().at(ivar).SetMin(x);
            Variables().at(ivar).SetMax(x);
         } 
         else {
            UpdateNorm( ivar,  x );
         }
         x0(ivar) += x*weight;
         x2(ivar) += x*x*weight;
      }
      for (UInt_t itgt=0; itgt<ntgts; itgt++) {
         Double_t x = ev->GetTarget(itgt);
         if (ievt==0) {
            Targets().at(itgt).SetMin(x);
            Targets().at(itgt).SetMax(x);
         } 
         else {
            UpdateNorm( nvars+itgt,  x );
         }
         x0(nvars+itgt) += x*weight;
         x2(nvars+itgt) += x*x*weight;
      }
   }

   if (sumOfWeights <= 0) {
      Log() << kFATAL << " the sum of event weights calcualted for your input is == 0"
            << " or exactly: " << sumOfWeights << " there is obviously some problem..."<< Endl;
   } 

   // set Mean and RMS
   for (UInt_t ivar=0; ivar<nvars; ivar++) {
      Double_t mean = x0(ivar)/sumOfWeights;
      
      Variables().at(ivar).SetMean( mean ); 
      if (x2(ivar)/sumOfWeights - mean*mean < 0) {
         Log() << kFATAL << " the RMS of your input variable " << ivar 
               << " evaluates to an imaginary number: sqrt("<< x2(ivar)/sumOfWeights - mean*mean
               <<") .. sometimes related to a problem with outliers and negative event weights"
               << Endl;
      }
      Variables().at(ivar).SetRMS( TMath::Sqrt( x2(ivar)/sumOfWeights - mean*mean) );
   }
   for (UInt_t itgt=0; itgt<ntgts; itgt++) {
      Double_t mean = x0(nvars+itgt)/sumOfWeights;
      Targets().at(itgt).SetMean( mean ); 
      if (x2(nvars+itgt)/sumOfWeights - mean*mean < 0) {
         Log() << kFATAL << " the RMS of your target variable " << itgt 
               << " evaluates to an imaginary number: sqrt(" << x2(nvars+itgt)/sumOfWeights - mean*mean
               <<") .. sometimes related to a problem with outliers and negative event weights"
               << Endl;
      }
      Targets().at(itgt).SetRMS( TMath::Sqrt( x2(nvars+itgt)/sumOfWeights - mean*mean) );
   }

   Log() << kVERBOSE << "Set minNorm/maxNorm for variables to: " << Endl;
   Log() << std::setprecision(3);
   for (UInt_t ivar=0; ivar<GetNVariables(); ivar++)
      Log() << "    " << Variables().at(ivar).GetInternalName()
              << "\t: [" << Variables().at(ivar).GetMin() << "\t, " << Variables().at(ivar).GetMax() << "\t] " << Endl;
   Log() << kVERBOSE << "Set minNorm/maxNorm for targets to: " << Endl;
   Log() << std::setprecision(3);
   for (UInt_t itgt=0; itgt<GetNTargets(); itgt++)
      Log() << "    " << Targets().at(itgt).GetInternalName()
              << "\t: [" << Targets().at(itgt).GetMin() << "\t, " << Targets().at(itgt).GetMax() << "\t] " << Endl;
   Log() << std::setprecision(5); // reset to better value       
}

//_______________________________________________________________________
std::vector<TString>* TMVA::VariableTransformBase::GetTransformationStrings( Int_t /*cls*/ ) const
{
   // TODO --> adapt to variable,target,spectator selection
   // default transformation output
   // --> only indicate that transformation occurred
   std::vector<TString>* strVec = new std::vector<TString>;
   for (UInt_t ivar=0; ivar<GetNVariables(); ivar++) {
      strVec->push_back( Variables()[ivar].GetLabel() + "_[transformed]");
   }

   return strVec;   
}

//_______________________________________________________________________
void TMVA::VariableTransformBase::UpdateNorm ( Int_t ivar,  Double_t x ) 
{
   // TODO --> adapt to variable,target,spectator selection
   // update min and max of a given variable (target) and a given transformation method
   Int_t nvars = fDsi.GetNVariables();
   if( ivar < nvars ){
      if (x < Variables().at(ivar).GetMin()) Variables().at(ivar).SetMin(x);
      if (x > Variables().at(ivar).GetMax()) Variables().at(ivar).SetMax(x);
   }else{
      if (x < Targets().at(ivar-nvars).GetMin()) Targets().at(ivar-nvars).SetMin(x);
      if (x > Targets().at(ivar-nvars).GetMax()) Targets().at(ivar-nvars).SetMax(x);
   }
}

//_______________________________________________________________________
void TMVA::VariableTransformBase::AttachXMLTo(void* parent) 
{
   // create XML description the transformation (write out info of selected variables)

   void* selxml = gTools().AddChild(parent, "Selection");

   void* inpxml = gTools().AddChild(selxml, "Input");
   gTools().AddAttr(inpxml, "NInputs", fGet.size() );

   // choose the new dsi for output if present, if not, take the common one
   const DataSetInfo* outputDsiPtr = (fDsiOutput? fDsiOutput : &fDsi );

   for( ItVarTypeIdx itGet = fGet.begin(), itGetEnd = fGet.end(); itGet != itGetEnd; ++itGet ) {
      UInt_t idx  = (*itGet).second;
      Char_t type = (*itGet).first;
      
      TString label      = "";
      TString expression = "";
      TString typeString = "";
      switch( type ){
      case 'v':
	 typeString = "Variable";
	 label = fDsi.GetVariableInfo( idx ).GetLabel();
	 expression = fDsi.GetVariableInfo( idx ).GetExpression();
	 break;
      case 't':
	 typeString = "Target";
	 label = fDsi.GetTargetInfo( idx ).GetLabel();
	 expression = fDsi.GetTargetInfo( idx ).GetExpression();
	 break;
      case 's':
	 typeString = "Spectator";
	 label = fDsi.GetSpectatorInfo( idx ).GetLabel();
	 expression = fDsi.GetSpectatorInfo( idx ).GetExpression();
	 break;
      default:
	 Log() << kFATAL << "VariableTransformBase/AttachXMLTo unknown variable type '" << type << "'." << Endl;
      }
	 
       void* idxxml = gTools().AddChild(inpxml, "Input");
//      gTools().AddAttr(idxxml, "Index", idx);
      gTools().AddAttr(idxxml, "Type",  typeString);
      gTools().AddAttr(idxxml, "Label", label);
      gTools().AddAttr(idxxml, "Expression", expression);
   }


   void* outxml = gTools().AddChild(selxml, "Output");
   gTools().AddAttr(outxml, "NOutputs", fPut.size() );

   for( ItVarTypeIdx itPut = fPut.begin(), itPutEnd = fPut.end(); itPut != itPutEnd; ++itPut ) {
      UInt_t idx  = (*itPut).second;
      Char_t type = (*itPut).first;
      
      TString label = "";
      TString expression = "";
      TString typeString = "";
      switch( type ){
      case 'v':
	 typeString = "Variable";
	 label = outputDsiPtr->GetVariableInfo( idx ).GetLabel();
	 expression = outputDsiPtr->GetVariableInfo( idx ).GetExpression();
	 break;
      case 't':
	 typeString = "Target";
	 label = outputDsiPtr->GetTargetInfo( idx ).GetLabel();
	 expression = outputDsiPtr->GetTargetInfo( idx ).GetExpression();
	 break;
      case 's':
	 typeString = "Spectator";
	 label = outputDsiPtr->GetSpectatorInfo( idx ).GetLabel();
	 expression = outputDsiPtr->GetSpectatorInfo( idx ).GetExpression();
	 break;
      default:
	 Log() << kFATAL << "VariableTransformBase/AttachXMLTo unknown variable type '" << type << "'." << Endl;
      }
	 
       void* idxxml = gTools().AddChild(outxml, "Output");
//      gTools().AddAttr(idxxml, "Index", idx);
      gTools().AddAttr(idxxml, "Type",  typeString);
      gTools().AddAttr(idxxml, "Label", label);
      gTools().AddAttr(idxxml, "Expression", expression);
   }


}

//_______________________________________________________________________
void TMVA::VariableTransformBase::ReadFromXML( void* selnode ) 
{
   // Read the input variables from the XML node

   void* inpnode = gTools().GetChild( selnode );
   void* outnode = gTools().GetNextChild( inpnode );

   UInt_t nvars  = GetNVariables();
   UInt_t ntgts  = GetNTargets();
   UInt_t nspcts = GetNSpectators();



   // read inputs
   fGet.clear();       

   UInt_t nInputs = 0;
   gTools().ReadAttr(inpnode, "NInputs", nInputs);

   void* ch = gTools().GetChild( inpnode );
   while(ch) {
      TString typeString = "";
      TString label      = "";
      TString expression = "";

      gTools().ReadAttr(ch, "Type",  typeString);
      gTools().ReadAttr(ch, "Label", label);
      gTools().ReadAttr(ch, "Expression", expression);
   
      if( typeString == "Variable"  ){
	 for( UInt_t ivar = 0; ivar < nvars; ++ivar ) { // search all variables
	    if( fDsi.GetVariableInfo( ivar ).GetLabel() == label ||
	        fDsi.GetVariableInfo( ivar ).GetExpression() == expression) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('v',ivar) );
	       break;
	    }
	 }
      }else if( typeString == "Target"    ){
	 for( UInt_t itgt = 0; itgt < ntgts; ++itgt ) { // search all targets
	    if( fDsi.GetTargetInfo( itgt ).GetLabel() == label ||
	        fDsi.GetTargetInfo( itgt ).GetExpression() == expression ) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('t',itgt) );
	       break;
	    }
	 }
      }else if( typeString == "Spectator" ){
	 for( UInt_t ispct = 0; ispct < nspcts; ++ispct ) { // search all spectators
	    if( fDsi.GetSpectatorInfo( ispct ).GetLabel() == label ||
	        fDsi.GetSpectatorInfo( ispct ).GetExpression() == expression ) {
	       fGet.push_back( std::pair<Char_t,UInt_t>('s',ispct) );
	       break;
	    }
	 }
      }else{
	 Log() << kFATAL << "VariableTransformationBase/ReadFromXML : unknown type '" << typeString << "'." << Endl;
      }
      ch = gTools().GetNextChild( ch );
   }

   assert( nInputs == fGet.size() );
   
   // read outputs
   fPut.clear();       

   UInt_t nOutputs = 0;
   gTools().ReadAttr(outnode, "NOutputs", nOutputs);

   void* chOut = gTools().GetChild( outnode );
   while(chOut) {
      TString typeString = "";
      TString label      = "";
      TString expression = "";

      gTools().ReadAttr(chOut, "Type",  typeString);
      gTools().ReadAttr(chOut, "Label", label);
      gTools().ReadAttr(chOut, "Expression", expression);
   
      if( typeString == "Variable"  ){
	 for( UInt_t ivar = 0; ivar < nvars; ++ivar ) { // search all variables
	    if( fDsi.GetVariableInfo( ivar ).GetLabel() == label ||
	        fDsi.GetVariableInfo( ivar ).GetExpression() == expression ) {
	       fPut.push_back( std::pair<Char_t,UInt_t>('v',ivar) );
	       break;
	    }
	 }
      }else if( typeString == "Target"    ){
	 for( UInt_t itgt = 0; itgt < ntgts; ++itgt ) { // search all targets
	    if( fDsi.GetTargetInfo( itgt ).GetLabel() == label ||
	        fDsi.GetTargetInfo( itgt ).GetExpression() == expression ) {
	       fPut.push_back( std::pair<Char_t,UInt_t>('t',itgt) );
	       break;
	    }
	 }
      }else if( typeString == "Spectator" ){
	 for( UInt_t ispct = 0; ispct < nspcts; ++ispct ) { // search all spectators
	    if( fDsi.GetSpectatorInfo( ispct ).GetLabel() == label ||
	        fDsi.GetSpectatorInfo( ispct ).GetExpression() == expression ) {
	       fPut.push_back( std::pair<Char_t,UInt_t>('s',ispct) );
	       break;
	    }
	 }
      }else{
	 Log() << kFATAL << "VariableTransformationBase/ReadFromXML : unknown type '" << typeString << "'." << Endl;
      }
      chOut = gTools().GetNextChild( chOut );
   }

   assert( nOutputs == fPut.size() );


}


//_______________________________________________________________________
void TMVA::VariableTransformBase::MakeFunction( std::ostream& fout, const TString& /*fncName*/, Int_t part,
						UInt_t /*trCounter*/, Int_t /*cls*/ )
{
   // getinput and setoutput equivalent
   if( part == 0 ){ // definitions
      fout << std::endl;
      fout << "   // define the indices of the variables which are transformed by this transformation" << std::endl;
      fout << "   static std::vector<int> indicesGet;" << std::endl;
      fout << "   static std::vector<int> indicesPut;" << std::endl << std::endl;
      fout << "   if ( indicesGet.empty() ) { " << std::endl;
      fout << "      indicesGet.reserve(fNvars);" << std::endl;

      for( ItVarTypeIdxConst itEntry = fGet.begin(), itEntryEnd = fGet.end(); itEntry != itEntryEnd; ++itEntry ) {
	 Char_t type = (*itEntry).first;
	 Int_t  idx  = (*itEntry).second;
	 
	 switch( type ) {
	 case 'v':
	    fout << "      indicesGet.push_back( " << idx << ");" << std::endl;
	    break;
	 case 't':
	    Log() << kWARNING << "MakeClass doesn't work with transformation of targets. The results will be wrong!" << Endl;
	    break;
	 case 's':
	    Log() << kWARNING << "MakeClass doesn't work with transformation of spectators. The results will be wrong!" << Endl;
	    break;
	 default:
	    Log() << kFATAL << "VariableTransformBase/GetInput : unknown type '" << type << "'." << Endl;
	 }
      }
      fout << "   } " <<  std::endl;
      fout << "   if ( indicesPut.empty() ) { " << std::endl;
      fout << "      indicesPut.reserve(fNvars);" << std::endl;

      for( ItVarTypeIdxConst itEntry = fPut.begin(), itEntryEnd = fPut.end(); itEntry != itEntryEnd; ++itEntry ) {
	 Char_t type = (*itEntry).first;
	 Int_t  idx  = (*itEntry).second;

	 switch( type ) {
	 case 'v':
	    fout << "      indicesPut.push_back( " << idx << ");" << std::endl;
	    break;
	 case 't':
	    Log() << kWARNING << "MakeClass doesn't work with transformation of targets. The results will be wrong!" << Endl;
	    break;
	 case 's':
	    Log() << kWARNING << "MakeClass doesn't work with transformation of spectators. The results will be wrong!" << Endl;
	    break;
	 default:
	    Log() << kFATAL << "VariableTransformBase/PutInput : unknown type '" << type << "'." << Endl;
	 }
      }

      fout << "   } " <<  std::endl;
      fout << std::endl;

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