Logo ROOT   6.08/07
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 
30 #include "TMVA/Event.h"
31 
32 #include "Rtypes.h"
33 
34 #include <iostream>
35 
37 
39 : fDataVector(0),
40  fCweight(1.),
41  fAlpha(0),
42  fAlpha_p(0),
43  fErrorCache(0),
44  fNVar(0),
45  fTypeFlag(0),
46  fIdx(0),
47  fNs(0),
48  fIsShrinked(0),
49  fLine(0),
50  fTarget(0)
51 {
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// constructor
56 
57 TMVA::SVEvent::SVEvent( const Event* event, Float_t C_par, Bool_t isSignal )
58  : fDataVector(event->GetValues()),
59  fCweight(C_par*event->GetWeight()),
60  fAlpha(0),
61  fAlpha_p(0),
62  fErrorCache(0),
63  fNVar ( event->GetNVariables() ),
64  fTypeFlag( isSignal ? -1 : 1 ),
65  fIdx ( isSignal ? -1 : 1 ),
66  fNs(0),
67  fIsShrinked(0),
68  fLine(0),
69  fTarget((event->GetNTargets() > 0 ? event->GetTarget(0) : 0))
70 {
71 }
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 /// constructor
75 
76 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Int_t typeFlag, UInt_t ns )
77  : fDataVector(*svector),
78  fCweight(-1.),
79  fAlpha(alpha),
80  fAlpha_p(0),
81  fErrorCache(-1.),
82  fNVar(svector->size()),
83  fTypeFlag(typeFlag),
84  fIdx(-1),
85  fNs(ns),
86  fIsShrinked(0),
87  fLine(0),
88  fTarget(0)
89 {
90 }
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// constructor
94 
95 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p,Int_t typeFlag)
96  : fDataVector(*svector),
97  fCweight(-1.),
98  fAlpha(alpha),
99  fAlpha_p(alpha_p),
100  fErrorCache(-1.),
101  fNVar(svector->size()),
102  fTypeFlag(typeFlag),
103  fIdx(-1),
104  fNs(0),
105  fIsShrinked(0),
106  fLine(0),
107  fTarget(0)
108 {
109 }
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// destructor
113 
115 {
116  if (fLine != 0) {
117  delete fLine;
118  fLine = 0;
119  }
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// printout
124 
125 void TMVA::SVEvent::Print( std::ostream& os ) const
126 {
127  os << "type::" << fTypeFlag <<" target::"<< fTarget << " alpha::" << fAlpha <<" alpha_p::"<< fAlpha_p<< " values::" ;
128  for (UInt_t j =0; j < fDataVector.size();j++) os<<fDataVector.at(j)<<" ";
129  os << std::endl;
130 }
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// printout
134 
136 {
137  for (UInt_t i = 0; i < fNVar; i++) std::cout<<fDataVector.at(i)<<" ";
138  std::cout<<std::endl;
139 }
virtual ~SVEvent()
destructor
Definition: SVEvent.cxx:114
const Int_t fTypeFlag
Definition: SVEvent.h:94
const Float_t fCweight
Definition: SVEvent.h:89
UInt_t fNs
Definition: SVEvent.h:96
float Float_t
Definition: RtypesCore.h:53
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void PrintData()
printout
Definition: SVEvent.cxx:135
const Float_t fTarget
Definition: SVEvent.h:99
Float_t * fLine
Definition: SVEvent.h:98
UInt_t fNVar
Definition: SVEvent.h:93
void Print(std::ostream &os) const
printout
Definition: SVEvent.cxx:125
Float_t fAlpha_p
Definition: SVEvent.h:91
unsigned int UInt_t
Definition: RtypesCore.h:42
Int_t fIdx
Definition: SVEvent.h:95
#define ClassImp(name)
Definition: Rtypes.h:279
Int_t fIsShrinked
Definition: SVEvent.h:97
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > fDataVector
Definition: SVEvent.h:88
Float_t fAlpha
Definition: SVEvent.h:90
Float_t fErrorCache
Definition: SVEvent.h:92