00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ROOT_TMVA_Event
00031 #define ROOT_TMVA_Event
00032
00033 #include <iosfwd>
00034 #include <vector>
00035
00036 #ifndef ROOT_Rtypes
00037 #include "Rtypes.h"
00038 #endif
00039 #ifndef ROOT_TMVA_Types
00040 #include "TMVA/Types.h"
00041 #endif
00042
00043 class TCut;
00044
00045 namespace TMVA {
00046
00047 class Event;
00048
00049 std::ostream& operator<<( std::ostream& os, const Event& event );
00050
00051 class Event {
00052
00053 friend std::ostream& operator<<( std::ostream& os, const Event& event );
00054
00055 public:
00056
00057
00058 Event();
00059 Event( const Event& );
00060 explicit Event( const std::vector<Float_t>& values,
00061 const std::vector<Float_t>& targetValues,
00062 const std::vector<Float_t>& spectatorValues,
00063 UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
00064 explicit Event( const std::vector<Float_t>& values,
00065 const std::vector<Float_t>& targetValues,
00066 UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
00067 explicit Event( const std::vector<Float_t>&,
00068 UInt_t theClass, Double_t weight = 1.0, Double_t boostweight = 1.0 );
00069 explicit Event( const std::vector<Float_t*>*&, UInt_t nvar );
00070
00071 ~Event();
00072
00073
00074 Bool_t IsDynamic() const {return fDynamic; }
00075
00076 Double_t GetWeight() const { return fWeight*fBoostWeight; }
00077 Double_t GetOriginalWeight() const { return fWeight; }
00078 Double_t GetBoostWeight() const { return TMath::Max(Double_t(0.0001),fBoostWeight); }
00079 UInt_t GetClass() const { return fClass; }
00080
00081 UInt_t GetNVariables() const;
00082 UInt_t GetNTargets() const;
00083 UInt_t GetNSpectators() const;
00084
00085 const std::vector<UInt_t>* GetVariableArrangement() const { return fVariableArrangement; }
00086
00087 Float_t GetValue( UInt_t ivar) const;
00088 const std::vector<Float_t>& GetValues() const;
00089
00090 Float_t GetTarget( UInt_t itgt ) const { return fTargets.at(itgt); }
00091 std::vector<Float_t>& GetTargets() const { return fTargets; }
00092
00093 Float_t GetSpectator( UInt_t ivar) const;
00094 std::vector<Float_t>& GetSpectators() const { return fSpectators; }
00095
00096 void ScaleWeight ( Double_t s ) { fWeight*=s; }
00097 void SetWeight ( Double_t w ) { fWeight=w; }
00098 void SetBoostWeight ( Double_t w ) { fBoostWeight=w; }
00099 void ScaleBoostWeight ( Double_t s ) { fBoostWeight *= s; }
00100 void SetClass ( UInt_t t ) { fClass=t; }
00101 void SetVal ( UInt_t ivar, Float_t val );
00102 void SetTarget ( UInt_t itgt, Float_t value );
00103 void SetSpectator ( UInt_t ivar, Float_t value );
00104 void SetVariableArrangement( std::vector<UInt_t>* const m ) const;
00105
00106 static void ClearDynamicVariables();
00107
00108 void CopyVarValues( const Event& other );
00109 void Print ( std::ostream & o ) const;
00110
00111 private:
00112
00113 mutable std::vector<Float_t> fValues;
00114 mutable std::vector<Float_t*>* fValuesDynamic;
00115 mutable std::vector<Float_t> fTargets;
00116 mutable std::vector<Float_t> fSpectators;
00117 mutable std::vector<UInt_t>* fVariableArrangement;
00118
00119 UInt_t fClass;
00120 Double_t fWeight;
00121 Double_t fBoostWeight;
00122 Bool_t fDynamic;
00123 };
00124 }
00125
00126 #endif