testMergeCont.C

Go to the documentation of this file.
00001 TFile *f;
00002 
00003 void testMergeCont()
00004 {
00005    // Macro to test merging of containers.
00006 
00007    gROOT->LoadMacro("$ROOTSYS/tutorials/hsimple.C");
00008    TList *list = GetCollection();
00009    TList *inputs = new TList();
00010    for (Int_t i=0; i<10; i++) {
00011       inputs->AddAt(GetCollection(),0);
00012       list->Merge(inputs);
00013       inputs->Delete();
00014       f->Close();
00015    }
00016    delete inputs;
00017    TH1F *hpx = (TH1F*)(((TList*)list->At(1))->At(0));
00018    printf("============================================\n");
00019    printf("Total  hpx: %d entries\n", hpx->GetEntries());
00020    hpx->Draw();
00021    list->Delete();
00022    delete list;
00023 }
00024 
00025 
00026 TSeqCollection *GetCollection()
00027 {
00028    TObject *obj;
00029    f = hsimple(1);
00030    gROOT->cd();
00031    TList *l0 = new TList();
00032    TList *l01 = new TList();
00033    TH1 *hpx = (TH1*)f->Get("hpx");
00034    printf("Adding hpx: %d entries\n", hpx->GetEntries());
00035    l01->Add(hpx);
00036    TH1 *hpxpy = (TH1*)f->Get("hpxpy");
00037    l01->Add(hpxpy);
00038    TH1 *hprof = (TH1*)f->Get("hprof");
00039    l0->Add(hprof);
00040    l0->Add(l01);
00041    return l0;
00042 }

Generated on Tue Jul 5 15:44:49 2011 for ROOT_528-00b_version by  doxygen 1.5.1