#include #include using namespace std; TCut* Cuts(const char* cut_name=0, const char* option="P") { TCut* new_cut = 0; string s_opt; if (option) s_opt = string(option); TDirectory* dir = gDirectory; TIter next(dir->GetList()); TObject *obj; if (!option) { if (cut_name) { TCut* c = (TCut*)dir->GetList()->FindObject(cut_name); if (c) new_cut = c; } } else if ((s_opt == "P") || (s_opt == "p")) { if (cut_name) { TCut* c = (TCut*)dir->GetList()->FindObject(cut_name); if (c) { c->Print(); new_cut = c; } } else { while( (obj = next()) ) if (obj->InheritsFrom(TCut::Class())) obj->Print(); } } else if (s_opt == "-") { if (cut_name) { TCut* c = (TCut*)dir->GetList()->FindObject(cut_name); if (c) dir->GetList()->Remove(c); delete c; } else { while( (obj = next()) ) if (obj->InheritsFrom(TCut::Class())) { dir->GetList()->Remove(obj); delete obj; } } } else if (option) { if (cut_name) { string s_cut(cut_name); TCut* c = (TCut*)dir->GetList()->FindObject(cut_name); if (c) dir->GetList()->Remove(c); delete c; c = new TCut(cut_name, option); dir->GetList()->Add(c); new_cut = c; } } return new_cut; }