00001 TCanvas *cw, *cf;
00002 TH1 *hTr;
00003 TH2 *hCh;
00004 TH1 *hChm;
00005 int nR=0;
00006
00007 float par_refYiled=2000;
00008
00009 void plTpcChi2(int mxR=2) {
00010 gStyle->SetPalette(1,0);
00011 gStyle->SetOptStat(0);
00012 char *inpList="pp500-hist.list";
00013 printf(" read %d runs from '%s'\n",mxR, inpList);
00014 FILE *fd=fopen(inpList,"r"); assert(fd);
00015 cw=new TCanvas(); cw->Divide(1,3);
00016 hTr=new TH1F("hTr"," # of glob tracks w/ pT>1 GeV/c per run; run index",mxR,0,mxR+1); hTr->SetMinimum(10);
00017 hCh=new TH2F("hCh","chi2/dof glob tracks w/ pT>1 GeV/c per run; run index;chi2/dof",mxR,0,mxR+1,30,0,3.);
00018 hChm=new TH1F("hTr"," mean chi2/dof glob tracks w/ pT>1 GeV/c per run; run index",mxR,0,mxR+1); hChm->SetMinimum(0.5);
00019 cw->cd(1); hTr->Draw(); gPad->SetLogy();
00020 cw->cd(2); hChm->Draw();
00021 cw->cd(3); hCh->Draw("colz"); hChm->Draw("same");
00022
00023 char txt[1000];
00024 char *cRun, *cFill;
00025 int lastF=0;
00026 while(nR<mxR) {
00027 int ret= fscanf(fd,"%s",txt);
00028 if(ret!=1) break;
00029 char* i=strstr(txt,"/");
00030 cRun=i+1;
00031 cRun[9]=NULL;
00032 cFill=txt;
00033 cFill[6]=NULL;
00034 int fill=atoi(cFill+1);
00035 if(lastF!=fill) {
00036 lastF=fill;
00037 drawNewFill(cFill);
00038 }
00039 nR++;
00040 printf("%d %s, %d %s %s %d\n",nR,txt,i-txt,cRun,cFill,fill);
00041 addRun(cFill,cRun);
00042
00043
00044 }
00045
00046
00047 for(int ic=2;ic<=3;ic++) {
00048 cw->cd(ic);
00049 ln=new TLine(0,1,nR,1); ln->SetLineColor(35); ln->SetLineStyle(2);
00050 ln->Draw();
00051 }
00052 }
00053
00054
00055 void addRun( char *cFill, char *cRun) {
00056 TString pathIn="data-ofl/";
00057 TString inFile=pathIn+cRun+".wana.hist.root";
00058 TFile *fd=new TFile(inFile);
00059 if(fd->IsOpen()==0) return;
00060 assert(fd->IsOpen());
00061
00062
00063 TH1F *h1=fd->Get("muTrch2"); assert(h1);
00064
00065 h1->Rebin(2);
00066 float nTr=h1->Integral();
00067 float chm=h1->GetMean();
00068 hTr->Fill(nR,nTr);
00069 hChm->Fill(nR,chm);
00070
00071 float weight=par_refYiled/nTr;
00072
00073 TAxis *ax=h1->GetXaxis(); assert(ax);
00074 for(int k=1; k<ax->GetNbins(); k++) {
00075 float x=h1->GetBinCenter(k);
00076 float val=h1->GetBinContent(k);
00077 hCh->Fill(nR,x,val*weight);
00078
00079 }
00080
00081
00082
00083
00084 fd->Close();
00085 }
00086
00087
00088 void drawNewFill(char *cFill) {
00089 printf("draw fill=%s\n",cFill);
00090 int off=3;
00091
00092
00093 ln=new TLine(nR,0,nR,2*par_refYiled); ln->SetLineColor(kMagenta);
00094 cw->cd(1); ln->Draw();
00095 tx=new TText(nR+off,20,cFill); tx->SetTextAngle(90); tx->Draw();
00096 tx->SetTextSize(0.06);
00097
00098
00099 ln=new TLine(nR,0,nR,5); ln->SetLineColor(kMagenta);
00100 cw->cd(2); ln->Draw();
00101 tx=new TText(nR+off,0.6,cFill); tx->SetTextAngle(90); tx->Draw();
00102 tx->SetTextSize(0.06);
00103
00104
00105 ln=new TLine(nR,0,nR,3); ln->SetLineColor(kMagenta);
00106 cw->cd(3); ln->Draw();
00107 tx=new TText(nR+off,2,cFill); tx->SetTextAngle(90); tx->Draw();
00108 tx->SetTextSize(0.06); tx->SetTextColor(kMagenta);
00109
00110
00111
00112 }
00113