| name | language | licence |
|---|---|---|
| Untitled Snippet | Other | Other |
| Command line arguments | C++ | Other |
| Read data from a file | C++ | Other |
| Merging trees using a TChain | C++ | Other |
| Sort a tree | C++ | Other |
| TTree Scan column size | Other | Other |
| Untitled Snippet | Other | Other |
| Event processed | Other | Other |
< 1 2 3 4 5 >
language: C++
licence: Other
Sort a tree
options: view full snippet • send to code collector
void sort() {
TFile f("hsimple.root");
TTree *tree = (TTree*)f.Get("ntuple");
Int_t nentries = (Int_t)tree->GetEntries();
//Drawing variable pz with no graphics option.
//variable pz stored in array fV1 (see TTree::Draw)
tree->Draw("pz","","goff");
Int_t *index = new Int_t[nentries];
//sort array containing pz in decreasing order
//The array index contains the entry numbers in decreasing order
// of pz
TMath::Sort(nentries,tree->GetV1(),index);
//open new file to store the sorted Tree



library
latex (12)