{ TFile f("working_dir_KpKm_invMass_63GeV/finalResult.root"); f.ls(); TCanvas *c1 = new TCanvas("c1","c1",400,250,899,699); c1->Range(-12, -12, 12, 12); c1->SetBorderSize(2); c1->SetFrameFillColor(0); TChain* chain = (TChain*) f.Get("invMass"); Int_t numberOfFilters = TMath::Nint(chain->GetEntries()); char str[1000]; int FN = 0; // currently processed filter number while(true) { if(FN==0) cout<<"\nNumber of filters = "<SetBranchAddress("FilterNumberBranch", &filterNumber); chain->SetBranchAddress("InvMassNTupleBranch", &ntpl); TNtuple* ntplFN = new TNtuple(Form("invMass%06i", FN), Form("Filter #%i invarint mass", FN), "invMass"); for(Int_t fn=0; fnGetEntry(fn); if(filterNumber!=FN) continue; Float_t im; ntpl->SetBranchAddress("invMass", &im); Int_t numberOfEntries = TMath::Nint(ntpl->GetEntries()); for(Int_t i=0; iGetEntry(i); ntplFN->Fill(im, 0.0); // the second variable is dummy }// end of for ntpl->ResetBranchAddresses(); }// end of for if(TMath::Nint(ntplFN->GetEntries())==0) break; ntplFN->Draw(Form("invMass>>htemp%i", FN), "", ""); TH1F* htemp = (TH1F*) gDirectory->Get(Form("htemp%i", FN)); sprintf(str, "invMassHist%06i", FN); htemp->SetNameTitle(str, "K^{+}K^{-} invariant mass: Phobos PR04 (63 GeV)"); htemp->SetFillColor(6); // purple c1->Update(); sprintf(str, "KpKmInvMass_63GeV_filter%06i.gif", FN); c1->SaveAs(str); sprintf(str, "KpKmInvMass_63GeV_filter%06i.root", FN); c1->SaveAs(str); delete ntpl; delete ntplFN; chain->ResetBranchAddresses(); FN++; }// end of while }