TObjArray is a class in ROOT framework, which is a data analysis platform widely used in high-energy physics. This class is used to store objects of different types in an array-like structure. It allows for easy and efficient management of a collection of objects of different types.
An example of using TObjArray could be:
```c++
#include "TObjArray.h"
#include "TH1F.h"
#include "TFile.h"
int main(){
TObjArray hist_array(5); // create array with 5 slots
for(int i=0; i<5; i++){
hist_array.Add(new TH1F(Form("hist%d",i),Form("Histogram %d",i),10,0,10));
}
TFile *output_file = new TFile("histograms.root","RECREATE");
hist_array.Write(); // write all histograms to file
output_file->Close();
}
```
In this example, an array of 5 TH1F histograms is created using TObjArray. These histograms are added to the array using the Add() method, which takes a pointer to an object. Once all histograms have been added, they are all written to a ROOT file using the Write() method of TObjArray.
The package library for TObjArray is ROOT framework, which is developed and maintained by CERN.
C++ (Cpp) TObjArray - 30 examples found. These are the top rated real world C++ (Cpp) examples of TObjArray extracted from open source projects. You can rate examples to help us improve the quality of examples.