--- calo/flight/FQLOOK/macros/FCaloQLOOK.cxx 2006/05/29 12:08:13 1.10 +++ calo/flight/FQLOOK/macros/FCaloQLOOK.cxx 2006/08/03 15:25:45 1.13 @@ -1,13 +1,15 @@ // // Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti // -// FCaloQLOOK.c version 1.08 (2006-05-29) +// FCaloQLOOK.c version 1.11 (2006-07-17) // // The only input needed is the path to the directory created by YODA for the data file you want to analyze. // // Changelog: // -// 1.07 - 1.08 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. +// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. +// +// 1.07 - 1.09 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Bug in latchup alarm not coming from the status word, fixed. // // 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the // case of latchup alarm. @@ -83,7 +85,7 @@ return file2; } -void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ +void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "png"){ gStyle->SetPaperSize(19.,25.); const char* startingdir = gSystem->WorkingDirectory(); // printf(" basename is %s \n",gSystem->BaseName(filename.Data())); @@ -112,7 +114,10 @@ Float_t ctshitthr = 0.65; Float_t cbasethr = 0.95; Float_t cdexythr = 0.995; + //Float_t cdexythr = 0.90; Float_t cdexycthr = 0.95; + Float_t h1rth = 0.90; + Int_t calevnth = 13; // pamela::calorimeter::CalorimeterEvent *ce = 0; pamela::EventHeader *eh = 0; @@ -198,9 +203,10 @@ hdiff->SetBit(TH1F::kCanRebin); Baseline = new TH1F("C9","baselines",100,0,3); Baseline->SetBit(TH1F::kCanRebin); - Dexy = new TH1F("C12","dexy",100,0.,37000.); - Dexyc = new TH1F("C10","dexyc",100,0,3); - Dexyc->SetBit(TH1F::kCanRebin); + Dexy = new TH1F("C12","dexy",100,0.,10000.); + Dexy->SetBit(TH1F::kCanRebin); + Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); +// Dexyc->SetBit(TH1F::kCanRebin); Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); @@ -281,7 +287,8 @@ bool isRAW = 0; Int_t alldexy=0; Int_t alldexy2=0; - Int_t stri=0; + Int_t planebases=0; + // Int_t stri=0; Int_t fcheck = 0; Int_t cestw=0; Int_t cmask = 127 ; @@ -309,6 +316,8 @@ Float_t headc = 0.; Float_t headco = 0.; Bool_t h1rcheck = false; + Int_t h1rin = 0; + Int_t h1rout = 0; Int_t intshit = 0; Int_t outtshit = 0; Int_t incshit = 0; @@ -344,9 +353,12 @@ headco = headc; headc = ph->GetCounter(); obt = ph->GetOrbitalTime(); - calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); - calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); - calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); + if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; + if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; + if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; + // calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); + // calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); + // calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); @@ -432,19 +444,32 @@ bdone = 0; bl++; allbase = ce->base[l][ii][bl]; + // alldexy=0; + // alldexy2=0; + // stri=0; + // for (Int_t e = 0; e < 16 ; e++ ){ + // stri = e + 16 * bl; + // alldexy += (int)ce->dexyc[l][ii][stri]; + // alldexy2 += (int)ce->dexy[l][ii][stri]; + // }; + }; + // + if ( kk == 0 ){ + planebases = 0; alldexy=0; alldexy2=0; - stri=0; - for (Int_t e = 0; e < 16 ; e++ ){ - stri = e + 16 * bl; - alldexy += (int)ce->dexyc[l][ii][stri]; - alldexy2 += (int)ce->dexy[l][ii][stri]; + for (Int_t e = 0; e < 96 ; e++ ){ + if ( e < 6 ) planebases += (int)ce->base[l][ii][e]; + alldexy += (int)ce->dexyc[l][ii][e]; + alldexy2 += (int)ce->dexy[l][ii][e]; }; }; + // if ( !isRAW ) { // if ( !pdone ){ - if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { + // if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { + if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) { pdone = 1; pshit[se][pl]++ ; if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { @@ -512,7 +537,8 @@ // } else { if ( !pdone ){ - if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { + if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { + // if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { pdone = 1; pshit[se][pl]++ ; if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ @@ -581,30 +607,39 @@ trshit += rshit[k][kk]; }; }; - Calstriphit->Fill(cshit); - if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ - incshit++; - } else { - outcshit++; - }; - if ( tshit>0 ) h1->Fill(tshit); - if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ - intshit++; - } else { - outtshit++; + if (isCOMP || isFULL){ + Calstriphit->Fill(cshit); + // if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ + if ( (cshit > 10 && cshit < 100) ){ + incshit++; + } else { + outcshit++; + }; + // + if ( tshit>0 ) h1->Fill(tshit); + // if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ + if ( (tshit > 10 && tshit < 100) ){ + intshit++; + } else { + outtshit++; + }; }; if ( trshit>0 ) { h1r->Fill(trshit); if ( trshit < 4210 ){ - h1rcheck = true; + h1rout++; // printf("ma come... trshit %i \n",trshit); + } else { + h1rin++; }; }; if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); i++; }; printf("\n"); - + if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ + h1rcheck = true; + }; // // output figures, first sheet: // @@ -670,20 +705,20 @@ h1->Draw(); // h1max = h1->GetMaximum()*1.05; - Double_t xc[4] = {0.,25.,25.,0.}; + Double_t xc[4] = {10.,100.,100.,10.}; Double_t yc[4] = {0.,0.,h1max,h1max}; banda1 = new TPolyLine(4,xc,yc); banda1->SetLineColor(5); banda1->SetFillColor(5); banda1->SetLineWidth(1); banda1->Draw("fSAME"); - Double_t xd[4] = {40.,80.,80.,40.}; - Double_t yd[4] = {0.,0.,h1max,h1max}; - banda2 = new TPolyLine(4,xd,yd); - banda2->SetLineColor(5); - banda2->SetFillColor(5); - banda2->SetLineWidth(1); - banda2->Draw("fSAME"); + // Double_t xd[4] = {40.,80.,80.,40.}; + // Double_t yd[4] = {0.,0.,h1max,h1max}; + // banda2 = new TPolyLine(4,xd,yd); + // banda2->SetLineColor(5); + // banda2->SetFillColor(5); + // banda2->SetLineWidth(1); + //banda2->Draw("fSAME"); h1->Draw("SAME"); // figura->cd(); @@ -720,20 +755,20 @@ h1->SetYTitle("Number of events"); h1->Draw(); h1max = h1->GetMaximum()*1.05; - Double_t xe[4] = {0.,25.,25.,0.}; + Double_t xe[4] = {10.,100.,100.,10.}; Double_t ye[4] = {0.,0.,h1max,h1max}; banda1 = new TPolyLine(4,xe,ye); banda1->SetLineColor(5); banda1->SetFillColor(5); banda1->SetLineWidth(1); banda1->Draw("fSAME"); - Double_t xf[4] = {40.,80.,80.,40.}; - Double_t yf[4] = {0.,0.,h1max,h1max}; - banda2 = new TPolyLine(4,xf,yf); - banda2->SetLineColor(5); - banda2->SetFillColor(5); - banda2->SetLineWidth(1); - banda2->Draw("fSAME"); + // Double_t xf[4] = {40.,80.,80.,40.}; + // Double_t yf[4] = {0.,0.,h1max,h1max}; + // banda2 = new TPolyLine(4,xf,yf); + // banda2->SetLineColor(5); + // banda2->SetFillColor(5); + // banda2->SetLineWidth(1); + // banda2->Draw("fSAME"); h1->Draw("SAME"); }; if ( trshit !=0 ) { @@ -763,7 +798,7 @@ }; }; if ( !errorfull ) { - if ( calevn1 || calevn2 || calevn3 ) { + if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); @@ -938,31 +973,34 @@ Dexyc->Draw("SAME"); // pd3->cd(); +// gPad->SetLogy(); Calstriphit->SetXTitle("Number of hit"); Calstriphit->SetYTitle("Number of events"); Calstriphit->Draw(); h1max = Calstriphit->GetMaximum()*1.05; - Double_t xg[4] = {0.,25.,25.,0.}; + Double_t xg[4] = {10.,100.,100.,10.}; Double_t yg[4] = {0.,0.,h1max,h1max}; banda1 = new TPolyLine(4,xg,yg); banda1->SetLineColor(5); banda1->SetFillColor(5); banda1->SetLineWidth(1); banda1->Draw("fSAME"); - Double_t xh[4] = {40.,80.,80.,40.}; - Double_t yh[4] = {0.,0.,h1max,h1max}; - banda2 = new TPolyLine(4,xh,yh); - banda2->SetLineColor(5); - banda2->SetFillColor(5); - banda2->SetLineWidth(1); - banda2->Draw("fSAME"); + // Double_t xh[4] = {40.,80.,80.,40.}; + // Double_t yh[4] = {0.,0.,h1max,h1max}; + // banda2 = new TPolyLine(4,xh,yh); + // banda2->SetLineColor(5); + // banda2->SetFillColor(5); + // banda2->SetLineWidth(1); + // banda2->Draw("fSAME"); Calstriphit->Draw("SAME"); // pd4->cd(); + gPad->SetLogy(); Dexy->SetXTitle("ADC channels"); Dexy->SetYTitle("Number of events"); Dexy->Draw(); - h1max = Dexy->GetMaximum()*1.05; + // h1max = Dexy->GetMaximum()*1.05; + h1max = Dexy->GetMaximum()*2.05; Double_t xd[4] = {2000.,5000.,5000.,2000.}; Double_t yd[4] = {0.,0.,h1max,h1max}; banda1 = new TPolyLine(4,xd,yd); @@ -998,10 +1036,12 @@ pd4->Draw(); // pd4->cd(); + gPad->SetLogy(); Dexy->SetXTitle("ADC channels"); Dexy->SetYTitle("Number of events"); Dexy->Draw(); - h1max = Dexy->GetMaximum()*1.05; + // h1max = Dexy->GetMaximum()*1.05; + h1max = Dexy->GetMaximum()*2.05; Double_t xd[4] = {2000.,5000.,5000.,2000.}; Double_t yd[4] = {0.,0.,h1max,h1max}; banda1 = new TPolyLine(4,xd,yd); @@ -1268,7 +1308,7 @@ errore << "Missing section: " << ver[i][j]; errore << " time(s)"; t->DrawLatex(2.,50.,errore.str().c_str()); - check = true; + if ( ver[i][j] > 3 ) check = true; } if (j == 10) { errore.str(""); @@ -1282,7 +1322,7 @@ errore << "CRC error (data): " << ver[i][j]; errore << " time(s)"; t->DrawLatex(2.,38.,errore.str().c_str()); - check = true; + if ( ver[i][j] > 10 ) check = true; } if (j == 12) { errore.str("");