Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSelEventGen.h
Go to the documentation of this file.
1// @(#)root/proof:$Id$
2// Author: Sangsu Ryu 22/06/2010
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSelEventGen
13#define ROOT_TSelEventGen
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TSelEventGen //
18// //
19// PROOF selector for event file generation. //
20// List of files to be generated for each node is provided by client. //
21// And list of files generated is sent back. //
22// Existing files are reused if not forced to be regenerated. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include <TSelector.h>
27#include <TTree.h>
28#include <TString.h>
29
30class TList;
31class TMacro;
32
33class TSelEventGen : public TSelector {
34
35private:
36
37 TString fBaseDir; // URL where the files will be written
38 //Int_t fMaxNWorkers;
39 Long64_t fNEvents; //number of events in a file
40 Int_t fNTracks; //avg or min-avg number of tracks in an event
41 Int_t fNTracksMax; //max-avg number of tracks in an event
42 Int_t fRegenerate; //force generation of cleanup files
43
44 TObject* fTotalGen; //events generated on this worker
45 TList* fFilesGenerated; //list of files generated
46
47 TMacro *fGenerateFun; //Macro with the function to generate the files
48
49protected:
50
51 Long64_t GenerateFiles(const char *filename, Long64_t sizenevents);
52
53public :
54
55 TTree *fChain; //!pointer to the analyzed TTree or TChain
56
57// TSelEventGen(TTree *);
59 ~TSelEventGen() override { }
60 Int_t Version() const override {return 1;}
61 void Begin(TTree *) override;
62 void SlaveBegin(TTree *tree) override;
63 void Init(TTree *tree) override;
64 Bool_t Notify() override;
65 Bool_t Process(Long64_t entry) override;
66 void SetOption(const char *option) override { fOption = option; }
67 void SetObject(TObject *obj) override { fObject = obj; }
68 void SetInputList(TList *input) override {fInput = input;}
69 TList *GetOutputList() const override { return fOutput; }
70 void SlaveTerminate() override;
71 void Terminate() override;
72 void Print(Option_t *option="") const override;
73
74 ClassDefOverride(TSelEventGen,0) //PROOF selector for event file generation
75};
76
77#endif
78
79#ifdef TSelEventGen_cxx
80
81void TSelEventGen::Init(TTree *tree)
82{
83 // The Init() function is called when the selector needs to initialize
84 // a new tree or chain. Typically here the branch addresses of the tree
85 // will be set. It is normaly not necessary to make changes to the
86 // generated code, but the routine can be extended by the user if needed.
87 // Init() will be called many times when running with PROOF.
88
89 if (tree == 0) return;
90 fChain = tree;
92}
93
95{
96 // The Notify() function is called when a new file is opened. This
97 // can be either for a new TTree in a TChain or when when a new TTree
98 // is started when using PROOF. Typically here the branch pointers
99 // will be retrieved. It is normaly not necessary to make changes
100 // to the generated code, but the routine can be extended by the
101 // user if needed.
102
103 return kTRUE;
104}
105
106#endif // #ifdef TSelEventGen_cxx
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
A doubly linked list.
Definition TList.h:38
Class supporting a collection of lines with C++ code.
Definition TMacro.h:31
Mother of all ROOT objects.
Definition TObject.h:41
Selector for event file generation.
void SlaveBegin(TTree *tree) override
The SlaveBegin() function is called after the Begin() function.
Int_t fRegenerate
TSelEventGen()
pointer to the analyzed TTree or TChain
void SetObject(TObject *obj) override
Long64_t fNEvents
void Begin(TTree *) override
The Begin() function is called at the start of the query.
TString fBaseDir
Long64_t GenerateFiles(const char *filename, Long64_t sizenevents)
Generate files for IO-bound run Input parameters filename: The name of the file to be generated sizen...
TTree * fChain
TList * GetOutputList() const override
TMacro * fGenerateFun
Bool_t Process(Long64_t entry) override
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
Int_t Version() const override
void SlaveTerminate() override
The SlaveTerminate() function is called after all entries or objects have been processed.
void Init(TTree *tree) override
void SetOption(const char *option) override
TObject * fTotalGen
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
void Terminate() override
The Terminate() function is the last function to be called during a query.
void SetInputList(TList *input) override
Bool_t Notify() override
This method must be overridden to handle object notification (the base implementation is no-op).
~TSelEventGen() override
TList * fFilesGenerated
Int_t fNTracksMax
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
TList * fInput
List of objects available during processing.
Definition TSelector.h:41
TString fOption
Option given to TTree::Process.
Definition TSelector.h:39
TSelectorList * fOutput
! List of objects created during processing
Definition TSelector.h:42
TObject * fObject
! Current object if processing object (vs. TTree)
Definition TSelector.h:40
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79
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:9177