#define unweighted_cxx #include "unweighted.h" #include #include #include #include void unweighted::Loop() { // In a ROOT session, you can do: // root> .L unweighted.C // root> unweighted t // root> t.GetEntry(12); // Fill t data members with entry number 12 // root> t.Show(); // Show values of entry 12 // root> t.Show(16); // Read and show values of entry 16 // root> t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch if (fChain == 0) return; hfile = new TFile("unweighted.root", "RECREATE", "ROOT histograms"); TH1F *h_Higgs_Minv = new TH1F("h_Higgs_Minv", "pp->...", 100, 0.0, 200.0); h_Higgs_Minv->SetLineColor(kRed); h_Higgs_Minv->GetXaxis()->SetTitle("Higgs Minv [GeV]"); h_Higgs_Minv->GetYaxis()->SetTitle("Normalized entries"); TH1F *h1_Higgs_Minv = new TH1F("h1_Higgs_Minv", "pp->...", 100, 0.0, 200.0); h1_Higgs_Minv->SetLineColor(kRed); h1_Higgs_Minv->GetXaxis()->SetTitle("Higgs Minv [GeV]"); h1_Higgs_Minv->GetYaxis()->SetTitle("Normalized entries"); cout << Particle_size << endl; TLorentzVector vH; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; // if (Cut(ientry) < 0) continue; // Method 1 vH.SetXYZT(Particle_Px[2], Particle_Py[2], Particle_Pz[2], Particle_E[2]); h_Higgs_Minv->Fill(vH.M()); if(vH.M()>0.0) cout << jentry << "vH.M " << vH.M() << endl; // Method 2 h1_Higgs_Minv->Fill(Particle_M[2]); if(Particle_M[2]>0.0) cout << jentry << " " << Particle_M[2] << endl; } }