--- quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx 2006/06/29 11:11:59 1.6 +++ quicklook/tracker/flight/macros/FTrkCalibQLook_EXPERT.cxx 2014/01/17 15:10:39 1.33 @@ -2,7 +2,7 @@ * FTrkCalibQLookExpert.cxx * * autor: D.Fedele - * version v1r04 + * version v1r28 * Parameters: * file - the data file to analyze * step - select =1 in order to analyze one event at time @@ -23,6 +23,10 @@ #include #include #include +#include +#include +#include +#include // #include #include @@ -30,7 +34,7 @@ #include // -typedef struct caltrk_def{ +struct caltrk_def{ Int_t good0[2]; Int_t daqmode[12]; Int_t dspnum[12]; @@ -58,7 +62,6 @@ { // // obtain information about the data file and select the output dir - const string filepath=file.Data(); Int_t dwpos = file.Last('/'); Int_t dwpos1 = file.Last('.'); TString base,ffile ; @@ -78,7 +81,7 @@ Int_t nevents=0; Int_t minevent = 0; Int_t maxevent = 0; - ULong64_t FOBT[2], HOBT=0, TOBT=0; + ULong_t FOBT[2]; FOBT[0]=0; FOBT[1]=0; @@ -122,7 +125,10 @@ pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; pamela::PscuHeader *ph=0; pamela::CalibTrk1Event *trk1 = 0; - pamela::CalibTrk2Event *trk2 = 0; + pamela::CalibTrk2Event *trk2 = 0; + pamela::EventCounter *cod=0; + + pamela::PacketType *pctp=0; hotr = (TTree*)calibFile->Get("CalibHeader"); hotr->SetBranchAddress("Header", &eh4); @@ -174,7 +180,7 @@ } else if (toevent > nevents) { maxevent = nevents; } else { - maxevent = fromevent; + maxevent = nevents; }; }; @@ -184,93 +190,116 @@ // //********************************************************************** + Int_t hcevent=hotr->GetEntries(); + Int_t tcevent=totr->GetEntries(); + ULong_t HOBT[hcevent], TOBT[tcevent]; + for (Int_t i = 0; i < hcevent; i++){ + hotr->GetEntry(i); + ph = eh4->GetPscuHeader(); + HOBT[i]= ph->GetOrbitalTime(); + } + for (Int_t i = 0; i < tcevent; i++){ + totr->GetEntry(i); + ph = eh3->GetPscuHeader(); + TOBT[i]= ph->GetOrbitalTime(); + } + printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); for (Int_t i = minevent; i < maxevent; i++){ otr1->GetEntry(i); - otr2->GetEntry(i); - totr->GetEntry(i); - hotr->GetEntry(i); - ph = eh4->GetPscuHeader(); - HOBT= ph->GetOrbitalTime(); - ph = eh3->GetPscuHeader(); - TOBT= ph->GetOrbitalTime(); - + otr2->GetEntry(i); + ctrk.good0[0]=trk1->good0; ctrk.good0[1]=trk2->good0; for (Int_t m = 0; m < 6; m++){ ph = eh1->GetPscuHeader(); + cod = eh1->GetCounter(); FOBT[0]= ph->GetOrbitalTime(); - ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; - ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; - ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; - ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; - ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; - ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; - ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; - ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; - ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; - ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; - ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; - ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; - ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; - ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; - ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; - ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; - ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; - ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; - for (Int_t j = 0; j < 3072; j++){ - ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; - ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; - ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; - }; + if(trk1->DSPnumber[m]>0){ + if(trk1->DSPnumber[m]<13){ + ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; + ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; + ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; + ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; + ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; + ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; + ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; + ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; + ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; + ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; + ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; + ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; + ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; + ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; + ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; + ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; + ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; + ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; + for (Int_t j = 0; j < 3072; j++){ + ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; + ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; + ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; + }; + } + } ph = eh2->GetPscuHeader(); FOBT[1]= ph->GetOrbitalTime(); - ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; - ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; - ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; - ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; - ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; - ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; - ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; - ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; - ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; - ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; - ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; - ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; - ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; - ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; - ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; - ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; - ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; - ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; - for (Int_t j = 0; j < 3072; j++){ - ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; - ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; - ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; - }; - }; + if(trk2->DSPnumber[m]>0){ + if(trk2->DSPnumber[m]<13){ + ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; + ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; + ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; + ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; + ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; + ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; + ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; + ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; + ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; + ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; + ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; + ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; + ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; + ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; + ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; + ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; + ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; + ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; + for (Int_t j = 0; j < 3072; j++){ + ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; + ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; + ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; + } + } + } + } // // other variables definitions + Int_t risposta=0; - stringstream fromfile; + stringstream fromfile,isfile; - 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); @@ -280,20 +309,57 @@ Int_t canvasy=900; TCanvas *c1 = new TCanvas("c1","FTrkCalibQLook_EXPERT_ped",canvasx,canvasy); c1->SetFillColor(10); - tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); - tzz->DrawLatex(.90,0.98,"PEDESTAL"); + tzz->DrawLatex(.01,.98,fromfile.str().c_str()); + tzz->DrawLatex(.90,.98,"PEDESTAL"); + + isfile<<"Chips with white line at least once showed anomalous behaviour"; + tzz->SetTextColor(17); + tzz->SetTextSize(0.018); + tzz->DrawLatex(.01,.96,isfile.str().c_str()); + isfile.str(""); + + isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; + tzz->SetTextColor(107); + // tzz->DrawLatex(.05,.96,isfile.str().c_str()); + isfile.str(""); + TCanvas *c2 = new TCanvas("c2","FTrkCalibQLook_EXPERT_sig",canvasx,canvasy); c2->SetFillColor(10); - tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); - tzz->DrawLatex(.90,0.98,"SIGMA"); + tzz->SetTextColor(1); + tzz->DrawLatex(.01,.98,fromfile.str().c_str()); + tzz->DrawLatex(.90,.98,"SIGMA"); + + isfile<<"Chips with white line at least once showed anomalous behaviour"; + tzz->SetTextColor(17); + tzz->SetTextSize(0.018); + tzz->DrawLatex(.01,.96,isfile.str().c_str()); + isfile.str(""); + + isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; + tzz->SetTextColor(107); + // tzz->DrawLatex(.05,.96,isfile.str().c_str()); + isfile.str(""); + + + TCanvas *sig=new TCanvas("sig","FTrkCalibQLook_EXPERT_histosig",canvasx,canvasy); + sig->SetFillColor(10); + tzz->SetTextColor(1); + tzz->DrawLatex(.01,.98,fromfile.str().c_str()); + tzz->DrawLatex(.85,.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 @@ -302,19 +368,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); @@ -331,7 +398,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 //-------------------------------- @@ -352,8 +447,10 @@ 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 - - + + if(ctrk.dspnum[n]==0) + continue; + nn=ctrk.dspnum[n]-1; /*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* * @@ -426,26 +523,30 @@ /******************************************************/ /* fill histos */ 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]); + histosig[nn]->Fill(j,ctrk.dspsig[n][j]); + histoped[nn]->Fill(j,ctrk.dspped[n][j]); + if(j<1024) histosiglad[nn][0]->Fill(ctrk.dspsig[n][j]); + if(j>=1024 && j<2048) histosiglad[nn][1]->Fill(ctrk.dspsig[n][j]); + if(j>=2048 && j<3072) histosiglad[nn][2]->Fill(ctrk.dspsig[n][j]); }; - histoasig[nn]->Fill(1,ctrk.sig1[nn]); - histoasig[nn]->Fill(1025,ctrk.sig2[nn]); - histoasig[nn]->Fill(2049,ctrk.sig3[nn]); + histoasig[nn]->Fill(1,ctrk.sig1[n]); + histoasig[nn]->Fill(1025,ctrk.sig2[n]); + histoasig[nn]->Fill(2049,ctrk.sig3[n]); histoaped[nn]->Fill(1,ctrk.ped1[nn]); - histoaped[nn]->Fill(1025,ctrk.ped2[nn]); - histoaped[nn]->Fill(2049,ctrk.ped3[nn]); + histoaped[nn]->Fill(1025,ctrk.ped2[n]); + histoaped[nn]->Fill(2049,ctrk.ped3[n]); /******************************************************/ - - TLine li; + + TLine li,liva1; li.SetLineColor(38); - li.SetLineStyle(3); + li.SetLineStyle(4); li.SetLineWidth(2); - - Float_t maxhist=0; + liva1.SetLineColor(42); + liva1.SetLineStyle(3); + liva1.SetLineWidth(1); + + Float_t maxhist=0,va1x=0,minhist=0.; TBox b; - b.SetFillColor(6); - b.SetFillStyle(3945); /* plot PEDESTAL */ c1->cd(); trkpadtext[nn]->Draw(); @@ -453,6 +554,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); @@ -462,33 +564,91 @@ if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(700,1700); histoaped[nn]->SetLineColor(5); histoaped[nn]->SetLineWidth(1); - if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ - histoped[nn]->Draw("b"); - if(nn==1){ - maxhist=histoped[nn]->GetMaximum(); - b.DrawBox(2816.,700.,3060.,maxhist); - } - else if(nn==6){ - maxhist=histoped[nn]->GetMaximum(); - b.DrawBox(2560.,2200.,2816.,maxhist); - b.DrawBox(512.,2200.,768.,maxhist); - b.DrawBox(1024.,2200.,1792.,maxhist); - } - else if(nn==11){ - maxhist=histoped[nn]->GetMaximum(); - b.DrawBox(768.,700.,1024.,maxhist); - } + // if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ + histoped[nn]->Draw("b"); + maxhist=histoped[nn]->GetMaximum(); + if(nn%2==0) minhist=2200; + else minhist=700; + b.SetFillColor(19); + b.SetFillStyle(3954); + if(nn==0){ + b.DrawBox(0.,minhist,2047.,maxhist); } - else histoped[nn]->Draw("axis"); + else if(nn==1){ + b.DrawBox(128.,minhist,256.,maxhist); + b.DrawBox(384.,minhist,512.,maxhist); + b.DrawBox(896.,minhist,1024.,maxhist); + b.DrawBox(2048.,minhist,2432.,maxhist); + b.DrawBox(2816.,minhist,2944.,maxhist); + b.DrawBox(2944.,minhist,3070.,maxhist); + } + else if(nn==3){ + b.DrawBox(0.,minhist,256.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + else if(nn==4){ + b.DrawBox(256.,minhist,512.,maxhist); + b.DrawBox(1792.,minhist,1920.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + else if(nn==5){ + b.DrawBox(0.,minhist,256.,maxhist); + b.DrawBox(896.,minhist,1024.,maxhist); + b.DrawBox(1664.,minhist,1792.,maxhist); + } + else if(nn==6){ + b.DrawBox(512.,minhist,768.,maxhist); + b.DrawBox(1024.,minhist,1280.,maxhist); + b.DrawBox(1280.,minhist,1792.,maxhist); + b.DrawBox(2560.,minhist,2816.,maxhist); + } + else if(nn==7){ + b.DrawBox(0.,minhist,1535.,maxhist); + b.DrawBox(2024.,minhist,2280.,maxhist); + } + else if(nn==8){ + b.DrawBox(512.,minhist,768.,maxhist); + } + else if(nn==9){ + b.DrawBox(0.,minhist,128.,maxhist); + b.DrawBox(256.,minhist,384.,maxhist); + b.DrawBox(512.,minhist,640.,maxhist); + b.DrawBox(896.,minhist,1152.,maxhist); + b.DrawBox(1280.,minhist,1535.,maxhist); + b.DrawBox(1664.,minhist,1920.,maxhist); + b.DrawBox(2048.,minhist,2304.,maxhist); + } + else if(nn==10){ + b.DrawBox(0.,minhist,512.,maxhist); + b.DrawBox(1024.,minhist,3070.,maxhist); + } + else if(nn==11){ + b.DrawBox(0.,minhist,512.,maxhist); + b.DrawBox(768.,minhist,1024.,maxhist); + b.DrawBox(1536.,minhist,1664.,maxhist); + b.DrawBox(1920.,minhist,2560.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + // } + // else histoped[nn]->Draw("axis"); histoaped[nn]->Draw("same"); if((nn+1)%2==1) { - li.DrawLine(1024.5,2200,1024.5,3200); - li.DrawLine(2048.5,2200,2048.5,3200); + for(int va=1; va<24; va++){ + va1x=128*va; + liva1.DrawLine(va1x,2200.,va1x,3200.); + } + li.DrawLine(1024.5,2200.,1024.5,3200.); + li.DrawLine(2048.5,2200.,2048.5,3200.); } if((nn+1)%2==0) { + for(int va=1; va<24; va++){ + va1x=128*va; + liva1.DrawLine(va1x,700.,va1x,1700.); + } li.DrawLine(1024.5,700,1024.5,1700); li.DrawLine(2048.5,700,2048.5,1700); } + c1->Update();//draw pads in canvas @@ -501,6 +661,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); @@ -510,45 +671,114 @@ histosig[nn]->GetYaxis()->CenterTitle(); histoasig[nn]->SetLineColor(5); histoasig[nn]->SetLineWidth(1); - if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ - histosig[nn]->Draw("b"); - if(nn==1){ - maxhist=histosig[nn]->GetMaximum(); - b.DrawBox(2816.,0.,3060.,maxhist); - } - else if(nn==6){ - maxhist=histosig[nn]->GetMaximum(); - b.DrawBox(2560.,0.,2816.,maxhist); - b.DrawBox(512.,0.,768.,maxhist); - b.DrawBox(1024.,0.,1792.,maxhist); - } - else if(nn==11){ - maxhist=histosig[nn]->GetMaximum(); - b.DrawBox(768.,0.,1024.,maxhist); - } + // if(ctrk.good0[0]==1 && ctrk.good0[1]==1){ + histosig[nn]->Draw("b"); + maxhist=histosig[nn]->GetMaximum(); + minhist=0.; + b.SetFillColor(19); + b.SetFillStyle(3945); + if(nn==0){ + b.DrawBox(0.,minhist,2047.,maxhist); + } + else if(nn==1){ + b.DrawBox(128.,minhist,256.,maxhist); + b.DrawBox(384.,minhist,512.,maxhist); + b.DrawBox(896.,minhist,1024.,maxhist); + b.DrawBox(2048.,minhist,2432.,maxhist); + b.DrawBox(2816.,minhist,2944.,maxhist); + b.DrawBox(2944.,minhist,3070.,maxhist); + } + else if(nn==3){ + b.DrawBox(0.,minhist,256.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + else if(nn==4){ + b.DrawBox(256.,minhist,512.,maxhist); + b.DrawBox(1792.,minhist,1920.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + else if(nn==5){ + b.DrawBox(0.,minhist,256.,maxhist); + b.DrawBox(896.,minhist,1024.,maxhist); + b.DrawBox(1664.,minhist,1792.,maxhist); + } + else if(nn==6){ + b.DrawBox(512.,minhist,768.,maxhist); + b.DrawBox(1024.,minhist,1280.,maxhist); + b.DrawBox(1280.,minhist,1792.,maxhist); + b.DrawBox(2560.,minhist,2816.,maxhist); + } + else if(nn==7){ + b.DrawBox(0.,minhist,1535.,maxhist); + b.DrawBox(2024.,minhist,2280.,maxhist); + } + else if(nn==8){ + b.DrawBox(512.,minhist,768.,maxhist); + } + else if(nn==9){ + b.DrawBox(0.,minhist,128.,maxhist); + b.DrawBox(256.,minhist,384.,maxhist); + b.DrawBox(512.,minhist,640.,maxhist); + b.DrawBox(896.,minhist,1152.,maxhist); + b.DrawBox(1280.,minhist,1535.,maxhist); + b.DrawBox(1664.,minhist,1920.,maxhist); + b.DrawBox(2048.,minhist,2304.,maxhist); + } + else if(nn==10){ + b.DrawBox(0.,minhist,512.,maxhist); + b.DrawBox(1024.,minhist,3070.,maxhist); } - else histosig[nn]->Draw("axis"); + else if(nn==11){ + b.DrawBox(0.,minhist,512.,maxhist); + b.DrawBox(768.,minhist,1024.,maxhist); + b.DrawBox(1536.,minhist,1664.,maxhist); + b.DrawBox(1920.,minhist,2560.,maxhist); + b.DrawBox(2816.,minhist,3070.,maxhist); + } + // } + // else histosig[nn]->Draw("axis"); histoasig[nn]->Draw("same"); + for(int va=1; va<24; va++){ + va1x=128*va; + liva1.DrawLine(va1x,0.,va1x,max); + } li.DrawLine(1024.5,0,1024.5,max); li.DrawLine(2048.5,0,2048.5,max); + c2->Update();//draw pads in canvas - - + 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;