ROOT  6.06/09
Reference Guide
SVEvent.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andrzej Zemla
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : SVEvent *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation *
12  * *
13  * Authors (alphabetical): *
14  * Marcin Wolter <Marcin.Wolter@cern.ch> - IFJ PAN, Krakow, Poland *
15  * Andrzej Zemla <azemla@cern.ch> - IFJ PAN, Krakow, Poland *
16  * (IFJ PAN: Henryk Niewodniczanski Inst. Nucl. Physics, Krakow, Poland) *
17  * *
18  * Copyright (c) 2005: *
19  * CERN, Switzerland *
20  * MPI-K Heidelberg, Germany *
21  * PAN, Krakow, Poland *
22  * *
23  * Redistribution and use in source and binary forms, with or without *
24  * modification, are permitted according to the terms listed in LICENSE *
25  * (http://tmva.sourceforge.net/LICENSE) *
26  **********************************************************************************/
27 
28 #include "TMVA/SVEvent.h"
29 #include "TMVA/Event.h"
30 
31 #include <iostream>
32 
34 
35 TMVA::SVEvent::SVEvent()
36  : fDataVector(0),
37  fCweight(1.),
38  fAlpha(0),
39  fAlpha_p(0),
40  fErrorCache(0),
41  fNVar(0),
42  fTypeFlag(0),
43  fIdx(0),
44  fNs(0),
45  fIsShrinked(0),
46  fLine(0),
47  fTarget(0)
48 {
49 }
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// constructor
53 
54 TMVA::SVEvent::SVEvent( const Event* event, Float_t C_par, Bool_t isSignal )
55  : fDataVector(event->GetValues()),
56  fCweight(C_par*event->GetWeight()),
57  fAlpha(0),
58  fAlpha_p(0),
59  fErrorCache(0),
60  fNVar ( event->GetNVariables() ),
61  fTypeFlag( isSignal ? -1 : 1 ),
62  fIdx ( isSignal ? -1 : 1 ),
63  fNs(0),
64  fIsShrinked(0),
65  fLine(0),
66  fTarget((event->GetNTargets() > 0 ? event->GetTarget(0) : 0))
67 {
68 }
69 
70 ////////////////////////////////////////////////////////////////////////////////
71 /// constructor
72 
73 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Int_t typeFlag, UInt_t ns )
74  : fDataVector(*svector),
75  fCweight(-1.),
76  fAlpha(alpha),
77  fAlpha_p(0),
78  fErrorCache(-1.),
79  fNVar(svector->size()),
80  fTypeFlag(typeFlag),
81  fIdx(-1),
82  fNs(ns),
83  fIsShrinked(0),
84  fLine(0),
85  fTarget(0)
86 {
87 }
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// constructor
91 
92 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p,Int_t typeFlag)
93  : fDataVector(*svector),
94  fCweight(-1.),
95  fAlpha(alpha),
96  fAlpha_p(alpha_p),
97  fErrorCache(-1.),
98  fNVar(svector->size()),
99  fTypeFlag(typeFlag),
100  fIdx(-1),
101  fNs(0),
102  fIsShrinked(0),
103  fLine(0),
104  fTarget(0)
105 {
106 }
107 
108 ////////////////////////////////////////////////////////////////////////////////
109 /// destructor
110 
112 {
113  if (fLine != 0) {
114  delete fLine;
115  fLine = 0;
116  }
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// printout
121 
122 void TMVA::SVEvent::Print( std::ostream& os ) const
123 {
124  os << "type::" << fTypeFlag <<" target::"<< fTarget << " alpha::" << fAlpha <<" alpha_p::"<< fAlpha_p<< " values::" ;
125  for (UInt_t j =0; j < fDataVector.size();j++) os<<fDataVector.at(j)<<" ";
126  os << std::endl;
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// printout
131 
133 {
134  for (UInt_t i = 0; i < fNVar; i++) std::cout<<fDataVector.at(i)<<" ";
135  std::cout<<std::endl;
136 }
virtual ~SVEvent()
destructor
Definition: SVEvent.cxx:111
float Float_t
Definition: RtypesCore.h:53
ClassImp(TMVA::SVEvent) TMVA
Definition: SVEvent.cxx:33
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void PrintData()
printout
Definition: SVEvent.cxx:132
void Print(std::ostream &os) const
printout
Definition: SVEvent.cxx:122
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t GetWeight(Double_t x) const
Abstract ClassifierFactory template that handles arbitrary types.