10 #define ProofPythia_cxx
31 ProofPythia::ProofPythia()
43 ProofPythia::~ProofPythia()
52 void ProofPythia::Begin(TTree * )
58 TString option = GetOption();
59 Info(
"Begin",
"starting a simple exercise with process option: %s", option.Data());
63 void ProofPythia::SlaveBegin(TTree * )
69 TString option = GetOption();
72 fTot =
new TH1F(
"histo1",
"total multiplicity", 25, 0.5, 2500.5);
73 fHist =
new TH1F(
"histo2",
"charged multiplicity", 20, 0.5, 500.5);
74 fPt =
new TH1F(
"histo3",
"particles pT", 100, 0., 10);
75 fEta =
new TH1F(
"histo4",
"particles Eta", 100, -10., 10);
76 fTot->SetFillColor(kBlue);
77 fHist->SetFillColor(kRed);
83 fPythia =
new TPythia8();
85 fPythia->SetName(
"pythia8");
86 fPythia->ReadConfigFile(
"pythia8/main03.cmnd");
89 fPythia->Initialize( 2212, 2212, 14000.);
90 fP =
new TClonesArray(
"TParticle", 1000);
95 Bool_t ProofPythia::Process(Long64_t entry)
99 fPythia->GenerateEvent();
101 fPythia->EventListing();
102 fPythia->ImportParticles(fP,
"All");
103 Int_t nTot = fPythia->GetN();
104 fPythia->ImportParticles(fP,
"All");
105 Int_t np = fP->GetEntriesFast();
108 for (Int_t ip = 0; ip < np; ip++) {
109 TParticle* part = (TParticle*) fP->At(ip);
110 Int_t ist = part->GetStatusCode();
111 Int_t pdg = part->GetPdgCode();
112 if (ist != 1)
continue;
113 Float_t charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
114 if (charge == 0.)
continue;
116 Float_t eta = part->Eta();
117 Float_t pt = part->Pt();
118 if (pt > 0.) fPt->Fill(pt);
119 if ((eta > -10) && (eta < 10)) fEta->Fill(eta);
121 fHist->Fill(nCharged);
128 void ProofPythia::SlaveTerminate()
136 void ProofPythia::Terminate()
145 TCanvas *c1 =
new TCanvas(
"c1",
"Proof ProofPythia canvas",200,10,700,700);
148 if ((fTot = dynamic_cast<TH1F *>(fOutput->FindObject(
"histo1")))) {
153 if ((fHist = dynamic_cast<TH1F *>(fOutput->FindObject(
"histo2")))) {
158 if ((fPt = dynamic_cast<TH1F *>(fOutput->FindObject(
"histo3")))) {
163 if ((fEta = dynamic_cast<TH1F *>(fOutput->FindObject(
"histo4")))) {