Logo ROOT   6.10/09
Reference Guide
TSelEvent.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_TSelEvent
13 #define ROOT_TSelEvent
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TSelEvent //
18 // //
19 // PROOF selector for I/O benchmark test. //
20 // For I/O benchmark, event files are read in and histograms are filled.//
21 // For memory clean-up, dedicated files large enough to clean up memory //
22 // cache on the machine are read in. Or memory clean-up can be //
23 // accompolished by system call on Linux machine inside SlaveBegin(..) //
24 // which should be much faster the reading in large files. //
25 // //
26 //////////////////////////////////////////////////////////////////////////
27 
28 #include <TChain.h>
29 #include <TFile.h>
30 #include <TSelector.h>
31 #include <TRef.h>
32 #include <Event.h>
33 
34 class TROOT;
35 class TH1F;
36 class TCanvas;
37 class THashList;
38 class TClonesArray;
39 class TRefArray;
40 class TPBReadType;
41 
42 class TSelEvent : public TSelector {
43 
44 private:
45 
46  TPBReadType *fReadType; //read type
47  Bool_t fDebug; //debug switch
48  TCanvas* fCHist; //canvas to display histograms
49 
50  //Output hists
53 
54 public :
55 
56  TTree *fChain; //!pointer to the analyzed TTree or TChain
57 
58  // Declaration of leave types
59 // Event *event;
69  Double32_t fClosestDistance[21]; //[fNvertex]
70  EventHeader fEvtHdr;
76  TH1F *fH;
79 
80  // List of branches
97  TBranch *b_fH; //!
100 
101  TSelEvent(TTree *);
102  TSelEvent();
103  //virtual ~TSelEvent() {if (fCHist) delete fCHist;}
104  virtual ~TSelEvent() {}
105  virtual Int_t Version() const {return 1;}
106  virtual void Begin(TTree *);
107  virtual void SlaveBegin(TTree *tree);
108  virtual void Init(TTree *tree);
109  virtual Bool_t Notify();
110  virtual Bool_t Process(Long64_t entry);
111  virtual void SetOption(const char *option) { fOption = option; }
112  virtual void SetObject(TObject *obj) { fObject = obj; }
113  virtual void SetInputList(TList *input) {fInput = input;}
114  virtual TList *GetOutputList() const { return fOutput; }
115  virtual void SlaveTerminate();
116  virtual void Terminate();
117 
119  Bool_t GetDebug(){return fDebug;}
120  TCanvas* GetCHist(){return fCHist;}
121  TH1F* GetPtHist(){return fPtHist;}
123 
124  ClassDef(TSelEvent,0) //PROOF selector for I/O-intensive benchmark test
125 };
126 
127 #endif
128 
129 #ifdef TSelEvent_cxx
131 {
132  // The Init() function is called when the selector needs to initialize
133  // a new tree or chain. Typically here the branch addresses of the tree
134  // will be set. It is normaly not necessary to make changes to the
135  // generated code, but the routine can be extended by the user if needed.
136  // Init() will be called many times when running with PROOF.
137 
138  // Set branch addresses
139  fEventName=0;
140  fTracks=0;
141  fHighPt=0;
142  fMuons=0;
143  fH=0;
144 
145  if (tree == 0) return;
146  fChain = tree;
147  fChain->SetMakeClass(1);
148 
149  fChain->SetBranchAddress("fType[20]",fType);
150  fChain->SetBranchAddress("fEventName",fEventName);
151  fChain->SetBranchAddress("fNtrack",&fNtrack);
152  fChain->SetBranchAddress("fNseg",&fNseg);
153  fChain->SetBranchAddress("fNvertex",&fNvertex);
154  fChain->SetBranchAddress("fFlag",&fFlag);
155  fChain->SetBranchAddress("fTemperature",&fTemperature);
156  fChain->SetBranchAddress("fMeasures[10]",fMeasures);
157  fChain->SetBranchAddress("fMatrix[4][4]",fMatrix);
158  fChain->SetBranchAddress("fClosestDistance",fClosestDistance);
159  fChain->SetBranchAddress("fEvtHdr",&fEvtHdr);
160  fChain->SetBranchAddress("fTracks",&fTracks);
161  fChain->SetBranchAddress("fHighPt",&fHighPt);
162  fChain->SetBranchAddress("fMuons",&fMuons);
163  fChain->SetBranchAddress("fLastTrack",&fLastTrack);
164  fChain->SetBranchAddress("fWebHistogram",&fWebHistogram);
165  fChain->SetBranchAddress("fH",&fH);
166  fChain->SetBranchAddress("fTriggerBits",&fTriggerBits);
167  fChain->SetBranchAddress("fIsValid",&fIsValid);
168 }
169 
171 {
172  // The Notify() function is called when a new file is opened. This
173  // can be either for a new TTree in a TChain or when when a new TTree
174  // is started when using PROOF. Typically here the branch pointers
175  // will be retrieved. It is normaly not necessary to make changes
176  // to the generated code, but the routine can be extended by the
177  // user if needed.
178 
179  Info("Notify","processing file: %s", fChain->GetCurrentFile()->GetName());
180 
181  // Get branch pointers
182  b_event_fType = fChain->GetBranch("fType[20]");
183  b_fEventName = fChain->GetBranch("fEventName");
184  b_event_fNtrack = fChain->GetBranch("fNtrack");
185  b_event_fNseg = fChain->GetBranch("fNseg");
186  b_event_fNvertex = fChain->GetBranch("fNvertex");
187  b_event_fFlag = fChain->GetBranch("fFlag");
188  b_event_fTemperature = fChain->GetBranch("fTemperature");
189  b_event_fMeasures = fChain->GetBranch("fMeasures[10]");
190  b_event_fMatrix = fChain->GetBranch("fMatrix[4][4]");
191  b_fClosestDistance = fChain->GetBranch("fClosestDistance");
192  b_event_fEvtHdr = fChain->GetBranch("fEvtHdr");
193  b_fTracks = fChain->GetBranch("fTracks");
194  b_fHighPt = fChain->GetBranch("fHighPt");
195  b_fMuons = fChain->GetBranch("fMuons");
196  b_event_fLastTrack = fChain->GetBranch("fLastTrack");
197  b_event_fWebHistogram = fChain->GetBranch("fWebHistogram");
198  b_fH = fChain->GetBranch("fH");
199  b_event_fTriggerBits = fChain->GetBranch("fTriggerBits");
200  b_event_fIsValid = fChain->GetBranch("fIsValid");
201 
202  return kTRUE;
203 }
204 
205 #endif // #ifdef TSelEvent_cxx
virtual TList * GetOutputList() const
Definition: TSelEvent.h:114
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Int_t fNseg
Definition: TSelEvent.h:63
Double32_t fMatrix[4][4]
Definition: TSelEvent.h:68
Char_t fType[20]
pointer to the analyzed TTree or TChain
Definition: TSelEvent.h:60
TBranch * b_event_fTemperature
Definition: TSelEvent.h:87
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:847
ROOT top level object description.
Definition: TROOT.h:100
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:44
TBranch * b_fMuons
Definition: TSelEvent.h:94
TBits fTriggerBits
Definition: TSelEvent.h:77
long long Long64_t
Definition: RtypesCore.h:69
TTree * fChain
Definition: TSelEvent.h:56
TBranch * b_event_fTriggerBits
Definition: TSelEvent.h:98
virtual ~TSelEvent()
Definition: TSelEvent.h:104
Char_t * fEventName
Definition: TSelEvent.h:61
TCanvas * fCHist
Definition: TSelEvent.h:48
TBranch * b_fTracks
Definition: TSelEvent.h:92
Double32_t fClosestDistance[21]
Definition: TSelEvent.h:69
TPBReadType * fReadType
Definition: TSelEvent.h:46
UInt_t fFlag
Definition: TSelEvent.h:65
TBranch * b_event_fMatrix
Definition: TSelEvent.h:89
virtual void Begin(TTree *)
The Begin() function is called at the start of the query.
Definition: TSelEvent.cxx:80
TBranch * b_event_fType
Definition: TSelEvent.h:81
TPBReadType * GetReadType()
Definition: TSelEvent.h:118
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:551
TBranch * b_event_fLastTrack
Definition: TSelEvent.h:95
virtual Int_t Version() const
Definition: TSelEvent.h:105
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void Init(TTree *tree)
TBranch * b_event_fNseg
Definition: TSelEvent.h:84
An array of references to TObjects.
Definition: TRefArray.h:39
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
Definition: TSelEvent.cxx:254
TClonesArray * fTracks
Definition: TSelEvent.h:71
TBranch * b_fEventName
Definition: TSelEvent.h:82
virtual void SetOption(const char *option)
Definition: TSelEvent.h:111
Persistent Reference link to a TObject A TRef is a lightweight object pointing to any TObject...
Definition: TRef.h:32
TRef fWebHistogram
Definition: TSelEvent.h:75
#define ClassDef(name, id)
Definition: Rtypes.h:297
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Definition: TTree.cxx:7873
EventHeader fEvtHdr
Definition: TSelEvent.h:70
Bool_t fIsValid
Definition: TSelEvent.h:78
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
Definition: TSelEvent.cxx:129
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:41
double Double32_t
Definition: RtypesCore.h:56
TBranch * b_event_fEvtHdr
Definition: TSelEvent.h:91
A doubly linked list.
Definition: TList.h:43
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition: TTree.cxx:4979
TBranch * b_event_fMeasures
Definition: TSelEvent.h:88
TBranch * b_event_fFlag
Definition: TSelEvent.h:86
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
Int_t fMeasures[10]
Definition: TSelEvent.h:67
TCanvas * GetCHist()
Definition: TSelEvent.h:120
TH1F * fPtHist
Definition: TSelEvent.h:51
Int_t fNvertex
Definition: TSelEvent.h:64
unsigned int UInt_t
Definition: RtypesCore.h:42
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition: TTree.cxx:5163
Int_t fNtrack
Definition: TSelEvent.h:62
TRefArray * fMuons
Definition: TSelEvent.h:73
Selector for PROOF I/O benchmark test.
Definition: TSelEvent.h:42
TBranch * b_event_fIsValid
Definition: TSelEvent.h:99
The Canvas class.
Definition: TCanvas.h:31
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:8616
TH1F * GetPtHist()
Definition: TSelEvent.h:121
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 ...
Definition: TSelEvent.cxx:201
TBranch * b_fHighPt
Definition: TSelEvent.h:93
Double32_t fTemperature
Definition: TSelEvent.h:66
TSelEvent()
Constructor.
Definition: TSelEvent.cxx:63
virtual void SetInputList(TList *input)
Definition: TSelEvent.h:113
Mother of all ROOT objects.
Definition: TObject.h:37
TBranch * b_fClosestDistance
Definition: TSelEvent.h:90
Container of bits.
Definition: TBits.h:29
char Char_t
Definition: RtypesCore.h:29
TBranch * b_fH
Definition: TSelEvent.h:97
TBranch * b_event_fWebHistogram
Definition: TSelEvent.h:96
virtual Bool_t Notify()
This method must be overridden to handle object notification.
An array of clone (identical) objects.
Definition: TClonesArray.h:32
TList * fInput
List of objects available during processing.
Definition: TSelector.h:43
TRefArray * fHighPt
Definition: TSelEvent.h:72
virtual void SetObject(TObject *obj)
Definition: TSelEvent.h:112
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
Definition: TSelEvent.cxx:263
TRef fLastTrack
Definition: TSelEvent.h:74
Bool_t GetDebug()
Definition: TSelEvent.h:119
TH1F * fNTracksHist
Definition: TSelEvent.h:52
TBranch * b_event_fNtrack
Definition: TSelEvent.h:83
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:78
TBranch * b_event_fNvertex
Definition: TSelEvent.h:85
TH1F * GetNTracksHist()
Definition: TSelEvent.h:122
A TTree is a list of TBranches.
Definition: TBranch.h:57
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:91
Bool_t fDebug
Definition: TSelEvent.h:47
TH1F * fH
Definition: TSelEvent.h:76