#include "TTree.h" #include "Riostream.h" #include "TFile.h" #include "TSystem.h" #include "TError.h" #include int basic(const char* inputfile) { TFile* rawFile = TFile::Open(inputfile); TTree *rawTree=(TTree *)rawFile->Get("RAW"); if(!rawTree) { Error("FilterRawData","Error getting RAW tree from file %s",inputfile); return -2; } TString snewfile(gSystem->BaseName(inputfile)); snewfile.ReplaceAll(".root","filtered.root"); rawTree->SetBranchStatus("*",0); rawTree->SetBranchStatus("rawevent",1); rawTree->SetBranchStatus("MUON*",1); TFile* newfile = new TFile(snewfile.Data(),"recreate"); TTree* newTree = rawTree->CloneTree(10); newTree->GetListOfBranches()->ls(); newTree->AutoSave(); newfile->Close(); delete newfile; delete rawFile; return 0; }