Logo ROOT  
Reference Guide
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 (0),
29 fDirectory (0),
30 fBuffSize (32000),
31 fVerbose (0),
32
33 fTreeK (0),
34 fTreeH (0),
35 fTreeC (0),
36 fTreeR (0),
37 fTreeKK (0),
38 fTreeV0 (0),
39 fTreeCC (0),
40 fTreeGI (0),
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 = 0;
90 delete fTreeH; fTreeH = 0;
91 delete fTreeC; fTreeC = 0;
92 delete fTreeR; fTreeR = 0;
93 delete fTreeV0; fTreeV0 = 0;
94 delete fTreeKK; fTreeKK = 0;
95 delete fTreeGI; fTreeGI = 0;
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 == 0)
153 throw eH + "directory not set.";
154
155 fTreeK = (TTree*) fDirectory->Get("Kinematics");
156 if (fTreeK == 0 && 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 == 0 && 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 == 0 && 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 == 0 && 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 == 0 && 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 == 0 && 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 == 0 && 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
208 TParticle::Class()->IgnoreTObjectStreamer(true);
209
210 TEveHit::Class()->IgnoreTObjectStreamer(true);
211 TEveCluster::Class()->IgnoreTObjectStreamer(true);
212
213 TEveRecTrack::Class()->IgnoreTObjectStreamer(true);
214 // TEveRecKink derives from TEveRecTrack
215
216 TEveRecV0::Class()->IgnoreTObjectStreamer(true);
217
218 TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
219}
void Class()
Definition: Class.C:29
#define ClassImp(name)
Definition: Rtypes.h:364
Describe directory structure in memory.
Definition: TDirectory.h:45
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Definition: TDirectory.cxx:814
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
Definition: TDirectory.cxx:504
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
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
virtual ~TEveVSD()
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 &)
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
const char * Data() const
Definition: TString.h:369
A TTree represents a columnar dataset.
Definition: TTree.h:79
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Definition: TTree.cxx:8277
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:349