--- quicklook/tracker/flight/macros/FTrkQLook_EXPERT.cxx 2006/05/18 13:06:08 1.2 +++ quicklook/tracker/flight/macros/FTrkQLook_EXPERT.cxx 2006/06/01 18:44:26 1.3 @@ -25,20 +25,21 @@ #include #include #include +#include #include #include #include // void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ - if ( to == 0 ){ - Int_t t2length = s2.Length(); - s1 = ""; - to = t2length; - }; - for (Int_t i = from; i0) base+="/"; TString out; if(outdir.Length()==0){ @@ -66,14 +68,16 @@ pamela::TsbTEvent *event = 0; pamela::TsbTRecord *record = 0; pamela::tracker::TrackerEvent *te=0; - pamela::EventHeader *eh=0,*aleh=0; - pamela::PscuHeader *ph=0; + pamela::EventHeader *eh=0,*aleh=0,*eH=0,*eT=0; + pamela::PscuHeader *ph=0,*pH=0; pamela::TrkAlarmEvent *al=0; + pamela::RunHeaderEvent *reh=0; TFile *datafile = new TFile(file); TTree *tree = (TTree*)datafile->Get("TsbT"); tree->SetBranchAddress("TsbT",&event); + tree->SetBranchAddress("Header",&eT); TTree *altr = (TTree*)datafile->Get("TrkAlarm"); altr->SetBranchAddress("TrkAlarm",&al); @@ -83,13 +87,21 @@ tr->SetBranchAddress("Tracker",&te); tr->SetBranchAddress("Header",&eh); + TTree *otr = (TTree*)datafile->Get("RunHeader"); + otr->SetBranchAddress("Header",&eH); + otr->SetBranchAddress("RunHeader",&reh); + Long64_t nevent = tr->GetEntries(); + Long64_t neventH = otr->GetEntries(); Long64_t tnevent = tree->GetEntries(); Long64_t alnevent = altr->GetEntries(); Int_t minevent=0; Int_t maxevent=0; printf("Number of total events: %lld\n",nevent); + printf("Number of header events: %lld\n",neventH); + printf("Number of TsbT events: %lld\n",tnevent); + printf("Number of TrkAlarm packet events: %lld\n",alnevent); if (nevent<=0){ datafile->Close(); @@ -122,29 +134,33 @@ nevent=maxevent-minevent ; } - - if (fromevent!=0) - printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); - else - printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); + Long64_t obt=0; + const Int_t sizeH=neventH; + ULong64_t HOBT[sizeH]; + Int_t trk_cal_us[sizeH],countrun=1; + for (Int_t vi=0; viGetEntry(ev); + pH = eH->GetPscuHeader(); + HOBT[ev]= pH->GetOrbitalTime(); + trk_cal_us[ev]=reh->TRK_CALIB_USED; + if((HOBT[ev]0) + countrun+=1; + // printf("\n%lld\t\tcountrun=%d\n",HOBT[ev],countrun); + } + countrun+=(Int_t)nevent/30000; + printf("\ncountrun=%d\n",countrun); // // other variables definitions stringstream oss1,oss2,oss3,oss4,fromfile,isfile,tit; - Int_t warning_dspnumber=0; Int_t ALARM=0; Int_t WARNING[12]; - const Int_t size=nevent; - Int_t dsp=0; - Double_t yd[size*12], yc[size*12], x[size], eventint[size]; - Double_t yyc[size], hi=0, land[size*12][3], illum[size*12][3]; - - TGraph *comprtime,*temp[5]; - TGraph *eventnumb; - TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; - TPaveText *pt1; - TPad *pt; - + Float_t hi=0; + // // information about the entries for the temperatures Int_t tmpSize=0,siztmp=0,maxsize=0; @@ -155,20 +171,32 @@ } const Int_t tsize=maxsize; Int_t tempt[tsize][5],xt[tsize], tempt_tmp[tsize]; - + // + // information about the temperatures + for (Int_t ev=0; evGetEntry(ev); + tmpSize = event->Records->GetEntries(); + for (Int_t j = 0; j < tmpSize; j++){ + record = (pamela::TsbTRecord*)event->Records->At(j); + xt[siztmp]=record->RECORD_OBT; //0.051*record->RECORD_OBT; + for (Int_t z = 0; z < 5; z++){ + tempt[siztmp][z] = record->TEMPERATURES[z+1]; + } + siztmp++; + } + } // - // open the output text files for the alarms - ofstream warning(out + "warning.txt",ios::out); + // open the output text files for the alarms + TString fname1 = out+ffile; TString fname = out+ffile; - TString fname1 = out+ffile; int slen=fname.Length(); int last=fname.Last('_'); if(last<(slen-1))fname.Append('_'); - fname.Append("Trk-ALARM-report.txt"); + fname.Append("FTrk-DSP-report.txt"); ofstream alarm(fname,ios::out); - alarm << "TRACKER ALARM REPORT - Downlink " << ffile<< endl; - fname1.Append("_TrkAlarm-pkt-report.txt"); + alarm << "TRACKER DSP REPORT - Downlink " << ffile<< endl; + fname1.Append("_FTrkAlarm-pkt-report.txt"); ofstream alarm1(fname1,ios::out); alarm1 << "TrkAlarm pkt REPORT - Downlink " << ffile<< endl; @@ -180,164 +208,51 @@ altr->GetEntry(ev); ph = aleh->GetPscuHeader(); + if(ph->GetOrbitalTime()0) + alarm1<GetOrbitalTime(); + alarm1 << "================================================="<< endl; alarm1 << "PSCU-Pkt N. "<< ph->GetCounter() ; alarm1 << " - OBT "<< ph->GetOrbitalTime() << " ms"< WARNING!! Check entry "<< ev<<" (DSP "<eventn[i+1]<eventn[0]; - } - } - - if(ev<=maxevent-1){ - - if((ev-minevent)>=1 && eventint[(ev-minevent)]!=eventint[(ev-minevent)-1]+1 && eventint[(ev-minevent)]!=1){ - warning_dspnumber++; - warning<< "==> WARNING!! Check entry "<< ev<GetCounter() ; - alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<DSPnumber[i]; - alarm.width(6); alarm << te->eventn[i]; - alarm.width(6); alarm << te->DATAlength[i]; - alarm.width(4); alarm << te->crc[i]; - alarm.width(4); alarm << te->fc[i]; - alarm.width(4); alarm << te->fl1[i]; - alarm.width(4); alarm << te->fl2[i]; - alarm.width(4); alarm << te->fl3[i]; - alarm.width(4); alarm << te->fl4[i]; - alarm.width(4); alarm << te->fl5[i]; - alarm.width(4); alarm << te->fl6[i]; - if(te->alarm[i]!=0)alarm<<" >> ALARM "; - if(WARNING[i]!=0)alarm<<" (DSP warning) "; - alarm << endl; - } } } - if(ALARM==0) alarm << endl<< "------> NO ALARM!!! <-------"<Close(); gStyle->SetLabelSize(0.05,"x"); @@ -352,463 +267,662 @@ gStyle->SetTitleSize(0.06,"y"); gStyle->SetTitleSize(0.055,"x"); - //**************************************************************************************** - //Output figures --- First sheet: - //**************************************************************************************** + + //*************************************************************************************** + // LOOP on each event + //*************************************************************************************** + + if (fromevent!=0) + printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); + else + printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); + + + Int_t minev=minevent,maxev=maxevent,countTEMP=0; + TCanvas *CompTimeCanv[countrun],*EventNumCanv[countrun],*LandauCanv1[countrun],*LandauCanv2[countrun],*LandauCanv3[countrun]; + TCanvas *IlluminaCanv[countrun],*TempCanv[countrun]; + TGraph *comprtime[12][countrun],*temp[5][countrun]; + TGraph *eventnumb[countrun]; + TH1F *landau1[12][countrun],*landau2[12][countrun],*landau3[12][countrun],*illuminazione[12][countrun]; + + for(Int_t ii=0; iiSetFillColor(10); - CompTimeCanv->Range(0,0,100,100); - fromfile<<"FTrkQLook_EXPERT File: "<SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - TLatex *t1=new TLatex(); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(64.,98.7,isfile.str().c_str()); - isfile.str(""); - - //**************************************************************************************** - //Output figures --- Second sheet: - //**************************************************************************************** - - TCanvas *EventNumCanv=new TCanvas("Tracker_Detector_Report_5/6","",900,1200); - EventNumCanv->SetFillColor(10); - EventNumCanv->Range(0,0,100,100); - isfile<<"WARNINGS on DSP EVENT NUMBER "; - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(68.4,98.7,isfile.str().c_str()); - isfile.str(""); - - //**************************************************************************************** - //Output figures --- Third sheet: - //**************************************************************************************** - - TCanvas *LandauCanv1=new TCanvas("Landau ladder1","",900,1200); - LandauCanv1->SetFillColor(10); - LandauCanv1->Range(0,0,100,100); - isfile<<"Landau ladder1"; - - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(70.,98.7,isfile.str().c_str()); - isfile.str(""); + ofstream warning(out + "warning.txt",ios::out); + + //**************************************************************************************** + //Output figures --- First sheet: + //**************************************************************************************** + + fromfile<<"FTrkQLook_EXPERT File: "<SetFillColor(10); + CompTimeCanv[ii]->Range(0,0,100,100); + TLatex *t=new TLatex(); + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + TLatex *t1=new TLatex(); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(59.,98.7,isfile.str().c_str()); + isfile.str(""); + + //**************************************************************************************** + //Output figures --- Second sheet: + //**************************************************************************************** + + isfile<<"WARNINGS on DSP EVENT NUMBER pag"<SetFillColor(10); + EventNumCanv[ii]->Range(0,0,100,100); + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(63.4,98.7,isfile.str().c_str()); + isfile.str(""); + + //**************************************************************************************** + //Output figures --- Third sheet: + //**************************************************************************************** + + isfile<<"Cluster Signal ladder1 pag"<SetFillColor(10); + LandauCanv1[ii]->Range(0,0,100,100); + + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(60.,98.7,isfile.str().c_str()); + isfile.str(""); - //**************************************************************************************** - //Output figures --- Third sheet: - //**************************************************************************************** - - TCanvas *LandauCanv2=new TCanvas("Landau ladder2","",900,1200); - LandauCanv2->SetFillColor(10); - LandauCanv2->Range(0,0,100,100); - isfile<<"Landau ladder2"; - - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(70.,98.7,isfile.str().c_str()); - isfile.str(""); - - //**************************************************************************************** - //Output figures --- Third sheet: - //**************************************************************************************** - - TCanvas *LandauCanv3=new TCanvas("Landau ladder3","",900,1200); - LandauCanv3->SetFillColor(10); - LandauCanv3->Range(0,0,100,100); - isfile<<"Landau ladder3"; - - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(70.,98.7,isfile.str().c_str()); - isfile.str(""); + //**************************************************************************************** + //Output figures --- Third sheet: + //**************************************************************************************** + + isfile<<"Cluster Signal ladder2 pag"<SetFillColor(10); + LandauCanv2[ii]->Range(0,0,100,100); + + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(60.,98.7,isfile.str().c_str()); + isfile.str(""); + + //**************************************************************************************** + //Output figures --- Third sheet: + //**************************************************************************************** + + isfile<<"Cluster Signal ladder3 pag"<SetFillColor(10); + LandauCanv3[ii]->Range(0,0,100,100); + + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(60.,98.7,isfile.str().c_str()); + isfile.str(""); - //**************************************************************************************** - //Output figures --- Fourth sheet: - //**************************************************************************************** - - TCanvas *IlluminaCanv=new TCanvas("Illuminazione","",900,1200); - IlluminaCanv->SetFillColor(10); - IlluminaCanv->Range(0,0,100,100); - isfile<<"lighting of the views"; - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(70.,98.7,isfile.str().c_str()); - isfile.str(""); - - //**************************************************************************************** - //Output figures --- Fifth sheet: - //**************************************************************************************** + //**************************************************************************************** + //Output figures --- Fourth sheet: + //**************************************************************************************** + + isfile<<"lighting of the views pag"<SetFillColor(10); + IlluminaCanv[ii]->Range(0,0,100,100); + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(65.,98.7,isfile.str().c_str()); + isfile.str(""); + + //**************************************************************************************** + //Output figures --- Fifth sheet: + //**************************************************************************************** - TCanvas *TempCanv=new TCanvas("Tracker_Detector_Temperaturt","",900,1200); - TempCanv->SetFillColor(10); - TempCanv->Range(0,0,100,100); - isfile<<"Temperatures vs OBT"; - - t->SetTextFont(32); - t->SetTextColor(1); - t->SetTextAlign(12); - t->SetTextSize(0.02); - t->DrawLatex(2.,98.7,fromfile.str().c_str()); - t1->SetTextFont(32); - t1->SetTextColor(1); - t1->SetTextAlign(12); - t1->SetTextSize(0.02); - t1->DrawLatex(80.,98.7,isfile.str().c_str()); - isfile.str(""); + isfile<<"Temperatures vs OBT pag"<SetFillColor(10); + TempCanv[ii]->Range(0,0,100,100); + + t->SetTextFont(32); + t->SetTextColor(1); + t->SetTextAlign(12); + t->SetTextSize(0.02); + t->DrawLatex(2.,98.7,fromfile.str().c_str()); + t1->SetTextFont(32); + t1->SetTextColor(1); + t1->SetTextAlign(12); + t1->SetTextSize(0.02); + t1->DrawLatex(75.,98.7,isfile.str().c_str()); + isfile.str(""); - //************************************************************************************* - //book pads and histos - //*************************************************************************************** + //************************************************************************************* + //book pads and histos + //*************************************************************************************** + Float_t posy = 0.95; // up y-coord - top pads + Float_t hpad = 0; // pad height + Float_t posx1=0; // left x-coord - pad column + Float_t posx0=0; // x-coord - column division + Float_t wrel = 0; // relative x size of first sub-column + Float_t marg = 0.004; // margin among pads + Float_t tposy = 0.95; // up y-coord - top pads + Float_t thpad = 0; // pad height + Float_t tposx1=0; // left x-coord - pad column + Float_t tposx0=0; // x-coord - column division + Float_t twrel = 0; // relative x size of first sub-column + Float_t tmarg = 0.004; // margin among pads + + hpad = (posy-marg*11)/6; + wrel = (1-marg*4)/2; + thpad = (tposy-tmarg*5)/3; + twrel = (1-tmarg*4)/2; - TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5]; //pad for histos - Double_t posy = 0.95; // up y-coord - top pads - Double_t hpad = 0; // pad height - Double_t posx1=0; // left x-coord - pad column - Double_t posx0=0; // x-coord - column division - Double_t wrel = 0; // relative x size of first sub-column - Double_t marg = 0.004; // margin among pads - Double_t tposy = 0.95; // up y-coord - top pads - Double_t thpad = 0; // pad height - Double_t tposx1=0; // left x-coord - pad column - Double_t tposx0=0; // x-coord - column division - Double_t twrel = 0; // relative x size of first sub-column - Double_t tmarg = 0.004; // margin among pads - - hpad = (posy-marg*11)/6; - wrel = (1-marg*4)/2; - thpad = (tposy-tmarg*5)/3; - twrel = (1-tmarg*4)/2; - stringstream title; - stringstream hid; - - for(Int_t n = 0; n<12; n++) { + for(Int_t n = 0; n<12; n++) { - if ( (n+1)%2==1 ) { - if(n>1) posy = posy-(marg*2+hpad); - posx1 = marg; - posx0 = posx1 + wrel; - } - else { - posx1 = posx0 + 2*marg; - posx0 = posx1 + wrel; - } + if ( (n+1)%2==1 ) { + if(n>1) posy = posy-(marg*2+hpad); + posx1 = marg; + posx0 = posx1 + wrel; + } + else { + posx1 = posx0 + 2*marg; + posx0 = posx1 + wrel; + } - if ( (n+1)%2==1 ) { - if(n>1) tposy = tposy-(tmarg*2+thpad); - tposx1 = tmarg; - tposx0 = tposx1 + twrel; - } - else { - tposx1 = tposx0 + 2*tmarg; - tposx0 = tposx1 + twrel; - } + if ( (n+1)%2==1 ) { + if(n>1) tposy = tposy-(tmarg*2+thpad); + tposx1 = tmarg; + tposx0 = tposx1 + twrel; + } + else { + tposx1 = tposx0 + 2*tmarg; + tposx0 = tposx1 + twrel; + } - /* -----------> pad for histograms */ - pad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0,posy,18,0,0); - pad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0,posy,18,0,0); - pad3[n] = new TPad("pad3"," ",posx1,posy-hpad,posx0,posy,18,0,0); - pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); - pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); - if(n<5) pad6[n] = new TPad("pad6"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); + /* -----------> pad for histograms */ + pad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0,posy,18,0,0); + pad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0,posy,18,0,0); + pad3[n] = new TPad("pad3"," ",posx1,posy-hpad,posx0,posy,18,0,0); + pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); + pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); + if(n<5) pad6[n] = new TPad("pad6"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); - /* -----------> HISTOGRAMS */ + /* -----------> HISTOGRAMS */ - oss1<<"DSP "<GetXaxis()->SetTitle("max signal"); - landau1[n]->GetXaxis()->CenterTitle(); - landau2[n]=new TH1F(oss2.str().c_str(),oss1.str().c_str(),1201,-0.5,1200.5); - landau2[n]->GetXaxis()->SetTitle("max signal"); - landau2[n]->GetXaxis()->CenterTitle(); - landau3[n]=new TH1F(oss3.str().c_str(),oss1.str().c_str(),1201,-0.5,1200.5); - landau3[n]->GetXaxis()->SetTitle("max signal"); - landau3[n]->GetXaxis()->CenterTitle(); - - illuminazione[n]=new TH1F(oss4.str().c_str(),oss1.str().c_str(),3073,-0.5,3072.5); - illuminazione[n]->GetXaxis()->SetTitle("strip with max signal"); - illuminazione[n]->GetXaxis()->CenterTitle(); - - oss1.str(""); - oss2.str(""); - oss3.str(""); - oss4.str(""); - }; + landau1[n][ii]=new TH1F(oss1.str().c_str(),oss1.str().c_str(),401,-0.5,1200.5); + landau1[n][ii]->GetXaxis()->SetTitle("max signal"); + landau1[n][ii]->GetXaxis()->CenterTitle(); + landau2[n][ii]=new TH1F(oss2.str().c_str(),oss1.str().c_str(),401,-0.5,1200.5); + landau2[n][ii]->GetXaxis()->SetTitle("max signal"); + landau2[n][ii]->GetXaxis()->CenterTitle(); + landau3[n][ii]=new TH1F(oss3.str().c_str(),oss1.str().c_str(),401,-0.5,1200.5); + landau3[n][ii]->GetXaxis()->SetTitle("max signal"); + landau3[n][ii]->GetXaxis()->CenterTitle(); + + illuminazione[n][ii]=new TH1F(oss4.str().c_str(),oss1.str().c_str(),3073,-0.5,3072.5); + illuminazione[n][ii]->GetXaxis()->SetTitle("strip with max signal"); + illuminazione[n][ii]->GetXaxis()->CenterTitle(); + + oss1.str(""); + oss2.str(""); + oss3.str(""); + oss4.str(""); + }; - //********************************************************************************** - // Fill Graphs and Histos - //********************************************************************************** + // printf("\nprova0\n"); + + + //********************************************************************************** + // Fill Graphs and Histos + //********************************************************************************** - Double_t maxhist=0; - TBox b; - b.SetFillColor(5); + // + // information about the tracker data + Int_t warning_dspnumber=0; + Float_t x[30000]; + Float_t yc[30000][12]; + Float_t eventint[30000]; + + for (Int_t ev=minev; evGetEntry(ev); + ph = eh->GetPscuHeader(); + + if(ev==maxevent-1) maxev=maxevent-1; + + if((ph->GetOrbitalTime()GetOrbitalTime(); + ALARM=0; + + Int_t dsp=0; + for(Int_t i=0; i<12; i++){ + dsp=te->DSPnumber[i]-1; + yc[(ev-minev)][dsp]= 0.051*te->compressiontime[i]; + + for(Int_t j=0;j<3;j++){ + if(te->signcluster[i][j]!=0){ + hi=(j*1024)+te->addrcluster[i][j]; + if((hi>505 && hi<519) ||(hi>1017 && hi<1031) ||(hi>1529 && hi<1543) || (hi>2041 && hi<2055) ||(hi>2553 && hi<2567)) + continue; + else illuminazione[dsp][ii]->Fill(hi); + + if(!(dsp%2)){ + landau1[dsp][ii]->Fill(1024-(te->signcluster[i][j])); + landau2[dsp][ii]->Fill(1024-(te->signcluster[i][j])); + landau3[dsp][ii]->Fill(1024-(te->signcluster[i][j])); + } + else{ + landau1[dsp][ii]->Fill(te->signcluster[i][j]); + landau2[dsp][ii]->Fill(te->signcluster[i][j]); + landau3[dsp][ii]->Fill(te->signcluster[i][j]); + } + } + } + + WARNING[i]=0; + if(te->fc[i]!=0 || te->fl1[i]!=0 || te->fl2[i]!=0 || te->fl3[i]!=0 || te->fl4[i]!=0 || te->fl5[i]!=0 || te->fl6[i]!=0){ + ALARM = 1; //general alarm + WARNING[i] = 1; // DSP warning + }; + + if(te->alarm[i]!=0){ // hardware alarm + ALARM = 1; + }; + + //************************************************************************************** + // warning for internal number + //************************************************************************************** + if(i<=10){ + if(te->eventn[i]!=te->eventn[i+1]){ + warning_dspnumber++; + warning<< "==> WARNING!! Check entry "<< ev<<" (DSP "<eventn[i+1]<eventn[0]; + } + } - for (Int_t i=0; i<12 ; i++){ - - for (Int_t ev=minevent; ev510 && illum[12*(ev-minevent)+i][0]<515) landau1[i]->Fill(land[12*(ev-minevent)+i][0]); - if( land[12*(ev-minevent)+i][0]!=0) landau1[i]->Fill(land[12*(ev-minevent)+i][0]); - if( land[12*(ev-minevent)+i][1]!=0) landau2[i]->Fill(land[12*(ev-minevent)+i][1]); - if( land[12*(ev-minevent)+i][2]!=0) landau3[i]->Fill(land[12*(ev-minevent)+i][2]); - for(Int_t j=0;j<3;j++){ - if(land[12*(ev-minevent)+i][j]!=0){ - hi=(j*1024)+illum[12*(ev-minevent)+i][j]; - illuminazione[i]->Fill(hi); + if(ev<=maxevent-1){ + + if((ev-minev)>=1 && eventint[(ev-minev)]!=eventint[(ev-minev)-1]+1 && eventint[(ev-minev)]!=1){ + warning_dspnumber++; + warning<< "==> WARNING!! Check entry "<< ev<GetCounter() ; + alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<DSPnumber[i]; + alarm.width(6); alarm << te->eventn[i]; + alarm.width(6); alarm << te->DATAlength[i]; + alarm.width(4); alarm << te->crc[i]; + alarm.width(4); alarm << te->fc[i]; + alarm.width(4); alarm << te->fl1[i]; + alarm.width(4); alarm << te->fl2[i]; + alarm.width(4); alarm << te->fl3[i]; + alarm.width(4); alarm << te->fl4[i]; + alarm.width(4); alarm << te->fl5[i]; + alarm.width(4); alarm << te->fl6[i]; + if(te->alarm[i]!=0)alarm<<" >> ALARM "; + if(WARNING[i]!=0)alarm<<" (DSP warning) "; + alarm << endl; + } } } + if(ALARM==0) alarm << endl<< "------> NO ALARM!!! <-------"<cd(); - pad1[i]->SetFillColor(10); - pad1[i]->SetFrameFillColor(10); - pad1[i]->Draw(); - pad1[i]->cd(); - landau1[i]->Draw(""); - LandauCanv2->cd(); - pad4[i]->SetFillColor(10); - pad4[i]->SetFrameFillColor(10); - pad4[i]->Draw(); - pad4[i]->cd(); - landau2[i]->Draw(""); - LandauCanv3->cd(); - pad5[i]->SetFillColor(10); - pad5[i]->SetFrameFillColor(10); - pad5[i]->Draw(); - pad5[i]->cd(); - landau3[i]->Draw(""); - - IlluminaCanv->cd(); - pad2[i]->SetFillColor(10); - pad2[i]->SetFrameFillColor(10); - pad2[i]->Draw(); - pad2[i]->cd(); - pad2[i]->SetLogy(); - // illuminazione[i]->SetStats(KFALSE); - if(i==1){ - illuminazione[i]->Draw("ah"); - maxhist= illuminazione[i]->GetMaximum(); - b.DrawBox(2816.,0.,3060.,maxhist); - illuminazione[i]->Draw("axis same"); - illuminazione[i]->Draw("same ]["); - } - else if(i==6){ - illuminazione[i]->Draw("ah"); - maxhist= illuminazione[i]->GetMaximum(); - b.DrawBox(2560.,0.,2816.,maxhist); - b.DrawBox(512.,0.,768.,maxhist); - b.DrawBox(1024.,0.,1792.,maxhist); - illuminazione[i]->Draw("axis same"); - illuminazione[i]->Draw("same]["); - } - else if(i==11){ - illuminazione[i]->Draw("ah"); - maxhist= illuminazione[i]->GetMaximum(); - b.DrawBox(768.,0.,1024.,maxhist); - illuminazione[i]->Draw("axis same"); - illuminazione[i]->Draw("same]["); - } - else illuminazione[i]->Draw(""); + printf("prova3\n"); + LandauCanv1[ii]->cd(); + pad1[i]->SetFillColor(10); + pad1[i]->SetFrameFillColor(10); + pad1[i]->Draw(); + pad1[i]->cd(); + landau1[i][ii]->Draw(""); + LandauCanv2[ii]->cd(); + pad4[i]->SetFillColor(10); + pad4[i]->SetFrameFillColor(10); + pad4[i]->Draw(); + pad4[i]->cd(); + landau2[i][ii]->Draw(""); + LandauCanv3[ii]->cd(); + pad5[i]->SetFillColor(10); + pad5[i]->SetFrameFillColor(10); + pad5[i]->Draw(); + pad5[i]->cd(); + landau3[i][ii]->Draw(""); + + printf("prova4\n"); + IlluminaCanv[ii]->cd(); + pad2[i]->SetFillColor(10); + pad2[i]->SetFrameFillColor(10); + pad2[i]->Draw(); + pad2[i]->cd(); + pad2[i]->SetLogy(); + // illuminazione[i][ii]->SetStats(KFALSE); + if(i==1){ + illuminazione[i][ii]->Draw("ah"); + maxhist= illuminazione[i][ii]->GetMaximum(); + b.DrawBox(2816.,0.,3060.,maxhist); + illuminazione[i][ii]->Draw("axis same"); + illuminazione[i][ii]->Draw("same ]["); + } + else if(i==6){ + illuminazione[i][ii]->Draw("ah"); + maxhist= illuminazione[i][ii]->GetMaximum(); + b.DrawBox(2560.,0.,2816.,maxhist); + b.DrawBox(512.,0.,768.,maxhist); + b.DrawBox(1024.,0.,1792.,maxhist); + illuminazione[i][ii]->Draw("axis same"); + illuminazione[i][ii]->Draw("same]["); + } + else if(i==11){ + illuminazione[i][ii]->Draw("ah"); + maxhist= illuminazione[i][ii]->GetMaximum(); + b.DrawBox(768.,0.,1024.,maxhist); + illuminazione[i][ii]->Draw("axis same"); + illuminazione[i][ii]->Draw("same]["); + } + else illuminazione[i][ii]->Draw(""); - CompTimeCanv->cd(); - pad3[i]->SetFillColor(10); - pad3[i]->SetFrameFillColor(10); - pad3[i]->Draw(); - pad3[i]->cd(); - comprtime= new TGraph(nevent,x,yyc); - oss1<<"DSP "<SetTitle(oss1.str().c_str()); - comprtime->GetXaxis()->SetTitle("OBT (ms)"); - comprtime->GetXaxis()->CenterTitle(); - comprtime->GetYaxis()->SetTitle("compressiontime (ms)"); - comprtime->GetYaxis()->CenterTitle(); - comprtime->GetYaxis()->SetRangeUser(0,2); - comprtime->Draw("ap"); - oss1.str(""); - }; + printf("prova5\n"); + + + CompTimeCanv[ii]->cd(); + pad3[i]->SetFillColor(10); + pad3[i]->SetFrameFillColor(10); + pad3[i]->Draw(); + pad3[i]->cd(); + comprtime[i][ii]= new TGraph(maxev-minev,x,yyc); + oss1<<"DSP "<SetTitle(oss1.str().c_str()); + comprtime[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); + comprtime[i][ii]->GetXaxis()->CenterTitle(); + comprtime[i][ii]->GetYaxis()->SetTitle("compressiontime (ms)"); + comprtime[i][ii]->GetYaxis()->CenterTitle(); + comprtime[i][ii]->GetYaxis()->SetRangeUser(0,2); + comprtime[i][ii]->Draw("ap"); + oss1.str(""); + + CompTimeCanv[ii]->Update(); + LandauCanv1[ii]->Update(); + LandauCanv2[ii]->Update(); + LandauCanv3[ii]->Update(); + IlluminaCanv[ii]->Update(); + }; - EventNumCanv->cd(); - TPad *pt0=new TPad("pt0"," ",0.704,0.004,0.996,0.98); - pt1 = new TPaveText(0.004,0.004,0.986,0.996); - pt = new TPad("pt"," ",0.004,0.004,0.7,0.98,18,0,0); - pt1->SetFillColor(10); - pt1->ReadFile(out + "warning.txt"); - pt1->SetTextAlign(22); - pt1->SetTextSize(0.035); - pt0->SetFillColor(10); - pt0->SetFrameFillColor(10); - pt0->Draw(); - pt0->cd(); - pt1->Draw(); - EventNumCanv->cd(); - pt->SetFillColor(10); - pt->SetFrameFillColor(10); - pt->Draw(); - pt->cd(); - eventnumb=new TGraph(nevent,x,eventint); - eventnumb->SetTitle(""); - eventnumb->GetXaxis()->SetLabelSize(0.04); - eventnumb->GetXaxis()->SetTitleSize(0.04); - eventnumb->GetXaxis()->SetTitle("OBT (ms)"); - eventnumb->GetXaxis()->CenterTitle(); - eventnumb->GetXaxis()->SetTickLength(0.01); - eventnumb->GetXaxis()->SetTitleOffset(1.2); - eventnumb->GetYaxis()->SetLabelSize(0.04); - eventnumb->GetYaxis()->SetTitleSize(0.04); - eventnumb->GetYaxis()->SetTitle("DSP event-number"); - eventnumb->GetYaxis()->CenterTitle(); - eventnumb->GetYaxis()->SetTitleOffset(1.5); - eventnumb->SetMarkerStyle(21); - eventnumb->SetMarkerColor(kBlue); - eventnumb->SetMarkerSize(0.3); - eventnumb->Draw("ap"); - - for(Int_t i=0; i<5; i++){ - for (Int_t ev=0; evcd(); + pt0=new TPad("pt0"," ",0.704,0.004,0.996,0.98); + pt1 = new TPaveText(0.004,0.004,0.986,0.996); + pt = new TPad("pt"," ",0.004,0.004,0.7,0.98,18,0,0); + pt1->SetFillColor(10); + pt1->ReadFile(out + "warning.txt"); + pt1->SetTextAlign(22); + pt1->SetTextSize(0.035); + pt0->SetFillColor(10); + pt0->SetFrameFillColor(10); + pt0->Draw(); + pt0->cd(); + pt1->Draw(); + EventNumCanv[ii]->cd(); + pt->SetFillColor(10); + pt->SetFrameFillColor(10); + pt->Draw(); + pt->cd(); + eventnumb[ii]=new TGraph(maxev-minev,x,eventint); + eventnumb[ii]->SetTitle(""); + eventnumb[ii]->GetXaxis()->SetLabelSize(0.04); + eventnumb[ii]->GetXaxis()->SetTitleSize(0.04); + eventnumb[ii]->GetXaxis()->SetTitle("OBT (ms)"); + eventnumb[ii]->GetXaxis()->CenterTitle(); + eventnumb[ii]->GetXaxis()->SetTickLength(0.01); + eventnumb[ii]->GetXaxis()->SetTitleOffset(1.2); + eventnumb[ii]->GetYaxis()->SetLabelSize(0.04); + eventnumb[ii]->GetYaxis()->SetTitleSize(0.04); + eventnumb[ii]->GetYaxis()->SetTitle("DSP event-number"); + eventnumb[ii]->GetYaxis()->CenterTitle(); + eventnumb[ii]->GetYaxis()->SetTitleOffset(1.5); + eventnumb[ii]->SetMarkerStyle(21); + eventnumb[ii]->SetMarkerColor(kBlue); + eventnumb[ii]->SetMarkerSize(0.3); + eventnumb[ii]->Draw("ap"); + EventNumCanv[ii]->Update(); + + printf("prova7\n"); + + obt=0; + for(Int_t i=0; i<5; i++){ + Int_t v=0; + for (Int_t ev=countTEMP; evGetEntry(ev); + ph=eT->GetPscuHeader(); + + if(ph->GetOrbitalTime()countTEMP){ + countTEMP=ev; + break; + } + else{ + obt=ph->GetOrbitalTime(); + tempt_tmp[v++]=(Int_t)(((3.3*tempt[ev][i]/4096)-0.586)/0.0231); + } + } + TempCanv[ii]->cd(); + tit<<"T"<SetFillColor(10); + pad6[i]->Draw(); + pad6[i]->cd(); + temp[i][ii]= new TGraph(v,xt,tempt_tmp); + temp[i][ii]->SetTitle(tit.str().c_str()); + temp[i][ii]->GetXaxis()->SetLabelSize(0.04); + temp[i][ii]->GetXaxis()->SetTitleSize(0.04); + temp[i][ii]->GetXaxis()->SetTitle("OBT (ms)"); + temp[i][ii]->GetXaxis()->CenterTitle(); + temp[i][ii]->GetXaxis()->SetTitleOffset(0.85); + temp[i][ii]->GetYaxis()->SetTitleOffset(1.2); + temp[i][ii]->GetYaxis()->SetLabelOffset(0.001); + temp[i][ii]->GetYaxis()->SetLabelSize(0.04); + temp[i][ii]->GetYaxis()->SetTitleSize(0.04); + temp[i][ii]->GetYaxis()->SetTitle("Temperatures ( ^{o}C)"); + temp[i][ii]->GetYaxis()->CenterTitle(); + temp[i][ii]->SetMarkerStyle(21); + temp[i][ii]->SetMarkerSize(0.2); + temp[i][ii]->Draw("ap"); + tit.str(""); + TempCanv[ii]->Update(); } - TempCanv->cd(); - tit<<"T"<SetFillColor(10); - pad6[i]->Draw(); - pad6[i]->cd(); - temp[i]= new TGraph(tsize,xt,tempt_tmp); - temp[i]->SetTitle(tit.str().c_str()); - temp[i]->GetXaxis()->SetLabelSize(0.04); - temp[i]->GetXaxis()->SetTitleSize(0.04); - temp[i]->GetXaxis()->SetTitle("OBT (ms)"); - temp[i]->GetXaxis()->CenterTitle(); - temp[i]->GetXaxis()->SetTitleOffset(0.85); - temp[i]->GetYaxis()->SetTitleOffset(1.2); - temp[i]->GetYaxis()->SetLabelOffset(0.001); - temp[i]->GetYaxis()->SetLabelSize(0.04); - temp[i]->GetYaxis()->SetTitleSize(0.04); - temp[i]->GetYaxis()->SetTitle("Temperatures ( ^{o}C)"); - temp[i]->GetYaxis()->CenterTitle(); - temp[i]->SetMarkerStyle(21); - temp[i]->SetMarkerSize(0.2); - temp[i]->Draw("ap"); - tit.str(""); - } - CompTimeCanv->Update(); - LandauCanv1->Update(); - LandauCanv2->Update(); - LandauCanv3->Update(); - IlluminaCanv->Update(); - TempCanv->Update(); - + + printf("prova8\n"); + minev=maxev; + printf("\ncountrun=%d\n",ii); + if(maxev==maxevent-1) { + countrun=ii+1; + break; + } + + warning.close(); + + } + + //***************************************** + //close all files + //***************************************** + alarm.close(); + datafile->Close(); + printf("... end of packets. \n"); //************************************************************************* // Save output Files //************************************************************************* stringstream out1,out2,out3,command; - if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ - out1.str(""); - out2.str(""); - out3.str(""); - - out1<Print(out+out1.str().c_str(),"Portrait"); - EventNumCanv->Print(out+out2.str().c_str(),"Portrait"); - LandauCanv1->Print(out+out2.str().c_str(),"Portrait"); - LandauCanv2->Print(out+out2.str().c_str(),"Portrait"); - LandauCanv3->Print(out+out2.str().c_str(),"Portrait"); - IlluminaCanv->Print(out+out2.str().c_str(),"Portrait"); - TempCanv->Print(out+out3.str().c_str(),"Portrait"); + for(Int_t fl=0;fl ps file converted in pdf format!\n"); - com.str(""); - com<<"rm -f "< ps file removed!\n\n"); - com.str(""); + if(countrun==1){ + CompTimeCanv[fl]->Print(out+out1.str().c_str(),"Portrait"); + EventNumCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv1[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv2[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv3[fl]->Print(out+out2.str().c_str(),"Portrait"); + IlluminaCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + TempCanv[fl]->Print(out+out3.str().c_str(),"Portrait"); + } + else if(countrun>=1){ + if(fl==0) CompTimeCanv[fl]->Print(out+out1.str().c_str(),"Portrait"); + else CompTimeCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + EventNumCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv1[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv2[fl]->Print(out+out2.str().c_str(),"Portrait"); + LandauCanv3[fl]->Print(out+out2.str().c_str(),"Portrait"); + IlluminaCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + if(fl!=countrun-1) TempCanv[fl]->Print(out+out2.str().c_str(),"Portrait"); + else TempCanv[fl]->Print(out+out3.str().c_str(),"Portrait"); + } + + if(!strcmp(outfile.Data(),"pdf")){ + stringstream com; + com<<"ps2pdf13 "< ps file converted in pdf format!\n"); + com.str(""); + com<<"rm -f "< ps file removed!\n\n"); + com.str(""); + } + } + else{ + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); + out1.str(""); + out1<Print(out+out1.str().c_str()); } } - else{ - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - out1.str(""); - out1<Print(out+out1.str().c_str()); - } - command.str(""); command<<"rm -f "<Reset(); + gROOT->Reset(); return; }