1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.1 2001/11/09 09:11:24 morsch
19 Realisation of AliGenReader that reads the kine tree (TreeK).
24 #include <TParticle.h>
26 #include "AliGenReaderTreeK.h"
28 #include "AliHeader.h"
31 ClassImp(AliGenReaderTreeK);
34 AliGenReaderTreeK::AliGenReaderTreeK():AliGenReader()
36 // Default constructor
47 AliGenReaderTreeK::~AliGenReaderTreeK()
53 void AliGenReaderTreeK::Init()
56 // Connect base file and file to read from
58 TTree *ali = gAlice->TreeE();
60 fBaseFile = ali->GetCurrentFile();
62 printf("\n Warning: Basefile cannot be found !\n");
64 fFile = new TFile(fFileName);
67 Int_t AliGenReaderTreeK::NextEvent()
69 // Read the next event
70 // cd to file with old kine tree
71 if (!fBaseFile) Init();
72 if (fStack) delete fStack;
73 fStack = new AliStack(1000);
79 fTreeE = (TTree*)gDirectory->Get("TE");
82 if (fHeader) delete fHeader;
84 fTreeE->SetBranchAddress("Header", &fHeader);
86 fTreeE->GetEntry(fNcurrent);
87 fStack = fHeader->Stack();
88 fStack->GetEvent(fNcurrent);
90 // cd back to base file
95 Int_t ntrack = fStack->GetNtrack();
96 printf("\n Next event contains %d particles", ntrack);
101 TParticle* AliGenReaderTreeK::NextParticle()
103 // Return next particle
104 TParticle* part = fStack->Particle(fNparticle);
111 AliGenReaderTreeK& AliGenReaderTreeK::operator=(const AliGenReaderTreeK& rhs)
113 // Assignment operator