RooCustomizer.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooCustomizer.h,v 1.11 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 #ifndef ROO_PDF_CUSTOMIZER
00018 #define ROO_PDF_CUSTOMIZER
00019 
00020 #include "Rtypes.h"
00021 #include "TList.h"
00022 #include "TNamed.h"
00023 #include "TString.h"
00024 #include "RooArgSet.h"
00025 #include "RooPrintable.h"
00026 #include "RooFactoryWSTool.h"
00027 class RooAbsCategoryLValue ; 
00028 class RooAbsCategory ;
00029 class RooAbsArg ;
00030 class RooAbsPdf ;
00031 
00032 class RooCustomizer : public TNamed, public RooPrintable {
00033 
00034 public:
00035 
00036   // Constructors, assignment etc
00037   RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafListOwned, RooArgSet* splitLeafListAll=0) ;
00038   RooCustomizer(const RooAbsArg& pdf, const char* name) ;
00039   virtual ~RooCustomizer() ;
00040   
00041   void setOwning(Bool_t flag) { 
00042     // If flag is true, make customizer own all created components
00043     _owning = flag ; 
00044   }
00045   
00046   void splitArgs(const RooArgSet& argSet, const RooAbsCategory& splitCat) ;
00047   void splitArg(const RooAbsArg& arg, const RooAbsCategory& splitCat) ;
00048   void replaceArg(const RooAbsArg& orig, const RooAbsArg& subst) ;
00049   RooAbsArg* build(const char* masterCatState, Bool_t verbose=kFALSE) ;
00050   RooAbsArg* build(Bool_t verbose=kFALSE) ;
00051 
00052   const RooArgSet& cloneBranchList() const { 
00053     // Return list of cloned branch nodes
00054     return *_cloneBranchList ; 
00055   }
00056   const RooArgSet& cloneLeafList() const { 
00057     // Return list of cloned leaf nodes
00058     return *_cloneNodeListOwned ; 
00059   }
00060 
00061   // Printing interface 
00062   virtual void printName(ostream& os) const ;
00063   virtual void printTitle(ostream& os) const ;
00064   virtual void printClassName(ostream& os) const ;
00065   virtual void printArgs(ostream& os) const ;
00066   virtual void printMultiline(ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent= "") const;
00067 
00068   inline virtual void Print(Option_t *options= 0) const {
00069     // Printing interface
00070     printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00071   }
00072 
00073   // Releases ownership of list of cloned branch nodes
00074   void setCloneBranchSet(RooArgSet& cloneBranchSet) ;
00075 
00076   // Factory interface
00077   class CustIFace : public RooFactoryWSTool::IFace {
00078   public:
00079     virtual ~CustIFace() {} ;
00080     std::string create(RooFactoryWSTool& ft, const char* typeName, const char* instanceName, std::vector<std::string> args) ;
00081   } ;
00082 
00083 protected:
00084   
00085   RooCustomizer(const RooCustomizer&) ;
00086   void initialize() ;
00087   
00088   RooAbsArg* doBuild(const char* masterCatState, Bool_t verbose) ;
00089 
00090   Bool_t _sterile ; // If true we do not have as associated master category
00091   Bool_t _owning ;  // If true we own all created components
00092   TString _name ;   // Name of this object
00093 
00094   TList _splitArgList ; // List of RooAbsArgs to be split
00095   TList _splitCatList ; // List of categories to be used for above splits
00096 
00097   TList _replaceArgList ; // List of RooAbsArgs to be replaced
00098   TList _replaceSubList ; // List of replacement RooAbsArgs
00099 
00100   // Master nodes are not owned
00101   RooAbsArg* _masterPdf ;             // Pointer to input p.d.f
00102   RooAbsCategoryLValue* _masterCat ;  // Pointer to input master category
00103 
00104   TIterator* _masterLeafListIter ;    // Iterator over leaf list
00105   TIterator* _masterBranchListIter ;  // Iterator over branch list
00106 
00107   RooArgSet  _masterBranchList ;      // List of branch nodes
00108   RooArgSet  _masterLeafList ;        // List of leaf nodes
00109 
00110   RooArgSet  _internalCloneBranchList ; // List of branches of internal clone
00111   RooArgSet* _cloneBranchList ;         // Pointer to list of cloned branches used
00112 
00113   // Cloned leafs are owned by the user supplied list in the ctor
00114   RooArgSet* _cloneNodeListAll ;        // List of all cloned nodes
00115   RooArgSet* _cloneNodeListOwned ;      // List of owned cloned nodes
00116 
00117   ClassDef(RooCustomizer,0) // Editing tool for RooAbsArg composite object expressions
00118 } ;
00119 
00120 #endif

Generated on Tue Jul 5 14:26:07 2011 for ROOT_528-00b_version by  doxygen 1.5.1