////////////////////////////////////////////////////////// // This class has been automatically generated on // Thu May 14 10:09:18 2015 by ROOT version 5.34/26 // from TTree ntuple/data from ascii file // found on file: run_2013.root ////////////////////////////////////////////////////////// #ifndef ReadNtupleExample_h #define ReadNtupleExample_h #include #include #include // Header file for the classes stored in the TTree if any. // Fixed size dimensions of array or collections stored in the TTree if any. class ReadNtupleExample { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Declaration of leaf types Float_t lam; Float_t a; Float_t b; Float_t ab; Float_t tdca; Float_t tdcb; Float_t adca; Float_t adcb; // List of branches TBranch *b_lam; //! TBranch *b_a; //! TBranch *b_b; //! TBranch *b_ab; //! TBranch *b_tdca; //! TBranch *b_tdcb; //! TBranch *b_adca; //! TBranch *b_adcb; //! ReadNtupleExample(TTree *tree=0); virtual ~ReadNtupleExample(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; #endif #ifdef ReadNtupleExample_cxx ReadNtupleExample::ReadNtupleExample(TTree *tree) : fChain(0) { // 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("run_2013.root"); if (!f || !f->IsOpen()) { f = new TFile("run_2013.root"); } f->GetObject("ntuple",tree); } Init(tree); } ReadNtupleExample::~ReadNtupleExample() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t ReadNtupleExample::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t ReadNtupleExample::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->GetTreeNumber() != fCurrent) { fCurrent = fChain->GetTreeNumber(); Notify(); } return centry; } void ReadNtupleExample::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("lam", &lam, &b_lam); fChain->SetBranchAddress("a", &a, &b_a); fChain->SetBranchAddress("b", &b, &b_b); fChain->SetBranchAddress("ab", &ab, &b_ab); fChain->SetBranchAddress("tdca", &tdca, &b_tdca); fChain->SetBranchAddress("tdcb", &tdcb, &b_tdcb); fChain->SetBranchAddress("adca", &adca, &b_adca); fChain->SetBranchAddress("adcb", &adcb, &b_adcb); Notify(); } Bool_t ReadNtupleExample::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } void ReadNtupleExample::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t ReadNtupleExample::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef ReadNtupleExample_cxx