Logo ROOT   6.18/05
Reference Guide
BDTEventWrapper.h
Go to the documentation of this file.
1
2/**********************************************************************************
3 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
4 * Package: TMVA *
5 * Class : BDTEventWrapper *
6 * Web : http://tmva.sourceforge.net *
7 * *
8 * Description: *
9 * *
10 * *
11 * Author: Doug Schouten (dschoute@sfu.ca) *
12 * *
13 * Copyright (c) 2007: *
14 * CERN, Switzerland *
15 * U. of Texas at Austin, USA *
16 * *
17 * Redistribution and use in source and binary forms, with or without *
18 * modification, are permitted according to the terms listed in LICENSE *
19 * (http://tmva.sourceforge.net/LICENSE) *
20 **********************************************************************************/
21
22#ifndef ROOT_TMVA_BDTEventWrapper
23#define ROOT_TMVA_BDTEventWrapper
24
25#include "RtypesCore.h"
26#include "Event.h"
27
28namespace TMVA {
29
31
32 public:
33
34 BDTEventWrapper( const Event* );
36
37 // Require '<' operator to use std::sort algorithms on collection of Events
38 Bool_t operator <( const BDTEventWrapper& other ) const;
39
40 // Set the accumulated weight, for sorted signal/background events
41 /**
42 * @param fType - true for signal, false for background
43 * @param weight - the total weight
44 */
46
47 // Get the accumulated weight
48 /**
49 * @param fType - true for signal, false for background
50 * @return the cumulative weight for sorted signal/background events
51 */
53
54 // Set the index of the variable to compare on
55 /**
56 * @param iVar - index of the variable in fEvent to use
57 */
58 inline static void SetVarIndex( Int_t iVar ) { if (iVar >= 0) GetVarIndex() = iVar; }
59
60 // Return the value of variable fVarIndex for this event
61 /**
62 * @return value of variable fVarIndex for this event
63 */
64 inline Double_t GetVal() const { return fEvent->GetValue(GetVarIndex()); }
65 const Event* operator*() const { return fEvent; }
66
67 inline Double_t GetVal(Int_t var) const { return fEvent->GetValue(var); }
68 private:
69
70 // This is a workaround for OSx where static thread_local data members are
71 // not supported. The C++ solution would indeed be the following:
72 static Int_t& GetVarIndex(){TTHREAD_TLS(Int_t) fVarIndex(0); return fVarIndex;}; // index of the variable to sort on
73
74 const Event* fEvent; // pointer to the event
75
76 Double_t fBkgWeight; // cumulative background weight for splitting
77 Double_t fSigWeight; // same for the signal weights
78 };
79}
80
82{
83 return GetVal() < other.GetVal();
84}
85
86#endif
87
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
Bool_t operator<(const BDTEventWrapper &other) const
const Event * operator*() const
~BDTEventWrapper()
Destructor.
BDTEventWrapper(const Event *)
Constructor.
static Int_t & GetVarIndex()
void SetCumulativeWeight(Bool_t type, Double_t weight)
Set the accumulated weight, for sorted signal/background events.
Double_t GetVal(Int_t var) const
Double_t GetCumulativeWeight(Bool_t type) const
Get the accumulated weight.
static void SetVarIndex(Int_t iVar)
Double_t GetVal() const
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
Definition: Event.cxx:237
create variable transformations