Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:38

0001 #include "TCanvas.h"
0002 #include "TFile.h"
0003 #include "TH1D.h"
0004 #include "TTree.h"
0005 
0006 void analyze_mc(){
0007 
0008 TFile* inf = new TFile("/server/02a/yilmaz/data/production/c00to10/central.root");
0009  TTree* hi = dynamic_cast<TTree*>(inf->Get("ana/hi"));
0010 
0011  int nev = hi->GetEntries();
0012 
0013  const char* selection = "abs(chg > 0)";
0014 
0015 TCanvas* c1 = new TCanvas("c1","c1",600,600); 
0016 c1->Divide(2,2);
0017 
0018 TCanvas* c2 = new TCanvas("c2","c2",600,600);
0019 c2->Divide(2,2);
0020 
0021 TH1D* h1 = new TH1D("h1","Impact Parameter; b[fm]; #_{events}",100,0,20);
0022 TH1D* h2 = new TH1D("h2","Vertex; z[cm]; #_{events}",100,-10,10);
0023 TH1D* h3 = new TH1D("h3","Vertex; r[cm]; #_{events}",100,-0.01,0.01);
0024 TH1D* h4 = new TH1D("h4","Event Ids; id; #_{events}",1050,0,1050);
0025 TH1D* h5 = new TH1D("h5","dN/d#eta;#eta;dN/d#eta",100,-10,10);
0026 TH1D* h6 = new TH1D("h6","dN/dp_{T};p_{T}[GeV];dN/dp_{T}",200,0,20);
0027 TH1D* h7 = new TH1D("h7","dN/d#phi;#phi;dN/d#phi",300,-3.15,3.15);
0028 TH1D* h8 = new TH1D("h8","",1050,0,1050);
0029 
0030  c1->cd(1);
0031  hi->Draw("b>>h1");
0032  h1->Draw();
0033  c1->cd(2);
0034  hi->Draw("vz>>h2");
0035  h2->Draw();
0036  
0037  c1->cd(3);
0038  hi->Draw("sqrt(vy*vy+vx*vx)>>h3");
0039  h3->Draw();
0040  c1->cd(4);
0041  hi->Draw("event>>h4");
0042  h4->Draw();
0043 
0044  c2->cd(1);
0045  hi->Draw("eta>>h5",selection);
0046  h5->Scale(1./nev/h5->GetBinWidth(1));
0047  h5->Draw();
0048  c2->cd(2);
0049  c2->GetPad(2)->SetLogy();
0050  hi->Draw("pt>>h6",selection);
0051  h6->Scale(1./nev/h6->GetBinWidth(1));
0052  h6->Draw();
0053  c2->cd(3);
0054  hi->Draw("phi>>h7",selection);
0055  h7->Scale(1./nev/h7->GetBinWidth(1));
0056  h7->Draw();
0057  c2->cd(4);
0058  
0059  c1->Draw();
0060  c1->Print("central1.gif");
0061  c2->Draw();
0062  c2->Print("central2.gif");
0063 
0064 
0065 }