Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TransformationHandler.cxx
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Eckhard von Toerne, Jan Therhaag
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : TransformationHandler *
8 * *
9 * *
10 * Description: *
11 * Implementation (see header for description) *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland *
16 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
17 * Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany *
18 * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
19 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
20 * *
21 * Copyright (c) 2005-2011: *
22 * CERN, Switzerland *
23 * MPI-K Heidelberg, Germany *
24 * U. of Bonn, Germany *
25 * *
26 * Redistribution and use in source and binary forms, with or without *
27 * modification, are permitted according to the terms listed in LICENSE *
28 * (see tmva/doc/LICENSE) *
29 **********************************************************************************/
30
31/*! \class TMVA::TransformationHandler
32\ingroup TMVA
33Class that contains all the data information.
34*/
35
37
38#include "TMVA/Config.h"
39#include "TMVA/DataSet.h"
40#include "TMVA/DataSetInfo.h"
41#include "TMVA/Event.h"
42#include "TMVA/MsgLogger.h"
43#include "TMVA/Ranking.h"
44#include "TMVA/Tools.h"
45#include "TMVA/Types.h"
48#include "TMVA/VariableInfo.h"
54
55#include "TAxis.h"
56#include "TDirectory.h"
57#include "TH1.h"
58#include "TH2.h"
59#include "TList.h"
60#include "TMath.h"
61#include "TProfile.h"
62
63#include <vector>
64#include <iomanip>
65
66////////////////////////////////////////////////////////////////////////////////
67/// constructor
68
70 : fDataSetInfo(dsi),
71 fRootBaseDir(0),
72 fCallerName (callerName),
73 fLogger ( new MsgLogger(TString("TFHandler_" + callerName).Data(), kINFO) )
74{
75 // produce one entry for each class and one entry for all classes. If there is only one class,
76 // produce only one entry
77 fNumC = (dsi.GetNClasses()<= 1) ? 1 : dsi.GetNClasses()+1;
78
79 fVariableStats.resize( fNumC );
80 for (Int_t i=0; i<fNumC; i++ ) fVariableStats.at(i).resize(dsi.GetNVariables() + dsi.GetNTargets());
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// destructor
85
87{
88 std::vector<Ranking*>::const_iterator it = fRanking.begin();
89 for (; it != fRanking.end(); ++it) delete *it;
90
91 fTransformations.SetOwner();
92 delete fLogger;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96
98{
99 fCallerName = name;
100 fLogger->SetSource( TString("TFHandler_" + fCallerName).Data() );
101}
102
103////////////////////////////////////////////////////////////////////////////////
104
106{
107 TString tfname = trf->Log().GetName();
108 trf->Log().SetSource(TString(fCallerName+"_"+tfname+"_TF").Data());
109 fTransformations.Add(trf);
110 fTransformationsReferenceClasses.push_back( cls );
111 return trf;
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Caches calculated summary statistics of transformed variables.
116///
117/// \param[in] k index of class
118/// \param[in] ivar index of variable
119/// \param[in] mean the mean value of the variable
120/// \param[in] rms the root-mean-square value of the variable
121/// \param[in] min the minimum value of the variable
122/// \param[in] max the maximum value of the variable
123
125{
126 if (rms <= 0 || TMath::IsNaN(rms)) {
127 Log() << kWARNING << "Variable \"" << Variable(ivar).GetExpression()
128 << "\" has zero, negative, or NaN RMS^2: "
129 << rms
130 << " ==> set to zero. Please check the variable content" << Endl;
131 rms = 0;
132 }
133
134 VariableStat stat; stat.fMean = mean; stat.fRMS = rms; stat.fMin = min; stat.fMax = max;
135 fVariableStats.at(k).at(ivar) = stat;
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// overrides the setting for all classes! (this is put in basically for the likelihood-method)
140/// be careful with the usage this method
141
143{
144 for (UInt_t i = 0; i < fTransformationsReferenceClasses.size(); i++) {
145 fTransformationsReferenceClasses.at( i ) = cls;
146 }
147}
148
149////////////////////////////////////////////////////////////////////////////////
150/// the transformation
151
153{
154 TListIter trIt(&fTransformations);
155 std::vector<Int_t>::const_iterator rClsIt = fTransformationsReferenceClasses.begin();
156 const Event* trEv = ev;
158 if (rClsIt == fTransformationsReferenceClasses.end()) Log() << kFATAL<< "invalid read in TransformationHandler::Transform " <<Endl;
159 trEv = trf->Transform(trEv, (*rClsIt) );
160 ++rClsIt;
161 }
162 return trEv;
163}
164
165////////////////////////////////////////////////////////////////////////////////
166
168{
169 if (fTransformationsReferenceClasses.empty()){
170 //Log() << kWARNING << __FILE__ <<":InverseTransform fTransformationsReferenceClasses is empty" << Endl;
171 return ev;
172 }
173 // the inverse transformation
174 TListIter trIt(&fTransformations, kIterBackward);
175 std::vector< Int_t >::const_iterator rClsIt = fTransformationsReferenceClasses.end();
176 std::vector<Int_t>::const_iterator rClsBegin = fTransformationsReferenceClasses.begin();
177 --rClsIt;
178 const Event* trEv = ev;
179 UInt_t nvars = 0, ntgts = 0, nspcts = 0;
180 while (VariableTransformBase *trf = (VariableTransformBase*) trIt() ) { // shouldn't be the transformation called in the inverse order for the inversetransformation?????
181 if (trf->IsCreated()) {
182 trf->CountVariableTypes( nvars, ntgts, nspcts );
183 if( !(suppressIfNoTargets && ntgts==0) )
184 trEv = trf->InverseTransform(ev, (*rClsIt) );
185 }
186 else break;
187 if (rClsIt > rClsBegin)
188 --rClsIt;
189 }
190 return trEv;
191
192
193 // TListIter trIt(&fTransformations);
194 // std::vector< Int_t >::const_iterator rClsIt = fTransformationsReferenceClasses.begin();
195 // const Event* trEv = ev;
196 // UInt_t nvars = 0, ntgts = 0, nspcts = 0;
197 // while (VariableTransformBase *trf = (VariableTransformBase*) trIt() ) { // shouldn't be the transformation called in the inverse order for the inversetransformation?????
198 // if (trf->IsCreated()) {
199 // trf->CountVariableTypes( nvars, ntgts, nspcts );
200 // if( !(suppressIfNoTargets && ntgts==0) )
201 // trEv = trf->InverseTransform(ev, (*rClsIt) );
202 // }
203 // else break;
204 // rClsIt++;
205 // }
206 // return trEv;
207
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// computation of transformation
212
213const std::vector<TMVA::Event*>* TMVA::TransformationHandler::CalcTransformations( const std::vector<Event*>& events,
215{
216 if (fTransformations.GetEntries() <= 0)
217 return &events;
218
219 // the transformedEvents are initialised with the initial events and then
220 // subsequently replaced with transformed ones. The n-th transformation will
221 // and on the events as they look like after the (n-1)-the transformation
222 // as intended for the chained transformations
223 std::vector<Event*> *transformedEvents = new std::vector<TMVA::Event*>(events.size());
224 for ( UInt_t ievt = 0; ievt<events.size(); ievt++)
225 transformedEvents->at(ievt) = new Event(*events.at(ievt));
226
227 TListIter trIt(&fTransformations);
228 std::vector< Int_t >::iterator rClsIt = fTransformationsReferenceClasses.begin();
230 if (trf->PrepareTransformation(*transformedEvents)) {
231 for (UInt_t ievt = 0; ievt<transformedEvents->size(); ievt++) { // loop through all events
232 *(*transformedEvents)[ievt] = *trf->Transform((*transformedEvents)[ievt],(*rClsIt));
233 }
234 ++rClsIt;
235 }
236 }
237
238 CalcStats(*transformedEvents);
239
240 // plot the variables once in this transformation
241 PlotVariables(*transformedEvents);
242
243 //sometimes, the actual transformed event vector is not used for anything but the previous
244 //CalcStat and PlotVariables calles, in that case, we delete it again (and return NULL)
245 if (!createNewVector) { // if we don't want that newly created event vector to persist, then delete it
246 for ( UInt_t ievt = 0; ievt<transformedEvents->size(); ievt++)
247 delete (*transformedEvents)[ievt];
248 delete transformedEvents;
250 }
251
252 return transformedEvents; // give back the newly created event collection (containing the transformed events)
253}
254
255////////////////////////////////////////////////////////////////////////////////
256/// method to calculate minimum, maximum, mean, and RMS for all
257/// variables used in the MVA
258
259void TMVA::TransformationHandler::CalcStats (const std::vector<Event*>& events )
260{
261 UInt_t nevts = events.size();
262
263 if (nevts==0)
264 Log() << kFATAL << "No events available to find min, max, mean and rms" << Endl;
265
266 // if transformation has not been succeeded, the tree may be empty
267 const UInt_t nvar = events[0]->GetNVariables();
268 const UInt_t ntgt = events[0]->GetNTargets();
269
270 Double_t *sumOfWeights = new Double_t[fNumC];
271 Double_t* *x2 = new Double_t*[fNumC];
272 Double_t* *x0 = new Double_t*[fNumC];
273 Double_t* *varMin = new Double_t*[fNumC];
274 Double_t* *varMax = new Double_t*[fNumC];
275
276 for (Int_t cls=0; cls<fNumC; cls++) {
277 sumOfWeights[cls]=0;
278 x2[cls] = new Double_t[nvar+ntgt];
279 x0[cls] = new Double_t[nvar+ntgt];
280 varMin[cls] = new Double_t[nvar+ntgt];
281 varMax[cls] = new Double_t[nvar+ntgt];
282 for (UInt_t ivar=0; ivar<nvar+ntgt; ivar++) {
283 x0[cls][ivar] = x2[cls][ivar] = 0;
285 varMax[cls][ivar] = -DBL_MAX;
286 }
287 }
288
289 for (UInt_t ievt=0; ievt<nevts; ievt++) {
290 const Event* ev = events[ievt];
291 Int_t cls = ev->GetClass();
292
293 Double_t weight = ev->GetWeight();
294 sumOfWeights[cls] += weight;
295 if (fNumC > 1 ) sumOfWeights[fNumC-1] += weight; // if more than one class, store values for all classes
296 for (UInt_t var_tgt = 0; var_tgt < 2; var_tgt++ ){ // first for variables, then for targets
297 UInt_t nloop = ( var_tgt==0?nvar:ntgt );
298 for (UInt_t ivar=0; ivar<nloop; ivar++) {
299 Double_t x = ( var_tgt==0?ev->GetValue(ivar):ev->GetTarget(ivar) );
300
301 if (x < varMin[cls][(var_tgt*nvar)+ivar]) varMin[cls][(var_tgt*nvar)+ivar]= x;
302 if (x > varMax[cls][(var_tgt*nvar)+ivar]) varMax[cls][(var_tgt*nvar)+ivar]= x;
303
304 x0[cls][(var_tgt*nvar)+ivar] += x*weight;
305 x2[cls][(var_tgt*nvar)+ivar] += x*x*weight;
306
307 if (fNumC > 1) {
308 if (x < varMin[fNumC-1][(var_tgt*nvar)+ivar]) varMin[fNumC-1][(var_tgt*nvar)+ivar]= x;
309 if (x > varMax[fNumC-1][(var_tgt*nvar)+ivar]) varMax[fNumC-1][(var_tgt*nvar)+ivar]= x;
310
311 x0[fNumC-1][(var_tgt*nvar)+ivar] += x*weight;
312 x2[fNumC-1][(var_tgt*nvar)+ivar] += x*x*weight;
313 }
314 }
315 }
316 }
317
318
319 // set Mean and RMS
320 for (UInt_t var_tgt = 0; var_tgt < 2; var_tgt++ ){ // first for variables, then for targets
321 UInt_t nloop = ( var_tgt==0?nvar:ntgt );
322 for (UInt_t ivar=0; ivar<nloop; ivar++) {
323 for (Int_t cls = 0; cls < fNumC; cls++) {
324 Double_t mean = x0[cls][(var_tgt*nvar)+ivar]/sumOfWeights[cls];
325 Double_t rms = TMath::Sqrt( x2[cls][(var_tgt*nvar)+ivar]/sumOfWeights[cls] - mean*mean);
326 AddStats(cls, (var_tgt*nvar)+ivar, mean, rms, varMin[cls][(var_tgt*nvar)+ivar], varMax[cls][(var_tgt*nvar)+ivar]);
327 }
328 }
329 }
330
331 // ------ pretty output of basic statistics -------------------------------
332 // find maximum length in V (and column title)
333 UInt_t maxL = 8, maxV = 0;
334 std::vector<UInt_t> vLengths;
335 for (UInt_t ivar=0; ivar<nvar+ntgt; ivar++) {
336 if( ivar < nvar )
337 maxL = TMath::Max( (UInt_t)Variable(ivar).GetLabel().Length(), maxL );
338 else
339 maxL = TMath::Max( (UInt_t)Target(ivar-nvar).GetLabel().Length(), maxL );
340 }
341 maxV = maxL + 2;
342 // full column length
343 UInt_t clen = maxL + 4*maxV + 11;
344 Log() << kHEADER ;
345 //for (UInt_t i=0; i<clen; i++) //Log() << "-";
346
347 //Log() << Endl;
348 // full column length
349 Log() << std::setw(maxL) << "Variable";
350 Log() << " " << std::setw(maxV) << "Mean";
351 Log() << " " << std::setw(maxV) << "RMS";
352 Log() << " " << std::setw(maxV) << "[ Min ";
353 Log() << " " << std::setw(maxV) << " Max ]"<< Endl;
354 for (UInt_t i=0; i<clen; i++) Log() << "-";
355 Log() << Endl;
356
357 // the numbers
358 TString format = "%#11.5g";
359 for (UInt_t ivar=0; ivar<nvar+ntgt; ivar++) {
360 if( ivar < nvar )
361 Log() << std::setw(maxL) << Variable(ivar).GetLabel() << ":";
362 else
363 Log() << std::setw(maxL) << Target(ivar-nvar).GetLabel() << ":";
364 Log() << std::setw(maxV) << Form( format.Data(), GetMean(ivar) );
365 Log() << std::setw(maxV) << Form( format.Data(), GetRMS(ivar) );
366 Log() << " [" << std::setw(maxV) << Form( format.Data(), GetMin(ivar) );
367 Log() << std::setw(maxV) << Form( format.Data(), GetMax(ivar) ) << " ]";
368 Log() << Endl;
369 }
370 for (UInt_t i=0; i<clen; i++) Log() << "-";
371 Log() << Endl;
372 // ------------------------------------------------------------------------
373
374 delete[] sumOfWeights;
375 for (Int_t cls=0; cls<fNumC; cls++) {
376 delete [] x2[cls];
377 delete [] x0[cls];
378 delete [] varMin[cls];
379 delete [] varMax[cls];
380 }
381 delete [] x2;
382 delete [] x0;
383 delete [] varMin;
384 delete [] varMax;
385}
386
387////////////////////////////////////////////////////////////////////////////////
388/// create transformation function
389
391{
392 TListIter trIt(&fTransformations);
393 std::vector< Int_t >::const_iterator rClsIt = fTransformationsReferenceClasses.begin();
396 trf->MakeFunction(fout, fncName, part, trCounter++, (*rClsIt) );
397 ++rClsIt;
398 }
399 if (part==1) {
400 for (Int_t i=0; i<fTransformations.GetSize(); i++) {
401 fout << " void InitTransform_"<<i+1<<"();" << std::endl;
402 fout << " void Transform_"<<i+1<<"( std::vector<double> & iv, int sigOrBgd ) const;" << std::endl;
403 }
404 }
405 if (part==2) {
406 fout << std::endl;
407 fout << "//_______________________________________________________________________" << std::endl;
408 fout << "inline void " << fncName << "::InitTransform()" << std::endl;
409 fout << "{" << std::endl;
410 for (Int_t i=0; i<fTransformations.GetSize(); i++)
411 fout << " InitTransform_"<<i+1<<"();" << std::endl;
412 fout << "}" << std::endl;
413 fout << std::endl;
414 fout << "//_______________________________________________________________________" << std::endl;
415 fout << "inline void " << fncName << "::Transform( std::vector<double>& iv, int sigOrBgd ) const" << std::endl;
416 fout << "{" << std::endl;
417 for (Int_t i=0; i<fTransformations.GetSize(); i++)
418 fout << " Transform_"<<i+1<<"( iv, sigOrBgd );" << std::endl;
419
420 fout << "}" << std::endl;
421 }
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// return transformation name
426
428{
429 TString name("Id");
430 TListIter trIt(&fTransformations);
432 if ((trf = (VariableTransformBase*) trIt())) {
433 name = TString(trf->GetShortName());
434 while ((trf = (VariableTransformBase*) trIt())) name += "_" + TString(trf->GetShortName());
435 }
436 return name;
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// incorporates transformation type into title axis (usually for histograms)
441
443{
444 TString xtit = info.GetTitle();
445 // indicate transformation, but not in case of single identity transform
446 if (fTransformations.GetSize() >= 1) {
447 if (fTransformations.GetSize() > 1 ||
448 ((VariableTransformBase*)GetTransformationList().Last())->GetVariableTransform() != Types::kIdentity) {
449 xtit += " (" + GetName() + ")";
450 }
451 }
452 return xtit;
453}
454
455
456////////////////////////////////////////////////////////////////////////////////
457/// create histograms from the input variables
458/// - histograms for all input variables
459/// - scatter plots for all pairs of input variables
460
461void TMVA::TransformationHandler::PlotVariables (const std::vector<Event*>& events, TDirectory* theDirectory )
462{
463 if (fRootBaseDir==0 && theDirectory == 0) return;
464
465 Log() << kDEBUG << "Plot event variables for ";
466 if (theDirectory !=0) Log()<< TString(theDirectory->GetName()) << Endl;
467 else Log() << GetName() << Endl;
468
469 // extension for transformation type
470 TString transfType = "";
471 if (theDirectory == 0) {
472 transfType += "_";
473 transfType += GetName();
474 }else{ // you plot for the individual classifiers. Note, here the "statistics" still need to be calculated as you are in the testing phase
475 CalcStats(events);
476 }
477
478 const UInt_t nvar = fDataSetInfo.GetNVariables();
479 const UInt_t ntgt = fDataSetInfo.GetNTargets();
480 const Int_t ncls = fDataSetInfo.GetNClasses();
481
482 // Create all histograms
483 // do both, scatter and profile plots
484 std::vector<std::vector<TH1*> > hVars( ncls ); // histograms for variables
485 std::vector<std::vector<std::vector<TH2F*> > > mycorr( ncls ); // histograms for correlations
486 std::vector<std::vector<std::vector<TProfile*> > > myprof( ncls ); // histograms for profiles
487
488 for (Int_t cls = 0; cls < ncls; cls++) {
489 hVars.at(cls).resize ( nvar+ntgt );
490 hVars.at(cls).assign ( nvar+ntgt, 0 ); // fill with zeros
491 mycorr.at(cls).resize( nvar+ntgt );
492 myprof.at(cls).resize( nvar+ntgt );
493 for (UInt_t ivar=0; ivar < nvar+ntgt; ivar++) {
494 mycorr.at(cls).at(ivar).resize( nvar+ntgt );
495 myprof.at(cls).at(ivar).resize( nvar+ntgt );
496 mycorr.at(cls).at(ivar).assign( nvar+ntgt, 0 ); // fill with zeros
497 myprof.at(cls).at(ivar).assign( nvar+ntgt, 0 ); // fill with zeros
498 }
499 }
500
501 // if there are too many input variables, the creation of correlations plots blows up
502 // memory and basically kills the TMVA execution
503 // --> avoid above critical number (which can be user defined)
504 if (nvar+ntgt > (UInt_t)gConfig().GetVariablePlotting().fMaxNumOfAllowedVariablesForScatterPlots) {
505 Int_t nhists = (nvar+ntgt)*(nvar+ntgt - 1)/2;
506 Log() << kINFO << gTools().Color("dgreen") << Endl;
507 Log() << kINFO << "<PlotVariables> Will not produce scatter plots ==> " << Endl;
508 Log() << kINFO
509 << "| The number of " << nvar << " input variables and " << ntgt << " target values would require "
510 << nhists << " two-dimensional" << Endl;
511 Log() << kINFO
512 << "| histograms, which would occupy the computer's memory. Note that this" << Endl;
513 Log() << kINFO
514 << "| suppression does not have any consequences for your analysis, other" << Endl;
515 Log() << kINFO
516 << "| than not disposing of these scatter plots. You can modify the maximum" << Endl;
517 Log() << kINFO
518 << "| number of input variables allowed to generate scatter plots in your" << Endl;
519 Log() << "| script via the command line:" << Endl;
520 Log() << kINFO
521 << "| \"(TMVA::gConfig().GetVariablePlotting()).fMaxNumOfAllowedVariablesForScatterPlots = <some int>;\""
522 << gTools().Color("reset") << Endl;
523 Log() << Endl;
524 Log() << kINFO << "Some more output" << Endl;
525 }
526
530
531 for (UInt_t var_tgt = 0; var_tgt < 2; var_tgt++) { // create the histos first for the variables, then for the targets
532 UInt_t nloops = ( var_tgt == 0? nvar:ntgt ); // number of variables or number of targets
533 for (UInt_t ivar=0; ivar<nloops; ivar++) {
534 const VariableInfo& info = ( var_tgt == 0 ? Variable( ivar ) : Target(ivar) ); // choose the appropriate one (variable or target)
535 TString myVari = info.GetInternalName();
536
537 Double_t mean = fVariableStats.at(fNumC-1).at( ( var_tgt*nvar )+ivar).fMean;
538 Double_t rms = fVariableStats.at(fNumC-1).at( ( var_tgt*nvar )+ivar).fRMS;
539
540 for (Int_t cls = 0; cls < ncls; cls++) {
541
542 TString className = fDataSetInfo.GetClassInfo(cls)->GetName();
543
544 // add "target" in case of target variable (required for plotting macros)
545 className += (ntgt == 1 && var_tgt == 1 ? "_target" : "");
546
547 // choose reasonable histogram ranges, by removing outliers
548 TH1* h = 0;
549 if (info.GetVarType() == 'I') {
550 // special treatment for integer variables
551 Int_t xmin = TMath::Nint( GetMin( ( var_tgt*nvar )+ivar) );
552 Int_t xmax = TMath::Nint( GetMax( ( var_tgt*nvar )+ivar) + 1 );
553 Int_t nbins = xmax - xmin;
554
555 h = new TH1F( TString::Format("%s__%s%s", myVari.Data(), className.Data(), transfType.Data()).Data(),
556 info.GetTitle(), nbins, xmin, xmax );
557 }
558 else {
559 Double_t xmin = TMath::Max( GetMin( ( var_tgt*nvar )+ivar), mean - timesRMS*rms );
560 Double_t xmax = TMath::Min( GetMax( ( var_tgt*nvar )+ivar), mean + timesRMS*rms );
561
562 //std::cout << "Class="<<cls<<" xmin="<<xmin << " xmax="<<xmax<<" mean="<<mean<<" rms="<<rms<<" timesRMS="<<timesRMS<<std::endl;
563 // protection
564 if (xmin >= xmax) xmax = xmin*1.1; // try first...
565 if (xmin >= xmax) xmax = xmin + 1; // this if xmin == xmax == 0
566 // safety margin for values equal to the maximum within the histogram
567 xmax += (xmax - xmin)/nbins1D;
568
569 h = new TH1F( TString::Format("%s__%s%s", myVari.Data(), className.Data(), transfType.Data()).Data(),
570 info.GetTitle(), nbins1D, xmin, xmax );
571 }
572
573 h->GetXaxis()->SetTitle( gTools().GetXTitleWithUnit( GetVariableAxisTitle( info ), info.GetUnit() ) );
574 h->GetYaxis()->SetTitle( gTools().GetYTitleWithUnit( *h, info.GetUnit(), kFALSE ) );
575 hVars.at(cls).at((var_tgt*nvar)+ivar) = h;
576
577 // profile and scatter plots
578 if (nvar+ntgt <= (UInt_t)gConfig().GetVariablePlotting().fMaxNumOfAllowedVariablesForScatterPlots) {
579
580 for (UInt_t v_t = 0; v_t < 2; v_t++) {
581 UInt_t nl = ( v_t==0?nvar:ntgt );
582 UInt_t start = ( v_t==0? (var_tgt==0?ivar+1:0):(var_tgt==0?nl:ivar+1) );
583 for (UInt_t j=start; j<nl; j++) {
584 // choose the appropriate one (variable or target)
585 const VariableInfo& infoj = ( v_t == 0 ? Variable( j ) : Target(j) );
586 TString myVarj = infoj.GetInternalName();
587
588 Double_t rxmin = fVariableStats.at(fNumC-1).at( ( v_t*nvar )+ivar).fMin;
589 Double_t rxmax = fVariableStats.at(fNumC-1).at( ( v_t*nvar )+ivar).fMax;
590 Double_t rymin = fVariableStats.at(fNumC-1).at( ( v_t*nvar )+j).fMin;
591 Double_t rymax = fVariableStats.at(fNumC-1).at( ( v_t*nvar )+j).fMax;
592
593 // scatter plot
594 TH2F* h2 = new TH2F( TString::Format( "scat_%s_vs_%s_%s%s" , myVarj.Data(), myVari.Data(),
595 className.Data(), transfType.Data() ),
596 TString::Format( "%s versus %s (%s)%s", infoj.GetTitle(), info.GetTitle(),
597 className.Data(), transfType.Data() ),
599 nbins2D, rymin , rymax );
600
601 h2->GetXaxis()->SetTitle( gTools().GetXTitleWithUnit( GetVariableAxisTitle( info ), info .GetUnit() ) );
602 h2->GetYaxis()->SetTitle( gTools().GetXTitleWithUnit( GetVariableAxisTitle( infoj ), infoj.GetUnit() ) );
603 mycorr.at(cls).at((var_tgt*nvar)+ivar).at((v_t*nvar)+j) = h2;
604
605 // profile plot
606 TProfile* p = new TProfile( TString::Format( "prof_%s_vs_%s_%s%s", myVarj.Data(),
607 myVari.Data(), className.Data(),
608 transfType.Data() ),
609 TString::Format( "profile %s versus %s (%s)%s",
610 infoj.GetTitle(), info.GetTitle(),
611 className.Data(), transfType.Data() ), nbins1D,
612 rxmin, rxmax );
613 // info.GetMin(), info.GetMax() );
614
615 p->GetXaxis()->SetTitle( gTools().GetXTitleWithUnit( GetVariableAxisTitle( info ), info .GetUnit() ) );
616 p->GetYaxis()->SetTitle( gTools().GetXTitleWithUnit( GetVariableAxisTitle( infoj ), infoj.GetUnit() ) );
617 myprof.at(cls).at((var_tgt*nvar)+ivar).at((v_t*nvar)+j) = p;
618 }
619 }
620 }
621 }
622 }
623 }
624
625 UInt_t nevts = events.size();
626
627 // compute correlation coefficient between target value and variables (regression only)
628 std::vector<Double_t> xregmean ( nvar+1, 0 );
629 std::vector<Double_t> x2regmean( nvar+1, 0 );
630 std::vector<Double_t> xCregmean( nvar+1, 0 );
631
632 // fill the histograms (this approach should be faster than individual projection
633 for (UInt_t ievt=0; ievt<nevts; ievt++) {
634
635 const Event* ev = events[ievt];
636
637 Float_t weight = ev->GetWeight();
638 Int_t cls = ev->GetClass();
639
640 // average correlation between first target and variables (so far only for single-target regression)
641 if (ntgt == 1) {
642 Float_t valr = ev->GetTarget(0);
643 xregmean[nvar] += valr;
644 x2regmean[nvar] += valr*valr;
645 for (UInt_t ivar=0; ivar<nvar; ivar++) {
646 Float_t vali = ev->GetValue(ivar);
647 xregmean[ivar] += vali;
650 }
651 }
652
653 // fill correlation histograms
654 for (UInt_t var_tgt = 0; var_tgt < 2; var_tgt++) { // create the histos first for the variables, then for the targets
655 UInt_t nloops = ( var_tgt == 0? nvar:ntgt ); // number of variables or number of targets
656 for (UInt_t ivar=0; ivar<nloops; ivar++) {
657 Float_t vali = ( var_tgt == 0 ? ev->GetValue(ivar) : ev->GetTarget(ivar) );
658
659 // variable histos
660 hVars.at(cls).at( ( var_tgt*nvar )+ivar)->Fill( vali, weight );
661
662 // correlation histos
664
665 for (UInt_t v_t = 0; v_t < 2; v_t++) {
666 UInt_t nl = ( v_t==0 ? nvar : ntgt );
667 UInt_t start = ( v_t==0 ? (var_tgt==0?ivar+1:0) : (var_tgt==0?nl:ivar+1) );
668 for (UInt_t j=start; j<nl; j++) {
669 Float_t valj = ( v_t == 0 ? ev->GetValue(j) : ev->GetTarget(j) );
670 mycorr.at(cls).at( ( var_tgt*nvar )+ivar).at( ( v_t*nvar )+j)->Fill( vali, valj, weight );
671 myprof.at(cls).at( ( var_tgt*nvar )+ivar).at( ( v_t*nvar )+j)->Fill( vali, valj, weight );
672 }
673 }
674 }
675 }
676 }
677 }
678
679 // correlation analysis for ranking (single-target regression only)
680 if (ntgt == 1) {
681 for (UInt_t ivar=0; ivar<=nvar; ivar++) {
682 xregmean[ivar] /= nevts;
684 }
685 for (UInt_t ivar=0; ivar<nvar; ivar++) {
688 }
689
690 fRanking.push_back( new Ranking( GetName() + "Transformation", "|Correlation with target|" ) );
691 for (UInt_t ivar=0; ivar<nvar; ivar++) {
693 fRanking.back()->AddRank( Rank( fDataSetInfo.GetVariableInfo(ivar).GetLabel(), abscor ) );
694 }
695
696 if (nvar+ntgt <= (UInt_t)gConfig().GetVariablePlotting().fMaxNumOfAllowedVariablesForScatterPlots) {
697
698 // compute also mutual information (non-linear correlation measure)
699 fRanking.push_back( new Ranking( GetName() + "Transformation", "Mutual information" ) );
700 for (UInt_t ivar=0; ivar<nvar; ivar++) {
701 TH2F* h1 = mycorr.at(0).at( nvar ).at( ivar );
703 fRanking.back()->AddRank( Rank( fDataSetInfo.GetVariableInfo(ivar).GetLabel(), mi ) );
704 }
705
706 // compute correlation ratio (functional correlations measure)
707 fRanking.push_back( new Ranking( GetName() + "Transformation", "Correlation Ratio" ) );
708 for (UInt_t ivar=0; ivar<nvar; ivar++) {
709 TH2F* h2 = mycorr.at(0).at( nvar ).at( ivar );
711 fRanking.back()->AddRank( Rank( fDataSetInfo.GetVariableInfo(ivar).GetLabel(), cr ) );
712 }
713
714 // additionally compute correlation ratio from transposed histograms since correlation ratio is asymmetric
715 fRanking.push_back( new Ranking( GetName() + "Transformation", "Correlation Ratio (T)" ) );
716 for (UInt_t ivar=0; ivar<nvar; ivar++) {
717 TH2F* h2T = gTools().TransposeHist( *mycorr.at(0).at( nvar ).at( ivar ) );
719 fRanking.back()->AddRank( Rank( fDataSetInfo.GetVariableInfo(ivar).GetLabel(), cr ) );
720 delete h2T;
721 }
722 }
723 }
724 // computes ranking of input variables
725 // separation for 2-class classification
726 else if (fDataSetInfo.GetNClasses() == 2
727 && fDataSetInfo.GetClassInfo("Signal") != NULL
728 && fDataSetInfo.GetClassInfo("Background") != NULL
729 ) { // TODO: ugly hack.. adapt to new framework
730 fRanking.push_back( new Ranking( GetName() + "Transformation", "Separation" ) );
731 for (UInt_t i=0; i<nvar; i++) {
732 Double_t sep = gTools().GetSeparation( hVars.at(fDataSetInfo.GetClassInfo("Signal") ->GetNumber()).at(i),
733 hVars.at(fDataSetInfo.GetClassInfo("Background")->GetNumber()).at(i) );
734 fRanking.back()->AddRank( Rank( hVars.at(fDataSetInfo.GetClassInfo("Signal")->GetNumber()).at(i)->GetTitle(),
735 sep ) );
736 }
737 }
738
739 // for regression compute performance from correlation with target value
740
741 // write histograms
742
744 if (theDirectory == 0) {
745 // create directory in root dir
746 fRootBaseDir->cd();
747 TString outputDir = TString("InputVariables");
748 TListIter trIt(&fTransformations);
750 outputDir += "_" + TString(trf->GetShortName());
751
753 Int_t counter = 0;
754 TObject* o = nullptr;
755 while( (o = fRootBaseDir->FindObject(uniqueOutputDir)) != nullptr ){
756 uniqueOutputDir = outputDir + TString::Format("_%d",counter);
757 Log() << kINFO << "A " << o->ClassName() << " with name " << o->GetName() << " already exists in "
758 << fRootBaseDir->GetPath() << ", I will try with "<<uniqueOutputDir<<"." << Endl;
759 ++counter;
760 }
761
762 // TObject* o = fRootBaseDir->FindObject(outputDir);
763 // if (o != 0) {
764 // Log() << kFATAL << "A " << o->ClassName() << " with name " << o->GetName() << " already exists in "
765 // << fRootBaseDir->GetPath() << "("<<outputDir<<")" << Endl;
766 // }
767 localDir = fRootBaseDir->mkdir( uniqueOutputDir );
768 localDir->cd();
769
770 Log() << kVERBOSE << "Create and switch to directory " << localDir->GetPath() << Endl;
771 }
772 else {
773 theDirectory->cd();
774 }
775
776 for (UInt_t i=0; i<nvar+ntgt; i++) {
777 for (Int_t cls = 0; cls < ncls; cls++) {
778 if (hVars.at(cls).at(i) != 0) {
779 hVars.at(cls).at(i)->Write();
780 hVars.at(cls).at(i)->SetDirectory(nullptr);
781 delete hVars.at(cls).at(i);
782 }
783 }
784 }
785
786 // correlation plots have dedicated directory
787 if (nvar+ntgt <= (UInt_t)gConfig().GetVariablePlotting().fMaxNumOfAllowedVariablesForScatterPlots) {
788
789 localDir = localDir->mkdir( "CorrelationPlots" );
790 localDir ->cd();
791 Log() << kDEBUG << "Create scatter and profile plots in target-file directory: " << Endl;
792 Log() << kDEBUG << localDir->GetPath() << Endl;
793
794
795 for (UInt_t i=0; i<nvar+ntgt; i++) {
796 for (UInt_t j=i+1; j<nvar+ntgt; j++) {
797 for (Int_t cls = 0; cls < ncls; cls++) {
798 if (mycorr.at(cls).at(i).at(j) != 0 ) {
799 mycorr.at(cls).at(i).at(j)->Write();
800 mycorr.at(cls).at(i).at(j)->SetDirectory(nullptr);
801 delete mycorr.at(cls).at(i).at(j);
802 }
803 if (myprof.at(cls).at(i).at(j) != 0) {
804 myprof.at(cls).at(i).at(j)->Write();
805 myprof.at(cls).at(i).at(j)->SetDirectory(nullptr);
806 delete myprof.at(cls).at(i).at(j);
807 }
808 }
809 }
810 }
811 }
812 if (theDirectory != 0 ) theDirectory->cd();
813 else fRootBaseDir->cd();
814}
815
816////////////////////////////////////////////////////////////////////////////////
817/// returns string for transformation
818
820{
821 VariableTransformBase* trf = ((VariableTransformBase*)GetTransformationList().Last());
822 if (!trf) return 0;
823 else return trf->GetTransformationStrings( fTransformationsReferenceClasses.back() );
824}
825
826////////////////////////////////////////////////////////////////////////////////
827/// returns string for transformation
828
830{
831 VariableTransformBase* trf = ((VariableTransformBase*)GetTransformationList().Last());
832 if (!trf) return 0;
833 else return trf->GetName();
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// write transformation to stream
838
840{
841 TListIter trIt(&fTransformations);
842 std::vector< Int_t >::const_iterator rClsIt = fTransformationsReferenceClasses.begin();
843
844 o << "NTransformtations " << fTransformations.GetSize() << std::endl << std::endl;
845
846 ClassInfo* ci;
847 UInt_t i = 1;
849 o << "#TR -*-*-*-*-*-*-* transformation " << i++ << ": " << trf->GetName() << " -*-*-*-*-*-*-*-" << std::endl;
850 trf->WriteTransformationToStream(o);
851 ci = fDataSetInfo.GetClassInfo( (*rClsIt) );
853 if (ci == 0 ) clsName = "AllClasses";
854 else clsName = ci->GetName();
855 o << "ReferenceClass " << clsName << std::endl;
856 ++rClsIt;
857 }
858}
859
860
861////////////////////////////////////////////////////////////////////////////////
862/// XML node describing the transformation
863
865{
866 if(!parent) return;
867 void* trfs = gTools().AddChild(parent, "Transformations");
868 gTools().AddAttr( trfs, "NTransformations", fTransformations.GetSize() );
869 TListIter trIt(&fTransformations);
870 while (VariableTransformBase *trf = (VariableTransformBase*) trIt()) trf->AttachXMLTo(trfs);
871}
872
873////////////////////////////////////////////////////////////////////////////////
874
876{
877 Log() << kFATAL << "Read transformations not implemented" << Endl;
878 // TODO
879}
880
881////////////////////////////////////////////////////////////////////////////////
882
884{
885 void* ch = gTools().GetChild( trfsnode );
886 while(ch) {
887 Int_t idxCls = -1;
889 gTools().ReadAttr(ch, "Name", trfname);
890
892
893 if (trfname == "Decorrelation" ) {
894 newtrf = new VariableDecorrTransform(fDataSetInfo);
895 }
896 else if (trfname == "PCA" ) {
897 newtrf = new VariablePCATransform(fDataSetInfo);
898 }
899 else if (trfname == "Gauss" ) {
900 newtrf = new VariableGaussTransform(fDataSetInfo);
901 }
902 else if (trfname == "Uniform" ) {
903 newtrf = new VariableGaussTransform(fDataSetInfo, "Uniform");
904 }
905 else if (trfname == "Normalize" ) {
906 newtrf = new VariableNormalizeTransform(fDataSetInfo);
907 }
908 else if (trfname == "Rearrange" ) {
909 newtrf = new VariableRearrangeTransform(fDataSetInfo);
910 }
911 else if (trfname != "None") {
912 }
913 else {
914 Log() << kFATAL << "<ReadFromXML> Variable transform '"
915 << trfname << "' unknown." << Endl;
916 }
917 newtrf->ReadFromXML( ch );
918 AddTransformation( newtrf, idxCls );
919 ch = gTools().GetNextChild(ch);
920 }
921}
922
923////////////////////////////////////////////////////////////////////////////////
924/// prints ranking of input variables
925
927{
928 //Log() << kINFO << " " << Endl;
929 Log() << kINFO << "Ranking input variables (method unspecific)..." << Endl;
930 std::vector<Ranking*>::const_iterator it = fRanking.begin();
931 for (; it != fRanking.end(); ++it) (*it)->Print();
932}
933
934////////////////////////////////////////////////////////////////////////////////
935
937{
938 try {
939 return fVariableStats.at(cls).at(ivar).fMean;
940 }
941 catch(...) {
942 try {
943 return fVariableStats.at(fNumC-1).at(ivar).fMean;
944 }
945 catch(...) {
946 Log() << kWARNING << "Inconsistent variable state when reading the mean value. " << Endl;
947 }
948 }
949 Log() << kWARNING << "Inconsistent variable state when reading the mean value. Value 0 given back" << Endl;
950 return 0;
951}
952
953////////////////////////////////////////////////////////////////////////////////
954
956{
957 try {
958 return fVariableStats.at(cls).at(ivar).fRMS;
959 }
960 catch(...) {
961 try {
962 return fVariableStats.at(fNumC-1).at(ivar).fRMS;
963 }
964 catch(...) {
965 Log() << kWARNING << "Inconsistent variable state when reading the RMS value. " << Endl;
966 }
967 }
968 Log() << kWARNING << "Inconsistent variable state when reading the RMS value. Value 0 given back" << Endl;
969 return 0;
970}
971
972////////////////////////////////////////////////////////////////////////////////
973
975{
976 try {
977 return fVariableStats.at(cls).at(ivar).fMin;
978 }
979 catch(...) {
980 try {
981 return fVariableStats.at(fNumC-1).at(ivar).fMin;
982 }
983 catch(...) {
984 Log() << kWARNING << "Inconsistent variable state when reading the minimum value. " << Endl;
985 }
986 }
987 Log() << kWARNING << "Inconsistent variable state when reading the minimum value. Value 0 given back" << Endl;
988 return 0;
989}
990
991////////////////////////////////////////////////////////////////////////////////
992
994{
995 try {
996 return fVariableStats.at(cls).at(ivar).fMax;
997 }
998 catch(...) {
999 try {
1000 return fVariableStats.at(fNumC-1).at(ivar).fMax;
1001 }
1002 catch(...) {
1003 Log() << kWARNING << "Inconsistent variable state when reading the maximum value. " << Endl;
1004 }
1005 }
1006 Log() << kWARNING << "Inconsistent variable state when reading the maximum value. Value 0 given back" << Endl;
1007 return 0;
1008}
#define h(i)
Definition RSha256.hxx:106
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
const Bool_t kIterBackward
Definition TCollection.h:43
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
const_iterator begin() const
const_iterator end() const
Describe directory structure in memory.
Definition TDirectory.h:45
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:645
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
Iterator of linked list.
Definition TList.h:191
Class that contains all the information of a class.
Definition ClassInfo.h:49
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition Config.h:109
VariablePlotting & GetVariablePlotting()
Definition Config.h:97
Class that contains all the data information.
Definition DataSetInfo.h:62
ostringstream derivative to redirect and format output
Definition MsgLogger.h:57
Ranking for variables in method (implementation)
Definition Ranking.h:48
Double_t GetSeparation(TH1 *S, TH1 *B) const
compute "separation" defined as
Definition Tools.cxx:121
Double_t GetMutualInformation(const TH2F &)
Mutual Information method for non-linear correlations estimates in 2D histogram Author: Moritz Backes...
Definition Tools.cxx:589
const TString & Color(const TString &)
human readable color strings
Definition Tools.cxx:828
Double_t GetCorrelationRatio(const TH2F &)
Compute Correlation Ratio of 2D histogram to estimate functional dependency between two variables Aut...
Definition Tools.cxx:620
void ReadAttr(void *node, const char *, T &value)
read attribute from xml
Definition Tools.h:329
void * GetChild(void *parent, const char *childname=nullptr)
get child node
Definition Tools.cxx:1150
void AddAttr(void *node, const char *, const T &value, Int_t precision=16)
add attribute to xml
Definition Tools.h:347
void * AddChild(void *parent, const char *childname, const char *content=nullptr, bool isRootNode=false)
add child node
Definition Tools.cxx:1124
TH2F * TransposeHist(const TH2F &)
Transpose quadratic histogram.
Definition Tools.cxx:657
void * GetNextChild(void *prevchild, const char *childname=nullptr)
XML helpers.
Definition Tools.cxx:1162
void AddXMLTo(void *parent=nullptr) const
XML node describing the transformation.
const char * GetNameOfLastTransform() const
returns string for transformation
void ReadFromStream(std::istream &istr)
TransformationHandler(DataSetInfo &, const TString &callerName)
constructor
const std::vector< Event * > * CalcTransformations(const std::vector< Event * > &, Bool_t createNewVector=kFALSE)
computation of transformation
const Event * Transform(const Event *) const
the transformation
Int_t fNumC
number of categories (#classes +1)
void AddStats(Int_t k, UInt_t ivar, Double_t mean, Double_t rms, Double_t min, Double_t max)
Caches calculated summary statistics of transformed variables.
Double_t GetRMS(Int_t ivar, Int_t cls=-1) const
Double_t GetMean(Int_t ivar, Int_t cls=-1) const
void SetCallerName(const TString &name)
std::vector< std::vector< TMVA::TransformationHandler::VariableStat > > fVariableStats
reference classes for the transformations
TString GetName() const
return transformation name
Double_t GetMin(Int_t ivar, Int_t cls=-1) const
void PrintVariableRanking() const
prints ranking of input variables
void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part) const
create transformation function
void SetTransformationReferenceClass(Int_t cls)
overrides the setting for all classes! (this is put in basically for the likelihood-method) be carefu...
void PlotVariables(const std::vector< Event * > &events, TDirectory *theDirectory=nullptr)
create histograms from the input variables
void CalcStats(const std::vector< Event * > &events)
method to calculate minimum, maximum, mean, and RMS for all variables used in the MVA
std::vector< TString > * GetTransformationStringsOfLastTransform() const
returns string for transformation
TString GetVariableAxisTitle(const VariableInfo &info) const
incorporates transformation type into title axis (usually for histograms)
VariableTransformBase * AddTransformation(VariableTransformBase *, Int_t cls)
Double_t GetMax(Int_t ivar, Int_t cls=-1) const
const Event * InverseTransform(const Event *, Bool_t suppressIfNoTargets=true) const
void WriteToStream(std::ostream &o) const
write transformation to stream
@ kIdentity
Definition Types.h:115
Linear interpolation class.
Gaussian Transformation of input variables.
Class for type info of MVA input variable.
Linear interpolation class.
Rearrangement of input variables.
Linear interpolation class.
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:456
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:225
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:420
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition TObject.cxx:654
Profile Histogram.
Definition TProfile.h:32
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Double_t x[n]
Definition legend1.C:17
TH1F * h1
Definition legend1.C:5
Config & gConfig()
Tools & gTools()
MsgLogger & Endl(MsgLogger &ml)
Definition MsgLogger.h:148
Bool_t IsNaN(Double_t x)
Definition TMath.h:896
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:697
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:250
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:666
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:198
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123