00001
00002
00003
00004
00005
00006
00007
00008
00009 #define ECM 14000
00010
00011
00012 int makePyEvts(int nEvents)
00013 {
00014
00015 double P4TOT[4];
00016
00017
00018 TPythia6* pythia = new TPythia6;
00019
00020 TH1F *h1 = new TH1F("h1","Higgs Mass",50,100.0,200.0);
00021
00022
00023
00024 pythia->SetMSEL(0);
00025 pythia->SetMSUB(102,1);
00026 pythia->SetPMAS(25,1,175);
00027 pythia->SetMSTP(61,0);
00028
00029
00030 int KF = 23;
00031 int idcmin = pythia->GetMDCY(KF,2);
00032 int idcmax = idcmin + pythia->GetMDCY(KF,3);
00033 cout<<"MyOutput: Z idcmin="<<idcmin<<" idcmax="<<idcmax<<endl;
00034 for (int idc = idcmin; idc < idcmax; idc++)
00035 {
00036 pythia->SetMDME(idc,1,0);
00037 }
00038 pythia->SetMDME(184,1,1);
00039
00040
00041 int KF = 25;
00042 int idcmin = pythia->GetMDCY(KF,2);
00043 int idcmax = idcmin + pythia->GetMDCY(KF,3);
00044 cout<<"MyOutput: Higgs idcmin="<<idcmin<<" idcmax="<<idcmax<<endl;
00045 for (int idc = idcmin; idc < idcmax; idc++)
00046 {
00047 pythia->SetMDME(idc,1,0);
00048 }
00049 pythia->SetMDME(225,1,1);
00050
00051
00052 pythia->Initialize("cms", "p", "p", ECM);
00053 #define FILENAME "pythia.root"
00054 #define TREENAME "tree"
00055 #define BRANCHNAME "particles"
00056
00057
00058 TFile* file = TFile::Open(FILENAME, "RECREATE");
00059 if (!file || !file->IsOpen()) {
00060 Error("makeEventSample", "Couldn;t open file %s", FILENAME);
00061 return 1;
00062 }
00063
00064
00065
00066 TTree* tree = new TTree(TREENAME, "Pythia 6 tree");
00067
00068
00069
00070 TClonesArray* particles = (TClonesArray*)pythia->GetListOfParticles();
00071 tree->Branch(BRANCHNAME, &particles);
00072 int KF_muon =13;
00073
00074 for (Int_t ievt = 0; ievt < nEvents; ievt++) {
00075
00076 if (ievt % 100 == 0)
00077 cout << "Event # " << ievt << endl;
00078
00079
00080 pythia->GenerateEvent();
00081
00082 tree->Fill();
00083
00084
00085 for (Int_t i=0; i<4; i++){P4TOT[i]=0.0;}
00086
00087
00088
00089
00090
00091
00092
00093 Int_t N = pythia->GetN();
00094
00095
00096
00097 Int_t N_muons =0;
00098 for (Int_t itk =1; itk<=N; itk++){
00099 Int_t KS = pythia->GetK(itk,1);
00100 Int_t KF = pythia->GetK(itk,2);
00101 if ((abs(KF)== KF_muon)&&(KS!=21)){
00102 N_muons++;
00103 P4TOT[0]=P4TOT[0]+pythia->GetP(itk,1);
00104 P4TOT[1]=P4TOT[1]+pythia->GetP(itk,2);
00105 P4TOT[2]=P4TOT[2]+pythia->GetP(itk,3);
00106 P4TOT[3]=P4TOT[3]+pythia->GetP(itk,4);
00107 }
00108 }
00109
00110 Float_t Hmass2 = pow(P4TOT[3],2)-pow(P4TOT[0],2)-pow(P4TOT[1],2)-pow(P4TOT[2],2);
00111 Float_t Hmass=0.0;
00112 if (Hmass2 >= 0.0) {Hmass = sqrt(Hmass2);}
00113 else {Hmass = -sqrt(abs(Hmass2));}
00114
00115 h1->Fill(Hmass);
00116 }
00117
00118
00119
00120 gROOT->Reset();
00121 c1 = new TCanvas("c1","pp -> H-> ZZ",200,10,700,500);
00122 c1->SetFillColor(42);
00123 c1->SetGrid();
00124
00125 title = new TPaveLabel(0.1,0.94,0.9,0.98,
00126 "Pythia MC: pp -> H -> ZZ");
00127 title->SetFillColor(16);
00128 title->SetTextFont(52);
00129 title->Draw();
00130
00131 h1->GetXaxis()->SetTitle("CM energy (GeV)");
00132 h1->GetXaxis()->CenterTitle();
00133 h1->GetYaxis()->SetTitle("Number Events/(2 GeV)");
00134 h1->GetYaxis()->CenterTitle();
00135 h1->GetYaxis()->SetRangeUser(0,1400);
00136 h1->GetXaxis()->SetRangeUser(140,200);
00137 h1->SetMarkerStyle(21);
00138 h1->SetMarkerColor(31);
00139 h1->SetMarkerSize(1);
00140 h1->SetLineColor(2);
00141 h1->SetLineWidth(4);
00142 h1->SetTitle("pp #rightarrow H #rightarrow ZZ");
00143 h1->Draw("e1p");
00144
00145 c1->Update();
00146 c1->GetFrame()->SetFillColor(21);
00147 c1->GetFrame()->SetBorderSize(3);
00148 c1->Modified();
00149
00150
00151
00152
00153
00154 pythia->Pystat(2);
00155 pythia->Pystat(4);
00156 pythia->Pylist(11);
00157 pythia->Pylist(12);
00158 pythia->Draw();
00159
00160 }
00161
00162
00163
00164
00165
00166
00167