Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
34class TROOT;
35class TH1F;
36class TCanvas;
37class THashList;
38class TClonesArray;
39class TRefArray;
40class TPBReadType;
41
42class TSelEvent : public TSelector {
43
44private:
45
46 TPBReadType *fReadType; //read type
47 Bool_t fDebug; //debug switch
48 TCanvas* fCHist; //canvas to display histograms
49
50 //Output hists
53
54public :
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;
79
80 // List of branches
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
123
124 ClassDefOverride(TSelEvent,0) //PROOF selector for I/O-intensive benchmark test
125};
126
127#endif
128
129#ifdef TSelEvent_cxx
130void TSelEvent::Init(TTree *tree)
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;
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
bool Bool_t
Definition RtypesCore.h:63
char Char_t
Definition RtypesCore.h:37
long long Long64_t
Definition RtypesCore.h:69
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#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
Container of bits.
Definition TBits.h:26
A TTree is a list of TBranches.
Definition TBranch.h:93
The Canvas class.
Definition TCanvas.h:23
An array of clone (identical) objects.
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:622
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
A doubly linked list.
Definition TList.h:38
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
ROOT top level object description.
Definition TROOT.h:94
An array of references to TObjects.
Definition TRefArray.h:33
Persistent Reference link to a TObject A TRef is a lightweight object pointing to any TObject.
Definition TRef.h:32
Selector for PROOF I/O benchmark test.
Definition TSelEvent.h:42
virtual void SetOption(const char *option)
Definition TSelEvent.h:111
virtual Bool_t Notify()
This method must be overridden to handle object notification (the base implementation is no-op).
Int_t fNvertex
Definition TSelEvent.h:64
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
TBranch * b_event_fTriggerBits
Definition TSelEvent.h:98
TH1F * fPtHist
Definition TSelEvent.h:51
TBranch * b_event_fMatrix
Definition TSelEvent.h:89
TH1F * fH
Definition TSelEvent.h:76
TTree * fChain
Definition TSelEvent.h:56
virtual void SetInputList(TList *input)
Definition TSelEvent.h:113
TBranch * b_event_fIsValid
Definition TSelEvent.h:99
Bool_t GetDebug()
Definition TSelEvent.h:119
TBranch * b_fClosestDistance
Definition TSelEvent.h:90
TBranch * b_event_fNvertex
Definition TSelEvent.h:85
TRef fWebHistogram
Definition TSelEvent.h:75
Char_t fType[20]
pointer to the analyzed TTree or TChain
Definition TSelEvent.h:60
TBranch * b_event_fFlag
Definition TSelEvent.h:86
Char_t * fEventName
Definition TSelEvent.h:61
virtual void Begin(TTree *)
The Begin() function is called at the start of the query.
Definition TSelEvent.cxx:80
TBranch * b_event_fEvtHdr
Definition TSelEvent.h:91
TBranch * b_fHighPt
Definition TSelEvent.h:93
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
TH1F * fNTracksHist
Definition TSelEvent.h:52
TSelEvent()
Constructor.
Definition TSelEvent.cxx:63
TRefArray * fMuons
Definition TSelEvent.h:73
virtual void Init(TTree *tree)
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
Int_t fMeasures[10]
Definition TSelEvent.h:67
UInt_t fFlag
Definition TSelEvent.h:65
TBranch * b_fEventName
Definition TSelEvent.h:82
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 ~TSelEvent()
Definition TSelEvent.h:104
EventHeader fEvtHdr
Definition TSelEvent.h:70
TBranch * b_event_fNtrack
Definition TSelEvent.h:83
virtual Int_t Version() const
Definition TSelEvent.h:105
virtual TList * GetOutputList() const
Definition TSelEvent.h:114
TBits fTriggerBits
Definition TSelEvent.h:77
TBranch * b_event_fType
Definition TSelEvent.h:81
TRefArray * fHighPt
Definition TSelEvent.h:72
virtual void SetObject(TObject *obj)
Definition TSelEvent.h:112
Bool_t fIsValid
Definition TSelEvent.h:78
TBranch * b_event_fNseg
Definition TSelEvent.h:84
TPBReadType * GetReadType()
Definition TSelEvent.h:118
TH1F * GetPtHist()
Definition TSelEvent.h:121
Double32_t fTemperature
Definition TSelEvent.h:66
TCanvas * fCHist
Definition TSelEvent.h:48
TCanvas * GetCHist()
Definition TSelEvent.h:120
TBranch * b_fMuons
Definition TSelEvent.h:94
TBranch * b_fH
Definition TSelEvent.h:97
TPBReadType * fReadType
Definition TSelEvent.h:46
Bool_t fDebug
Definition TSelEvent.h:47
TBranch * b_event_fLastTrack
Definition TSelEvent.h:95
Int_t fNtrack
Definition TSelEvent.h:62
TH1F * GetNTracksHist()
Definition TSelEvent.h:122
TBranch * b_event_fWebHistogram
Definition TSelEvent.h:96
TRef fLastTrack
Definition TSelEvent.h:74
Double32_t fClosestDistance[21]
Definition TSelEvent.h:69
Double32_t fMatrix[4][4]
Definition TSelEvent.h:68
TBranch * b_fTracks
Definition TSelEvent.h:92
Int_t fNseg
Definition TSelEvent.h:63
TBranch * b_event_fTemperature
Definition TSelEvent.h:87
TBranch * b_event_fMeasures
Definition TSelEvent.h:88
TClonesArray * fTracks
Definition TSelEvent.h:71
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
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition TTree.cxx:5294
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5479
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
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
Definition TTree.cxx:8385