#define MyClass_cxx #include "MyClass.h" #include #include #include #include "TMCParticle.h" #include "TClonesArray.h" //#include "TPolyLine3D.h" #include "TCanvas.h" #include #include #include "ATLFMiscMaker.h" #include "ATLFMaker.h" #include "ATLFParticle.h" #include "ATLFMCMaker.h" #include "ATLFast.h" #include "ATLFDisplay.h" void MyClass::Loop() { // In a ROOT session, you can do: // Root > .L MyClass.C // Root > MyClass 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; c1 = new TCanvas("c1"," ",200,10,600,480); c1->Divide(1,3); TH1F *hpx = new TH1F("Electrons","Electrons.m_PT distribution",40,0,2000); TH1F *hpx2 = new TH1F("Jets","Jets.m_PT distribution",40,0,5000); TH1F *hpx3 = new TH1F("Photons","Photons.m_PT distribution",40,0,2000); Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; // Electron Pt dist for (int i=0; iFill(Electrons_m_PT[i]); } // Jets Pt dist for (int i=0; iFill(Jets_m_PT[i]); } // Photon Pt dist for (int i=0; iFill(Photons_m_PT[i]); } } c1->cd(1); hpx->Draw(); c1->cd(2); hpx2->Draw(); c1->cd(3); hpx3->Draw(); } Bool_t MyClass::MyElectronCut(Float_t electronPT){ return electronPT > 0. ? true : false; } Bool_t MyClass::MyJetCut(Float_t jetPT){ return jetPT > 0. ? true : false; } Bool_t MyClass::MyPhotonCut(Float_t photonPT){ return photonPT > 0. ? true : false; } void MyClass::Anal() { if (fChain == 0) return; class TPythia; class ATLFast; class ATLFMisc; Int_t KF_BHinit = 77; Int_t KF_BHFinal = 78; float Mass_BHinit; float Mass_BHFinal; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; // gROOT->LoadMacro("WMassAnal.C"); ATLFMCMaker *mcmaker = gATLFast->MCMaker(); TClonesArray *particles = mcmaker->Fruits(); Int_t nparticles = particles->GetEntriesFast(); TMCParticle *particle; c2 = new TCanvas("c1"," ",200,10,600,480); TH1F *hpx4 = new TH1F("Particles"," Particles_fKF",100,30,50); // TLorentzVector BHinit, BHFinal for (Int_t i = 1; i<=nparticles; i++) //Loop over the particles(one evnet) { particle =(TMCParticle*)particles->At(i); Int_t KF = pythia->GetK(i,2); // KF code if (((KF) == KF_BHinit)) { TLorentzVector lvBHinit = TLorentzVector(pythia->GetP(i,1),/ pythia->GetP(i,2), pythia->GetP(i,3), pythia->GetP(i,4)); Mass_BHinit = lvBHinit.M(); hpx4->Fill(lvBHinit.M()); } } c2->cd(1); hpx4->Draw(); } } //root [1] .L MyClass.C //root [2] MyClass t; //root [3] t.Loop(); //root [4] t.Anal();