00001
00002
00003 void doAll() {
00004 for(int i=1;i<=24;i++) plSwap(i);
00005 }
00006
00007 plSwap(float n6=15, int set=20) {
00008 int isBprs=1;
00009 TString tscore="BTOW tower";
00010
00011 char *fname="fixMe";
00012 if(set==10) fname="sum-swapPnTn.hist.root";
00013 if(set==12) fname="sum-swapTyPy.hist.root";
00014
00015 if(set==20) fname="sumD43-70.hist.root";
00016
00017
00018 fd=new TFile(fname); assert(fd->IsOpen());
00019 printf("Work with %s\n", fd->GetName());
00020 gStyle->SetOptStat(0);
00021 gStyle->SetPalette(1,0);
00022 gStyle->SetOptFit(1);
00023
00024
00025 TH2F* hr= BPRS_c0;
00026
00027 TH2F* hm=mipBprsTr;
00028
00029 if(!isBprs) {
00030 hr= BTOW_c0;
00031 TH2F* hm=mipBtowAdc;
00032 }
00033
00034 float y1=-20, y2=80;
00035
00036 TH1I *idealMap=new TH1I("Map11", "ideal map 1:1",4800,0.5,4800.5);
00037 for(int i=1;i<=4800;i++) idealMap->SetBinContent(i,i);
00038 idealMap->SetLineStyle(3); idealMap->SetLineColor(kBlack);
00039
00040
00041 float x1=n6*200-200;
00042 float x2=n6*200;
00043 char txt[100];
00044 sprintf(txt,"%s softID=[%d,%d], with Jan's swaps",tscore.Data(),x1,x2);
00045 x1-=10;
00046 x2+=10;
00047
00048 cM=new TCanvas(tscore+" MAP",tscore+" MAP",480,480);
00049 hMap=(TH2F*)swapScan;
00050 hMap->SetAxisRange(x1,x2,"x");
00051 hMap->SetAxisRange(x1,x2,"y");
00052 hMap ->Draw("colz");
00053 hMap ->SetMinimum(20);
00054 float yMax= hMap->GetMaximum();
00055 if(yMax>20) hMap ->SetMaximum(0.8*yMax);
00056 idealMap->Draw("same");
00057 gPad->SetGrid();
00058
00059
00060 c=new TCanvas(txt,txt,1300,400);
00061
00062 c->Divide(1,2);
00063 c->cd(1); hr->Draw("colz"); gPad->SetLogz();
00064 hr->SetAxisRange(x1,x2);
00065 hr->SetAxisRange(y1,y2,"y");
00066 if(isBprs) {
00067 drawPMBoxes(x1,-22);
00068 TString tt="Raw BPRS spectra, pedestal subtracted, Rory's & Jan's swaps used";
00069 if(!isBprs)tt="Raw BTOW spectra, pedestal subtracted, Jan's swaps used";
00070 tx=new TText(x1+80,y2+7,tt); tx->Draw(); tx->SetTextColor(55);
00071 } else {
00072 drawTowers(x1);
00073 }
00074
00075 c->cd(2); hm->Draw("colz") ;
00076 if(!isBprs) hm->Rebin2D(1,2);
00077 hm->SetAxisRange(x1,x2);
00078 hm->SetAxisRange(-10,50,"y");
00079 hm->SetMaximum(50);
00080 if(isBprs) {
00081 drawPMBoxes(x1,-10.5 );
00082 TString tt="BPRS spectra, gated with TPC MIP tracks, Rory's & Jan's swaps used";
00083 if(!isBprs)tt="BTOW spectra, gated with TPC MIP tracks, Jan's swaps used";
00084 tx=new TText(x1+82,53,tt); tx->Draw(); tx->SetTextColor(55);
00085 } else {
00086 drawTowers(x1);
00087 }
00088
00089 sprintf(txt,"ps/btowAdc%04d.ps",x1);
00090 c->Print(txt);
00091 return;
00092
00093 }
00094
00095
00096 void markPM1(float id1, float y11) {
00097 float y=y11-10, yH=100;
00098 for(int i=0;i<4;i++) {
00099 float x1=id1+i*20;
00100 float x2=x1+4;
00101 ln=new TLine(x1,y+10,x2,y+10); ln->Draw();
00102 ln->SetLineColor(kRed); ln->SetLineWidth(2.);
00103 ln=new TLine(x1,y,x1,yH); ln->Draw();
00104 ln->SetLineColor(kRed);
00105 for(int j=0;j<5;j++) {
00106 float d=j*4;
00107 int iCol=kRed+j;
00108
00109 ln=new TLine(x2+d,y,x2+d,yH); ln->Draw();
00110 ln->SetLineColor(iCol); ln->SetLineStyle(3);
00111 {
00112 char c='F'+i;
00113 TString tt=c; tt+="-";tt+=j+1;
00114 tx=new TText(x1+.5+d,y+4,tt); tx->Draw(); tx->SetTextColor(iCol);
00115 tx->SetTextSize(0.04);
00116 }
00117 }
00118 }
00119 }
00120
00121
00122 drawTowers(int x1) {
00123 float y1=-32, y2=90;
00124 float x0=(x1-1)/20;
00125 x0=0.5+x0*20;
00126 for(int k=0;k<10;k++) {
00127 float x=x0+k*20;
00128 ln=new TLine(x,y1,x,y2); ln->Draw(); ln->SetLineColor(kMagenta);
00129 x=x+10;
00130 ln=new TLine(x,y1,x,y2); ln->Draw(); ln->SetLineColor(kMagenta); ln->SetLineStyle(2);
00131 }
00132 }
00133
00134 drawPMBoxes(int x1,float y11) {
00135 float y1=-32, y2=90;
00136 if(x1<2400) {
00137 int zoff=339;
00138 for(int k=0;k<30;k++) {
00139 int zid=zoff+k*80;
00140 float id=zid%2400 +1+0.5;
00141 int zpmt=24;
00142 int pmtid=1+(zpmt+30-k)%30;
00143
00144 ln=new TLine(id,y1,id,y2);
00145 ln->Draw(); ln->SetLineColor(kMagenta);
00146 TString tt="PMT-"; tt+=pmtid;
00147 tx=new TText(id+30,y2-8,tt); tx->Draw(); tx->SetTextColor(kMagenta);
00148 markPM1(id,y11);
00149 }
00150 } else {
00151 int zoff=2420;
00152 for(int k=0;k<30;k++) {
00153 int zid=zoff+k*80;
00154 float id=zid%2400 +2400+0.5;
00155 int zpmt=32;
00156 int pmtid=31+(zpmt+k)%30;
00157
00158 ln=new TLine(id,y1,id,y2);
00159 ln->Draw(); ln->SetLineColor(kMagenta);
00160 TString tt="PMT-"; tt+=pmtid;
00161 tx=new TText(id+30,y2-8,tt); tx->Draw(); tx->SetTextColor(kMagenta);
00162 markPM1(id,y11);
00163 }
00164 }
00165 }
00166
00167