Logo ROOT  
Reference Guide
 
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
20
21////////////////////////////////////////////////////////////////////////////////
22/// Constructor.
23
24TEveVSD::TEveVSD(const char* , const char*) :
25 TObject(),
26
27 fFile (nullptr),
28 fDirectory (nullptr),
29 fBuffSize (32000),
30 fVerbose (0),
31
32 fTreeK (nullptr),
33 fTreeH (nullptr),
34 fTreeC (nullptr),
35 fTreeR (nullptr),
36 fTreeKK (nullptr),
37 fTreeV0 (nullptr),
38 fTreeCC (nullptr),
39 fTreeGI (nullptr),
40
41 fK(), fpK (&fK),
42 fH(), fpH (&fH),
43 fC(), fpC (&fC),
44 fR(), fpR (&fR),
45 fKK(), fpKK(&fKK),
46 fV0(), fpV0(&fV0),
47 fCC(), fpCC(&fCC),
48 fGI(), fpGI(&fGI)
49{
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Destructor.
54
58
59////////////////////////////////////////////////////////////////////////////////
60/// Set directory in which the trees are (or will be) created.
61
63{
64 fDirectory = dir;
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Create internal trees.
69
71{
72 fDirectory->cd();
73 fTreeK = new TTree("Kinematics", "Simulated tracks.");
74 fTreeH = new TTree("Hits", "Combined detector hits.");
75 fTreeC = new TTree("Clusters", "Reconstructed clusters.");
76 fTreeR = new TTree("RecTracks", "Reconstructed tracks.");
77 fTreeKK = new TTree("RecKinks", "Reconstructed kinks.");
78 fTreeV0 = new TTree("RecV0s", "Reconstructed V0s.");
79 fTreeCC = new TTree("RecCascades","Reconstructed cascades.");
80 fTreeGI = new TTree("TEveMCRecCrossRef", "Objects prepared for cross query.");
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// Delete internal trees.
85
87{
88 delete fTreeK; fTreeK = nullptr;
89 delete fTreeH; fTreeH = nullptr;
90 delete fTreeC; fTreeC = nullptr;
91 delete fTreeR; fTreeR = nullptr;
92 delete fTreeV0; fTreeV0 = nullptr;
93 delete fTreeKK; fTreeKK = nullptr;
94 delete fTreeGI; fTreeGI = nullptr;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Create internal VSD branches.
99
101{
102 if (fTreeK) fTreeK ->Branch("K", "TEveMCTrack", &fpK);
103 if (fTreeH) fTreeH ->Branch("H", "TEveHit", &fpH);
104 if (fTreeC) fTreeC ->Branch("C", "TEveCluster", &fpC);
105 if (fTreeR) fTreeR ->Branch("R", "TEveRecTrack", &fpR);
106 if (fTreeKK) fTreeKK->Branch("KK", "TEveRecKink", &fpKK);
107 if (fTreeV0) fTreeV0->Branch("V0", "TEveRecV0", &fpV0);
108
109 if (fTreeGI)
110 {
111 fTreeGI->Branch("GI", "TEveMCRecCrossRef", &fpGI);
112 fTreeGI->Branch("K.", "TEveMCTrack", &fpK);
113 fTreeGI->Branch("R.", "TEveRecTrack", &fpR);
114 }
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Set branche addresses of internal trees.
119
121{
122 if (fTreeK) fTreeK ->SetBranchAddress("K", &fpK);
123 if (fTreeH) fTreeH ->SetBranchAddress("H", &fpH);
124 if (fTreeC) fTreeC ->SetBranchAddress("C", &fpC);
125 if (fTreeR) fTreeR ->SetBranchAddress("R", &fpR);
126 if (fTreeKK) fTreeKK->SetBranchAddress("KK", &fpKK);
127 if (fTreeV0) fTreeV0->SetBranchAddress("V0", &fpV0);
128
129 if (fTreeGI)
130 {
134 }
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Does nothing here ... reimplemented in sub-classes.
139
141{
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// Load internal trees from directory.
146
148{
149 static const TEveException eH("TEveVSD::LoadTrees ");
150
151 if (fDirectory == nullptr)
152 throw eH + "directory not set.";
153
154 fTreeK = (TTree*) fDirectory->Get("Kinematics");
155 if (fTreeK == nullptr && fVerbose) {
156 printf("%s Kinematics not available in fDirectory %s.\n",
157 eH.Data(), fDirectory->GetName());
158 }
159
160 fTreeH = (TTree*) fDirectory->Get("Hits");
161 if (fTreeH == nullptr && fVerbose) {
162 printf("%s Hits not available in fDirectory %s.\n",
163 eH.Data(), fDirectory->GetName());
164 }
165
166 fTreeC = (TTree*) fDirectory->Get("Clusters");
167 if (fTreeC == nullptr && fVerbose) {
168 printf("%s Clusters not available in fDirectory %s.\n",
169 eH.Data(), fDirectory->GetName());
170 }
171
172 fTreeR = (TTree*) fDirectory->Get("RecTracks");
173 if (fTreeR == nullptr && fVerbose) {
174 printf("%s RecTracks not available in fDirectory %s.\n",
175 eH.Data(), fDirectory->GetName());
176 }
177
178 fTreeKK = (TTree*) fDirectory->Get("RecKinks");
179 if (fTreeKK == nullptr && fVerbose) {
180 printf("%s Kinks not available in fDirectory %s.\n",
181 eH.Data(), fDirectory->GetName());
182 }
183
184 fTreeV0 = (TTree*) fDirectory->Get("RecV0s");
185 if (fTreeV0 == nullptr && fVerbose) {
186 printf("%s V0 not available in fDirectory %s.\n",
187 eH.Data(), fDirectory->GetName());
188 }
189
190 fTreeGI = (TTree*)fDirectory->Get("TEveMCRecCrossRef");
191 if(fTreeGI == nullptr && fVerbose) {
192 printf("%s TEveMCRecCrossRef not available in fDirectory %s.\n",
193 eH.Data(), fDirectory->GetName());
194 }
195
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Disable TObject streamers for those VSD structs that inherit from
200/// TObject directly.
201
203{
204 // TEveVector is not TObject
205
206 // TEveMCTrack derives from TParticle
207 TParticle::Class()->IgnoreTObjectStreamer(true);
208
209 TEveHit::Class()->IgnoreTObjectStreamer(true);
210 TEveCluster::Class()->IgnoreTObjectStreamer(true);
211
212 TEveRecTrack::Class()->IgnoreTObjectStreamer(true);
213 // TEveRecKink derives from TEveRecTrack
214
215 TEveRecV0::Class()->IgnoreTObjectStreamer(true);
216
217 TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
218}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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()
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:202
virtual void SetBranchAddresses()
Set branche addresses of internal trees.
Definition TEveVSD.cxx:120
~TEveVSD() override
Destructor.
Definition TEveVSD.cxx:55
virtual void DeleteTrees()
Delete internal trees.
Definition TEveVSD.cxx:86
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:62
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:70
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:147
virtual void CreateBranches()
Create internal VSD branches.
Definition TEveVSD.cxx:100
virtual void WriteTrees()
Does nothing here ... reimplemented in sub-classes.
Definition TEveVSD.cxx:140
TTree * fTreeR
Clusters.
Definition TEveVSD.h:35
TEveVSD(const TEveVSD &)
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:41
static TClass * Class()
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
Definition TTree.cxx:8637
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:389