"SfR Fresh" - the SfR Freeware/Shareware Archive 
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 ==============================================================================
2 TSelector Documentation
3 ==============================================================================
4
5 Overview of the TSelector class
6 -------------------------------
7
8 The TSelector is a framework for analyzing event like data. The user
9 derives from the TSelector class and implements the member functions
10 with specific analysis algorithms. When running the analysis, ROOT
11 calls the member functions in a well defined sequence and with well
12 defined arguments. By following the model this analysis class can be
13 used to process data sequentialy on a local workstation and in batch
14 or in parallel using PROOF.
15
16 ROOT can generate a skeleton class for a given TTree. This skeleton
17 class is a good a starting point for the analysis class. It is
18 recommended that users follow this method.
19
20 When running with PROOF a number of "slave" processes are used to
21 analyze the events. The user creates a PROOF session from the client
22 workstation which allocates a number of slaves. The slaves instantiate
23 an object of the users analysis class. Each slave processes a fraction
24 of the events as determined by the relative performance of the servers
25 on which the slaves are running. The PROOF system takes care of distributing
26 the work. It calls the TSelector functions in each slave. It also
27 distributes the input list to the slaves. This is a TList with streamable
28 objects provided in the client. After processing the events PROOF combines
29 the partial results of the slaves and returns the consolidated objects
30 (e.g. histograms) to the client session.
31
32 The two sequences below show the order in which the TSelector member
33 functions are called when either processing a tree or chain on a single
34 workstation or when using PROOF to process trees or collections of keyed
35 objects on a distributed system. When running on a sequential query
36 the user calls TTree::Process() and TChain::Process(), when using PROOF
37 the user calls TDSet::Process() (a few other entry points are available
38 as well). Each of the member functions is described in detail after the
39 call sequences.
40
41
42 Local, sequential query:
43
44
45 Begin()
46 SlaveBegin()
47 Init()
48 Notify()
49 Process()
50 ...
51 Process()
52 ...
53 Notify()
54 Process()
55 ...
56 Process()
57 SlaveTerminate()
58 Terminate()
59
60
61 Distributed, parallel query, using PROOF:
62
63 ++ CLIENT Session ++ ++ (n) SLAVES ++
64 Begin()
65 SlaveBegin()
66 Init()
67 Notify()
68 Process()
69 ...
70 Process()
71 ...
72 Init()
73 Notify()
74 Process()
75 ...
76 Process()
77 ...
78 SlaveTerminate()
79 Terminate()
80
81
82
83 ==============================================================================
84 Main Framework Functions
85 ==============================================================================
86
87 The Begin() and SlaveBegin() member functions
88 ---------------------------------------------
89
90 The Begin() function is called at the start of the query. It always runs
91 in the client ROOT session. The SlaveBegin() function is either called
92 in the client or when running with PROOF, on each of the slaves.
93 All initialization that is needed for Process() (see below) must therefore
94 be put in SlaveBegin(). Code which needs to access the local client
95 environment, e.g. graphics or the filesystem must be put in Begin().
96 When running with PROOF the input list (fInput) is distributed to the
97 slaves after Begin() returns and before SlaveBegin() is called.
98 This way objects on the client can be made available to the
99 TSelector instances in the slaves.
100
101 The tree argument is deprecated. (In the case of PROOF the tree is not
102 available on the client and 0 will be passed. The Init() function should
103 be used to implement operations depending on the tree)
104
105 Signature:
106
107 virtual void Begin(TTree *tree);
108
109 virtual void SlaveBegin(TTree *tree);
110
111
112 The Init() member function
113 --------------------------
114
115 The Init() function is called when the selector needs to initialize
116 a new tree or chain. Typically here the branch addresses of the tree
117 will be set. It is normaly not necessary to make changes to the generated
118 code, but the routine can be extended by the user if needed. Init() will
119 be called many times when running with PROOF.
120
121 Signature:
122
123 virtual void Init(TTree *tree)
124
125
126 The Notify() member function
127 ----------------------------
128
129 The Notify() function is called when a new file is opened. This can be either
130 for a new TTree in a TChain or when when a new TTree is started when using
131 PROOF. Typically here the branch pointers will be retrieved. It is normaly
132 not necessary to make changes to the generated code, but the routine
133 can be extended by the user if needed.
134
135 Signature:
136
137 virtual Bool_t Notify()
138
139
140 The Process() member function
141 -----------------------------
142
143 The Process() function is called for each entry in the tree (or possibly
144 keyed object in the case of PROOF) to be processed. The entry argument
145 specifies which entry in the currently loaded tree is to be processed.
146 It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
147 to read either all or the required parts of the data. When processing
148 keyed objects with PROOF, the object is already loaded and is available
149 via the fObject pointer.
150
151 This function should contain the "body" of the analysis. It can contain
152 simple or elaborate selection criteria, run algorithms on the data
153 of the event and typically fill histograms.
154
155 Signature:
156
157 virtual Bool_t Process(Int_t entry)
158
159
160 The SlaveTerminate() and Terminate() member functions
161 -----------------------------------------------------
162
163 The SlaveTerminate() function is called after all entries or objects
164 have been processed. When running with PROOF it is executed by
165 each of the slaves. It can be used to do post processing before the
166 partial results of the slaves are merged. After SlaveTerminate()
167 the objects in the fOutput lists in the slaves are combined by the
168 PROOF system and returned to the client ROOT session.
169 The Terminate() function is the last function to be called during
170 a query. It always runs on the client, it can be used to present
171 the results graphically or save the results to file.
172
173 Signature:
174
175 virtual void SlaveTerminate()
176
177 virtual void Terminate()
178
179
180 ==============================================================================
181 Utility Functions
182 ==============================================================================
183
184 The Version() member function
185 -----------------------------
186
187 The Version() function is introduced to manage API changes in the
188 TSelector class. Version zero, uses the ProcessCut() and ProcessFill()
189 pair rather then Process(). Version one uses Process(), introduces
190 the SlaveBegin() / SlaveTerminate() functions and clarifies the role
191 of Init() and Notify().
192
193 Signature:
194
195 virtual int Version();
196
197
198 The SetInputList() member function
199 ----------------------------------
200
201 Setter for the input list of objects to be transfered to the
202 remote PROOF servers. The input list is transfered after the execution
203 of the Begin() function, so objects can still be added in Begin() to
204 this list. These objects are then available during the selection process
205 (e.g. predefined histograms, etc.). Does not transfer ownership.
206
207 Signature:
208
209 virtual void SetInputList(TList *input)
210
211
212 The GetOutputList() member function
213 -----------------------------------
214
215 Getter for the output list of objects to be transfered back to the
216 client. The output list on each slave is transfered back to the client
217 session after the execution of the SlaveTerminate() function. The PROOF
218 master server merges the objects from the slave output lists in a single
219 output list (merging partial objects into a single one). Ownership remains
220 with the selector. Each query will clear this list.
221
222 Signature:
223
224 virtual TList *GetOutputList()
225
226
227 The SetObject() member function
228 -------------------------------
229
230 Setter for the object to be processed (internal use only).
231
232 Signature:
233
234 virtual void SetObject(TObject *obj)
235
236
237 The SetOption() member function
238 -------------------------------
239
240 Setter for the query option string (internal use only).
241
242 Signature:
243
244 virtual void SetOption(const char *option)
245
246
247 The GetOption() member function
248 -------------------------------
249
250 Getter for the option string that was passed by the user to
251 Tree::Process() or TDSet::Process().
252
253 Signature:
254
255 virtual const char *GetOption()
256