ROOT logo
// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveVSD.h"
#include "TFile.h"

//==============================================================================
// TEveVSD
//==============================================================================

//______________________________________________________________________________
//
// Visualization Summary Data - a collection of trees holding standard
// event data in experiment independent format.

ClassImp(TEveVSD);

//______________________________________________________________________________
TEveVSD::TEveVSD(const char* , const char*) :
   TObject(),

   fFile      (0),
   fDirectory (0),
   fBuffSize  (32000),
   fVerbose   (0),

   fTreeK  (0),
   fTreeH  (0),
   fTreeC  (0),
   fTreeR  (0),
   fTreeKK (0),
   fTreeV0 (0),
   fTreeCC (0),
   fTreeGI (0),

   fK(),  fpK (&fK),
   fH(),  fpH (&fH),
   fC(),  fpC (&fC),
   fR(),  fpR (&fR),
   fKK(), fpKK(&fKK),
   fV0(), fpV0(&fV0),
   fCC(), fpCC(&fCC),
   fGI(), fpGI(&fGI)
{
   // Constructor.
}

//______________________________________________________________________________
TEveVSD::~TEveVSD()
{
   // Destructor.
}

/******************************************************************************/

//______________________________________________________________________________
void TEveVSD::SetDirectory(TDirectory* dir)
{
   // Set directory in which the trees are (or will be) created.

   fDirectory = dir;
}

/******************************************************************************/

//______________________________________________________________________________
void TEveVSD::CreateTrees()
{
   // Create internal trees.

   fDirectory->cd();
   fTreeK  = new TTree("Kinematics", "Simulated tracks.");
   fTreeH  = new TTree("Hits",       "Combined detector hits.");
   fTreeC  = new TTree("Clusters",   "Reconstructed clusters.");
   fTreeR  = new TTree("RecTracks",  "Reconstructed tracks.");
   fTreeKK = new TTree("RecKinks",   "Reconstructed kinks.");
   fTreeV0 = new TTree("RecV0s",     "Reconstructed V0s.");
   fTreeCC = new TTree("RecCascades","Reconstructed cascades.");
   fTreeGI = new TTree("TEveMCRecCrossRef", "Objects prepared for cross query.");
}

//______________________________________________________________________________
void TEveVSD::DeleteTrees()
{
   // Delete interal trees.

   delete fTreeK;  fTreeK  = 0;
   delete fTreeH;  fTreeH  = 0;
   delete fTreeC;  fTreeC  = 0;
   delete fTreeR;  fTreeR  = 0;
   delete fTreeV0; fTreeV0 = 0;
   delete fTreeKK; fTreeKK = 0;
   delete fTreeGI; fTreeGI = 0;
}

//______________________________________________________________________________
void TEveVSD::CreateBranches()
{
   // Create internal VSD branches.

   if (fTreeK)  fTreeK ->Branch("K",  "TEveMCTrack",  &fpK);
   if (fTreeH)  fTreeH ->Branch("H",  "TEveHit",      &fpH);
   if (fTreeC)  fTreeC ->Branch("C",  "TEveCluster",  &fpC);
   if (fTreeR)  fTreeR ->Branch("R",  "TEveRecTrack", &fpR);
   if (fTreeKK) fTreeKK->Branch("KK", "TEveRecKink",  &fpKK);
   if (fTreeV0) fTreeV0->Branch("V0", "TEveRecV0",    &fpV0);

   if (fTreeGI)
   {
      fTreeGI->Branch("GI", "TEveMCRecCrossRef",  &fpGI);
      fTreeGI->Branch("K.", "TEveMCTrack",  &fpK);
      fTreeGI->Branch("R.", "TEveRecTrack", &fpR);
   }
}

//______________________________________________________________________________
void TEveVSD::SetBranchAddresses()
{
   // Set branche addresses of internal trees.

   if (fTreeK)  fTreeK ->SetBranchAddress("K",  &fpK);
   if (fTreeH)  fTreeH ->SetBranchAddress("H",  &fpH);
   if (fTreeC)  fTreeC ->SetBranchAddress("C",  &fpC);
   if (fTreeR)  fTreeR ->SetBranchAddress("R",  &fpR);
   if (fTreeKK) fTreeKK->SetBranchAddress("KK", &fpKK);
   if (fTreeV0) fTreeV0->SetBranchAddress("V0", &fpV0);

   if (fTreeGI)
   {
      fTreeGI->SetBranchAddress("GI", &fpGI);
      fTreeGI->SetBranchAddress("K.", &fpK);
      fTreeGI->SetBranchAddress("R.", &fpR);
   }
}

//______________________________________________________________________________
void TEveVSD::WriteTrees()
{
   // Does nothing here ... reimplemented in sub-classes.
}

/******************************************************************************/

