////////////////////////////////////////////////////////// // This class has been automatically generated // (Mon May 6 12:14:35 2002 by ROOT version3.03/04) // from TTree TreeMCH/MC Hits // found on file: hit.root ////////////////////////////////////////////////////////// #ifndef MyHit_h #define MyHit_h #include #include #include class MyHit { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain //Declaration of leaves types //List of branches MyHit(TTree *tree=0); ~MyHit(); Int_t Cut(Int_t entry); Int_t GetEntry(Int_t entry); Int_t LoadTree(Int_t entry); void Init(TTree *tree); void Loop(); Bool_t Notify(); void Show(Int_t entry = -1); }; #endif #ifdef MyHit_cxx MyHit::MyHit(TTree *tree) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("hit.root"); if (!f) { f = new TFile("hit.root"); f->cd("Rint:/"); } tree = (TTree*)gDirectory->Get("TreeMCH"); } Init(tree); } MyHit::~MyHit() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t MyHit::GetEntry(Int_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Int_t MyHit::LoadTree(Int_t entry) { // Set the environment to read one entry if (!fChain) return -5; Int_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->IsA() != TChain::Class()) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void MyHit::Init(TTree *tree) { // Set branch addresses if (tree == 0) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); Notify(); } Bool_t MyHit::Notify() { // Called when loading a new file. // Get branch pointers. return kTRUE; } void MyHit::Show(Int_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t MyHit::Cut(Int_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef MyHit_cxx