00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef __CINT__
00014 #include "RooGlobalFunc.h"
00015 #endif
00016 #include "RooRealVar.h"
00017 #include "RooDataSet.h"
00018 #include "RooPolynomial.h"
00019 #include "RooCategory.h"
00020 #include "RooMappedCategory.h"
00021 #include "RooMultiCategory.h"
00022 #include "RooSuperCategory.h"
00023 #include "Roo1DTable.h"
00024 #include "TCanvas.h"
00025 #include "RooPlot.h"
00026 using namespace RooFit ;
00027 
00028 
00029 class TestBasic406 : public RooFitTestUnit
00030 {
00031 public: 
00032   TestBasic406(TFile* refFile, Bool_t writeRef, Int_t verbose) : RooFitTestUnit("Category-to-category functions",refFile,writeRef,verbose) {} ;
00033   Bool_t testCode() {
00034 
00035   
00036   
00037 
00038   
00039   RooCategory tagCat("tagCat","Tagging category") ;
00040   tagCat.defineType("Lepton") ;
00041   tagCat.defineType("Kaon") ;
00042   tagCat.defineType("NetTagger-1") ;
00043   tagCat.defineType("NetTagger-2") ;
00044 
00045   
00046   RooCategory b0flav("b0flav","B0 flavour eigenstate") ;
00047   b0flav.defineType("B0",-1) ;
00048   b0flav.defineType("B0bar",1) ;
00049 
00050   
00051   RooRealVar x("x","x",0,10) ;
00052   RooPolynomial p("p","p",x) ;
00053   RooDataSet* data = p.generate(RooArgSet(x,b0flav,tagCat),10000) ;
00054 
00055 
00056 
00057   
00058   
00059 
00060   
00061   
00062   
00063   RooMappedCategory tcatType("tcatType","tagCat type",tagCat,"Cut based") ;
00064 
00065   
00066   tcatType.map("Lepton","Cut based") ;
00067   tcatType.map("Kaon","Cut based") ;
00068 
00069   
00070   tcatType.map("NetTagger*","Neural Network") ;
00071 
00072   
00073   Roo1DTable* mtable = data->table(tcatType) ;
00074 
00075 
00076 
00077   
00078   
00079 
00080   
00081   
00082   RooSuperCategory b0Xtcat("b0Xtcat","b0flav X tagCat",RooArgSet(b0flav,tagCat)) ;
00083 
00084   
00085   Roo1DTable* stable = data->table(b0Xtcat) ;
00086 
00087   
00088   b0Xtcat.setLabel("{B0bar;Lepton}") ;
00089 
00090 
00091 
00092   
00093   
00094   RooMultiCategory b0Xttype("b0Xttype","b0flav X tagType",RooArgSet(b0flav,tcatType)) ;
00095   
00096   
00097   Roo1DTable* xtable = data->table(b0Xttype) ;
00098 
00099   regTable(mtable,"rf406_mtable") ;
00100   regTable(stable,"rf406_stable") ;
00101   regTable(xtable,"rf406_xtable") ;
00102 
00103   delete data ;
00104 
00105   return kTRUE ;
00106   }
00107 
00108 } ;