2 TH2F *h2D=
new TH2F(
"kin2D",
"W #rightarrow e + #nu, 3D isotropic in W CMS; electron P_{Z} (GeV/c); electron P_{T} (GeV/c)",100,-60,60,50,0,60);
5 TRandom3 *rnd=
new TRandom3();
8 gStyle->SetPalette(1,0);
9 gStyle->SetOptStat(1000000);
12 TFile *fdnEPW = TFile::Open(
"noEndcap/mcSetD1_ppWprod.wana.hist.root");
13 assert(fdnEPW->IsOpen());
14 hPW=(TH1F*)fdnEPW->Get(
"pubJoe1"); assert(hPW);
15 hPW->SetTitle(
"accepted Pythia Ws");
20 ax->SetTitleSize(0.05); ax->SetTitleOffset(0.8);
22 hmcPt=(TH1F *) hPW->Clone();
24 hmcPt->SetNameTitle(
"mcPt",
"Isotropic W decay; electron P_{T} (GeV/c)");
26 hmcP=(TH1F *) hPW->Clone();
28 hmcP->SetNameTitle(
"mcP",
"Isotropic W decay; electron P (GeV/c)");
30 hPW->SetLineColor(kRed);
34 for(
int i=0;i<nEve;i++) throwDecay(sig);
36 float fac=hmcPt->Integral()/hPW->Integral();
39 float mxY=hPW->GetMaximum();
40 if(mxY<mcPt->GetMaximum())mxY=mcPt->GetMaximum();
41 hmcPt->SetMaximum(1.1*mxY);
44 c=
new TCanvas(
"aa2",
"aa2",1000,400);
45 TPad *cL,*cR; splitPadX(0.5,&cL,&cR);
46 cL->cd(); h2D->Draw(
"colz");
47 ln=
new TLine(-55,15,55,15); ln->SetLineColor(kBlue); ln->Draw();
48 tx=
new TText(-28,10,
"ET>15 GeV cut used in reco"); tx->Draw(); tx->SetTextColor(kBlue); tx->SetTextSize(0.04);
49 char txt[1000]; sprintf(txt,
"smear 1D #sigma=%.0f GeV",sig);
50 tx=
new TLatex(-50,55,txt); tx->Draw();
55 cR->cd(1); hmcPt->Draw(); hmcPt->SetAxisRange(10,60); hPW->Draw(
"same");
56 cR->cd(2); hmcP->Draw(); hmcP->SetAxisRange(10,60);
60 void throwDecay(
float sig=3.) {
62 float phi=2*3.1416*rnd->Uniform();
63 float cosTh=2*rnd->Uniform()-1.;
64 float theta=acos(cosTh);
65 TVector3 P(1,2,3); P.SetMag(Pmag); P.SetTheta(theta); P.SetPhi(phi);
66 TVector3 sigP(rnd->Gaus(0,sig),rnd->Gaus(0,sig),rnd->Gaus(0,sig));
68 h2D->Fill(P.z(), P.Pt());
69 if( fabs(P.Pt())<15)
continue;
79 void splitPadX(
float x, TPad **cL, TPad **cR) {
80 (*cL) =
new TPad(
"padL",
"apdL",0.0,0.,x,0.95);
82 (*cR) =
new TPad(
"padL",
"apdL",x+0.005,0.,1.0,0.95);