Logo ROOT   6.14/05
Reference Guide
PDEFoamEvent.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Tancredi Carli, Dominik Dannheim, Alexander Voigt
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Classes: PDEFoamEvent *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation. *
12  * *
13  * Authors (alphabetical): *
14  * Tancredi Carli - CERN, Switzerland *
15  * Dominik Dannheim - CERN, Switzerland *
16  * S. Jadach - Institute of Nuclear Physics, Cracow, Poland *
17  * Alexander Voigt - TU Dresden, Germany *
18  * Peter Speckmayer - CERN, Switzerland *
19  * *
20  * Copyright (c) 2008, 2010: *
21  * CERN, Switzerland *
22  * MPI-K Heidelberg, Germany *
23  * *
24  * Redistribution and use in source and binary forms, with or without *
25  * modification, are permitted according to the terms listed in LICENSE *
26  * (http://tmva.sourceforge.net/LICENSE) *
27  **********************************************************************************/
28 
29 /*! \class TMVA::PDEFoamEvent
30 \ingroup TMVA
31 This PDEFoam variant stores in every cell the sum of event weights
32 and the sum of the squared event weights. It therefore acts as
33 event density estimator. It should be booked together with the
34 PDEFoamEventDensity density estimator, which returns the event
35 weight density at a given phase space point during the foam
36 build-up.
37 */
38 
39 #include "TMVA/PDEFoamEvent.h"
40 
41 #include "TMVA/Event.h"
42 #include "TMVA/MsgLogger.h"
43 #include "TMVA/PDEFoam.h"
44 #include "TMVA/Types.h"
45 
46 #include "Rtypes.h"
47 
48 namespace TMVA {
49  class PDEFoamCell;
50 }
51 class TString;
52 
54 
55 ////////////////////////////////////////////////////////////////////////////////
56 /// Default constructor for streamer, user should not use it.
57 
59 : PDEFoam()
60 {
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 
66  : PDEFoam(name)
67 {}
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Copy Constructor NOT IMPLEMENTED (NEVER USED)
71 
73  : PDEFoam(from)
74 {
75  Log() << kFATAL << "COPY CONSTRUCTOR NOT IMPLEMENTED" << Endl;
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// This function fills an event weight 'wt' into the PDEFoam. Cell
80 /// element 0 is filled with the weight 'wt', and element 1 is
81 /// filled with the squared weight.
82 
84 {
85  // find corresponding foam cell
86  std::vector<Float_t> values = ev->GetValues();
87  std::vector<Float_t> tvalues = VarTransform(values);
88  PDEFoamCell *cell = FindCell(tvalues);
89 
90  // 0. Element: Sum of event weights 'wt'
91  // 1. Element: Sum of squared event weights 'wt'
92  SetCellElement(cell, 0, GetCellElement(cell, 0) + wt);
93  SetCellElement(cell, 1, GetCellElement(cell, 1) + wt * wt);
94 }
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:158
float Float_t
Definition: RtypesCore.h:53
virtual void FillFoamCells(const Event *ev, Float_t wt)
This function fills an event weight &#39;wt&#39; into the PDEFoam.
Float_t VarTransform(Int_t idim, Float_t x) const
Definition: PDEFoam.h:279
Basic string class.
Definition: TString.h:131
Double_t GetCellElement(const PDEFoamCell *cell, UInt_t i) const
Returns cell element i of cell &#39;cell&#39;.
Definition: PDEFoam.cxx:1417
void SetCellElement(PDEFoamCell *cell, UInt_t i, Double_t value)
Set cell element i of cell to value.
Definition: PDEFoam.cxx:1433
PDEFoamCell * FindCell(const std::vector< Float_t > &) const
Find cell that contains &#39;xvec&#39; (in foam coordinates [0,1]).
Definition: PDEFoam.cxx:1081
This PDEFoam variant stores in every cell the sum of event weights and the sum of the squared event w...
Definition: PDEFoamEvent.h:38
Implementation of PDEFoam.
Definition: PDEFoam.h:77
MsgLogger & Log() const
Definition: PDEFoam.h:238
#define ClassImp(name)
Definition: Rtypes.h:359
PDEFoamEvent()
Default constructor for streamer, user should not use it.
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > & GetValues()
Definition: Event.h:89
char name[80]
Definition: TGX11.cxx:109