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 "RooProofDriverSelector.h"
27 #include "RooDataSet.h"
28 #include "RooWorkspace.h"
29 #include "RooAbsPdf.h"
30 #include "RooRealVar.h"
31 #include "RooFitResult.h"
32 #include "TRandom.h"
33 #include "RooRandom.h"
34 #include "RooAbsStudy.h"
35 #include "RooStudyPackage.h"
36 #include "RooGlobalFunc.h"
37 
38 using namespace RooFit;
39 using namespace std;
40 
42 {
43  // Retrieve study pack
44  _pkg=0 ;
45  if (fInput) {
46  TIterator* iter = fInput->MakeIterator() ;
47  TObject* obj ;
48  while((obj=iter->Next())) {
49  RooStudyPackage* tmp = dynamic_cast<RooStudyPackage*>(obj) ;
50  if (tmp) {
51  _pkg = tmp ;
52  }
53  }
54  }
55  if (_pkg==0) {
56  cout << "RooProofDriverSelector::SlaveBegin() no RooStudyPackage found, aborting process" << endl ;
57  fStatus = kAbortProcess ;
58  } else {
59  cout << "workspace contents = " << endl ;
60  _pkg->wspace().Print() ;
61 
62  // Initialize study pack
63  seed = _pkg->initRandom() ;
64  _pkg->initialize() ;
65  }
66 
67 }
68 
70 {
71  cout << "RooProofDriverSelector::Process(" << entry << ")" << endl ;
72  _pkg->runOne() ;
73  return kTRUE;
74 }
75 
76 
78 {
79  _pkg->finalize() ;
80  _pkg->exportData(fOutput,seed) ;
81 }
82 
83 
84 
86 {
87  // Set branch addresses and branch pointers
88  if (!tree) return;
89  fChain = tree;
90  fChain->SetMakeClass(1);
91  fChain->SetBranchAddress("i", &i, &b_i);
92 }
93 
95 {
96  return kTRUE;
97 }
98 
RooWorkspace.h
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
tree
Definition: tree.py:1
RooStudyPackage
Definition: RooStudyPackage.h:31
RooStudyPackage::wspace
RooWorkspace & wspace()
Definition: RooStudyPackage.h:40
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TTree
Definition: TTree.h:79
TRandom.h
RooDataSet.h
bool
TIterator
Definition: TIterator.h:30
RooProofDriverSelector::Process
virtual Bool_t Process(Long64_t entry)
Definition: RooProofDriverSelector.cxx:69
RooProofDriverSelector::SlaveBegin
virtual void SlaveBegin(TTree *tree)
Definition: RooProofDriverSelector.cxx:41
RooWorkspace::Print
void Print(Option_t *opts=0) const
Print contents of the workspace.
Definition: RooWorkspace.cxx:2194
RooFit
Definition: RooCFunction1Binding.h:29
RooAbsPdf.h
RooAbsStudy.h
RooRandom.h
RooRealVar.h
RooFitResult.h
TIterator::Next
virtual TObject * Next()=0
RooProofDriverSelector::Notify
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: RooProofDriverSelector.cxx:94
RooGlobalFunc.h
TObject
Definition: TObject.h:37
RooProofDriverSelector.h
RooStudyPackage.h
RooProofDriverSelector::Init
virtual void Init(TTree *tree)
Definition: RooProofDriverSelector.cxx:85
RooProofDriverSelector::SlaveTerminate
virtual void SlaveTerminate()
Definition: RooProofDriverSelector.cxx:77