#include "TFile.h" #include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TRandom.h" #include "TLegend.h" #include "TPaveStats.h" #include "TGraph.h" #include "TSystem.h" #include "TTree.h" #include "TTreePlayer.h" #include "TF1.h" #include "TCut.h" #include "TPaletteAxis.h" #include "TFitResult.h" #include "TMath.h" void treefilter() { TFile *fin = TFile::Open("Sim.root"); fin->ls (); if (fin == 0) { printf("Error: cannot open the file!\n"); } else { TTree *te=0; fin->GetObject("Tree1",te); TTree *ntuple = (TTree*) fin->Get("ntuple"); cout << "Start Edep copy" << endl; TFile *fout1 = new TFile("SimEdep.root","recreate"); TTree *small1 = ntuple->CopyTree("Edep"); cout << "Edep Ntupla copied in SimEdep.root" << endl; cout << "Start Zint copy" << endl; TFile *fout2 = new TFile("SimZint.root","recreate"); TTree *small2 = ntuple->CopyTree("Zint"); cout << "Zint Ntupla copied in SimEdep.root" << endl; cout << "Start Egamma copy" << endl; TFile *fout3 = new TFile("SimEgamma.root","recreate"); TTree *small3 = ntuple->CopyTree("Egamma"); cout << "Egamma Ntupla copied in SimEdep.root" << endl; cout << "Start Egammacascade copy" << endl; TFile *fout4 = new TFile("SimEgammacascade.root","recreate"); TTree *small4 = ntuple->CopyTree("Egammacascade"); cout << "Egammacascade Ntupla copied in SimEdep.root" << endl; cout << "Start Pgamma copy" << endl; TFile *fout5 = new TFile("SimPgamma.root","recreate"); TTree *small5 = ntuple->CopyTree("Pgx"); cout << "Pgx Ntupla copied in SimEdep.root" << endl; TTree *small6 = ntuple->CopyTree("Pgy"); cout << "Pgy Ntupla copied in SimEdep.root" << endl; TTree *small7 = ntuple->CopyTree("Pgz"); cout << "Pgz Ntupla copied in SimEdep.root" << endl; } }