StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
saveTrackQA.C
1 
2 void saveTrackQA(Char_t* signalFile="signalShapes.root")
3 {
4  gStyle->SetPalette(1);
5  TFile f(signalFile);
6  Char_t buffer[100];
7  Char_t quadName[10];
8  Char_t layerName[10];
9 
10 
11  Char_t* trkChi2="";
12  Char_t* numTrkPerEv="numTracksPerEvent";
13  Char_t* numPointsPerTrack="numPointsPerTrack";
14  Char_t* vtxDist="z_Vtx_From_trk_fit";
15  Char_t* ipProj="ProjToIP";
16 
17  TCanvas c;
18  TH1D* h=(TH1D*)f.Get(numTrkPerEv);
19  if(h!=0)
20  {
21  h->SetTitle("Number of Tracks per Event");
22  h->SetName(numTrkPerEv);
23  h->Draw();
24  h->GetYaxis()->SetTitle("dN");
25  h->GetXaxis()->SetTitle("number of tracks in ev");
26  h->SetFillColor(kYellow-9);
27  c.SetLogy();
28  c.SaveAs("numTrkPerEv.png");
29  }
30 
31  h=(TH1D*)f.Get(numPointsPerTrack);
32  if(h!=0)
33  {
34  h->SetTitle("Number of Points per Track");
35  h->SetName(numPointsPerTrack);
36  h->SetFillColor(kYellow-9);
37  h->Draw();
38  c.SaveAs("numPointsPerTrack.png");
39  }
40  c.SetLogy(false);
41  h=(TH1D*)f.Get(vtxDist);
42  if(h!=0)
43  {
44  h->SetTitle("Vertex Distribution");
45  h->SetName(vtxDist);
46  h->GetXaxis()->SetTitle("z [cm]");
47  h->GetYaxis()->SetTitle("dN");
48  h->SetFillColor(kYellow-9);
49  h->Draw();
50  c.SaveAs("zVtxDist.png");
51 
52  }
53 
54  TH2D* h2=(TH2D*)f.Get(ipProj);
55  if(h2!=0)
56  {
57  h2->SetTitle("Vertex Distribution");
58  h2->SetName(vtxDist);
59  h2->Draw("colz");
60  h2->GetXaxis()->SetTitle("z [cm]");
61  h2->GetYaxis()->SetTitle("dca [cm]");
62  c.SaveAs("z_Dca.png");
63  }
64 
65  c.SetLogy(false);
66  for(int iD=1;iD<7;iD++)
67  {
68  for(int iQ=0;iQ<4;iQ++)
69  {
70  if(iQ==0)
71  sprintf(quadName,"A");
72  if(iQ==1)
73  sprintf(quadName,"B");
74  if(iQ==2)
75  sprintf(quadName,"C");
76  if(iQ==3)
77  sprintf(quadName,"D");
78  for(int iL=0;iL<2;iL++)
79  {
80  if(iL==0)
81  sprintf(layerName,"P");
82  else
83  sprintf(layerName,"R");
84  sprintf(buffer,"chargeTrackCluster%s_disc%d_quad%d",layerName,iD,iQ);
85  cout <<"loading " << buffer <<endl;
86  TH1D* h=(TH1D*)f.Get(buffer);
87  TF1* fLandau=new TF1("fLandau","landau(0)",0,10000);
88  h->Fit(fLandau);
89  h->GetXaxis()->SetTitle("cluster charge [ACD counts]");
90  h->GetYaxis()->SetTitle("dN");
91  h->SetFillColor(kYellow-9);
92  h->Draw();
93  sprintf(buffer,"%s.png",buffer);
94  cout <<"save as " << buffer <<endl;
95  c.SaveAs(buffer);
96  }
97  }
98  }
99 }