00001 // @(#)root/tmva $Id: VariableIdentityTransform.cxx 36966 2010-11-26 09:50:13Z evt $ 00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : VariableIdentityTransform * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Implementation (see header for description) * 00012 * * 00013 * Authors (alphabetical): * 00014 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 00015 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland * 00016 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00017 * * 00018 * Copyright (c) 2005: * 00019 * CERN, Switzerland * 00020 * MPI-K Heidelberg, Germany * 00021 * * 00022 * Redistribution and use in source and binary forms, with or without * 00023 * modification, are permitted according to the terms listed in LICENSE * 00024 * (http://tmva.sourceforge.net/LICENSE) * 00025 **********************************************************************************/ 00026 00027 #include <iostream> 00028 00029 #include "TMVA/VariableIdentityTransform.h" 00030 00031 #ifndef ROOT_TMVA_MsgLogger 00032 #include "TMVA/MsgLogger.h" 00033 #endif 00034 00035 ClassImp(TMVA::VariableIdentityTransform) 00036 00037 //_______________________________________________________________________ 00038 TMVA::VariableIdentityTransform::VariableIdentityTransform( DataSetInfo& dsi ) 00039 : VariableTransformBase( dsi, Types::kIdentity, "Id" ) 00040 { 00041 // constructor 00042 } 00043 00044 //_______________________________________________________________________ 00045 void TMVA::VariableIdentityTransform::Initialize() 00046 { 00047 // nothing to initialize 00048 } 00049 00050 //_______________________________________________________________________ 00051 Bool_t TMVA::VariableIdentityTransform::PrepareTransformation( const std::vector<Event*>& events) 00052 { 00053 // the identity does not need to be prepared, only calculate the normalization 00054 Initialize(); 00055 00056 if (!IsEnabled() || IsCreated()) return kTRUE; 00057 00058 Log() << kINFO << "Preparing the Identity transformation..." << Endl; 00059 00060 SetNVariables(events[0]->GetNVariables()); 00061 00062 SetCreated( kTRUE ); 00063 00064 return kTRUE; 00065 } 00066 00067 //_______________________________________________________________________ 00068 void TMVA::VariableIdentityTransform::AttachXMLTo( void* ) 00069 { 00070 // identity transformation to write to XML 00071 //Log() << kFATAL << "Please implement writing of transformation as XML" << Endl; 00072 } 00073 00074 //_______________________________________________________________________ 00075 void TMVA::VariableIdentityTransform::ReadFromXML( void* ) 00076 { 00077 // reding the identity transformation from XML 00078 return; 00079 } 00080 00081 //_______________________________________________________________________ 00082 const TMVA::Event* TMVA::VariableIdentityTransform::Transform (const TMVA::Event* const ev, Int_t ) const 00083 { 00084 // identity transform returns same event 00085 return ev; 00086 } 00087 00088 //_______________________________________________________________________ 00089 void TMVA::VariableIdentityTransform::MakeFunction( std::ostream& fout, const TString& fncName, 00090 Int_t , UInt_t trCounter, Int_t ) 00091 { 00092 // creates C++ code fragment of the indentity transform for inclusion in standalone C++ class 00093 00094 fout << "inline void " << fncName << "::InitTransform_Identity_" << trCounter << "() {}" << std::endl; 00095 fout << std::endl; 00096 fout << "inline void " << fncName << "::Transform_Identity_" << trCounter << "(const std::vector<double> &, int) const {}" << std::endl; 00097 }