00001
00002
00003 plSwap_byCrate(int icr=2, int set=2) {
00004
00005
00006
00007 char *fname="sum.hist.root";
00008 if(set==0) fname="sum-noswap.hist.root";
00009 if(set==1) fname="sum-swap14.hist.root";
00010 if(set==2) fname="/star/data05/scratch/balewski/sched-swapA/R9068088.barCal.hist.root";
00011 if(set==99) fname="sum.hist.root";
00012
00013
00014 fd=new TFile(fname); assert(fd->IsOpen());
00015 printf("Work with %s\n", fd->GetName());
00016 gStyle->SetOptStat(1000010);
00017 gStyle->SetPalette(1,0);
00018 gStyle->SetOptFit(1);
00019
00020 TH2F* hr= BPRS_c0;
00021 TH2F* hm=mipBprsAdc;
00022 float y1=-20, y2=80;
00023
00024 TString crName="aaa";
00025 c=new TCanvas();
00026
00027 switch(icr) {
00028
00029 case 0:
00030 case 2:
00031 {
00032 float x1=1,x2=340,x3=1541,x4=2400;
00033 crName="PSD1W";
00034 if(icr==2) {
00035 crName="PSD1E";
00036 x1=2401; x2=2900; x3=4101; x4=4800;
00037 }
00038 c->SetTitle(crName);
00039 TH2F* hA[4]; hA[0]=hr; hA[2]=hm;
00040 for(int i=0;i<2;i++){
00041 hA[1+2*i]=(TH2F*) hA[2*i]->Clone();
00042 hA[2*i]->SetAxisRange(x1,x2);
00043 hA[2*i]->SetAxisRange(x1,x2);
00044 hA[1+2*i]->SetAxisRange(x3,x4);
00045 hA[1+2*i]->SetAxisRange(x3,x4);
00046 }
00047
00048 c->Divide(2,2);
00049 for(int i=0;i<4;i++){
00050 c->cd(i+1); hA[i]->Draw("colz");
00051 if(i<2) gPad->SetLogz();
00052 }
00053 }
00054 break;
00055
00056 case 1:
00057 case 3:
00058 {
00059 float x1=341,x2=1540;
00060 crName="PSD19W";
00061 if(icr==3) {
00062 crName="PSD20E";
00063 x1=2901;x2=4100;
00064 }
00065 c->SetTitle(crName);
00066 c->Divide(1,2);
00067 c->cd(1); hr->Draw("colz"); gPad->SetLogz();gPad->SetGrid();
00068 hr->SetAxisRange(x1,x2);
00069 hr->SetAxisRange(y1,y2,"y");
00070 c->cd(2); hm->Draw("colz") ;gPad->SetGrid();
00071 hm->SetAxisRange(x1,x2);
00072 hm->SetAxisRange(y1,y2,"y");
00073 }
00074 }
00075
00076
00077 return;
00078
00079
00080
00081 int ipmt=kpmt-1;
00082 for(int i=0;i<4;i++) {
00083 float id1=1461+i*20+ipmt*4;
00084 float id2=id1+4;
00085 for(int j=0;j<4;j++) {
00086 int id=id1+j;
00087 printf("==========%d\n",id);
00088
00089 {
00090 TH1F *hr=getSlice( BPRS_c0,id, "raw");
00091 TH1F *hm=getSlice(mipBprsAdc,id, "mip");
00092 c=new TCanvas("a","a",500,500);
00093 c=new TCanvas();
00094 c->Divide(1,2);
00095 c->cd(1);
00096 hr->Draw();gPad->SetLogy();gPad->SetGrid();
00097 hr->Fit("gaus");
00098 c->cd(2);
00099 hm->Draw();
00100 gPad->SetGrid();
00101 char txt1[100];
00102 sprintf(txt1,"ps/pmt%d_id%d.ps",kpmt,id);
00103 c->Print(txt1);
00104 }
00105 }
00106 }
00107 printf("MANY pages has piled up!!!\n");
00108 }
00109
00110
00111 void markMP1() {
00112 float y=-15;
00113 for(int i=0;i<4;i++) {
00114 float x1=1461+i*20-0.5;
00115 float x2=x1+4;
00116 ln=new TLine(x1,y,x2,y);
00117 ln->Draw();
00118 ln->SetLineColor(kRed); ln->SetLineWidth(2.);
00119 }
00120 }
00121
00122
00123 TH1F * getSlice(TH2F * h2, int id, char *ctit) {
00124 axX=h2->GetXaxis();
00125 float x1=axX->GetXmin();
00126 float x2=axX->GetXmax();
00127 int nbX=axX->GetNbins();
00128 printf("X-axis range --> [%.1f, %.1f], nb=%d %s\n",x1,x2,nbX,axX->GetTitle());
00129
00130 axY=h2->GetYaxis();
00131 float y1=axY->GetXmin();
00132 float y2=axY->GetXmax();
00133 int nbY=axY->GetNbins();
00134 printf("Y-axis range --> [%.1f, %.1f], nb=%d\n",y1,y2,nbY);
00135
00136 assert(id>=1 && id<=nbX);
00137
00138 char txt1[100], txt2[1000];
00139 sprintf(txt1,"%s_id%d",ctit,id);
00140 sprintf(txt2,"%s soft id=%d;%s ",ctit, id,axY->GetTitle());
00141 TH1F*h=new TH1F(txt1,txt2,nbY,y1,y2);
00142
00143 int i;
00144 for(i=1;i<=nbY;i++) h->SetBinContent(i,h2->GetBinContent(id,i));
00145
00146
00147
00148 float x1=-20, x2=70;
00149 h->SetAxisRange(x1,x2);
00150 h->SetEntries(h->Integral());
00151
00152 return h;
00153 }
00154
00155
00156
00157 void plCuts() {
00158
00159 c=new TCanvas();
00160 c->Divide(2,2);
00161
00162 c->cd(1);
00163 mipZver->Draw();
00164 float x=50, y=5e6;
00165 ln=new TLine(x,0,x,y); ln->Draw();
00166 ln->SetLineColor(kRed);
00167 ln=new TLine(-x,0,-x,y); ln->Draw();
00168 ln->SetLineColor(kRed);
00169 mipZverAc->Draw("same"); mipZverAc->SetLineColor(kBlue);
00170
00171
00172 c->cd(2);
00173 mipTrPt->Draw();gPad->SetLogy();
00174 x=0.3; y=5e7;
00175 ln=new TLine(x,0,x,y); ln->Draw();
00176 ln->SetLineColor(kRed);
00177 mipTrPtAc->Draw("same"); mipTrPtAc->SetLineColor(kBlue);
00178
00179 c->cd(3);
00180 mipDeDx->Draw("colz");gPad->SetLogz();
00181 float y=3.4;
00182 ln=new TLine(0,y,20,y); ln->Draw();
00183 ln->SetLineColor(kRed);
00184 y=1.5;
00185 ln=new TLine(0,y,20,y); ln->Draw();
00186 ln->SetLineColor(kRed);
00187
00188 c->cd(4);
00189 mipTrRZ21->Draw("colz");
00190
00191
00192 }