//______________________________________________________________________________
void TEveVSD::LoadTrees()
{
   // Load internal trees from directory.

   static const TEveException eH("TEveVSD::LoadTrees ");

   if (fDirectory == 0)
      throw eH + "directory not set.";

   fTreeK = (TTree*) fDirectory->Get("Kinematics");
   if (fTreeK == 0 && fVerbose) {
      printf("%s Kinematics not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeH = (TTree*) fDirectory->Get("Hits");
   if (fTreeH == 0 && fVerbose) {
      printf("%s Hits not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeC = (TTree*) fDirectory->Get("Clusters");
   if (fTreeC == 0 && fVerbose) {
      printf("%s Clusters not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeR = (TTree*) fDirectory->Get("RecTracks");
   if (fTreeR == 0 && fVerbose) {
      printf("%s RecTracks not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeKK =  (TTree*) fDirectory->Get("RecKinks");
   if (fTreeKK == 0 && fVerbose) {
      printf("%s Kinks not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeV0 =  (TTree*) fDirectory->Get("RecV0s");
   if (fTreeV0 == 0 && fVerbose) {
      printf("%s V0 not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

   fTreeGI = (TTree*)fDirectory->Get("TEveMCRecCrossRef");
   if(fTreeGI == 0 && fVerbose) {
      printf("%s TEveMCRecCrossRef not available in fDirectory %s.\n",
             eH.Data(), fDirectory->GetName());
   }

}

/******************************************************************************/

//______________________________________________________________________________
void TEveVSD::DisableTObjectStreamersForVSDStruct()
{
   // Disble TObject streamers for those VSD structs that inherit from
   // TObject directly.

   // TEveVector is not TObject

   // TEveMCTrack derives from TParticle
   TParticle::Class()->IgnoreTObjectStreamer(true);

   TEveHit::Class()->IgnoreTObjectStreamer(true);
   TEveCluster::Class()->IgnoreTObjectStreamer(true);

   TEveRecTrack::Class()->IgnoreTObjectStreamer(true);
   // TEveRecKink derives from TEveRecTrack

   TEveRecV0::Class()->IgnoreTObjectStreamer(true);

   TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
}
 TEveVSD.cxx:1
 TEveVSD.cxx:2
 TEveVSD.cxx:3
 TEveVSD.cxx:4
 TEveVSD.cxx:5
 TEveVSD.cxx:6
 TEveVSD.cxx:7
 TEveVSD.cxx:8
 TEveVSD.cxx:9
 TEveVSD.cxx:10
 TEveVSD.cxx:11
 TEveVSD.cxx:12
 TEveVSD.cxx:13
 TEveVSD.cxx:14
 TEveVSD.cxx:15
 TEveVSD.cxx:16
 TEveVSD.cxx:17
 TEveVSD.cxx:18
 TEveVSD.cxx:19
 TEveVSD.cxx:20
 TEveVSD.cxx:21
 TEveVSD.cxx:22
 TEveVSD.cxx:23
 TEveVSD.cxx:24
 TEveVSD.cxx:25
 TEveVSD.cxx:26
 TEveVSD.cxx:27
 TEveVSD.cxx:28
 TEveVSD.cxx:29
 TEveVSD.cxx:30
 TEveVSD.cxx:31
 TEveVSD.cxx:32
 TEveVSD.cxx:33
 TEveVSD.cxx:34
 TEveVSD.cxx:35
 TEveVSD.cxx:36
 TEveVSD.cxx:37
 TEveVSD.cxx:38
 TEveVSD.cxx:39
 TEveVSD.cxx:40
 TEveVSD.cxx:41
 TEveVSD.cxx:42
 TEveVSD.cxx:43
 TEveVSD.cxx:44
 TEveVSD.cxx:45
 TEveVSD.cxx:46
 TEveVSD.cxx:47
 TEveVSD.cxx:48
 TEveVSD.cxx:49
 TEveVSD.cxx:50
 TEveVSD.cxx:51
 TEveVSD.cxx:52
 TEveVSD.cxx:53
 TEveVSD.cxx:54
 TEveVSD.cxx:55
 TEveVSD.cxx:56
 TEveVSD.cxx:57
 TEveVSD.cxx:58
 TEveVSD.cxx:59
 TEveVSD.cxx:60
 TEveVSD.cxx:61
 TEveVSD.cxx:62
 TEveVSD.cxx:63
 TEveVSD.cxx:64
 TEveVSD.cxx:65
 TEveVSD.cxx:66
 TEveVSD.cxx:67
 TEveVSD.cxx:68
 TEveVSD.cxx:69
 TEveVSD.cxx:70
 TEveVSD.cxx:71
 TEveVSD.cxx:72
 TEveVSD.cxx:73
 TEveVSD.cxx:74
 TEveVSD.cxx:75
 TEveVSD.cxx:76
 TEveVSD.cxx:77
 TEveVSD.cxx:78
 TEveVSD.cxx:79
 TEveVSD.cxx:80
 TEveVSD.cxx:81
 TEveVSD.cxx:82
 TEveVSD.cxx:83
 TEveVSD.cxx:84
 TEveVSD.cxx:85
 TEveVSD.cxx:86
 TEveVSD.cxx:87
 TEveVSD.cxx:88
 TEveVSD.cxx:89
 TEveVSD.cxx:90
 TEveVSD.cxx:91
 TEveVSD.cxx:92
 TEveVSD.cxx:93
 TEveVSD.cxx:94
 TEveVSD.cxx:95
 TEveVSD.cxx:96
 TEveVSD.cxx:97
 TEveVSD.cxx:98
 TEveVSD.cxx:99
 TEveVSD.cxx:100
 TEveVSD.cxx:101
 TEveVSD.cxx:102
 TEveVSD.cxx:103
 TEveVSD.cxx:104
 TEveVSD.cxx:105
 TEveVSD.cxx:106
 TEveVSD.cxx:107
 TEveVSD.cxx:108
 TEveVSD.cxx:109
 TEveVSD.cxx:110
 TEveVSD.cxx:111
 TEveVSD.cxx:112
 TEveVSD.cxx:113
 TEveVSD.cxx:114
 TEveVSD.cxx:115
 TEveVSD.cxx:116
 TEveVSD.cxx:117
 TEveVSD.cxx:118
 TEveVSD.cxx:119
 TEveVSD.cxx:120
 TEveVSD.cxx:121
 TEveVSD.cxx:122
 TEveVSD.cxx:123
 TEveVSD.cxx:124
 TEveVSD.cxx:125
 TEveVSD.cxx:126
 TEveVSD.cxx:127
 TEveVSD.cxx:128
 TEveVSD.cxx:129
 TEveVSD.cxx:130
 TEveVSD.cxx:131
 TEveVSD.cxx:132
 TEveVSD.cxx:133
 TEveVSD.cxx:134
 TEveVSD.cxx:135
 TEveVSD.cxx:136
 TEveVSD.cxx:137
 TEveVSD.cxx:138
 TEveVSD.cxx:139
 TEveVSD.cxx:140
 TEveVSD.cxx:141
 TEveVSD.cxx:142
 TEveVSD.cxx:143
 TEveVSD.cxx:144
 TEveVSD.cxx:145
 TEveVSD.cxx:146
 TEveVSD.cxx:147
 TEveVSD.cxx:148
 TEveVSD.cxx:149
 TEveVSD.cxx:150
 TEveVSD.cxx:151
 TEveVSD.cxx:152
 TEveVSD.cxx:153
 TEveVSD.cxx:154
 TEveVSD.cxx:155
 TEveVSD.cxx:156
 TEveVSD.cxx:157
 TEveVSD.cxx:158
 TEveVSD.cxx:159
 TEveVSD.cxx:160
 TEveVSD.cxx:161
 TEveVSD.cxx:162
 TEveVSD.cxx:163
 TEveVSD.cxx:164
 TEveVSD.cxx:165
 TEveVSD.cxx:166
 TEveVSD.cxx:167
 TEveVSD.cxx:168
 TEveVSD.cxx:169
 TEveVSD.cxx:170
 TEveVSD.cxx:171
 TEveVSD.cxx:172
 TEveVSD.cxx:173
 TEveVSD.cxx:174
 TEveVSD.cxx:175
 TEveVSD.cxx:176
 TEveVSD.cxx:177
 TEveVSD.cxx:178
 TEveVSD.cxx:179
 TEveVSD.cxx:180
 TEveVSD.cxx:181
 TEveVSD.cxx:182
 TEveVSD.cxx:183
 TEveVSD.cxx:184
 TEveVSD.cxx:185
 TEveVSD.cxx:186
 TEveVSD.cxx:187
 TEveVSD.cxx:188
 TEveVSD.cxx:189
 TEveVSD.cxx:190
 TEveVSD.cxx:191
 TEveVSD.cxx:192
 TEveVSD.cxx:193
 TEveVSD.cxx:194
 TEveVSD.cxx:195
 TEveVSD.cxx:196
 TEveVSD.cxx:197
 TEveVSD.cxx:198
 TEveVSD.cxx:199
 TEveVSD.cxx:200
 TEveVSD.cxx:201
 TEveVSD.cxx:202
 TEveVSD.cxx:203
 TEveVSD.cxx:204
 TEveVSD.cxx:205
 TEveVSD.cxx:206
 TEveVSD.cxx:207
 TEveVSD.cxx:208
 TEveVSD.cxx:209
 TEveVSD.cxx:210
 TEveVSD.cxx:211
 TEveVSD.cxx:212
 TEveVSD.cxx:213
 TEveVSD.cxx:214
 TEveVSD.cxx:215
 TEveVSD.cxx:216
 TEveVSD.cxx:217
 TEveVSD.cxx:218
 TEveVSD.cxx:219
 TEveVSD.cxx:220
 TEveVSD.cxx:221
 TEveVSD.cxx:222
 TEveVSD.cxx:223
 TEveVSD.cxx:224
 TEveVSD.cxx:225
 TEveVSD.cxx:226
 TEveVSD.cxx:227
 TEveVSD.cxx:228