ROOT  6.06/09
Reference Guide
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 #ifndef ROOT_TSelector
27 #include <TSelector.h>
28 #endif
29 #ifndef ROOT_TTree
30 #include <TTree.h>
31 #endif
32 #ifndef ROOT_TString
33 #include <TString.h>
34 #endif
35 
36 class TList;
37 class TMacro;
38 
39 class TSelEventGen : public TSelector {
40 
41 private:
42 
43  TString fBaseDir; // URL where the files will be written
44  //Int_t fMaxNWorkers;
45  Long64_t fNEvents; //number of events in a file
46  Int_t fNTracks; //avg or min-avg number of tracks in an event
47  Int_t fNTracksMax; //max-avg number of tracks in an event
48  Int_t fRegenerate; //force generation of cleanup files
49 
50  TObject* fTotalGen; //events generated on this worker
51  TList* fFilesGenerated; //list of files generated
52 
53  TMacro *fGenerateFun; //Macro with the function to generate the files
54 
55 protected:
56 
57  Long64_t GenerateFiles(const char *filename, Long64_t sizenevents);
58 
59 public :
60 
61  TTree *fChain; //!pointer to the analyzed TTree or TChain
62 
63 // TSelEventGen(TTree *);
64  TSelEventGen();
65  virtual ~TSelEventGen() { }
66  virtual Int_t Version() const {return 1;}
67  virtual void Begin(TTree *);
68  virtual void SlaveBegin(TTree *tree);
69  virtual void Init(TTree *tree);
70  virtual Bool_t Notify();
71  virtual Bool_t Process(Long64_t entry);
72  virtual void SetOption(const char *option) { fOption = option; }
73  virtual void SetObject(TObject *obj) { fObject = obj; }
74  virtual void SetInputList(TList *input) {fInput = input;}
75  virtual TList *GetOutputList() const { return fOutput; }
76  virtual void SlaveTerminate();
77  virtual void Terminate();
78  virtual void Print(Option_t *option="") const;
79 
80  ClassDef(TSelEventGen,0) //PROOF selector for event file generation
81 };
82 
83 #endif
84 
85 #ifdef TSelEventGen_cxx
86 
87 void TSelEventGen::Init(TTree *tree)
88 {
89  // The Init() function is called when the selector needs to initialize
90  // a new tree or chain. Typically here the branch addresses of the tree
91  // will be set. It is normaly not necessary to make changes to the
92  // generated code, but the routine can be extended by the user if needed.
93  // Init() will be called many times when running with PROOF.
94 
95  if (tree == 0) return;
96  fChain = tree;
97  fChain->SetMakeClass(1);
98 }
99 
101 {
102  // The Notify() function is called when a new file is opened. This
103  // can be either for a new TTree in a TChain or when when a new TTree
104  // is started when using PROOF. Typically here the branch pointers
105  // will be retrieved. It is normaly not necessary to make changes
106  // to the generated code, but the routine can be extended by the
107  // user if needed.
108 
109  return kTRUE;
110 }
111 
112 #endif // #ifdef TSelEventGen_cxx
TString fBaseDir
Definition: TSelEventGen.h:43
TSelectorList * fOutput
Definition: TSelector.h:50
long long Long64_t
Definition: RtypesCore.h:69
TTree * fChain
Definition: TSelEventGen.h:61
const char Option_t
Definition: RtypesCore.h:62
Long64_t fNEvents
Definition: TSelEventGen.h:45
TObject * fTotalGen
Definition: TSelEventGen.h:50
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
static const char * filename()
virtual void SetOption(const char *option)
Definition: TSelEventGen.h:72
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:33
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...
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
Int_t fRegenerate
Definition: TSelEventGen.h:48
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
TList * fFilesGenerated
Definition: TSelEventGen.h:51
TString fOption
Definition: TSelector.h:47
A doubly linked list.
Definition: TList.h:47
TObject * fObject
Definition: TSelector.h:48
TMacro * fGenerateFun
Definition: TSelEventGen.h:53
Long64_t entry
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:8272
virtual TList * GetOutputList() const
Definition: TSelEventGen.h:75
virtual ~TSelEventGen()
Definition: TSelEventGen.h:65
virtual Bool_t Process(Long64_t entry)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
virtual void SetInputList(TList *input)
Definition: TSelEventGen.h:74
Int_t fNTracksMax
Definition: TSelEventGen.h:47
Int_t fNTracks
Definition: TSelEventGen.h:46
Mother of all ROOT objects.
Definition: TObject.h:58
TSelEventGen()
pointer to the analyzed TTree or TChain
TList * fInput
Current object if processing object (vs. TTree)
Definition: TSelector.h:49
virtual Bool_t Notify()
This method must be overridden to handle object notification.
virtual void Init(TTree *tree)
A TTree object has a header with a name and a title.
Definition: TTree.h:94
virtual void Begin(TTree *)
The Begin() function is called at the start of the query.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:39
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
virtual Int_t Version() const
Definition: TSelEventGen.h:66
virtual void SetObject(TObject *obj)
Definition: TSelEventGen.h:73