Logo ROOT  
Reference Guide
RooProofDriverSelector.cxx
Go to the documentation of this file.
1#define RooProofDriverSelector_cxx
2// The class definition in RooProofDriverSelector.h has been generated automatically
3// by the ROOT utility TTree::MakeSelector(). This class is derived
4// from the ROOT class TSelector. For more information on the TSelector
5// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
6
7// The following methods are defined in this file:
8// Begin(): called every time a loop on the tree starts,
9// a convenient place to create your histograms.
10// SlaveBegin(): called after Begin(), when on PROOF called only on the
11// slave servers.
12// Process(): called for each event, in this function you decide what
13// to read and fill your histograms.
14// SlaveTerminate: called at the end of the loop on the tree, when on PROOF
15// called only on the slave servers.
16// Terminate(): called at the end of the loop on the tree,
17// a convenient place to draw/fit your histograms.
18//
19// To use this file, try the following session on your Tree T:
20//
21// Root > T->Process("RooProofDriverSelector.C")
22// Root > T->Process("RooProofDriverSelector.C","some options")
23// Root > T->Process("RooProofDriverSelector.C+")
24//
25
26// #include <unistd.h>
28#include <TH2.h>
29#include <TStyle.h>
30#include "RooDataSet.h"
31#include "RooWorkspace.h"
32#include "RooAbsPdf.h"
33#include "RooRealVar.h"
34#include "RooFitResult.h"
35#include "TRandom.h"
36#include "RooRandom.h"
37#include "RooAbsStudy.h"
38#include "TSystem.h"
39#include "RooStudyPackage.h"
40#ifndef __CINT__
41#include "RooGlobalFunc.h"
42#endif
43
44using namespace RooFit ;
45using namespace std ;
46
48{
49 // Retrieve study pack
50 _pkg=0 ;
51 if (fInput) {
52 TIterator* iter = fInput->MakeIterator() ;
53 TObject* obj ;
54 while((obj=iter->Next())) {
55 RooStudyPackage* tmp = dynamic_cast<RooStudyPackage*>(obj) ;
56 if (tmp) {
57 _pkg = tmp ;
58 }
59 }
60 }
61 if (_pkg==0) {
62 cout << "RooProofDriverSelector::SlaveBegin() no RooStudyPackage found, aborting process" << endl ;
64 } else {
65 cout << "workspace contents = " << endl ;
66 _pkg->wspace().Print() ;
67
68 // Initialize study pack
69 seed = _pkg->initRandom() ;
70 _pkg->initialize() ;
71 }
72
73}
74
76{
77 cout << "RooProofDriverSelector::Process(" << entry << ")" << endl ;
78 _pkg->runOne() ;
79 return kTRUE;
80}
81
82
84{
85 _pkg->finalize() ;
87}
88
89
90
92{
93 // Set branch addresses and branch pointers
94 if (!tree) return;
95 fChain = tree;
97 fChain->SetBranchAddress("i", &i, &b_i);
98}
99
101{
102 return kTRUE;
103}
104
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
virtual void SlaveBegin(TTree *tree)
virtual Bool_t Process(Long64_t entry)
virtual Bool_t Notify()
This method must be overridden to handle object notification.
virtual void Init(TTree *tree)
Int_t i
pointer to the analyzed TTree or TChain
RooStudyPackage is a utility class to manage studies that consist of repeated applications of generat...
Int_t initRandom()
Choose random seed for this process in case pass a definite seed to have it deterministic use also wo...
RooWorkspace & wspace()
void finalize()
Finalize all studies.
void initialize()
Make iterator over copy of studies attached to workspace.
void exportData(TList *olist, Int_t seqno)
void Print(Option_t *opts=0) const
Print contents of the workspace.
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:721
Mother of all ROOT objects.
Definition: TObject.h:37
TList * fInput
List of objects available during processing.
Definition: TSelector.h:43
@ kAbortProcess
Definition: TSelector.h:36
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:44
Long64_t fStatus
Selector status.
Definition: TSelector.h:39
A TTree represents a columnar dataset.
Definition: TTree.h:78
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Definition: TTree.cxx:8237
virtual void SetMakeClass(Int_t make)
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
Definition: TTree.cxx:9024
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: tree.py:1