--- quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx 2006/07/13 10:13:37 1.8 +++ quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx 2006/08/11 10:24:09 1.9 @@ -2,7 +2,7 @@ * FTrkCalibQLookExpert.cxx * * autor: D.Fedele - * version v1r06 + * version v1r08 * Parameters: * file - the data file to analyze * step - select =1 in order to analyze one event at time @@ -187,7 +187,6 @@ //********************************************************************** Int_t hcevent=hotr->GetEntries(); - printf("\n%d\n",hcevent); ULong64_t HOBT[hcevent], TOBT[hcevent]; for (Int_t i = 0; i < hcevent; i++){ totr->GetEntry(i); @@ -266,21 +265,25 @@ Int_t risposta=0; stringstream fromfile; - printf("\n\t%d\n",cod->Get(pctp->CalibHeader)); fromfile<<"FTrkCalibQLook_EXPERT File: "<SetLabelSize(0.08,"x"); - gStyle->SetLabelSize(0.08,"y"); + gStyle->SetLabelSize(0.07,"x"); + gStyle->SetLabelSize(0.07,"y"); gStyle->SetTitleFillColor(10); - gStyle->SetTitleFontSize(0.1); + gStyle->SetTitleFontSize(0.08); gStyle->SetTitleOffset(0.8,"y"); - gStyle->SetTitleOffset(1.,"x"); + gStyle->SetTitleOffset(0.9,"x"); gStyle->SetTitleSize(0.06,"y"); gStyle->SetTitleSize(0.06,"x"); - gStyle->SetOptStat(0); + gStyle->SetOptStat(101110); + gStyle->SetStatX(0.9); + gStyle->SetStatW(0.4); + gStyle->SetStatColor(10); + gStyle->SetStatFontSize(0.1); // // draw display area + TLatex *tzz=new TLatex(); tzz->SetTextFont(32); tzz->SetTextColor(1); @@ -297,13 +300,25 @@ tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); tzz->DrawLatex(.90,0.98,"SIGMA"); + + TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy); + sig->SetFillColor(10); + tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); + tzz->DrawLatex(.85,0.97,"Histograms of the sigmas"); + + + // draw pads - TPad *trkpad1[12],*trkpad2[12]; //pad for histos + TPad *trkpad1[12],*trkpad2[12],*trkpad3[36]; //pad for histos TPaveText *trkpadtext[12]; //pad for header TH1F *histosig[12]; //histos of sigma TH1F *histoped[12]; //histos of pedestals TH1F *histoasig[12]; //histos of sigma TH1F *histoaped[12]; //histos of pedestals + + TH1F *histosiglad[12][3]; //histos of sigma + stringstream title; + stringstream hid; Float_t posy = 0.95; // up y-coord - top pads Float_t hpad = 0.15; // pad height @@ -312,19 +327,20 @@ Float_t posx0=0; // x-coord - column division Float_t wrel = 0.6; // relative x size of first sub-column Float_t marg = 0.004; // margin among pads - stringstream title; - stringstream hid; + for(Int_t n = 0; n<12; n++){ if ( (n+1)%2 ) { if(n>1)posy = posy-(marg*2+hpad); posx1 = marg; posx2 = 0.5 - marg; posx0 = 0.5*wrel; + } else { posx1 = posx1 + 0.5; posx2 = posx2 + 0.5; posx0 = posx0 + 0.5; + }; /* -----------> pad for histograms */ trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); @@ -341,7 +357,6 @@ histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); hid.str(""); hid<<"hhh"<1) tposy = tposy-(tmarg*2+thpad); + tposx1 = tmarg; + tposx0 = tposx1 + twrel; + } else { + tposx1 = tposx0 + 2*tmarg; + tposx0 = tposx1 + twrel; + } + trkpad3[n]= new TPad("pad3"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); + } + + stringstream message; - + //-------------------------------- //CHECK CALIBRATION procedure //-------------------------------- @@ -362,7 +406,7 @@ Int_t calok = 0;//BAD for(Int_t n = 0; n<12; n++){ if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD - + nn=ctrk.dspnum[n]-1; /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* @@ -438,6 +482,9 @@ for(Int_t j = 0; j < 3072; j++){ histosig[nn]->Fill((Float_t)j,ctrk.dspsig[nn][j]); histoped[nn]->Fill((Float_t)j,ctrk.dspped[nn][j]); + if(j<1024) histosiglad[nn][0]->Fill(ctrk.dspsig[nn][j]); + if(j>=1024 && j<2048) histosiglad[nn][1]->Fill(ctrk.dspsig[nn][j]); + if(j>=2048 && j<3072) histosiglad[nn][2]->Fill(ctrk.dspsig[nn][j]); }; histoasig[nn]->Fill(1,ctrk.sig1[nn]); histoasig[nn]->Fill(1025,ctrk.sig2[nn]); @@ -454,8 +501,6 @@ Float_t maxhist=0; TBox b; - b.SetFillColor(6); - b.SetFillStyle(3945); /* plot PEDESTAL */ c1->cd(); trkpadtext[nn]->Draw(); @@ -463,6 +508,7 @@ trkpad1[nn]->cd(); trkpad1[nn]->SetFillColor(10); trkpad1[nn]->SetFrameFillColor(10); + histoped[nn]->SetStats(kFALSE); histoped[nn]->SetLineColor(1); histoped[nn]->SetFillColor(12); histoped[nn]->SetLineWidth(1); @@ -476,17 +522,42 @@ histoped[nn]->Draw("b"); if(nn==1){ maxhist=histoped[nn]->GetMaximum(); - b.DrawBox(2816.,700.,3060.,maxhist); + b.SetFillColor(6); + b.SetFillStyle(3945); + b.DrawBox(2944.,700.,3060.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(2816.,700.,2944.,maxhist); + b.DrawBox(2048.,700.,2176.,maxhist); } else if(nn==6){ maxhist=histoped[nn]->GetMaximum(); + b.SetFillColor(6); + b.SetFillStyle(3945); b.DrawBox(2560.,2200.,2816.,maxhist); - b.DrawBox(512.,2200.,768.,maxhist); b.DrawBox(1024.,2200.,1792.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(512.,2200.,768.,maxhist); + } + else if(nn==7){ + maxhist=histoped[nn]->GetMaximum(); + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(512.,700.,768.,maxhist); } else if(nn==11){ maxhist=histoped[nn]->GetMaximum(); + b.SetFillColor(6); + b.SetFillStyle(3945); b.DrawBox(768.,700.,1024.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(0.,700.,512.,maxhist); + b.DrawBox(1920.,700.,2048.,maxhist); } } else histoped[nn]->Draw("axis"); @@ -511,6 +582,7 @@ trkpad2[nn]->cd(); trkpad2[nn]->SetFillColor(10); trkpad2[nn]->SetFrameFillColor(10); + histosig[nn]->SetStats(kFALSE); histosig[nn]->SetLineColor(1); histosig[nn]->SetFillColor(12); histosig[nn]->SetLineWidth(1); @@ -524,17 +596,42 @@ histosig[nn]->Draw("b"); if(nn==1){ maxhist=histosig[nn]->GetMaximum(); - b.DrawBox(2816.,0.,3060.,maxhist); + b.SetFillColor(6); + b.SetFillStyle(3945); + b.DrawBox(2944.,0.,3060.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(2816.,0.,2944.,maxhist); + b.DrawBox(2048.,0.,2176.,maxhist); } else if(nn==6){ maxhist=histosig[nn]->GetMaximum(); + b.SetFillColor(6); + b.SetFillStyle(3945); b.DrawBox(2560.,0.,2816.,maxhist); - b.DrawBox(512.,0.,768.,maxhist); b.DrawBox(1024.,0.,1792.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(512.,0.,768.,maxhist); + } + else if(nn==7){ + maxhist=histosig[nn]->GetMaximum(); + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(512.,0.,768.,maxhist); } else if(nn==11){ maxhist=histosig[nn]->GetMaximum(); + b.SetFillColor(6); + b.SetFillStyle(3945); b.DrawBox(768.,0.,1024.,maxhist); + + b.SetFillColor(107); + b.SetFillStyle(3954); + b.DrawBox(0.,0.,512.,maxhist); + b.DrawBox(1920.,0.,2048.,maxhist); } } else histosig[nn]->Draw("axis"); @@ -542,23 +639,39 @@ li.DrawLine(1024.5,0,1024.5,max); li.DrawLine(2048.5,0,2048.5,max); - - - };//end loop on views + for(int ii=0;ii<3;ii++){ + sig->cd(); + trkpad3[nn*3+ii]->Draw(); + trkpad3[nn*3+ii]->cd(); + trkpad3[nn*3+ii]->SetFillColor(10); + trkpad3[nn*3+ii]->SetFrameFillColor(10); + trkpad3[nn*3+ii]->SetLogy(); + histosiglad[nn][ii]->SetLineColor(1); + histosiglad[nn][ii]->SetFillColor(1); + histosiglad[nn][ii]->SetLineWidth(1); + histosiglad[nn][ii]->GetXaxis()->SetTitle("SIG (ADC channels)"); + histosiglad[nn][ii]->GetXaxis()->CenterTitle(); + histosiglad[nn][ii]->Draw(""); + } + };//end loop on views c1->Update();//draw pads in canvas c2->Update();//draw pads in canvas - - stringstream nom1; - stringstream nom2; - + sig->Update();//draw pads in canvas + + stringstream nom1,nom2,nom3; + if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ nom1.str(""); nom2.str(""); + nom3.str(""); nom1<Print(nom1.str().c_str(),"Landscape"); c2->Print(nom2.str().c_str(),"Landscape"); + sig->Print(nom3.str().c_str(),"Landscape"); + if(!strcmp(outfile.Data(),"pdf")){ stringstream com; com<<"ps2pdf13 "<Print(nom1.str().c_str()); c2->Print(nom2.str().c_str()); + sig->Print(nom3.str().c_str()); } - + if(step==1 && i!=maxevent-1 ){ printf("\n Press 1 to continue, 2 to quit.\n"); cin>>risposta;