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 **************************************************************************/
21 #include <TParticle.h>
23 #include "AliGenReaderTreeK.h"
25 #include "AliHeader.h"
28 ClassImp(AliGenReaderTreeK);
31 AliGenReaderTreeK::AliGenReaderTreeK():AliGenReader()
33 // Default constructor
43 void AliGenReaderTreeK::Init()
46 // Connect base file and file to read from
48 TTree *ali = gAlice->TreeE();
50 fBaseFile = ali->GetCurrentFile();
52 printf("\n Warning: Basefile cannot be found !\n");
54 fFile = new TFile(fFileName);
57 Int_t AliGenReaderTreeK::NextEvent()
59 // Read the next event
60 // cd to file with old kine tree
61 if (!fBaseFile) Init();
62 if (fStack) delete fStack;
63 fStack = new AliStack(1000);
66 TTree* treeE = (TTree*)gDirectory->Get("TE");
68 if (fHeader) delete fHeader;
70 treeE->SetBranchAddress("Header", &fHeader);
72 treeE->GetEntry(fNcurrent);
73 fStack = fHeader->Stack();
74 fStack->GetEvent(fNcurrent);
76 // cd back to base file
81 Int_t ntrack = fStack->GetNtrack();
82 printf("\n Next event contains %d particles", ntrack);
87 TParticle* AliGenReaderTreeK::NextParticle()
89 // Return next particle
90 TParticle* part = fStack->Particle(fNparticle);