Logo ROOT   6.14/05
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 #include <TSelector.h>
27 #include <TTree.h>
28 #include <TString.h>
29 
30 class TList;
31 class TMacro;
32 
33 class TSelEventGen : public TSelector {
34 
35 private:
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 
49 protected:
50 
51  Long64_t GenerateFiles(const char *filename, Long64_t sizenevents);
52 
53 public :
54 
55  TTree *fChain; //!pointer to the analyzed TTree or TChain
56 
57 // TSelEventGen(TTree *);
58  TSelEventGen();
59  virtual ~TSelEventGen() { }
60  virtual Int_t Version() const {return 1;}
61  virtual void Begin(TTree *);
62  virtual void SlaveBegin(TTree *tree);
63  virtual void Init(TTree *tree);
64  virtual Bool_t Notify();
65  virtual Bool_t Process(Long64_t entry);
66  virtual void SetOption(const char *option) { fOption = option; }
67  virtual void SetObject(TObject *obj) { fObject = obj; }
68  virtual void SetInputList(TList *input) {fInput = input;}
69  virtual TList *GetOutputList() const { return fOutput; }
70  virtual void SlaveTerminate();
71  virtual void Terminate();
72  virtual void Print(Option_t *option="") const;
73 
74  ClassDef(TSelEventGen,0) //PROOF selector for event file generation
75 };
76 
77 #endif
78 
79 #ifdef TSelEventGen_cxx
80 
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;
91  fChain->SetMakeClass(1);
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
TString fBaseDir
Definition: TSelEventGen.h:37
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:44
long long Long64_t
Definition: RtypesCore.h:69
TTree * fChain
Definition: TSelEventGen.h:55
const char Option_t
Definition: RtypesCore.h:62
Long64_t fNEvents
Definition: TSelEventGen.h:39
TObject * fTotalGen
Definition: TSelEventGen.h:44
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual void SetOption(const char *option)
Definition: TSelEventGen.h:66
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
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:131
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:42
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
TList * fFilesGenerated
Definition: TSelEventGen.h:45
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:41
A doubly linked list.
Definition: TList.h:44
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
TMacro * fGenerateFun
Definition: TSelEventGen.h:47
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:8751
virtual ~TSelEventGen()
Definition: TSelEventGen.h:59
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:68
Int_t fNTracksMax
Definition: TSelEventGen.h:41
Int_t fNTracks
Definition: TSelEventGen.h:40
Mother of all ROOT objects.
Definition: TObject.h:37
TSelEventGen()
pointer to the analyzed TTree or TChain
TList * fInput
List of objects available during processing.
Definition: TSelector.h:43
virtual Bool_t Notify()
This method must be overridden to handle object notification.
virtual Int_t Version() const
Definition: TSelEventGen.h:60
virtual void Init(TTree *tree)
Selector for event file generation.
Definition: TSelEventGen.h:33
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:70
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:33
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual TList * GetOutputList() const
Definition: TSelEventGen.h:69
virtual void SetObject(TObject *obj)
Definition: TSelEventGen.h:67