Example of script to loop on all the objects of a ROOT file directory and print on Postscript all TH1 derived objects.
This script uses the file generated by tutorial hsimple.C
DV
void loopdir() {
TIter keyList(
f1->GetListOfKeys());
while ((key = (
TKey*)keyList())) {
}
}
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
TH1 is the base class of all histogram classes in ROOT.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual TObject * ReadObj()
To read a TObject* from the file.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
void Print(const char *filename="") const override
Save Pad contents in a file in one of various formats.
- Author
- Rene Brun
Definition in file loopdir.C.