00001
00002
00003
00004
00005 TFile *f;
00006 TCanvas *cc;
00007 TString inPath;
00008
00009
00010 plSmdCal(TString hFile="R7089008"){
00011 inPath="/star/u/wissink/cal2006/iter4-pp/";
00012
00013 f=new TFile(inPath+hFile+".hist.root");
00014
00015 gStyle->SetPalette(1,0);
00016 return;
00017 }
00018
00019
00020
00021 plOne(int sec=1, float zMax=10., int sepSect=1) {
00022 if(sepSect) {
00023 TString fname="sect01/sum-sect"; fname+=sec;
00024 f=new TFile(inPath+fname+".hist.root");
00025 }
00026
00027 printf("\n MIP yield for sector=%d --------------------\n",sec);
00028 char name[100], title[500];
00029 sprintf(name,"mip%02d",sec);
00030 cc=new TCanvas(name,name,1000,700);
00031 cc->Range(0,0,1,1);
00032 cc->cd();
00033 TPad *c1 = new TPad("pad0", "apd0",0.0,0.,.35,1.);
00034 c1->Draw();
00035 c1->Divide(1,2);
00036
00037
00038 float x1[]={ -20, 40, 60, 40, -20, -80, -170, -220, -240, -220,-160, -80};
00039 float y1[]={ 40, -20, -80, -160,-220,-250, -220, -160, -80, 0, 40, 60};
00040 int is=sec-1;
00041
00042 int i;
00043 for(i=0;i<2;i++) {
00044 sprintf(name,"xy%02d",sec);
00045 if(i==0) sprintf(name,"xy%02dm",sec);
00046
00047 TH2F* h=(TH2F *)f->Get(name); assert(h);
00048 c1->cd(1+i);
00049 h->Draw("colz");
00050 if(i==0) h->SetMaximum(zMax);
00051 h->SetAxisRange(x1[is],x1[is]+180,"X");
00052 h->SetAxisRange(y1[is],y1[is]+180,"Y");
00053 }
00054
00055 cc->cd();
00056 c1 = new TPad("pad0", "apd0",0.35,0.,1.,1.);
00057 c1->Draw();
00058 c1->cd();
00059 c1->Divide(1,2);
00060
00061
00062
00063 int binL=5,binH=50; int ped=20; char cT='T';
00064
00065
00066 sprintf(name,"y%02d",sec);
00067 sprintf(title,"MIP yield per tower, sector=%d; tower ID=sub+eta*5, 1=A12,2=B12,3=C12,...6=A11,..,11=A10, 21=A8, 31=A6, 41=A4, 51=A2",sec);
00068 TH1F * hy=new TH1F(name,title,60,.5,60.5);
00069 sprintf(name,"m%02d",sec);
00070 TH1F * hm=new TH1F(name,"MIP yiled / UxV yield ; tower ID=sub+eta*5, ....(as above)",60,.5,60.5); hm->SetMarkerStyle(20);
00071 hm->SetMarkerColor(kRed);
00072 hm->SetMinimum(-0.001);
00073
00074 int sub,eta=5;
00075
00076 sprintf(name,"ca%02d",sec);
00077
00078 TH1F * huxv=(TH1F *)f->Get(name); assert(huxv);
00079
00080 int ix=0;
00081 for(eta=12;eta>=1;eta--)
00082 for(sub='A';sub<='E';sub++) {
00083 ix++;
00084 sprintf(name,"e%02d%c%c%02d",sec,cT,sub,eta);
00085 TH1F *h1=(TH1F *)f->Get(name); assert(h1);
00086
00087 float nMip=h1->Integral(binL+ped,binH+ped);
00088
00089
00090 int iPhi=(sec-1)*5+sub-'A';
00091 int iSpir=iPhi+(eta-1)*60;
00092 float nUxV=huxv->GetBinContent(iSpir+1);
00093 float rat=-1.;
00094 if(nUxV>0) rat=nMip/nUxV;
00095
00096 printf("x=%2d %s iSpir=%3d nUxV=%d nMip=%d -->R=%.3f\n",ix,name,iSpir,nUxV,nMip,rat);
00097
00098 if(nMip==0) nMip=0.2;
00099 hy->Fill(ix,nMip);
00100
00101 hm->SetBinContent(ix,rat);
00102 hm->SetBinError(ix,sqrt(nMip)/nUxV);
00103
00104 }
00105 c1->cd(1);
00106 hy->Draw("e");
00107 gPad->SetGrid();
00108
00109 hy->SetMinimum(-0.9);
00110 hy->SetMarkerStyle(23);
00111 hy->SetStats(0);
00112 c1->cd(2);
00113
00114 hm->Draw();
00115 hm->SetStats(0);
00116
00117 sprintf(name,"mip%02d.ps",sec); cc->Print(name);
00118 }
00119
00120
00121 pl2Dall(float zMax=10., int bestMip=0, int sepSect=1) {
00122
00123 char *tit="12secUxV";
00124 if(bestMip) tit="12secMIP";
00125 cc=new TCanvas(tit,tit,600,630);
00126 for(int sec=1;sec<=12;sec++) {
00127 char txt[100];
00128 if(sepSect) {
00129 if(sec<10) {TString fname=inPath+"sect0"; fname+=sec; fname+="/sum-sect"; fname+=sec; fname+=".hist.root";}
00130 if(sec>9) {TString fname=inPath+"sect"; fname+=sec; fname+="/sum-sect"; fname+=sec; fname+=".hist.root";}
00131 printf("read each sector from different input file=%s\n",fname.Data());
00132 f=new TFile(fname);
00133 }
00134 TString opt="colz";
00135
00136 if(sec>1) opt+=" same";
00137
00138
00139 sprintf(txt,"xy%02d",sec);
00140 if(bestMip) sprintf(txt,"xy%02dm",sec);
00141 printf("=%s=%s\n",txt,opt.Data());
00142 TH2F *h=(TH2F *)f->Get(txt);
00143 if(sec==1) {
00144 h->SetStats(0);
00145 if(bestMip)
00146 h->SetTitle("MIP position, UxV & Tw & pre/post");
00147 else
00148 h->SetTitle("MIP position, only UxV");
00149 }
00150 assert(h);
00151 h->Draw(opt.Data());
00152 h->SetMaximum(zMax);
00153 float phi=(75-30*(sec-1))/180.*3.1416;
00154 float y=50*sin(phi);
00155 float x=50*cos(phi);
00156 ln=new TLine(x,y,5*x,5*y);
00157 ln->Draw();
00158 continue;
00159 sprintf(txt,"%02d",sec);
00160 tx=new TText(5*x,5*y,txt);
00161 tx->Draw(); tx->SetTextSize(0.03);
00162
00163 }
00164 gPad->SetGrid();
00165 }
00166
00167
00168
00169 void do12(){
00170 int i;
00171 for(i=1;i<=12;i++) plOne(i,30);
00172 }