StEEmcPool/muEztPanitkin/EEqaPresenter.cxx

00001 #include <stdio.h> 00002 #include <assert.h> 00003 00004 #include <TPad.h> 00005 #include <TH2.h> 00006 #include <TF1.h> 00007 #include <TEnv.h> 00008 00009 #include <TPaveStats.h> 00010 #include <TStyle.h> // for gPad 00011 #include <TROOT.h> // for gROOT 00012 #include <TSystem.h> 00013 #include <TMath.h> 00014 00015 const int mxh=64; 00016 static TH1 *hr[mxh] = {0}; 00017 static TH1 *h[mxh] = {0}; 00018 //static TList *hCleanUp=new TList; 00019 00020 00021 #include "EEqaPresenter.h" 00022 TStyle *defStyle=0; 00023 TStyle *ee1Style=0; 00024 00025 00026 //-------------------------------------- 00027 //-------------------------------------- 00028 void eePlotInit() { 00029 defStyle=gROOT->GetStyle("Default"); 00030 ee1Style= new TStyle("ee1STyle","ee1Style (general, minimal Stat)"); 00031 ee1Style->SetOptStat(11); 00032 ee1Style->SetPalette(1); 00033 // ee1Style->cd(); 00034 ee1Style->SetTextSize(0.09); 00035 } 00036 00037 //-------------------------------------- 00038 //-------------------------------------- 00039 void GetHisto(FileType &fd,char *name, int i) { 00040 // this is very silly trick to avoid memory leak in the online version 00041 hr[i] = 0; 00042 h[i] = 0; 00043 hr[i] = (TH1*)fd.Get(name, hr[i]); 00044 if (!hr[i]) return; 00045 hr[i]->SetDirectory(0); 00046 h[i] = hr[i]; 00047 // h[i]=(TH1*) hr[i]->Clone(); 00048 // hCleanUp->Add(h[i]); 00049 } 00050 00051 //-------------------------------------- 00052 //-------------------------------------- 00053 void 00054 eePlot(int page, int panel,FileType fd, TPad *cc, const Char_t *eemcTwMaskFilename){ 00055 static int first=1; 00056 static EemcTwMask *twMask=0; 00057 if(first) { 00058 bool twMaskFound=false; 00059 twMask =new EemcTwMask; 00060 eePlotInit(); 00061 // const char *maskFile = gEnv->GetValue("OnLine.eemcMask","eemcTwMask.dat"); 00062 twMaskFound=useTwMask(eemcTwMaskFilename, twMask); 00063 00064 first=0; 00065 if(!twMaskFound) { delete twMask; twMask=0;} 00066 } 00067 00068 ee1Style->cd(); // use my default style 00069 // hCleanUp->Delete(); 00070 cc->Clear(); 00071 00072 if(page==10) { 00073 switch(panel) { 00074 case 1: eeJpQa(fd, cc, twMask); break; 00075 case 2: eeDaqCorr(fd, cc,1); break; 00076 case 3: eeFreq(fd, cc, twMask); break; 00077 case 4: eeDaqTwCr(fd, cc, twMask); break; 00078 case 5: eeDaqTwHot(fd, cc, twMask); break; 00079 case 6: eeDaqTwHit(fd, cc); break; 00080 default: plNone(cc); break; 00081 } 00082 } else if (page==11) { 00083 switch(panel) { 00084 case 1: eeDaqCorr(fd, cc,2); break; 00085 case 2: eeDaqMapmtStat(fd, cc); break; 00086 case 3: eeDaqMapmtCr(fd, cc,64); break; 00087 case 4: eeDaqMapmtCr(fd, cc,72); break; 00088 case 5: eeDaqMapmtCr(fd, cc,80); break; 00089 case 6: eeDaqMapmtCr(fd, cc,88); break; 00090 case 7: eeDaqMapmtCr(fd, cc,96); break; 00091 case 8: eeDaqMapmtCr(fd, cc,104); break; 00092 case 9: eeDaqSmdA(fd, cc,"SmdA",'U'); break; 00093 case 10: eeDaqSmdA(fd, cc,"SmdA",'V'); break; 00094 case 11: eeDaqSmdA(fd, cc,"HSmd",'U'); break; 00095 case 12: eeDaqSmdA(fd, cc,"HSmd",'V'); break; 00096 default: plNone(cc); break; 00097 } 00098 } else if (page==12) { 00099 switch(panel) { 00100 case 1: eeTrigHanks(fd, cc); break; 00101 case 2: eeTrigDsm0(fd, cc,"HT"); break; 00102 case 3: eeTrigDsm0(fd, cc,"TP"); break; 00103 case 4: eeTrigDsm1(fd, cc,"HT"); break; 00104 case 5: eeTrigDsm1(fd, cc,"TP"); break; 00105 case 6: eeTrigDsm2HT(fd, cc); break; 00106 case 7: eeTrigJPsum(fd, cc,"_sum"); break; 00107 case 8: eeTrigJPfreq(fd, cc); break; 00108 case 9: eeTrigAdjJPsum(fd, cc,"_sum"); break; 00109 case 10: eeTrigAdjJPcor(fd, cc,"_cor"); break; 00110 case 11: eeTrigEtot(fd, cc); break; 00111 default: plNone(cc); break; 00112 } 00113 00114 } 00115 // defStyle->cd(); // retun to default style 00116 printf("JB panel=%d page=%d done\n",panel,page); 00117 00118 } 00119 00120 //-------------------------------------- 00121 //-------------------------------------- 00122 void plNone( TPad *c){ 00123 static TText txt(0.05,.5,"tempo disabled, Jan"); 00124 c->Clear(); 00125 txt.Draw(); 00126 } 00127 00128 //-------------------------------------- 00129 //-------------------------------------- 00130 void eeJpQa(FileType fd, TPad *c0, EemcTwMask *m) { // out 00131 c0->Clear(); 00132 c0->cd(0); 00133 00134 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.); 00135 c->Draw(); c->cd(); 00136 c->Divide(2,2); 00137 char *name1[]={"JPpedZoom","JPtotCor","JPtotFreq","JPpedHot"}; 00138 char *name2[]={"JPpedZoom","JPsumTh3","JPtotFreq","xx"}; 00139 //printf("m=%p\n",m); 00140 char **name=name1; 00141 if(m==0) name=name2; // dirty trick, JB 00142 int i; 00143 for(i=0;i<4;i++) { 00144 // printf("%d %s\n",i,name[i]); 00145 GetHisto(fd,name[i],i); 00146 if( h[i]==0) continue; 00147 c->cd(1+i); 00148 if(i==0) 00149 h[i]->Draw("colz"); 00150 else 00151 h[i]->Draw("b"); 00152 if(i==0) gPad->SetLogz(); 00153 } 00154 // extra steps 00155 if(h[2]) { 00156 eeJpQaMinMax(h[2]); 00157 } 00158 if(h[1]) { 00159 eeJpQaMinMax(h[1]); 00160 } 00161 00162 if(m==0) return; 00163 if(h[3] && h[1]) {// start counting hot towers 00164 TH1* H4jpHot=h[3]; 00165 H4jpHot->Reset(); // should be here, but online works w/o it 00166 00167 int cr; 00168 char tit[100]; 00169 for(cr=1;cr<6;cr++) { 00170 sprintf(tit,"cr%dHot",cr); 00171 GetHisto(fd,tit,4+cr); 00172 TH1F * hx=( TH1F *)h[4+cr]; 00173 if (!hx) continue; 00174 if(hx->Integral()<=50 ) continue; 00175 if(hx->GetRMS()<=2.) continue; 00176 hx->Fit("pol0","0Q"); 00177 TF1 * ff=hx->GetFunction("pol0"); 00178 // assert(ff); 00179 float yM=ff->GetParameter(0); 00180 // printf("fit(%s) yM=%f\n",hx->GetName(),yM); 00181 00182 int nb=hx->GetNbinsX(); 00183 int k; 00184 for(k=1;k<=nb;k++){ 00185 if(hx->GetBinContent(k)<10*yM) continue; 00186 if(m->crCh[cr-1][k-1]) continue; // ignore masked channels 00187 printf(" hot cr=%d ch=%d val=%f\n",cr,k-1,hx->GetBinContent(k)); 00188 H4jpHot->Fill(cr); 00189 } 00190 } 00191 } 00192 // write text on the left 00193 c0->cd(0); 00194 TPad *c3 = new TPad("pad3", "apd3",0.,0.,1.,.1); 00195 c3->Draw(); 00196 c3->cd(); 00197 m->txtH->Draw(); 00198 00199 } 00200 00201 //-------------------------------------- 00202 //-------------------------------------- 00203 void eeDaqCorr(FileType fd, TPad *c, int es) { // out 00204 00205 static TPad *c2 =0; 00206 static TPad *c3 =0; 00207 00208 // if(c2) delete c2; // to avoid memory leak, breaks in online 00209 00210 char *nameT[]={"ETowHealth","ETowHeadCorr","ETowOFF","ETowN256","ETowOFFid","ETowGhost","ETowCorrBit"}; 00211 char *nameE[]={"ESmdHealth","ESmdHeadCorr","ESmdOFF","ESmdN256","ESmdOFFid","ESmdGhost","ESmdCorrBit"}; 00212 00213 char **name=nameT; 00214 float y1=0.3; 00215 int n1=6; 00216 if(es==2) { 00217 name=nameE; 00218 y1=0.45; 00219 n1=4; 00220 } 00221 00222 int i; 00223 c->cd(0); 00224 c2 = new TPad("pad2", "apd2",0.0,y1+0.01,1.,1.); 00225 c2->Draw(); c2->cd(); 00226 c2->Divide(2,n1/2); 00227 00228 for(i=0;i<n1;i++) { 00229 // printf("%d %s\n",i,name[i]); 00230 GetHisto(fd,name[i],i); 00231 if( h[i]==0) continue; 00232 c2->cd(1+i); 00233 h[i]->Draw(); 00234 // gPad->SetLogy(0); 00235 // if(h[i]->Integral()>0 ) gPad->SetLogy(); 00236 // if(i<2) gPad->SetLogx(); 00237 } 00238 00239 if(es==2) { 00240 c->cd(0); 00241 float y2=y1*0.7; 00242 c2 = new TPad("pad2", "apd2",0.0,y2,1.,y1); 00243 y1=y2; 00244 c2->Draw(); c2->cd(); 00245 i=4; 00246 GetHisto(fd,name[i],i); 00247 if (h[i]) { 00248 h[i]->Draw(); 00249 if(h[i]->Integral()>0 ) gPad->SetLogy(); 00250 } 00251 } 00252 00253 00254 c2->cd(5); 00255 gPad->SetGridx(); 00256 00257 c->cd(0); 00258 c3 = new TPad("pad3", "apd3",0.0,0.,1.,y1); 00259 c3->Draw(); 00260 c3->cd(); 00261 i=6; 00262 GetHisto(fd,name[i],i); 00263 if (h[i]) { 00264 h[i]->Draw(); 00265 gPad->SetGridx(); 00266 } 00267 } 00268 00269 00270 //-------------------------------------- 00271 //-------------------------------------- 00272 00273 void eeDaqTwCr(FileType fd, TPad *c, EemcTwMask *m) { 00274 // raw tower crates 1-6 00275 // ee2Style->cd(); 00276 00277 char tit[100]; 00278 c->Divide(3,2); 00279 int i; 00280 for(i=0;i<6;i++) { 00281 sprintf(tit,"cr%d",i+1); 00282 GetHisto(fd,tit,i); 00283 if (h[i]) { 00284 c->cd(i+1); 00285 gPad->SetLogz(0); 00286 h[i]->Draw("colz"); 00287 h[i]->SetAxisRange(0,500); 00288 if(h[i]->Integral()>0 )gPad->SetLogz(); 00289 TGraphErrors *gr= m->crG2+i; 00290 if(gr->GetN()>0) gr->Draw("P"); 00291 } 00292 } 00293 00294 } 00295 00296 //-------------------------------------- 00297 //-------------------------------------- 00298 00299 void eeFreq(FileType fd, TPad *c, EemcTwMask *m) { 00300 const int nh=4; 00301 char *name[nh]={"TowHits","Pre1Hits","Pre2Hits","PostHits"}; 00302 int i; 00303 c->Divide(1,4); 00304 for(i=0;i<nh;i++) { 00305 GetHisto(fd,name[i],i); 00306 //printf("i=%d =%s= p=%p\n",i,name[i],h[i]); 00307 if(h[i]==0) continue; 00308 // printf("name=%s=\n",h[i]->GetName()); 00309 c->cd(1+i); 00310 gPad->SetLogz(0); 00311 h[i]->Draw("colz"); 00312 gPad->SetGrid(); 00313 if(h[i]->Integral()>0 ) gPad->SetLogz(); 00314 if(i==0 && m->phiG.GetN()>0){ // show hot towers 00315 m->phiG.Draw("P"); 00316 } 00317 } 00318 if(h[0]) addJPphiLimits(h[0]); 00319 00320 } 00321 00322 //-------------------------------------- 00323 //-------------------------------------- 00324 void eeDaqTwHit(FileType fd, TPad *c) { 00325 const int nh=4; 00326 00327 char *name[nh]={"HTow","HPre1","HPre2","HPost"}; 00328 00329 int i; 00330 00331 c->Divide(2,2); 00332 00333 for(i=0;i<nh;i++) { 00334 GetHisto(fd,name[i],i); 00335 if (h[i]) { 00336 c->cd(1+i); 00337 gPad->SetLogy(0); 00338 h[i]->Draw(); 00339 if(h[i]->Integral()>0 ) gPad->SetLogy(); 00340 } 00341 } 00342 } 00343 00344 00345 //-------------------------------------- 00346 //-------------------------------------- 00347 void eeMany1D(FileType fd, TPad *c, char *core, int nh, int nx, int ny) { 00348 int linLog=1; 00349 char tit[100]; 00350 c->Divide(nx,ny); 00351 00352 int i; 00353 00354 for(i=0;i<nh;i++) { 00355 sprintf(tit,"%s%d",core,i+1); 00356 GetHisto(fd,tit,i); 00357 if (h[i]) { 00358 c->cd(i+1); 00359 h[i]->Draw(); 00360 gPad->SetLogy(0); 00361 if (h[i]->Integral()>0 && linLog==1) gPad->SetLogy(); 00362 } 00363 } 00364 } 00365 00366 00367 00368 //-------------------------------------- 00369 //-------------------------------------- 00370 00371 void eeDaqTwHot(FileType fd, TPad *c, EemcTwMask *m) { 00372 const int ncr=6; // raw tower crates 1-6 00373 int i; 00374 float ymax=2; 00375 00376 char tit[100]; 00377 c->Divide(1,ncr); 00378 for(i=0;i<ncr;i++) { 00379 sprintf(tit,"cr%dHot",i+1); 00380 GetHisto(fd,tit,i); 00381 if (h[i]) { 00382 c->cd(i+1); 00383 gPad->SetLogy(0); 00384 gPad->SetGridx(); 00385 h[i]->Draw("b"); 00386 TH1F * hx=( TH1F *)h[i]; 00387 if(hx->Integral()<=10 ) continue; 00388 if(hx->GetRMS()<=2.) continue; 00389 if(hx->Integral()>1) gPad->SetLogy(); 00390 hx->Fit("pol0"); 00391 TF1 * ff=hx->GetFunction("pol0"); 00392 float yM=ff->GetParameter(0); 00393 if(ymax<yM) ymax=yM; 00394 TGraph *gr= m->crG+i; 00395 if(gr->GetN()>0) gr->Draw("P"); 00396 } 00397 } 00398 00399 int j; 00400 for(j=0;j<6;j++) { 00401 if(h[j]==0) continue; 00402 h[j]->SetMaximum(ymax*20.); 00403 } 00404 00405 } 00406 00407 //-------------------------------------- 00408 //-------------------------------------- 00409 00410 void eeDaqMapmtCr(FileType fd, TPad *c,int cr1) { 00411 //raw mapmt crates 84-91 or 92-99 00412 int cr; 00413 char tit[100]; 00414 c->Divide(4,2); 00415 for(cr=cr1;cr<=cr1+7;cr++) { 00416 int i=cr-cr1; 00417 sprintf(tit,"cr%d",cr); 00418 GetHisto(fd,tit,i); 00419 if (h[i]) { 00420 c->cd(cr-cr1+1); 00421 gPad->SetLogz(0); 00422 h[i]->Draw("colz"); 00423 h[i]->SetAxisRange(0,1000); 00424 if(h[i]->Integral()>0 ) gPad->SetLogz(); 00425 } 00426 } 00427 00428 } 00429 00430 //-------------------------------------- 00431 //-------------------------------------- 00432 00433 void eeDaqSmdA(FileType fd, TPad *c, char *core,char uv){ 00434 00435 char tit[100]; 00436 if( strstr(core,"SmdA")) 00437 c->Divide(2,6); 00438 else 00439 c->Divide(3,4); 00440 00441 int sec; 00442 int i=0; 00443 for(sec=1;sec<=12;sec++) { 00444 sprintf(tit,"%s%d%c",core,sec,uv); 00445 GetHisto(fd,tit,i); 00446 // printf("i=%d =%s= p=%p\n",i,tit,h[i]); 00447 if( h[i]==0) continue; 00448 c->cd(i+1); 00449 h[i]->Draw(); 00450 gPad->SetLogy(0); 00451 if (h[i]->Integral()>0 ) gPad->SetLogy(); 00452 i++; 00453 00454 } 00455 } 00456 00457 //-------------------------------------- 00458 //-------------------------------------- 00459 void eeDaqMapmtStat(FileType fd, TPad *c) { 00460 // static TH2F *h2=0; 00461 int i=0; 00462 c->Divide(1,2); 00463 GetHisto(fd,"MAPMHits",i); 00464 if(h[i]==0) return; 00465 TH2F *h2 = (TH2F*)h[i]; 00466 //h2=(TH2F *) h[i]->Clone(); 00467 00468 c->cd(1); 00469 h2->Draw("colz"); 00470 gPad->SetGrid(); 00471 h2->SetAxisRange(63,87); 00472 h2->SetXTitle("Crate ID 12S1=64, 1S1=68, 2S1=72, 3S1=76, 4S1=80, 5S1=84"); 00473 gPad->SetLogz(0); 00474 if (h2->Integral()>0) gPad->SetLogz(); 00475 00476 00477 c->cd(2); 00478 h2=(TH2F *) h[i]; 00479 h2->Draw("colz"); 00480 gPad->SetGrid(); 00481 h2->SetAxisRange(88,120); 00482 h2->SetXTitle("Crate ID 6S1=88, 7S1=92, 8S1=96, 9S1=100, 10S1=104, 11S1=108"); 00483 gPad->SetLogz(0); 00484 if (h[i]->Integral()>0) gPad->SetLogz(); 00485 00486 } 00487 00488 00489 00490 //-------------------------------------- 00491 //-------------------------------------- 00492 void eeTrigHanks(FileType fd, TPad *c ) { 00493 00494 char *name[2]={"dsm0inJPall_HT","dsm0inJPall_TP"}; 00495 c->Divide(1,2); 00496 00497 int i; 00498 for(i=0;i<2;i++) { 00499 GetHisto(fd,name[i],i); 00500 // printf("aaa%d %s %p\n",i,name[i],h[i]); 00501 if (h[i]) { 00502 c->cd(1+i); 00503 gPad->SetLogz(0); 00504 h[i]->Draw("colz"); 00505 if( h[i]->Integral()>0 ) gPad->SetLogz(); 00506 } 00507 } 00508 00509 } 00510 00511 00512 //-------------------------------------- 00513 //-------------------------------------- 00514 void eeTrigDsm0(FileType fd, TPad *c, char *mode ) { 00515 char tit[100]; 00516 c->Divide(2,3); 00517 00518 float ymax=0; 00519 int j; 00520 00521 for(j=0;j<6;j++) { 00522 sprintf(tit,"dsm0inJP%d_%s",j+1,mode); 00523 c->cd(j+1); 00524 GetHisto(fd,tit,j); 00525 if (h[j]) { 00526 gPad->SetLogz(0); 00527 h[j]->Draw("colz"); 00528 if(ymax<h[j]->GetMaximum()) ymax=h[j]->GetMaximum(); 00529 00530 if ( h[j]->Integral()>0 ) gPad->SetLogz(); 00531 } 00532 } 00533 00534 for(j=0;j<6;j++) { 00535 if(h[j]==0) continue; 00536 h[j]->SetMaximum(ymax); 00537 } 00538 } 00539 00540 //-------------------------------------- 00541 //-------------------------------------- 00542 void eeTrigDsm1(FileType fd, TPad *c, char *mode ) { 00543 char tit[100]; 00544 char *core="dsm1HJP"; 00545 int j; 00546 00547 if(mode[0]=='H') 00548 c->Divide(2,6); 00549 else 00550 c->Divide(4,3); 00551 00552 float ymax=0; 00553 00554 for(j=0;j<12;j++) { 00555 00556 sprintf(tit,"%s%d_%s",core,j+1,mode); 00557 GetHisto(fd,tit,j); 00558 if (h[j]) { 00559 c->cd(j+1); 00560 h[j]->Draw("colz"); 00561 gPad->SetLogz(0); 00562 if(ymax<h[j]->GetMaximum()) ymax=h[j]->GetMaximum(); 00563 00564 if ( h[j]->Integral()>0 ) gPad->SetLogz(); 00565 if(mode[0]=='H') gPad->SetGridx(); 00566 } 00567 } 00568 00569 00570 for(j=0;j<12;j++) { 00571 if(h[j]==0) continue; 00572 h[j]->SetMaximum(ymax); 00573 } 00574 00575 } 00576 //-------------------------------------- 00577 //-------------------------------------- 00578 void eeTrigDsm2HT(FileType fd, TPad *c ) { 00579 00580 char *name[3]={"dsm2Half1_HTTP","dsm2Half2_HTTP","dsm3_HTTP"}; 00581 c->Divide(2,2); 00582 00583 int i; 00584 for(i=0;i<3;i++) { 00585 GetHisto(fd,name[i],i); 00586 if (h[i]) { 00587 c->cd(1+i); 00588 gPad->SetLogz(0); 00589 00590 h[i]->Draw("colz"); 00591 if( h[i]->Integral()>0 ) gPad->SetLogz(); 00592 } 00593 } 00594 00595 } 00596 00597 00598 00599 //-------------------------------------- 00600 //-------------------------------------- 00601 void eeTrigJPsum(FileType fd, TPad *c, char *mode ) { 00602 00603 char tit[100]; 00604 char newtitle[500]; 00605 00606 c->Divide(2,3); 00607 00608 char *core="JP"; 00609 int j; 00610 for(j=0;j<6;j++) { 00611 sprintf(tit,"%s%d%s",core,j+1,mode); 00612 //printf("%s %d\n",tit,j); 00613 GetHisto(fd,tit,j); 00614 if (h[j]) { 00615 c->cd(j+1); 00616 int maxbin=h[j]->GetMaximumBin()-1; 00617 //printf("max bin = %d\n",maxbin); 00618 const char *title=h[j]->GetTitle(); 00619 sprintf(newtitle,"%s ped= %d\n",title,maxbin); 00620 //printf("%s",newtitle); 00621 h[j]->SetTitle(newtitle); 00622 gPad->SetLogy(0); 00623 h[j]->GetXaxis()->SetRange(1,200); //for p-p commnet out and use full range for Au-Au 00624 h[j]->Draw(); 00625 if(h[j]->Integral()>0 ) gPad->SetLogy(); 00626 } 00627 } 00628 00629 } 00630 00631 00632 //-------------------------------------- 00633 //-------------------------------------- 00634 void eeTrigJPfreq(FileType fd, TPad *c) { 00635 00636 char tit[100]; 00637 00638 c->Divide(2,3); 00639 char *core="JPsumTh"; 00640 int j; 00641 for(j=0;j<4;j++) { 00642 sprintf(tit,"%s%d",core,j); 00643 //printf("%s %d\n",tit,j); 00644 GetHisto(fd,tit,j); 00645 if (h[j]) { 00646 //printf("h=%p\n",h[j]); 00647 c->cd(j+1); 00648 h[j]->Draw(); 00649 h[j]->SetMinimum(0.); 00650 } 00651 } 00652 00653 00654 for(j=0;j<2;j++) { 00655 sprintf(tit,"dsm2Half%d_Etot",j+1); 00656 GetHisto(fd,tit,j); 00657 if (h[j]) { 00658 c->cd(j+5); 00659 h[j]->Draw(); 00660 } 00661 } 00662 00663 #if 0 // out 2006+ 00664 GetHisto(fd,"JPadjTh",5); 00665 c->cd(5); 00666 if (h[5]) h[5]->Draw(); 00667 #endif 00668 00669 } 00670 00671 //-------------------------------------- 00672 //-------------------------------------- 00673 void eeTrigAdjJPsum(FileType fd, TPad *c, char *mode ) { 00674 00675 char tit[100]; 00676 00677 c->Divide(2,3); 00678 00679 char *core="JP"; 00680 int j; 00681 for(j=0;j<6;j++) { 00682 sprintf(tit,"%s%d%d%s",core,j+1,((j+1)%6)+1,mode); 00683 //printf("%s %d\n",tit,j); 00684 GetHisto(fd,tit,j); 00685 if (h[j]) { 00686 c->cd(j+1); 00687 gPad->SetLogy(0); 00688 // h[j]->GetXaxis()->SetRange(19,69); //for p-p commnet out and use full range for Au-Au 00689 h[j]->Draw(); 00690 if(h[j]->Integral()>0 ) gPad->SetLogy(); 00691 } 00692 } 00693 00694 } 00695 00696 00697 //-------------------------------------- 00698 //-------------------------------------- 00699 void eeTrigEtot(FileType fd, TPad *c ) { 00700 00701 char *nameA[3]={"dsm2E_etot","dsm2B_etot","dsm2BE_etot"}; 00702 c->Divide(1,3); 00703 00704 int i; 00705 int k=0; 00706 char name[20]; 00707 for(i=0;i<3;i++) { 00708 c->cd(1+i); 00709 gPad->SetLogy(0); 00710 int ii; 00711 for(ii=0;ii<=1;ii++) { 00712 sprintf(name,"%s%d",nameA[i],ii); 00713 GetHisto(fd,name,k); 00714 if (h[k]) { 00715 if(ii==0 ) { 00716 h[k]->Draw(); 00717 TString tt=h[k]->GetTitle(); 00718 tt+=" COLORS: bit=0 BLUE , bit=1 RED"; 00719 h[k]->SetTitle(tt); 00720 } else h[k]->Draw("same"); 00721 if( ii==0&&h[k]->Integral()>0 ) gPad->SetLogy(); 00722 } 00723 k++; 00724 } 00725 } 00726 // return; 00727 00728 // lock maxY 00729 float ymax=0; 00730 int j; 00731 for(j=0;j<6;j++) { 00732 if(h[j]==0) continue; 00733 if(ymax< h[j]->GetMaximum() ) ymax= h[j]->GetMaximum(); 00734 } 00735 00736 for(j=0;j<6;j++) { 00737 if(h[j]==0) continue; 00738 h[j]->SetMaximum(ymax*1.1); 00739 } 00740 } 00741 00742 //-------------------------------------- 00743 //-------------------------------------- 00744 void eeTrigAdjJPcor(FileType fd, TPad *c, char *mode ) { 00745 00746 char tit[100]; 00747 00748 c->Divide(3,2); 00749 00750 char *core="JP"; 00751 int j; 00752 for(j=0;j<6;j++) { 00753 sprintf(tit,"%s%d%d%s",core,j+1,((j+1)%6)+1,mode); 00754 //printf("%s %d\n",tit,j); 00755 GetHisto(fd,tit,j); 00756 if (h[j]) { 00757 c->cd(j+1); 00758 gPad->SetLogz(0); 00759 h[j]->Draw("colz"); 00760 if ( h[j]->Integral()>0) gPad->SetLogz(); 00761 } 00762 } 00763 00764 } 00765 00766 //-------------------------------------- 00767 //-------------------------------------- 00768 bool useTwMask(const char *fname, EemcTwMask *m) { 00769 const int mx=1000; 00770 char buf[mx]; 00771 00772 printf("EEqaPresenter::useTwMask(\'%s') ...\n",fname); 00773 00774 FILE * fd=fopen(fname,"r"); 00775 int nok=0; 00776 int nM=1; 00777 m->txtH=new TPaveText(0,0.,1,1); 00778 TString myTxt="ETOW masked (cr-ch-name): "; 00779 if(fd==0) goto abandon; 00780 while (1) { 00781 char * ret=fgets(buf,mx,fd); 00782 if(ret==0) break ; //EOF 00783 if(buf[0]=='#') continue; // skip comment 00784 if(buf[0]=='\n') continue; // skip empty lines 00785 // printf("uu=%s=%d\n",buf,ret); 00786 char name[100]; 00787 int cr,ch; 00788 int sec,isub,jeta,jphi; 00789 int n=sscanf(buf,"%d %d %s",&cr, &ch, name); 00790 if(n!=3) goto abandon; 00791 if(cr<1 || cr>m->nCr || ch<0 || ch>=m->nCh) goto abandon; 00792 if(name[2]!='T') goto abandon; 00793 sec=atoi(name); 00794 isub=name[3]-'A'; 00795 jeta=atoi(name+4); 00796 jphi=(sec-1)*5+isub; 00797 // printf("%s sec=%d isub=%d jeta=%d, jphi=%d\n",name, sec,isub,jeta,jphi); 00798 00799 m->crCh[cr-1][ch]=1; 00800 int jj=m->crG[cr-1].GetN(); 00801 m->crG[cr-1].SetPoint(jj,ch,10); 00802 m->crG2[cr-1].SetPoint(jj,250,ch); 00803 m->crG2[cr-1].SetPointError(jj,250,0.); 00804 00805 jj=m->phiG.GetN(); 00806 m->phiG.SetPoint(jj,jphi,jeta); 00807 char tt[100]; 00808 sprintf(tt,"%d-%d-%s, ",cr,ch,name); 00809 myTxt+=tt; 00810 nok++; 00811 nM++; 00812 printf("mask ETOW cr=%d ch=%d =%s=\n",cr,ch,name); 00813 if(nM%4==0) { 00814 m->txtH->AddText(myTxt); 00815 myTxt=" "; 00816 } 00817 } 00818 m->nMask=nok; 00819 m->txtH->AddText(myTxt); m->txtH->AddText("--"); 00820 printf(" got %d masked towers\n",nok); 00821 00822 int i; 00823 for(i=0;i<6;i++){ 00824 m->crG[i].SetMarkerStyle(23); 00825 m->crG[i].SetMarkerColor(kRed); 00826 m->crG2[i].SetMarkerStyle(1); 00827 m->crG2[i].SetLineColor(kRed); 00828 } 00829 00830 m->phiG.SetMarkerStyle(24); 00831 00832 return 1; 00833 abandon: // any error has happened (this is a new approach for me, JB) 00834 m->clear(); 00835 m->txtH->AddText("List of ETOW hot towers not found"); m->txtH->AddText("--"); 00836 printf(" EEqaPresenter::useTwMask() FAILED\n"); 00837 return 0; 00838 } 00839 00840 00841 //-------------------------------------- 00842 //-------------------------------------- 00843 void addJPphiLimits(TH1 *h){ 00844 TList *Lx= h->GetListOfFunctions(); 00845 if(Lx->GetSize()>0) return; // do it just once 00846 int i; 00847 for(i=0;i<=5;i++) { // boundarioes for JP 00848 float x1=2.5+i*10; 00849 TLine *ln=new TLine(x1,-0.2,x1,12.5); 00850 Lx->Add(ln); 00851 int jpid=i+2; 00852 if(jpid==7)jpid=1; 00853 TString aa="Jet Patch "; aa+=jpid; 00854 TText *tt=new TText(x1+1,12.6,aa); 00855 tt->SetTextSize(0.08); 00856 Lx->Add(tt); 00857 } 00858 00859 } 00860 00861 //-------------------------------------- 00862 //-------------------------------------- 00863 void eeJpQaMinMax(TH1 *hh) { 00864 hh->SetAxisRange(0.5,6.4); 00865 hh->SetMinimum(0.); 00866 int ib= hh->GetMaximumBin(); 00867 float yMax=hh->GetBinContent(ib); 00868 ib= hh->GetMinimumBin(); 00869 float yMin=hh->GetBinContent(ib); 00870 float r=0,er=999; 00871 if(yMin<=0) yMin=1; 00872 if(yMax<=0) yMax=1; 00873 r=yMin/yMax; 00874 er=r*TMath::Sqrt(1/yMax + 1/yMin); 00875 printf("JP min/max=%.2f +/- %.2f (min=%.0f max=%.0f) \"%s\"\n",r,er,yMin, yMax,hh->GetTitle()); 00876 printf("#JP %.2f %.2f %.0f %.0f :%s\n",r,er,yMin, yMax,hh->GetTitle()); 00877 }

Generated on Tue Feb 17 04:54:27 2009 for StRoot by doxygen 1.3.7