/[PAMELA software]/calo/flight/FQLOOK/macros/FCaloQLOOK.cxx
ViewVC logotype

Diff of /calo/flight/FQLOOK/macros/FCaloQLOOK.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mocchiut, Thu Mar 9 16:14:32 2006 UTC revision 1.8 by mocchiut, Tue May 23 13:28:22 2006 UTC
# Line 1  Line 1 
1  //  //
2  //   Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti  //   Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti
3  //  //
4  //   FCaloQLOOK.c      version 1.01  (2006-02-28)  //   FCaloQLOOK.c      version 1.07  (2006-05-23)
5  //  //
6  //   The only input needed is the path to the directory created by YODA for the data file you want to analyze.  //   The only input needed is the path to the directory created by YODA for the data file you want to analyze.
7  //  //
8  //   Changelog:  //   Changelog:
9  //  //
10    //   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
11    //                             case of latchup alarm.
12    //
13    //   1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script!
14    //
15    //   1.04 - 1.05 (2006-03-22): Corrected wrong .C files.
16    //
17    //   1.03 - 1.04 (2006-03-20): Documentation updated.
18    //
19    //   1.02 - 1.03 (2006-03-20): Changed name of shared libraries (from FCaloQLOOK_cxx.so to libFCaloQLOOK.so).
20    //
21    //   1.01 - 1.02 (2006-03-13): Include files from YODA without "event" directory.
22    //
23  //   1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package.  //   1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package.
24  //  //
25  //   0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software).  //   0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software).
# Line 25  Line 38 
38  #include <TPad.h>  #include <TPad.h>
39  #include <TPolyLine.h>  #include <TPolyLine.h>
40  #include <TStyle.h>  #include <TStyle.h>
41    #include <TSystem.h>
42  //  //
43  #include <event/PamelaRun.h>  #include <PamelaRun.h>
44  #include <event/physics/calorimeter/CalorimeterEvent.h>  #include <physics/calorimeter/CalorimeterEvent.h>
45  //  //
46  #include <FCaloQLOOKfun.h>  #include <FCaloQLOOKfun.h>
47  //  //
# Line 72  void FCaloQLOOK(TString filename, Int_t Line 86  void FCaloQLOOK(TString filename, Int_t
86    ifstream myfile;    ifstream myfile;
87    myfile.open(filename.Data());    myfile.open(filename.Data());
88    if ( !myfile ){    if ( !myfile ){
89      printf(" No such file, exiting...\n");      printf(" %s :no such file, exiting...\n\n",filename.Data());
90      return;      return;
91    };    };
92    myfile.close();    myfile.close();
93    //    //
94    TFile *File = new TFile(filename.Data());    TFile *File = new TFile(filename.Data());
95    TTree *tr = (TTree*)File->Get("Physics");    TTree *tr = (TTree*)File->Get("Physics");
96      if ( !tr ) {
97        printf(" Physics : no such tree in %s \n",filename.Data());
98        printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n");
99        return;
100      };
101    //    //
102    // Define variables    // Define variables
103    //    //
# Line 160  void FCaloQLOOK(TString filename, Int_t Line 179  void FCaloQLOOK(TString filename, Int_t
179    TH1F *calev01;    TH1F *calev01;
180    TH1F *calev23;    TH1F *calev23;
181    TH1F *calev03;    TH1F *calev03;
182      TH1F *lupstw[4];
183      TH1F *lup[4];
184    TH2D *calev2;    TH2D *calev2;
185    
186    h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.);    h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.);
# Line 182  void FCaloQLOOK(TString filename, Int_t Line 203  void FCaloQLOOK(TString filename, Int_t
203    calev03->SetBit(TH1F::kCanRebin);    calev03->SetBit(TH1F::kCanRebin);
204    calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.);    calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.);
205    calev2->SetBit(TH2D::kCanRebin);    calev2->SetBit(TH2D::kCanRebin);
206        
207      stringstream oss;
208      stringstream noss;
209      for ( Int_t i=0; i<4; i++){
210        oss.str("");
211        oss << "OBT stw latch up section " << i;
212        noss.str("");
213        noss << "C" << 21+i;
214        lupstw[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1);
215        lupstw[i]->SetBit(TH1F::kCanRebin);
216        oss.str("");
217        oss << "OBT no stw latch up section " << i;
218        noss.str("");
219        noss << "C" << 25+i;
220        lup[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1);
221        lup[i]->SetBit(TH1F::kCanRebin);
222      };
223    
224    //    //
225    // run over each event and take out some variables    // run over each event and take out some variables
226    //    //
# Line 273  void FCaloQLOOK(TString filename, Int_t Line 311  void FCaloQLOOK(TString filename, Int_t
311    Int_t outdexy = 0;    Int_t outdexy = 0;
312    Int_t indexyc = 0;    Int_t indexyc = 0;
313    Int_t outdexyc = 0;    Int_t outdexyc = 0;
314      Int_t obt = 0;
315      Int_t minobt[4];
316      Int_t maxobt[4];
317      Int_t swminobt[4];
318      Int_t swmaxobt[4];
319      Bool_t firstobt[4];
320      Bool_t swfirstobt[4];
321      for ( Int_t i = 0; i<4; i++){
322        minobt[i] = 0;
323        maxobt[i] = 0;
324        swminobt[i] = 0;
325        swmaxobt[i] = 0;
326        firstobt[i] = true;
327        swfirstobt[i] = true;
328      };
329    while ( i < maxevent+1){    while ( i < maxevent+1){
330      tshit = 0;      tshit = 0;
331      trshit = 0;      trshit = 0;
# Line 282  void FCaloQLOOK(TString filename, Int_t Line 335  void FCaloQLOOK(TString filename, Int_t
335      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
336      headco = headc;      headco = headc;
337      headc = ph->GetCounter();      headc = ph->GetCounter();
338        obt = ph->GetOrbitalTime();
339      calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));      calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));
340      calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));      calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));
341      calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));      calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));
# Line 385  void FCaloQLOOK(TString filename, Int_t Line 439  void FCaloQLOOK(TString filename, Int_t
439                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 ) {
440                  pdone = 1;                  pdone = 1;
441                  pshit[se][pl]++ ;                  pshit[se][pl]++ ;
442                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++;                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ) {
443                  lver[se][2]++ ;                    lalarm[se]++;
444                      lup[se]->Fill(obt);
445                      if ( firstobt[se] ) minobt[se] = obt;
446                      if ( obt > maxobt[se] ) maxobt[se] = obt;
447                    };
448                    lver[se][2]++ ;        
449                };                };
450              }              }
451              //              //
# Line 448  void FCaloQLOOK(TString filename, Int_t Line 507  void FCaloQLOOK(TString filename, Int_t
507                if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {                if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {
508                  pdone = 1;                  pdone = 1;
509                  pshit[se][pl]++ ;                                          pshit[se][pl]++ ;                        
510                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++;                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ){
511                      lalarm[se]++;
512                      lup[se]->Fill(obt);
513                      if ( firstobt[se] ) minobt[se] = obt;
514                      if ( obt > maxobt[se] ) maxobt[se] = obt;
515                    };
516                  lver[se][2]++ ;                  lver[se][2]++ ;
517                };                };
518              };              };
# Line 482  void FCaloQLOOK(TString filename, Int_t Line 546  void FCaloQLOOK(TString filename, Int_t
546          if ( cestw & (1 << 1) ) ver[k][5]++ ;          if ( cestw & (1 << 1) ) ver[k][5]++ ;
547          if ( cestw & (1 << 2) ) ver[k][4]++ ;          if ( cestw & (1 << 2) ) ver[k][4]++ ;
548          if ( cestw & (1 << 3) ) ver[k][3]++ ;          if ( cestw & (1 << 3) ) ver[k][3]++ ;
549          if ( cestw & (1 << 4) ) ver[k][2]++ ;          if ( cestw & (1 << 4) ){
550              ver[k][2]++ ;
551              lupstw[k]->Fill(obt);
552              if ( swfirstobt[k] ) swminobt[k] = obt;
553              if ( obt > swmaxobt[k] ) swmaxobt[k] = obt;
554            };
555          if ( cestw & (1 << 5) ) ver[k][1]++ ;          if ( cestw & (1 << 5) ) ver[k][1]++ ;
556          if ( cestw & (1 << 6) ) ver[k][0]++ ;                    if ( cestw & (1 << 6) ) ver[k][0]++ ;          
557        };        };
# Line 547  void FCaloQLOOK(TString filename, Int_t Line 616  void FCaloQLOOK(TString filename, Int_t
616    t->DrawLatex(2.,99.,errore.str().c_str());    t->DrawLatex(2.,99.,errore.str().c_str());
617    TPad *pd5;    TPad *pd5;
618    TPad *pd6;    TPad *pd6;
619      TPad *pd7;
620      TPad *pd8;
621    TPad *pad1;    TPad *pad1;
622    TPad *pad2;    TPad *pad2;
623    TPad *pad3;    TPad *pad3;
# Line 933  void FCaloQLOOK(TString filename, Int_t Line 1004  void FCaloQLOOK(TString filename, Int_t
1004      Dexy->Draw("SAME");      Dexy->Draw("SAME");
1005    };      };  
1006    //    //
1007      TCanvas *figura3 = 0;
1008      Bool_t printfigure3 = false;
1009      for (Int_t i = 0; i<4; i++){
1010        if ( ver[i][2] || lver[i][2] ){
1011          printfigure3 = true;
1012          break;
1013        };
1014      };
1015      if ( printfigure3 ){
1016        figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900);
1017        figura3->SetFillColor(10);
1018        figura3->Range(0,0,100,100);
1019        errore.str("");
1020        errore << "EXPERT  --  File: " << file;
1021        errore << " ";
1022        t=new TLatex();
1023        t->SetTextFont(32);
1024        t->SetTextColor(1);
1025        t->SetTextAlign(12);
1026        t->SetTextSize(0.015);
1027        t->DrawLatex(2.,99.,errore.str().c_str());
1028        pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45);
1029        pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45);
1030        pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45);
1031        pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45);
1032        pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45);
1033        pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45);
1034        pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45);
1035        pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45);
1036        figura3->cd();
1037        pd1->Range(0,0,100,100);
1038        pd2->Range(0,0,100,100);
1039        pd3->Range(0,0,100,100);
1040        pd4->Range(0,0,100,100);      
1041        pd1->SetTicks();
1042        pd2->SetTicks();
1043        pd3->SetTicks();
1044        pd4->SetTicks();
1045        pd1->Draw();
1046        pd2->Draw();
1047        pd3->Draw();
1048        pd4->Draw();
1049        pd5->Range(0,0,100,100);
1050        pd6->Range(0,0,100,100);
1051        pd7->Range(0,0,100,100);
1052        pd8->Range(0,0,100,100);      
1053        pd5->SetTicks();
1054        pd6->SetTicks();
1055        pd7->SetTicks();
1056        pd8->SetTicks();
1057        pd5->Draw();
1058        pd6->Draw();
1059        pd7->Draw();
1060        pd8->Draw();
1061        pd1->cd();
1062        lup[0]->SetAxisRange((Double_t)minobt[0]*0.9,(Double_t)maxobt[0]*1.1,"X");
1063        lup[0]->Draw();
1064        pd5->cd();
1065        lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X");
1066        lupstw[0]->Draw();
1067        pd2->cd();
1068        lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X");
1069        lup[1]->Draw();
1070        pd6->cd();
1071        lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X");
1072        lupstw[1]->Draw();
1073        pd3->cd();
1074        lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X");
1075        lup[2]->Draw();
1076        pd7->cd();
1077        lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X");
1078        lupstw[2]->Draw();
1079        pd4->cd();
1080        lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X");
1081        lup[3]->Draw();
1082        pd8->cd();
1083        lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X");
1084        lupstw[3]->Draw();
1085      };
1086      //
1087    //  output figures, report sheet:    //  output figures, report sheet:
1088    //    //
1089    TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900);    TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900);
# Line 1009  void FCaloQLOOK(TString filename, Int_t Line 1160  void FCaloQLOOK(TString filename, Int_t
1160            check = true;            check = true;
1161          }          }
1162          if (j == 2) {          if (j == 2) {
1163              //      printf("boh! lalarm[%i] = %i \n",i,lalarm[i]);
1164            if ( lalarm[i] ){            if ( lalarm[i] ){
1165              errore.str("");              errore.str("");
1166              errore << "* Latch up: " << ver[i][j];              errore << "* Latch up: " << ver[i][j];
1167              errore << " (" << lalarm[i];                      errore << " (" << lalarm[i];        
1168              errore << " NOT rec!): ";              errore << " NOT rec!): ";
1169              t->DrawLatex(0.,70.,errore.str().c_str());              t->DrawLatex(2.,70.,errore.str().c_str());
1170              check = true;              check = true;
1171            } else {            } else {
1172              errore.str("");              errore.str("");
# Line 1239  void FCaloQLOOK(TString filename, Int_t Line 1391  void FCaloQLOOK(TString filename, Int_t
1391      figsave2.str("");      figsave2.str("");
1392      figsave2 << outdir << "/" ;      figsave2 << outdir << "/" ;
1393      figsave2 << figrec << "_qlook.";      figsave2 << figrec << "_qlook.";
1394      figsave2 << format << ")";      if ( printfigure3 ){
1395      figura2->Print(figsave2.str().c_str(),"Landscape");        figsave2 << format;
1396          figura2->Print(figsave2.str().c_str(),"Landscape");
1397          figsave2.str("");
1398          figsave2 << outdir << "/" ;
1399          figsave2 << figrec << "_qlook.";
1400          figsave2 << format << ")";
1401          figura3->Print(figsave2.str().c_str(),"Landscape");
1402        } else {
1403          figsave2 << format << ")";;
1404          figura2->Print(figsave2.str().c_str(),"Landscape");
1405        };
1406    } else {    } else {
1407      figsave.str("");      figsave.str("");
1408      figsave << outdir << "/" ;      figsave << outdir << "/" ;
# Line 1252  void FCaloQLOOK(TString filename, Int_t Line 1414  void FCaloQLOOK(TString filename, Int_t
1414      figsave << figrec << "_qlook2.";      figsave << figrec << "_qlook2.";
1415      figsave << format;      figsave << format;
1416      figura2->SaveAs(figsave.str().c_str());      figura2->SaveAs(figsave.str().c_str());
1417        if ( printfigure3 ){
1418          figsave.str("");
1419          figsave << outdir << "/" ;
1420          figsave << figrec << "_qlook2bis.";
1421          figsave << format;
1422          figura3->SaveAs(figsave.str().c_str());
1423        };
1424      figsave.str("");      figsave.str("");
1425      figsave << outdir << "/" ;      figsave << outdir << "/" ;
1426      figsave << figrec << "_qlook3.";      figsave << figrec << "_qlook3.";

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.23