Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
HistFactoryNavigation.cxx
Go to the documentation of this file.
1
2/** \class RooStats::HistFactory::HistFactoryNavigation
3 * \ingroup HistFactory
4 */
5
6#include <iomanip>
7#include <sstream>
8
9#include "TFile.h"
10#include "TRegexp.h"
11#include "TMath.h"
12
13#include "RooRealSumPdf.h"
14#include "RooProduct.h"
15#include "RooMsgService.h"
16#include "RooCategory.h"
17#include "RooSimultaneous.h"
18#include "RooWorkspace.h"
19#include "RooFit/ModelConfig.h"
20
23
24
25
26
27namespace RooStats {
28 namespace HistFactory {
29
30
31 // CONSTRUCTOR
33 : _minBinToPrint(-1), _maxBinToPrint(-1),
34 _label_print_width(20), _bin_print_width(12) {
35
36 if( !mc ) {
37 std::cout << "Error: The supplied ModelConfig is nullptr " << std::endl;
38 throw hf_exc();
39 }
40
41 // Save the model pointer
42 RooAbsPdf* pdf_in_mc = mc->GetPdf();
43 if( !pdf_in_mc ) {
44 std::cout << "Error: The pdf found in the ModelConfig: " << mc->GetName()
45 << " is nullptr" << std::endl;
46 throw hf_exc();
47 }
48
49 // Set the PDF member
50 fModel = mc->GetPdf();
51
52 // Get the observables
53 RooArgSet* observables_in_mc = const_cast<RooArgSet*>(mc->GetObservables());
54 if( !observables_in_mc ) {
55 std::cout << "Error: Observable set in the ModelConfig: " << mc->GetName()
56 << " is nullptr" << std::endl;
57 throw hf_exc();
58 }
59 if( observables_in_mc->empty() ) {
60 std::cout << "Error: Observable list: " << observables_in_mc->GetName()
61 << " found in ModelConfig: " << mc->GetName()
62 << " has no entries." << std::endl;
63 throw hf_exc();
64 }
65
66 // Set the observables member
68
69 // Initialize the rest of the members
71
72 }
73
74
75 // CONSTRUCTOR
77 const std::string& WorkspaceName,
78 const std::string& ModelConfigName) :
79 _minBinToPrint(-1), _maxBinToPrint(-1),
80 _label_print_width(20), _bin_print_width(12) {
81
82 // Open the File
83 auto file = std::make_unique<TFile>(FileName.c_str());
84 if( !file ) {
85 std::cout << "Error: Failed to open file: " << FileName << std::endl;
86 throw hf_exc();
87 }
88
89 // Get the workspace
90 RooWorkspace* wspace = static_cast<RooWorkspace*>(file->Get(WorkspaceName.c_str()));
91 if( !wspace ) {
92 std::cout << "Error: Failed to get workspace: " << WorkspaceName
93 << " from file: " << FileName << std::endl;
94 throw hf_exc();
95 }
96
97 // Get the ModelConfig
98 ModelConfig* mc = static_cast<ModelConfig*>(wspace->obj(ModelConfigName));
99 if( !mc ) {
100 std::cout << "Error: Failed to find ModelConfig: " << ModelConfigName
101 << " from workspace: " << WorkspaceName
102 << " in file: " << FileName << std::endl;
103 throw hf_exc();
104 }
105
106 // Save the model pointer
107 RooAbsPdf* pdf_in_mc = mc->GetPdf();
108 if( !pdf_in_mc ) {
109 std::cout << "Error: The pdf found in the ModelConfig: " << ModelConfigName
110 << " is nullptr" << std::endl;
111 throw hf_exc();
112 }
113
114 // Set the PDF member
116
117 // Get the observables
118 RooArgSet* observables_in_mc = const_cast<RooArgSet*>(mc->GetObservables());
119 if( !observables_in_mc ) {
120 std::cout << "Error: Observable set in the ModelConfig: " << ModelConfigName
121 << " is nullptr" << std::endl;
122 throw hf_exc();
123 }
124 if( observables_in_mc->empty() ) {
125 std::cout << "Error: Observable list: " << observables_in_mc->GetName()
126 << " found in ModelConfig: " << ModelConfigName
127 << " in file: " << FileName
128 << " has no entries." << std::endl;
129 throw hf_exc();
130 }
131
132 // Set the observables member
134
135 // Initialize the rest of the members
137
138 }
139
140
141 // CONSTRUCTOR
143 _minBinToPrint(-1), _maxBinToPrint(-1),
144 _label_print_width(20), _bin_print_width(12) {
145
146 // Save the model pointer
147 if( !model ) {
148 std::cout << "Error: The supplied pdf is nullptr" << std::endl;
149 throw hf_exc();
150 }
151
152 // Set the PDF member
153 fModel = model;
154 fObservables = observables;
155
156 // Get the observables
157 if( !observables ) {
158 std::cout << "Error: Supplied Observable set is nullptr" << std::endl;
159 throw hf_exc();
160 }
161 if( observables->empty() ) {
162 std::cout << "Error: Observable list: " << observables->GetName()
163 << " has no entries." << std::endl;
164 throw hf_exc();
165 }
166
167 // Initialize the rest of the members
169
170 }
171
172
174
175 // This is how ROOT makes us loop over histograms :(
176 int current_bin = 0;
177 int num_bins = hist->GetNbinsX()*hist->GetNbinsY()*hist->GetNbinsZ();
178 for(int i = 0; i < num_bins; ++i) {
179 // Avoid the overflow/underflow
180 current_bin++;
181 while( hist->IsBinUnderflow(current_bin) ||
182 hist->IsBinOverflow(current_bin) ) {
183 current_bin++;
184 }
185 // Check that we should print this bin
186 if( _minBinToPrint != -1 && i < _minBinToPrint) continue;
187 if( _maxBinToPrint != -1 && i > _maxBinToPrint) break;
188 std::cout << std::setw(bin_print_width) << hist->GetBinContent(current_bin);
189 }
190 std::cout << std::endl;
191
192 }
193
194
195
196 RooAbsPdf* HistFactoryNavigation::GetChannelPdf(const std::string& channel) {
197
198 std::map< std::string, RooAbsPdf* >::iterator itr;
199 itr = fChannelPdfMap.find(channel);
200
201 if( itr == fChannelPdfMap.end() ) {
202 std::cout << "Warning: Could not find channel: " << channel
203 << " in pdf: " << fModel->GetName() << std::endl;
204 return nullptr;
205 }
206
207 RooAbsPdf* pdf = itr->second;
208 if( pdf == nullptr ) {
209 std::cout << "Warning: Pdf associated with channel: " << channel
210 << " is nullptr" << std::endl;
211 return nullptr;
212 }
213
214 return pdf;
215
216 }
217
218 void HistFactoryNavigation::PrintState(const std::string& channel) {
219
220 //int label_print_width = 20;
221 //int bin_print_width = 12;
222 std::cout << std::endl << channel << ":" << std::endl;
223
224 // Get the map of Samples for this channel
225 std::map< std::string, RooAbsReal*> SampleFunctionMap = GetSampleFunctionMap(channel);
226
227 // Set the size of the print width if necessary
228 /*
229 for( std::map< std::string, RooAbsReal*>::iterator itr = SampleFunctionMap.begin();
230 itr != SampleFunctionMap.end(); ++itr) {
231 std::string sample_name = itr->first;
232 label_print_width = std::max(label_print_width, (int)sample_name.size()+2);
233 }
234 */
235
236 // Loop over the SampleFunctionMap and print the individual histograms
237 // to get the total histogram for the channel
238 int num_bins = 0;
239 std::map< std::string, RooAbsReal*>::iterator itr = SampleFunctionMap.begin();
240 for( ; itr != SampleFunctionMap.end(); ++itr) {
241
242 std::string sample_name = itr->first;
243 std::string tmp_name = sample_name + channel + "_pretty_tmp";
244 std::unique_ptr<TH1> sample_hist{GetSampleHist(channel, sample_name, tmp_name)};
245 num_bins = sample_hist->GetNbinsX()*sample_hist->GetNbinsY()*sample_hist->GetNbinsZ();
246 std::cout << std::setw(_label_print_width) << sample_name;
247
248 // Print the content of the histogram
250
251 }
252
253 // Make the line break as a set of "===============" ...
254 std::string line_break;
255 int high_bin = _maxBinToPrint==-1 ? num_bins : std::min(_maxBinToPrint, (int)num_bins);
256 int low_bin = _minBinToPrint==-1 ? 1 : _minBinToPrint;
259 for(int i = 0; i < break_length; ++i) {
260 line_break += "=";
261 }
262 std::cout << line_break << std::endl;
263
264 std::string tmp_name = channel + "_pretty_tmp";
265 std::unique_ptr<TH1> channel_hist{GetChannelHist(channel, tmp_name)};
266 std::cout << std::setw(_label_print_width) << "TOTAL:";
267
268 // Print the Histogram
270
271 return;
272
273 }
274
275
277 // Loop over channels and print their states, one after another
278 for(unsigned int i = 0; i < fChannelNameVec.size(); ++i) {
280 }
281 }
282
283
284 void HistFactoryNavigation::SetPrintWidths(const std::string& channel) {
285
286 // Get the map of Samples for this channel
287 std::map< std::string, RooAbsReal*> SampleFunctionMap = GetSampleFunctionMap(channel);
288
289 // Get the max of the samples
290 for( std::map< std::string, RooAbsReal*>::iterator itr = SampleFunctionMap.begin();
291 itr != SampleFunctionMap.end(); ++itr) {
292 std::string sample_name = itr->first;
293 _label_print_width = std::max(_label_print_width, (int)sample_name.size()+2);
294 }
295
296 _label_print_width = std::max( _label_print_width, (int)channel.size() + 7);
297 }
298
299
301 const std::string& channel_to_print) {
302
303 // Print the contents of a 'HistFactory' RooDataset
304 // These are stored in a somewhat odd way that makes
305 // them difficult to inspect for humans.
306 // They have the following layout:
307 // =====================================================
308 // ChannelA ChannelB ChannelCat Weight
309 // -----------------------------------------------------
310 // bin_1_center 0 ChannelA bin_1_height
311 // bin_2_center 0 ChannelA bin_2_height
312 // 0 bin_1_center ChannelB bin_1_height
313 // 0 bin_2_center ChannelB bin_2_height
314 // ...etc...
315 // =====================================================
316
317 // int label_print_width = 20;
318 // int bin_print_width = 12;
319
320 // Get the Data Histogram for this channel
321 for( unsigned int i_chan=0; i_chan < fChannelNameVec.size(); ++i_chan) {
322
323 std::string channel_name = fChannelNameVec.at(i_chan);
324
325 // If we pass a channel string, we only print that one channel
326 if( !channel_to_print.empty() && channel_name != channel_to_print) continue;
327
328 std::unique_ptr<TH1> data_hist{GetDataHist(data, channel_name, channel_name+"_tmp")};
329 std::cout << std::setw(_label_print_width) << channel_name + " (data)";
330
331 // Print the Histogram
333 }
334 }
335
336
338 // Loop over all channels and print model
339 // (including all samples) and compare
340 // it to the supplied dataset
341
342 for( unsigned int i = 0; i < fChannelNameVec.size(); ++i) {
343 std::string channel = fChannelNameVec.at(i);
344 SetPrintWidths(channel);
345 PrintState(channel);
346 PrintDataSet(data, channel);
347 }
348
349 std::cout << std::endl;
350 }
351
352
354
355 // Get the list of parameters
356 RooArgSet params;
358
359 std::cout << std::endl;
360
361 // Create the title row
362 std::cout << std::setw(30) << "Parameter";
363 std::cout << std::setw(15) << "Value"
364 << std::setw(15) << "Error Low"
365 << std::setw(15) << "Error High"
366 << std::endl;
367
368 // Loop over the parameters and print their values, etc
369 for (auto const *param : static_range_cast<RooRealVar *>(params)) {
370 if( !IncludeConstantParams && param->isConstant() ) continue;
371
372 std::cout << std::setw(30) << param->GetName();
373 std::cout << std::setw(15) << param->getVal();
374 if( !param->isConstant() ) {
375 std::cout << std::setw(15) << param->getErrorLo() << std::setw(15) << param->getErrorHi();
376 }
377 std::cout<< std::endl;
378 }
379 std::cout << std::endl;
380 }
381
382 void HistFactoryNavigation::PrintChannelParameters(const std::string& channel,
384
385 // Get the list of parameters
386 RooArgSet params;
388
389 // Get the pdf for this channel
391
392 std::cout << std::endl;
393
394 // Create the title row
395 std::cout << std::setw(30) << "Parameter";
396 std::cout << std::setw(15) << "Value"
397 << std::setw(15) << "Error Low"
398 << std::setw(15) << "Error High"
399 << std::endl;
400
401 // Loop over the parameters and print their values, etc
402 for (auto const *param : static_range_cast<RooRealVar *>(params)) {
403 if( !IncludeConstantParams && param->isConstant() ) continue;
404 if( findChild(param->GetName(), channel_pdf)==nullptr ) continue;
405 std::cout << std::setw(30) << param->GetName();
406 std::cout << std::setw(15) << param->getVal();
407 if( !param->isConstant() ) {
408 std::cout << std::setw(15) << param->getErrorLo() << std::setw(15) << param->getErrorHi();
409 }
410 std::cout<< std::endl;
411 }
412 std::cout << std::endl;
413 }
414
415
416 void HistFactoryNavigation::PrintSampleParameters(const std::string& channel,
417 const std::string& sample,
419
420 // Get the list of parameters
421 RooArgSet params;
423
424 // Get the pdf for this channel
426
427 std::cout << std::endl;
428
429 // Create the title row
430 std::cout << std::setw(30) << "Parameter";
431 std::cout << std::setw(15) << "Value"
432 << std::setw(15) << "Error Low"
433 << std::setw(15) << "Error High"
434 << std::endl;
435
436 // Loop over the parameters and print their values, etc
437 for (auto const *param : static_range_cast<RooRealVar *>(params)) {
438 if( !IncludeConstantParams && param->isConstant() ) continue;
439 if( findChild(param->GetName(), sample_func)==nullptr ) continue;
440 std::cout << std::setw(30) << param->GetName();
441 std::cout << std::setw(15) << param->getVal();
442 if( !param->isConstant() ) {
443 std::cout << std::setw(15) << param->getErrorLo() << std::setw(15) << param->getErrorHi();
444 }
445 std::cout<< std::endl;
446 }
447 std::cout << std::endl;
448 }
449
450
451 double HistFactoryNavigation::GetBinValue(int bin, const std::string& channel) {
452 // Get the total bin height for the ith bin (ROOT indexing convention)
453 // in channel 'channel'
454 // (Could be optimized, it uses an intermediate histogram for now...)
455
456 // Get the histogram, fetch the bin content, and return
457 std::unique_ptr<TH1> channel_hist_tmp{GetChannelHist(channel, channel+"_tmp")};
458 return channel_hist_tmp->GetBinContent(bin);
459 }
460
461
462 double HistFactoryNavigation::GetBinValue(int bin, const std::string& channel, const std::string& sample){
463 // Get the total bin height for the ith bin (ROOT indexing convention)
464 // in channel 'channel'
465 // (This will be slow if you plan on looping over it.
466 // Could be optimized, it uses an intermediate histogram for now...)
467
468 // Get the histogram, fetch the bin content, and return
469 std::unique_ptr<TH1> sample_hist_tmp{GetSampleHist(channel, sample, channel+"_tmp")};
470 return sample_hist_tmp->GetBinContent(bin);
471 }
472
473
474 std::map< std::string, RooAbsReal*> HistFactoryNavigation::GetSampleFunctionMap(const std::string& channel) {
475 // Get a map of strings to function pointers,
476 // which each function corresponds to a sample
477
478 std::map< std::string, std::map< std::string, RooAbsReal*> >::iterator channel_itr;
481 std::cout << "Error: Channel: " << channel << " not found in Navigation" << std::endl;
482 throw hf_exc();
483 }
484
485 return channel_itr->second;
486 }
487
488
489 RooAbsReal* HistFactoryNavigation::SampleFunction(const std::string& channel, const std::string& sample){
490 // Return the function object pointer corresponding
491 // to a particular sample in a particular channel
492
493 std::map< std::string, std::map< std::string, RooAbsReal*> >::iterator channel_itr;
496 std::cout << "Error: Channel: " << channel << " not found in Navigation" << std::endl;
497 throw hf_exc();
498 }
499
500 std::map< std::string, RooAbsReal*>& SampleMap = channel_itr->second;
501 std::map< std::string, RooAbsReal*>::iterator sample_itr;
503 if( sample_itr==SampleMap.end() ){
504 std::cout << "Error: Sample: " << sample << " not found in Navigation" << std::endl;
505 throw hf_exc();
506 }
507
508 return sample_itr->second;
509
510 }
511
512
514 // Get the observables for a particular channel
515
516 std::map< std::string, RooArgSet*>::iterator channel_itr;
517 channel_itr = fChannelObservMap.find(channel);
518 if( channel_itr==fChannelObservMap.end() ){
519 std::cout << "Error: Channel: " << channel << " not found in Navigation" << std::endl;
520 throw hf_exc();
521 }
522
523 return channel_itr->second;
524
525 }
526
527
528 TH1* HistFactoryNavigation::GetSampleHist(const std::string& channel, const std::string& sample,
529 const std::string& hist_name) {
530 // Get a histogram of the expected values for
531 // a particular sample in a particular channel
532 // Give a name, or a default one will be used
533
535
536 std::string name = hist_name;
537 if(hist_name.empty()) name = channel + "_" + sample + "_hist";
538
540
542
543 }
544
545
546 TH1* HistFactoryNavigation::GetChannelHist(const std::string& channel, const std::string& hist_name) {
547 // Get a histogram of the total expected value
548 // per bin for this channel
549 // Give a name, or a default one will be used
550
552
553 std::map< std::string, RooAbsReal*> SampleFunctionMap = GetSampleFunctionMap(channel);
554
555 // Okay, 'loop' once
556 TH1* total_hist = nullptr;
557 std::map< std::string, RooAbsReal*>::iterator itr = SampleFunctionMap.begin();
558 for( ; itr != SampleFunctionMap.end(); ++itr) {
559 std::string sample_name = itr->first;
560 std::string tmp_hist_name = sample_name + "_hist_tmp";
561 RooAbsReal* sample_function = itr->second;
564 total_hist = static_cast<TH1*>(sample_hist->Clone("TotalHist"));
565 break;
566 }
567 if (!total_hist)
568 return nullptr;
569
570 total_hist->Reset();
571
572 // Loop over the SampleFunctionMap and add up all the histograms
573 // to get the total histogram for the channel
575 for( ; itr != SampleFunctionMap.end(); ++itr) {
576 std::string sample_name = itr->first;
577 std::string tmp_hist_name = sample_name + "_hist_tmp";
578 RooAbsReal* sample_function = itr->second;
581 total_hist->Add(sample_hist.get());
582 }
583
584 if(hist_name.empty()) total_hist->SetName(hist_name.c_str());
585 else total_hist->SetName( (channel + "_hist").c_str() );
586
587 return total_hist;
588
589 }
590
591
592 std::vector< std::string > HistFactoryNavigation::GetChannelSampleList(const std::string& channel) {
593
594 std::vector<std::string> sample_list;
595
596 std::map< std::string, RooAbsReal*> sample_map = fChannelSampleFunctionMap[channel];
597 std::map< std::string, RooAbsReal*>::iterator itr = sample_map.begin();
598 for( ; itr != sample_map.end(); ++itr) {
599 sample_list.push_back( itr->first );
600 }
601
602 return sample_list;
603
604 }
605
606
608 const std::string& name) {
609
610 THStack* stack = new THStack(name.c_str(), "");
611
612 std::vector< std::string > samples = GetChannelSampleList(channel);
613
614 // Add the histograms
615 for( unsigned int i=0; i < samples.size(); ++i) {
616 std::string sample_name = samples.at(i);
617 TH1* hist = GetSampleHist(channel, sample_name, sample_name+"_tmp");
618 hist->SetLineColor(2+i);
619 hist->SetFillColor(2+i);
620 stack->Add(hist);
621 }
622
623 return stack;
624
625 }
626
627
629 const std::string& name) {
630
631 // TO DO:
632 // MAINTAIN THE ACTUAL RANGE, USING THE OBSERVABLES
633 // MAKE IT WORK FOR MULTI-DIMENSIONAL
634 //
635
636 // If the dataset covers multiple categories,
637 // Split the dataset based on the categories
638 if(strcmp(fModel->ClassName(),"RooSimultaneous")==0){
639
640 // If so, get a list of the component pdf's:
642 auto channelCat = static_cast<RooCategory const*>(&simPdf->indexCat());
643
644 std::vector<std::unique_ptr<RooAbsData>> dataset_list{data->split(*channelCat)};
645
646 auto found = std::find_if(dataset_list.begin(), dataset_list.end(), [&](auto const &item) {
647 return channel == item->GetName();
648 });
649 data = found != dataset_list.end() ? dynamic_cast<RooDataSet*>(found->get()) : nullptr;
650
651 }
652
653 RooArgList vars( *GetObservableSet(channel) );
654
655 int dim = vars.size();
656
657 TH1* hist = nullptr;
658
659 if (!data) {
660 std::cout << "Error: To Create Histogram from RooDataSet" << std::endl;
661 throw hf_exc();
662 } else if( dim==1 ) {
663 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
664 hist = data->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()) );
665 }
666 else if( dim==2 ) {
667 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
668 RooRealVar* varY = static_cast<RooRealVar*>(vars.at(1));
669 hist = data->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()),
670 RooFit::YVar(*varY, RooFit::Binning(varY->getBinning())) );
671 }
672 else if( dim==3 ) {
673 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
674 RooRealVar* varY = static_cast<RooRealVar*>(vars.at(1));
675 RooRealVar* varZ = static_cast<RooRealVar*>(vars.at(2));
676 hist = data->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()),
677 RooFit::YVar(*varY, RooFit::Binning(varY->getBinning())),
678 RooFit::YVar(*varZ, RooFit::Binning(varZ->getBinning())) );
679 }
680 else {
681 std::cout << "Error: To Create Histogram from RooDataSet, Dimension must be 1, 2, or 3" << std::endl;
682 std::cout << "Observables: " << std::endl;
683 vars.Print("V");
684 throw hf_exc();
685 }
686
687 return hist;
688
689 }
690
691
692 void HistFactoryNavigation::DrawChannel(const std::string& channel, RooDataSet* data) {
693
694 // Get the stack
695 THStack* stack = GetChannelStack(channel, channel+"_stack_tmp");
696
697 stack->Draw();
698
699 if( data!=nullptr ) {
700 TH1* data_hist = GetDataHist(data, channel, channel+"_data_tmp");
701 data_hist->Draw("SAME");
702 }
703
704 }
705
706
707
709
710 // An internal method to recursively get all products,
711 // including if a RooProduct is a Product of RooProducts
712 // etc
713
715
716 // Get All Subnodes of this product
717 // Loop over the subnodes and add
718 for (auto *arg : node->components()) {
719 std::string ClassName = arg->ClassName();
720 if( ClassName == "RooProduct" ) {
721 RooProduct* prod = static_cast<RooProduct*>(arg);
722 allTerms.add( _GetAllProducts(prod) );
723 }
724 else {
725 allTerms.add(*arg);
726 }
727 }
728 return allTerms;
729 }
730
731
732
733
735
736 // Get the pdf from the ModelConfig
737 //RooAbsPdf* modelPdf = mc->GetPdf();
738 //RooArgSet* observables = mc->GetObservables();
739
740 // Check if it is a simultaneous pdf or not
741 // (if it's an individual channel, it won't be, if it's
742 // combined, it's simultaneous)
743 // Fill the channel vectors based on the structure
744 // (Obviously, if it's not simultaneous, there will be
745 // only one entry in the vector for the single channel)
746 if(strcmp(modelPdf->ClassName(),"RooSimultaneous")==0){
747
748 // If so, get a list of the component pdf's:
749 auto simPdf = static_cast<RooSimultaneous*>(modelPdf);
750 auto channelCat = static_cast<RooCategory const*>(&simPdf->indexCat());
751
752 // Iterate over the categories and get the
753 // pdf and observables for each category
754 for (const auto& nameIdx : *channelCat) {
755 const std::string& ChannelName = nameIdx.first;
756 fChannelNameVec.push_back( ChannelName );
757 RooAbsPdf* pdftmp = simPdf->getPdf(ChannelName.c_str()) ;
758 RooArgSet* obstmp = std::unique_ptr<RooArgSet>{pdftmp->getObservables(*observables)}.release();
761 }
762
763 } else {
764 RooArgSet* obstmp = std::unique_ptr<RooArgSet>{modelPdf->getObservables(*observables)}.release();
765 // The channel name is model_CHANNEL
766 std::string ChannelName = modelPdf->GetName();
767 ChannelName = ChannelName.replace(0, 6, "");
768 fChannelNameVec.push_back(ChannelName);
771
772 }
773
774 // Okay, now we have maps of the pdfs
775 // and the observable list per channel
776 // We then loop over the channel pdfs:
777 // and find their RooRealSumPdfs
778 // std::map< std::string, RooRealSumPdf* > channelSumNodeMap;
779
780 for( unsigned int i = 0; i < fChannelNameVec.size(); ++i ) {
781
782 std::string ChannelName = fChannelNameVec.at(i);
784
785 // Loop over the pdf's components and find
786 // the (one) that is a RooRealSumPdf
787 // Based on the mode, we assume that node is
788 // the "unconstrained" pdf node for that channel
789 std::unique_ptr<RooArgSet> comps{pdf->getComponents()};
790 for (auto *arg : *comps) {
791 std::string ClassName = arg->ClassName();
792 if( ClassName == "RooRealSumPdf" ) {
793 fChannelSumNodeMap[ChannelName] = static_cast <RooRealSumPdf*>(arg);
794 break;
795 }
796 }
797 }
798
799 // Okay, now we have all necessary
800 // nodes filled for each channel.
801 for( unsigned int i = 0; i < fChannelNameVec.size(); ++i ) {
802
803 std::string ChannelName = fChannelNameVec.at(i);
805
806 // We now take the RooRealSumPdf and loop over
807 // its component functions. The RooRealSumPdf turns
808 // a list of functions (expected events or bin heights
809 // per sample) and turns it into a pdf.
810 // Therefore, we loop over it to find the expected
811 // height for the various samples
812
813 // First, create a map to store the function nodes
814 // for each sample in this channel
815 std::map< std::string, RooAbsReal*> sampleFunctionMap;
816
817 // Loop over the sample nodes in this
818 // channel's RooRealSumPdf
819 for (auto *func : static_range_cast<RooAbsReal *>(sumPdf->funcList())) {
820 // Do a bit of work to get the name of each sample
821 std::string SampleName = func->GetName();
822 if( SampleName.find("L_x_") != std::string::npos ) {
823 size_t index = SampleName.find("L_x_");
824 SampleName.replace( index, 4, "" );
825 }
826 if( SampleName.find(ChannelName) != std::string::npos ) {
827 size_t index = SampleName.find(ChannelName);
828 SampleName = SampleName.substr(0, index-1);
829 }
830
831 // And simply save this node into our map
833 }
834
836
837 // Okay, now we have a list of histograms
838 // representing the samples for this channel.
839
840 }
841
842 }
843
844
845 RooAbsArg* HistFactoryNavigation::findChild(const std::string& name, RooAbsReal* parent) const {
846
847 RooAbsArg* term=nullptr;
848
849 // Check if it is a "component",
850 // ie a sub node:
851 std::unique_ptr<RooArgSet> comps{parent->getComponents()};
852 for (auto arg : *comps) {
853 std::string ArgName = arg->GetName();
854 if (ArgName == name) {
855 term = arg;
856 break;
857 }
858 }
859
860 if( term != nullptr ) return term;
861
862 // If that failed,
863 // Check if it's a Parameter
864 // (ie a RooRealVar)
865 RooArgSet args;
866 std::unique_ptr<RooArgSet> parameters{parent->getParameters(&args)};
867 for (auto *param : *parameters) {
868 std::string ParamName = param->GetName();
869 if( ParamName == name ) {
870 term = param;
871 break;
872 }
873 }
874
875 /* Not sure if we want to be silent
876 But since we're returning a pointer which can be nullptr,
877 I think it's the user's job to do checks on it.
878 A dereference will always cause a crash, so it won't
879 be silent for long...
880 if( term==nullptr ) {
881 std::cout << "Error: Failed to find node: " << name
882 << " as a child of: " << parent->GetName()
883 << std::endl;
884 }
885 */
886
887 return term;
888
889 }
890
891
893
894 std::string ConstraintTermName = parameter + "Constraint";
895
896 // First, as a sanity check, let's see if the parameter
897 // itself actually exists and if the model depends on it:
898 RooRealVar* param = dynamic_cast<RooRealVar*>(findChild(parameter, fModel));
899 if( param==nullptr ) {
900 std::cout << "Error: Couldn't Find parameter: " << parameter << " in model."
901 << std::endl;
902 return nullptr;
903 }
904
905 // The "gamma"'s use a different constraint term name
906 if( parameter.find("gamma_stat_") != std::string::npos ) {
907 ConstraintTermName = parameter + "_constraint";
908 }
909
910 // Now, get the constraint itself
912
913 if( term==nullptr ) {
914 std::cout << "Error: Couldn't Find constraint term for parameter: " << parameter
915 << " (Looked for '" << ConstraintTermName << "')" << std::endl;
916 return nullptr;
917 }
918
919 return term;
920
921 }
922
923
925
926 RooAbsReal* constraintTerm = GetConstraintTerm(parameter);
927 if( constraintTerm==nullptr ) {
928 std::cout << "Error: Cannot get uncertainty because parameter: " << parameter
929 << " has no constraint term" << std::endl;
930 throw hf_exc();
931 }
932
933 // Get the type of constraint
934 std::string ConstraintType = constraintTerm->ClassName();
935
936 // Find its value
937 double sigma = 0.0;
938
939 if( ConstraintType.empty() ) {
940 std::cout << "Error: Constraint type is an empty string."
941 << " This simply should not be." << std::endl;
942 throw hf_exc();
943 }
944 else if( ConstraintType == "RooGaussian" ){
945
946 // Gaussian errors are the 'sigma' in the constraint term
947
948 // Get the name of the 'sigma' for the gaussian
949 // (I don't know of a way of doing RooGaussian::GetSigma() )
950 // For alpha's, the sigma points to a global RooConstVar
951 // with the name "1"
952 // For gamma_stat_*, the sigma is named *_sigma
953 std::string sigmaName;
954 if( parameter.find("alpha_")!=std::string::npos ) {
955 sigmaName = "1";
956 }
957 else if( parameter.find("gamma_stat_")!=std::string::npos ) {
958 sigmaName = parameter + "_sigma";
959 }
960
961 // Get the sigma and its value
962 RooAbsReal* sigmaVar = dynamic_cast<RooAbsReal*>(constraintTerm->findServer(sigmaName.c_str()));
963 if( sigmaVar==nullptr ) {
964 std::cout << "Error: Failed to find the 'sigma' node: " << sigmaName
965 << " in the RooGaussian: " << constraintTerm->GetName() << std::endl;
966 throw hf_exc();
967 }
968 // If we find the uncertainty:
969 sigma = sigmaVar->getVal();
970 }
971 else if( ConstraintType == "RooPoisson" ){
972 // Poisson errors are given by inverting: tau = 1 / (sigma*sigma)
973 std::string tauName = "nom_" + parameter;
974 RooAbsReal* tauVar = dynamic_cast<RooAbsReal*>(constraintTerm->findServer(tauName.c_str()) );
975 if( tauVar==nullptr ) {
976 std::cout << "Error: Failed to find the nominal 'tau' node: " << tauName
977 << " for the RooPoisson: " << constraintTerm->GetName() << std::endl;
978 throw hf_exc();
979 }
980 double tau_val = tauVar->getVal();
981 sigma = 1.0 / std::sqrt( tau_val );
982 }
983 else {
984 std::cout << "Error: Encountered unknown constraint type for Stat Uncertainties: "
985 << ConstraintType << std::endl;
986 throw hf_exc();
987 }
988
989 return sigma;
990
991 }
992
993 void HistFactoryNavigation::ReplaceNode(const std::string& ToReplace, RooAbsArg* ReplaceWith) {
994
995 // First, check that the node to replace is actually a node:
997 if( nodeToReplace==nullptr ) {
998 std::cout << "Error: Cannot replace node: " << ToReplace
999 << " because this node wasn't found in: " << fModel->GetName()
1000 << std::endl;
1001 throw hf_exc();
1002 }
1003
1004
1005 const std::string attrib = "ORIGNAME:" + ToReplace;
1006 const bool oldAttrib = ReplaceWith->getAttribute(attrib.c_str());
1007 ReplaceWith->setAttribute(attrib.c_str());
1008 RooArgSet newServerSet{*ReplaceWith};
1009
1010 // Now that we have the node we want to replace, we have to
1011 // get its parent node
1012
1013 // Do this by looping over the clients and replacing their servers
1014 // (NOTE: This happens for ALL clients across the pdf)
1015 for (auto client : nodeToReplace->clients()) {
1016
1017 // Check if this client is a member of our pdf
1018 // (We probably don't want to mess with clients
1019 // if they aren't...)
1020 if( findChild(client->GetName(), fModel) == nullptr) continue;
1021
1022 // Now, do the replacement:
1024 std::cout << "Replaced: " << ToReplace << " with: " << ReplaceWith->GetName()
1025 << " in node: " << client->GetName() << std::endl;
1026
1027 }
1028
1029 // reset temporary attribute for server redirection
1030 ReplaceWith->setAttribute(attrib.c_str(), oldAttrib);
1031
1032 return;
1033
1034 }
1035
1036
1037 void HistFactoryNavigation::PrintSampleComponents(const std::string& channel,
1038 const std::string& sample) {
1039
1040 // Get the Sample Node
1042
1043 // Get the observables for this channel
1045
1046 // Make the total histogram for this sample
1047 std::string total_Name = sampleNode->GetName();
1048 std::unique_ptr<TH1> total_hist{MakeHistFromRooFunction( sampleNode, observable_list, total_Name + "_tmp")};
1049 unsigned int num_bins = total_hist->GetNbinsX()*total_hist->GetNbinsY()*total_hist->GetNbinsZ();
1050
1051 RooArgSet components;
1052
1053 // Let's see what it is...
1054 int label_print_width = 30;
1055 int bin_print_width = 12;
1056 if( strcmp(sampleNode->ClassName(),"RooProduct")==0){
1057 RooProduct* prod = dynamic_cast<RooProduct*>(sampleNode);
1058 components.add( _GetAllProducts(prod) );
1059 }
1060 else {
1061 components.add(*sampleNode);
1062 }
1063
1064 /////// NODE SIZE
1065 {
1066 for (auto *component : static_range_cast<RooAbsReal*>(components)) {
1067 std::string NodeName = component->GetName();
1068 label_print_width = std::max(label_print_width, static_cast<int>(NodeName.size())+2);
1069 }
1070 }
1071
1072 // Now, loop over the components and print them out:
1073 std::cout << std::endl;
1074 std::cout << "Channel: " << channel << " Sample: " << sample << std::endl;
1075 std::cout << std::setw(label_print_width) << "Factor";
1076
1077 for(unsigned int i=0; i < num_bins; ++i) {
1078 if( _minBinToPrint != -1 && (int)i < _minBinToPrint) continue;
1079 if( _maxBinToPrint != -1 && (int)i > _maxBinToPrint) break;
1080 std::stringstream sstr;
1081 sstr << "Bin" << i;
1082 std::cout << std::setw(bin_print_width) << sstr.str();
1083 }
1084 std::cout << std::endl;
1085
1086
1087 for (auto *component : static_range_cast<RooAbsReal*>(components)) {
1088 std::string NodeName = component->GetName();
1089 // Make a histogram for this node
1090 // Do some horrible things to prevent some really
1091 // annoying messages from being printed
1093 RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
1094 std::unique_ptr<TH1> hist;
1096 RooMsgService::instance().setGlobalKillBelow(levelBefore);
1097
1098 // Print the hist
1099 std::cout << std::setw(label_print_width) << NodeName;
1100
1101 // Print the Histogram
1103 }
1104 /////
1105 std::string line_break;
1106 int high_bin = _maxBinToPrint==-1 ? num_bins : std::min(_maxBinToPrint, (int)num_bins);
1107 int low_bin = _minBinToPrint==-1 ? 1 : _minBinToPrint;
1110 for(int i = 0; i < break_length; ++i) {
1111 line_break += "=";
1112 }
1113 std::cout << line_break << std::endl;
1114
1115 std::cout << std::setw(label_print_width) << "TOTAL:";
1117 }
1118
1119
1121 std::string name ) {
1122
1123 // Turn a RooAbsReal* into a TH1* based
1124 // on a template histogram.
1125 // The 'vars' arg list defines the x (and y and z variables)
1126 // Loop over the bins of the Template,
1127 // find the bin centers,
1128 // Scan the input Var over those bin centers,
1129 // and use the value of the function
1130 // to make the new histogram
1131
1132 // Make the new histogram
1133 // Cone and empty the template
1134 // TH1* hist = (TH1*) histTemplate.Clone( name.c_str() );
1135
1136 int dim = vars.size();
1137
1138 TH1* hist=nullptr;
1139
1140 if( dim==1 ) {
1141 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
1142 hist = func->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()), RooFit::Scaling(false) );
1143 }
1144 else if( dim==2 ) {
1145 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
1146 RooRealVar* varY = static_cast<RooRealVar*>(vars.at(1));
1147 hist = func->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()), RooFit::Scaling(false),
1148 RooFit::YVar(*varY, RooFit::Binning(varY->getBinning())) );
1149 }
1150 else if( dim==3 ) {
1151 RooRealVar* varX = static_cast<RooRealVar*>(vars.at(0));
1152 RooRealVar* varY = static_cast<RooRealVar*>(vars.at(1));
1153 RooRealVar* varZ = static_cast<RooRealVar*>(vars.at(2));
1154 hist = func->createHistogram( name.c_str(),*varX, RooFit::Binning(varX->getBinning()), RooFit::Scaling(false),
1155 RooFit::YVar(*varY, RooFit::Binning(varY->getBinning())),
1156 RooFit::YVar(*varZ, RooFit::Binning(varZ->getBinning())) );
1157 }
1158 else {
1159 std::cout << "Error: To Create Histogram from RooAbsReal function, Dimension must be 1, 2, or 3" << std::endl;
1160 throw hf_exc();
1161 }
1162
1163 return hist;
1164 }
1165
1166 // A simple wrapper to use a ModelConfig
1168 RooAbsPdf* modelPdf = mc->GetPdf();
1169 const RooArgSet* observables = mc->GetObservables();
1170 _GetNodes(modelPdf, observables);
1171 }
1172
1173
1174 void HistFactoryNavigation::SetConstant(const std::string& regExpr, bool constant) {
1175
1176 // Regex FTW
1177
1180
1181 // Now, loop over all variables and
1182 // set the constant as
1183
1184 // Get the list of parameters
1185 RooArgSet params;
1187
1188 std::cout << std::endl;
1189
1190 // Create the title row
1191 std::cout << std::setw(30) << "Parameter";
1192 std::cout << std::setw(15) << "Value"
1193 << std::setw(15) << "Error Low"
1194 << std::setw(15) << "Error High"
1195 << std::endl;
1196
1197 // Loop over the parameters and print their values, etc
1198 for (auto *param : static_range_cast<RooRealVar *>(params)) {
1199
1200 std::string ParamName = param->GetName();
1202
1203 // Use the Regex to skip all parameters that don't match
1204 //if( theRegExpr.Index(ParamNameTString, ParamName.size()) == -1 ) continue;
1205 Ssiz_t dummy;
1206 if( theRegExpr.Index(ParamNameTString, &dummy) == -1 ) continue;
1207
1208 param->setConstant( constant );
1209 std::cout << "Setting param: " << ParamName << " constant"
1210 << " (matches regex: " << regExpr << ")" << std::endl;
1211 }
1212 }
1213
1214 RooRealVar* HistFactoryNavigation::var(const std::string& varName) const {
1215
1217 if( !arg ) return nullptr;
1218
1219 RooRealVar* var_obj = dynamic_cast<RooRealVar*>(arg);
1220 return var_obj;
1221
1222 }
1223
1224 } // namespace HistFactory
1225} // namespace RooStats
1226
1227
1228
1229
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char name[80]
Definition TGX11.cxx:110
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
bool redirectServers(const RooAbsCollection &newServerList, bool mustReplaceAll=false, bool nameChange=false, bool isRecursionStep=false)
Replace all direct servers of this object with the new servers in newServerList.
RooFit::OwningPtr< RooArgSet > getComponents() const
Create a RooArgSet with all components (branch nodes) of the expression tree headed by this object.
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
RooAbsArg * findServer(const char *name) const
Return server of this with name name. Returns nullptr if not found.
Definition RooAbsArg.h:153
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
TH1 * createHistogram(RooStringView varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const
Create and fill a ROOT histogram TH1, TH2 or TH3 with the values of this function for the variables w...
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:110
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Object to represent discrete states.
Definition RooCategory.h:28
Container class to hold unbinned data.
Definition RooDataSet.h:32
static RooMsgService & instance()
Return reference to singleton instance.
Represents the product of a given set of RooAbsReal objects.
Definition RooProduct.h:29
RooArgList components()
Definition RooProduct.h:48
Implements a PDF constructed from a sum of functions:
const RooArgList & funcList() const
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
void PrintParameters(bool IncludeConstantParams=false)
Print the current values and errors of pdf parameters.
std::vector< std::string > fChannelNameVec
The list of channels.
RooArgSet * GetObservableSet(const std::string &channel)
Get the set of observables for a given channel.
TH1 * GetDataHist(RooDataSet *data, const std::string &channel, const std::string &name="")
Get a histogram from the dataset for this channel.
void _GetNodes(ModelConfig *mc)
Fetch the node information for the pdf in question, and save it in the various collections in this cl...
std::map< std::string, RooAbsPdf * > fChannelSumNodeMap
Map of channel names to pdf without constraint.
void ReplaceNode(const std::string &ToReplace, RooAbsArg *ReplaceWith)
Find a node in the pdf and replace it with a new node These nodes can be functions,...
void PrintState()
Should pretty print all channels and the current values

void PrintSampleComponents(const std::string &channel, const std::string &sample)
Print the different components that make up a sample (NormFactors, Statistical Uncertainties,...
void SetPrintWidths(const std::string &channel)
Set the title and bin widths.
RooAbsPdf * fModel
The HistFactory Pdf Pointer.
TH1 * GetChannelHist(const std::string &channel, const std::string &name="")
Get the total channel histogram for this channel.
TH1 * GetSampleHist(const std::string &channel, const std::string &sample, const std::string &name="")
The (current) histogram for that sample This includes all parameters and interpolation.
TH1 * MakeHistFromRooFunction(RooAbsReal *func, RooArgList vars, std::string name="Hist")
Make a histogram from a function Edit so it can take a RooArgSet of parameters.
void PrintMultiDimHist(TH1 *hist, int bin_print_width)
Print a histogram's contents to the screen void PrettyPrintHistogram(TH1* hist);.
void PrintSampleParameters(const std::string &channel, const std::string &sample, bool IncludeConstantParams=false)
Print parameters that effect a particular sample.
std::map< std::string, RooAbsReal * > GetSampleFunctionMap(const std::string &channel)
Get a map of sample names to their functions for a particular channel.
RooAbsReal * SampleFunction(const std::string &channel, const std::string &sample)
Get the RooAbsReal function for a given sample in a given channel.
HistFactoryNavigation(ModelConfig *mc)
Initialize based on an already-created HistFactory Model.
double GetBinValue(int bin, const std::string &channel)
The value of the ith bin for the total in that channel.
RooAbsArg * findChild(const std::string &name, RooAbsReal *parent) const
Internal method implementation of finding a daughter node from a parent node (looping over all genera...
std::map< std::string, std::map< std::string, RooAbsReal * > > fChannelSampleFunctionMap
Map of Map of Channel, Sample names to Function Nodes Used by doing: fChannelSampleFunctionMap["MyCha...
std::map< std::string, RooAbsPdf * > fChannelPdfMap
Map of channel names to their full pdf's.
std::vector< std::string > GetChannelSampleList(const std::string &channel)
void PrintModelAndData(RooDataSet *data)
Print the model and the data, comparing channel by channel.
std::map< std::string, RooArgSet * > fChannelObservMap
Map of channel names to their set of ovservables.
RooAbsPdf * GetChannelPdf(const std::string &channel)
void PrintDataSet(RooDataSet *data, const std::string &channel="")
Print a "HistFactory style" RooDataSet in a readable way.
void PrintChannelParameters(const std::string &channel, bool IncludeConstantParams=false)
Print parameters that effect a particular channel.
void SetConstant(const std::string &regExpr=".*", bool constant=true)
RooArgSet _GetAllProducts(RooProduct *node)
Recursively get all products of products.
THStack * GetChannelStack(const std::string &channel, const std::string &name="")
Get a stack of all samples in a channel.
RooAbsReal * GetConstraintTerm(const std::string &parameter)
Get the constraint term for a given systematic (alpha or gamma)
void DrawChannel(const std::string &channel, RooDataSet *data=nullptr)
Draw a stack of the channel, and include data if the pointer is supplied.
RooRealVar * var(const std::string &varName) const
double GetConstraintUncertainty(const std::string &parameter)
Get the uncertainty based on the constraint term for a given systematic.
< A class that holds configuration information for a model using a workspace as a store
Definition ModelConfig.h:34
Persistable container for RooFit projects.
TObject * obj(RooStringView name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:38
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:108
virtual Int_t GetNbinsY() const
Definition TH1.h:542
virtual Int_t GetNbinsZ() const
Definition TH1.h:543
virtual Int_t GetNbinsX() const
Definition TH1.h:541
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
Return true if the bin is underflow.
Definition TH1.cxx:5217
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
Return true if the bin is overflow.
Definition TH1.cxx:5185
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5064
The Histogram stack class.
Definition THStack.h:40
virtual void Add(TH1 *h, Option_t *option="")
Add a new histogram to the list.
Definition THStack.cxx:365
void Draw(Option_t *chopt="") override
Draw this stack with its current attributes.
Definition THStack.cxx:452
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:226
Regular expression class.
Definition TRegexp.h:31
Basic string class.
Definition TString.h:139
RooCmdArg YVar(const RooAbsRealLValue &var, const RooCmdArg &arg={})
RooCmdArg Scaling(bool flag)
RooCmdArg Binning(const RooAbsBinning &binning)
const Double_t sigma
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
Namespace for the RooStats classes.
Definition CodegenImpl.h:61