#include "TEveVSD.h"
#include "TFile.h"
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)
{
}
TEveVSD::~TEveVSD()
{
}
void TEveVSD::SetDirectory(TDirectory* dir)
{
fDirectory = dir;
}
void TEveVSD::CreateTrees()
{
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 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()
{
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()
{
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()
{
}
void TEveVSD::LoadTrees()
{
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()
{
TParticle::Class()->IgnoreTObjectStreamer(true);
TEveHit::Class()->IgnoreTObjectStreamer(true);
TEveCluster::Class()->IgnoreTObjectStreamer(true);
TEveRecTrack::Class()->IgnoreTObjectStreamer(true);
TEveRecV0::Class()->IgnoreTObjectStreamer(true);
TEveMCRecCrossRef::Class()->IgnoreTObjectStreamer(true);
}