Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
TEveVSD.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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#include "TEveVSD.h"
13
14/** \class TEveVSD
15\ingroup TEve
16Visualization Summary Data - a collection of trees holding standard
17event data in experiment independent format.
18*/
19
21
22////////////////////////////////////////////////////////////////////////////////
23/// Constructor.
24
25TEveVSD::TEveVSD(const char* , const char*) :
26 TObject(),
27
28 fFile (nullptr),
29 fDirectory (nullptr),
30 fBuffSize (32000),
31 fVerbose (0),
32
33 fTreeK (nullptr),
34 fTreeH (nullptr),
35 fTreeC (nullptr),
36 fTreeR (nullptr),
37 fTreeKK (nullptr),
38 fTreeV0 (nullptr),
39 fTreeCC (nullptr),
40 fTreeGI (nullptr),
41
42 fK(), fpK (&fK),
43 fH(), fpH (&fH),
44 fC(), fpC (&fC),
45 fR(), fpR (&fR),
46 fKK(), fpKK(&fKK),
47 fV0(), fpV0(&fV0),
48 fCC(), fpCC(&fCC),
49 fGI(), fpGI(&fGI)
50{
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Destructor.
55
57{
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Set directory in which the trees are (or will be) created.
62
64{
65 fDirectory = dir;
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Create internal trees.
70
72{
73 fDirectory->cd();
74 fTreeK = new TTree("Kinematics", "Simulated tracks.");
75 fTreeH = new TTree("Hits", "Combined detector hits.");
76 fTreeC = new TTree("Clusters", "Reconstructed clusters.");
77 fTreeR = new TTree("RecTracks", "Reconstructed tracks.");
78 fTreeKK = new TTree("RecKinks", "Reconstructed kinks.");
79 fTreeV0 = new TTree("RecV0s", "Reconstructed V0s.");
80 fTreeCC = new TTree("RecCascades","Reconstructed cascades.");
81 fTreeGI = new TTree("TEveMCRecCrossRef", "Objects prepared for cross query.");
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Delete internal trees.
86
88{
89 delete fTreeK; fTreeK = nullptr;
90 delete fTreeH; fTreeH = nullptr;
91 delete fTreeC; fTreeC = nullptr;
92 delete fTreeR; fTreeR = nullptr;
93 delete fTreeV0; fTreeV0 = nullptr;
94 delete fTreeKK; fTreeKK = nullptr;
95 delete fTreeGI; fTreeGI = nullptr;
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Create internal VSD branches.
100
102{
103 if (fTreeK) fTreeK ->Branch("K", "TEveMCTrack", &fpK);
104 if (fTreeH) fTreeH ->Branch("H", "TEveHit", &fpH);
105 if (fTreeC) fTreeC ->Branch("C", "TEveCluster", &fpC);
106 if (fTreeR) fTreeR ->Branch("R", "TEveRecTrack", &fpR);
107 if (fTreeKK) fTreeKK->Branch("KK", "TEveRecKink", &fpKK);
108 if (fTreeV0) fTreeV0->Branch("V0", "TEveRecV0", &fpV0);
109
110 if (fTreeGI)
111 {
112 fTreeGI->Branch("GI", "TEveMCRecCrossRef", &fpGI);
113 fTreeGI->Branch("K.", "TEveMCTrack", &fpK);
114 fTreeGI->Branch("R.", "TEveRecTrack", &fpR);
115 }
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// Set branche addresses of internal trees.
120
122{
123 if (fTreeK) fTreeK ->SetBranchAddress("K", &fpK);
124 if (fTreeH) fTreeH ->SetBranchAddress("H", &fpH);
125 if (fTreeC) fTreeC ->SetBranchAddress("C", &fpC);
126 if (fTreeR) fTreeR ->SetBranchAddress("R", &fpR);
127 if (fTreeKK) fTreeKK->SetBranchAddress("KK", &fpKK);
128 if (fTreeV0) fTreeV0->SetBranchAddress("V0", &fpV0);
129
130 if (fTreeGI)
131 {
135 }
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Does nothing here ... reimplemented in sub-classes.
140
142{
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Load internal trees from directory.
147
149{
150 static const TEveException eH("TEveVSD::LoadTrees ");
151
152 if (fDirectory == nullptr)
153 throw eH + "directory not set.";
154
155 fTreeK = (TTree*) fDirectory->Get("Kinematics");
156 if (fTreeK == nullptr && fVerbose) {
157 printf("%s Kinematics not available in fDirectory %s.\n",
158 eH.Data(), fDirectory->GetName());
159 }
160
161 fTreeH = (TTree*) fDirectory->Get("Hits");
162 if (fTreeH == nullptr && fVerbose) {
163 printf("%s Hits not available in fDirectory %s.\n",
164 eH.Data(), fDirectory->GetName());
165 }
166
167 fTreeC = (TTree*) fDirectory->Get("Clusters");
168 if (fTreeC == nullptr && fVerbose) {
169 printf("%s Clusters not available in fDirectory %s.\n",
170 eH.Data(), fDirectory->GetName());
171 }
172
173 fTreeR = (TTree*) fDirectory->Get("RecTracks");
174 if (fTreeR == nullptr && fVerbose) {
175 printf("%s RecTracks not available in fDirectory %s.\n",
176 eH.Data(), fDirectory->GetName());
177 }
178
179 fTreeKK = (TTree*) fDirectory->Get("RecKinks");
180 if (fTreeKK == nullptr && fVerbose) {
181 printf("%s Kinks not available in fDirectory %s.\n",
182 eH.Data(), fDirectory->GetName());
183 }
184
185 fTreeV0 = (TTree*) fDirectory->Get("RecV0s");
186 if (fTreeV0 == nullptr && fVerbose) {
187 printf("%s V0 not available in fDirectory %s.\n",
188 eH.Data(), fDirectory->GetName());
189 }
190
191 fTreeGI = (TTree*)fDirectory->Get("TEveMCRecCrossRef");
192 if(fTreeGI == nullptr && fVerbose) {
193 printf("%s TEveMCRecCrossRef not available in fDirectory %s.\n",
194 eH.Data(), fDirectory->GetName());
195 }
196
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Disable TObject streamers for those VSD structs that inherit from
201/// TObject directly.
202
204{
205 // TEveVector is not TObject
206
207 // TEveMCTrack derives from TParticle
209
212
214 // TEveRecKink derives from TEveRecTrack
215
217
219}
#define ClassImp(name)
Definition Rtypes.h:382
void IgnoreTObjectStreamer(Bool_t ignore=kTRUE)
When the class kIgnoreTObjectStreamer bit is set, the automatically generated Streamer will not call ...
Definition TClass.cxx:4910
Describe directory structure in memory.
Definition TDirectory.h:45
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Bool_t cd()
Change current directory to "this" directory.
static TClass * Class()
Exception class thrown by TEve classes and macros.
Definition TEveUtil.h:102
static TClass * Class()
static TClass * Class()
static TClass * Class()
static TClass * Class()
Visualization Summary Data - a collection of trees holding standard event data in experiment independ...
Definition TEveVSD.h:20
TTree * fTreeGI
Cascades.
Definition TEveVSD.h:39
static void DisableTObjectStreamersForVSDStruct()
Disable TObject streamers for those VSD structs that inherit from TObject directly.
Definition TEveVSD.cxx:203
virtual void SetBranchAddresses()
Set branche addresses of internal trees.
Definition TEveVSD.cxx:121
~TEveVSD() override
Destructor.
Definition TEveVSD.cxx:56
virtual void DeleteTrees()
Delete internal trees.
Definition TEveVSD.cxx:87
TDirectory * fDirectory
Definition TEveVSD.h:26
TTree * fTreeCC
VO's.
Definition TEveVSD.h:38
virtual void SetDirectory(TDirectory *dir)
Set directory in which the trees are (or will be) created.
Definition TEveVSD.cxx:63
TTree * fTreeKK
Reconstructed tracks.
Definition TEveVSD.h:36
TEveMCTrack * fpK
Definition TEveVSD.h:41
TEveMCRecCrossRef * fpGI
Definition TEveVSD.h:48
TTree * fTreeH
Kinematics.
Definition TEveVSD.h:33
TTree * fTreeK
Definition TEveVSD.h:32
TEveRecKink * fpKK
Definition TEveVSD.h:45
TEveHit * fpH
Definition TEveVSD.h:42
TEveCluster * fpC
Definition TEveVSD.h:43
TTree * fTreeV0
Kinks.
Definition TEveVSD.h:37
TTree * fTreeC
Hits.
Definition TEveVSD.h:34
virtual void CreateTrees()
Create internal trees.
Definition TEveVSD.cxx:71
TEveRecV0 * fpV0
Definition TEveVSD.h:46
Int_t fVerbose
Definition TEveVSD.h:29
TEveRecTrack * fpR
Definition TEveVSD.h:44
virtual void LoadTrees()
Load internal trees from directory.
Definition TEveVSD.cxx:148
virtual void CreateBranches()
Create internal VSD branches.
Definition TEveVSD.cxx:101
virtual void WriteTrees()
Does nothing here ... reimplemented in sub-classes.
Definition TEveVSD.cxx:141
TTree * fTreeR
Clusters.
Definition TEveVSD.h:35
TEveVSD(const TEveVSD &)
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
static TClass * Class()
const char * Data() const
Definition TString.h:376
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
Definition TTree.cxx:8375
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Definition TTree.h:353