/[PAMELA software]/eventviewer/flight/src/FEventViewerCore.cpp
ViewVC logotype

Diff of /eventviewer/flight/src/FEventViewerCore.cpp

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

revision 1.2 by mocchiut, Mon Feb 26 12:51:10 2007 UTC revision 1.9 by mocchiut, Tue Apr 17 16:05:22 2007 UTC
# Line 146  void ShowEvent(TString filename="help", Line 146  void ShowEvent(TString filename="help",
146    pamela->SetGUIPtr(*pamgui);    pamela->SetGUIPtr(*pamgui);
147    if ( outDir == "" ) outDir = startingdir;        if ( outDir == "" ) outDir = startingdir;    
148    //    //
149      TTree *otr0 = 0;
150    TTree *otr1 = 0;    TTree *otr1 = 0;
151    TTree *otr2 = 0;    TTree *otr2 = 0;
152    TTree *otr3 = 0;    TTree *otr3 = 0;
# Line 156  void ShowEvent(TString filename="help", Line 157  void ShowEvent(TString filename="help",
157    TTree *otr8 = 0;    TTree *otr8 = 0;
158    //    //
159    pamela->var.fl0 = false;    pamela->var.fl0 = false;
160      Int_t i = 0;
161      Int_t isOK = 0;
162    //    //
163   restart:   restart:
164    //    //
# Line 203  void ShowEvent(TString filename="help", Line 206  void ShowEvent(TString filename="help",
206    gStyle->SetNdivisions(1,"X");    gStyle->SetNdivisions(1,"X");
207    gStyle->SetNdivisions(1,"Y");    gStyle->SetNdivisions(1,"Y");
208    //    //
209    Int_t i = 0;    if ( i < 0 ){
210    Int_t isOK = 0;      i = -i;
211      } else {
212        i = 0;
213      };
214      isOK = 0;
215    //    //
216    // from here to refresh    // from here to refresh
217    //    //
218   refresh:   refresh:
219    //    //
220      // reset pointers
221      //
222      TFile *headerFile = 0;
223      TChain *otr = 0;
224      TTree *L0 = 0;
225      //
226      //  gROOT->Reset();
227      //
228    // set selection file variables    // set selection file variables
229    //    //
230     if ( pamela->var.refresh ){    if ( pamela->var.refresh ){
231       pamela->var.selex = true;                               //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????      if ( pamela->var.selex ){
232       selfile = pamela->var.thefilter.Data();        //      pamela->var.selex = true;                               //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
233     };        selfile = pamela->var.thefilter.Data();
234        };
235      };
236    //    //
237    //    //
238    //  if ( pamela->var.fl0 == true ) {    //  if ( pamela->var.fl0 == true ) {
# Line 284  void ShowEvent(TString filename="help", Line 301  void ShowEvent(TString filename="help",
301      carica.str("");      carica.str("");
302      carica << paminc.str().c_str() << "/feventvstruct.h";      carica << paminc.str().c_str() << "/feventvstruct.h";
303      gROOT->LoadMacro(carica.str().c_str());      gROOT->LoadMacro(carica.str().c_str());
304        //    carica.str("");
305        //    carica << paminc.str().c_str() << "/CaloNuclei.h";
306        //    gROOT->LoadMacro(carica.str().c_str());
307      //      //
308      // load the selection macro      // load the selection macro
309      //      //
310      Int_t chkload = gROOT->LoadMacro(selfile);      Int_t chkload = gROOT->LoadMacro(selfile);
311      //      //
312        pamela->var.selex = false;
313        //
314      if ( chkload ){      if ( chkload ){
315        //        //
316        // not able to open the selection file        // not able to open the selection file
# Line 302  void ShowEvent(TString filename="help", Line 324  void ShowEvent(TString filename="help",
324        pamela->var.selex = false;        pamela->var.selex = false;
325        printf("\n WARNING! no selection file loaded! \n\n");        printf("\n WARNING! no selection file loaded! \n\n");
326        pamgui->DIALOG(1," No selection file loaded! ");        pamgui->DIALOG(1," No selection file loaded! ");
327          selfile = "";
328        //        //
329        // clear field in the GUI        // clear field in the GUI
330        //        //
# Line 321  void ShowEvent(TString filename="help", Line 344  void ShowEvent(TString filename="help",
344    //  LOAD FILES        //  LOAD FILES    
345    //    //
346    //    //
347    TFile *headerFile = 0;  //   if ( headerFile ) headerFile->Close();
348    TTree *otr = 0;  //   if ( otr ) otr->Delete();
349    //   if ( L0 ) L0->Delete();
350    
351    //    //
352    // check if user has given as input a correct path    // check if user has given as input a correct path
353    //    //
# Line 344  void ShowEvent(TString filename="help", Line 369  void ShowEvent(TString filename="help",
369    //    //
370    // ok, open file and determine if it is a YODA or DARTHVADER file    // ok, open file and determine if it is a YODA or DARTHVADER file
371    //    //
372    
373    headerFile=new TFile(filename.Data());    headerFile=new TFile(filename.Data());
374    if ( FORCELEV == 0 ){    if ( FORCELEV == 0 ){
375      pamela->level.file = 0;      pamela->level.file = 0;
376      otr = (TTree*)headerFile->Get("Physics");      L0 = (TTree*)headerFile->Get("Physics");
377      if ( !otr ){      if ( !L0 ){
378        printf("ERROR: no Physics tree...\n");        printf("ERROR: no Physics tree...\n");
379        pamgui->DIALOG(2,"No Physics tree in this file");        pamgui->DIALOG(2,"No Physics tree in this file");
380        pamela->var.waitforever = true;        pamela->var.waitforever = true;
# Line 356  void ShowEvent(TString filename="help", Line 382  void ShowEvent(TString filename="help",
382      }      }
383    } else {    } else {
384      pamela->level.file = 2;      pamela->level.file = 2;
385      otr = (TTree*)headerFile->Get("Trigger");      otr0 = (TTree*)headerFile->Get("Trigger");
386      otr1 = (TTree*)headerFile->Get("Calorimeter");      otr1 = (TTree*)headerFile->Get("Calorimeter");
387      otr2 = (TTree*)headerFile->Get("Tracker");      otr2 = (TTree*)headerFile->Get("Tracker");
388      otr3 = (TTree*)headerFile->Get("NeutronD");      otr3 = (TTree*)headerFile->Get("NeutronD");
# Line 365  void ShowEvent(TString filename="help", Line 391  void ShowEvent(TString filename="help",
391      otr6 = (TTree*)headerFile->Get("ToF");      otr6 = (TTree*)headerFile->Get("ToF");
392      otr7 = (TTree*)headerFile->Get("Run");      otr7 = (TTree*)headerFile->Get("Run");
393      otr8 = (TTree*)headerFile->Get("Anticounter");      otr8 = (TTree*)headerFile->Get("Anticounter");
394      if ( !otr && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 ){      if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 ){
395        otr = (TTree*)headerFile->Get("Physics");              L0 = (TTree*)headerFile->Get("Physics");      
396        pamela->level.file = -1;        pamela->level.file = -1;
397      } else {      } else {
398        stringstream dddec;        stringstream dddec;
399        dddec.str("");        dddec.str("");
400        dddec << " +ALL +CAL1 -TRKh -TRK1 ";        dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 ";
401        if ( !otr ){        if ( !otr0 ){
402          dddec << " -TRG ";          dddec << " -TRG ";
403          //      pamela->var.TRG = 0;          pamela->var.TRG = 0;
404            otr0 = otr1;
405        };        };
406        if ( !otr1 ){        if ( !otr1 ){
407          dddec << " -CAL ";          dddec << " -CAL ";
408          pamela->var.CALO = 0;          pamela->var.CALO = 0;
409            if ( !otr0 ) otr0 = otr2;
410        };        };
411        if ( !otr2 ){        if ( !otr2 ){
412          dddec << " -TRK2 -TRK ";          dddec << " -TRK2 -TRK ";
413          pamela->var.TRK = 0;          pamela->var.TRK = 0;
414            if ( !otr0 ) otr0 = otr3;
415        };        };
416        if ( !otr3 ){        if ( !otr3 ){
417          dddec << " -ND ";          dddec << " -ND ";
418          pamela->var.ND = 0;          pamela->var.ND = 0;
419            if ( !otr0 ) otr0 = otr4;
420        };        };
421        if ( !otr4 ){        if ( !otr4 ){
422          dddec << " -ORB ";          dddec << " -ORB ";
423        //        pamela->var.CALO = 0;          pamela->var.ORB = 0;
424            if ( !otr0 ) otr0 = otr5;
425        };        };
426        if ( !otr5 ){        if ( !otr5 ){
427          dddec << " -S4 ";          dddec << " -S4 ";
428          pamela->var.S4 = 0;          pamela->var.S4 = 0;
429            if ( !otr0 ) otr0 = otr6;
430        };        };
431        if ( !otr6 ){        if ( !otr6 ){
432          dddec << " -TOF ";          dddec << " -TOF ";
433          pamela->var.TOF = 0;          pamela->var.TOF = 0;
434            if ( !otr0 ) otr0 = otr8;
435        };        };
436        if ( !otr7 ){        if ( !otr7 ){
437          dddec << " -RUN ";          dddec << " -RUN ";
# Line 410  void ShowEvent(TString filename="help", Line 443  void ShowEvent(TString filename="help",
443        };        };
444        pamela->SetDDEC(dddec.str().c_str());        pamela->SetDDEC(dddec.str().c_str());
445      };      };
446      if ( !otr && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8){      if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 && !L0 ){
447        pamela->level.file = -1;        pamela->level.file = -1;
448        printf("ERROR: nor Physics nor Run tree...\n");        printf("ERROR: nor Physics nor Run tree...\n");
449        pamgui->DIALOG(2,"Nor Physics nor Run tree in this file");        pamgui->DIALOG(2,"Nor Physics nor Run tree in this file");
# Line 418  void ShowEvent(TString filename="help", Line 451  void ShowEvent(TString filename="help",
451        goto refresh;        goto refresh;
452      };      };
453    };    };
454      headerFile->Close("R");
455    //    //
456    if ( pamela->level.file != 2 ){    if ( pamela->level.file != 2 ){
457      printf(" This is a YODA (level0) file \n");      printf(" This is a YODA (level0) file \n");
# Line 431  void ShowEvent(TString filename="help", Line 465  void ShowEvent(TString filename="help",
465    //    //
466    // Load the file    // Load the file
467    //    //
468    if ( !pamela->Load(*otr,*headerFile) ){    if ( otr0 || L0 ){
469        otr = pamela->Load(filename.Data());
470        if ( !otr ){
471          pamela->level.file = -1;
472          printf("ERROR: problems opening file...\n");
473          pamgui->DIALOG(2,"Problems opening file");
474          pamela->var.waitforever = true;
475          goto refresh;
476        };
477      } else {
478      pamela->level.file = -1;      pamela->level.file = -1;
479      printf("ERROR: problems opening file...\n");      printf("ERROR: problems with TTree while opening file...\n");
480      pamgui->DIALOG(2,"Problems opening file");      pamgui->DIALOG(2,"Problems opening file");
481      pamela->var.waitforever = true;      pamela->var.waitforever = true;
482      goto refresh;      goto refresh;
# Line 443  void ShowEvent(TString filename="help", Line 486  void ShowEvent(TString filename="help",
486    //    //
487    // get the number of entries    // get the number of entries
488    //    //
489    otr->Print();    if ( !otr ) printf(" AGH! \n");
490      //
491    Long64_t nevents = otr->GetEntries();    Long64_t nevents = otr->GetEntries();
492    printf(" The file contains %i physics events \n",(int)nevents);    printf(" The file contains %i physics events \n",(int)nevents);
493    //    //
494    // check we have at least one event    // check we have at least one event
495    //    //
496    if (nevents<=0) {    if (nevents<=0) {
497      headerFile->Close();      //    headerFile->Close();
498      printf("The file is empty, exiting...\n");      printf("The file is empty, exiting...\n");
499      pamgui->DIALOG(0," The file contains no physics data! ");      pamgui->DIALOG(0," The file contains no physics data! ");
500      pamela->var.waitforever = true;      pamela->var.waitforever = true;
# Line 474  void ShowEvent(TString filename="help", Line 517  void ShowEvent(TString filename="help",
517    if ( !pamela->var.refresh ) i = pamela->minevent;    if ( !pamela->var.refresh ) i = pamela->minevent;
518    pamela->var.refresh = false;    pamela->var.refresh = false;
519    //    //
520      pamgui->RefreshButtons();
521      //
522    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
523    //  MAIN LOOP STARTS HERE:    //  MAIN LOOP STARTS HERE:
524    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
# Line 560  void ShowEvent(TString filename="help", Line 605  void ShowEvent(TString filename="help",
605        figsave << (pamela->var.i+1);        figsave << (pamela->var.i+1);
606        figsave << bw;        figsave << bw;
607        pamela->var.svas=figsave.str().c_str();        pamela->var.svas=figsave.str().c_str();
608    
609          //      printf(" qua %s \n",figsave.str().c_str());
610        //        //
611        // upgrade the figure filename in the GUI        // upgrade the figure filename in the GUI
612        //        //
# Line 580  void ShowEvent(TString filename="help", Line 627  void ShowEvent(TString filename="help",
627        //        //
628        pamela->var.goon = false;        pamela->var.goon = false;
629        if ( pamela->var.refresh || pamela->var.restart ){        if ( pamela->var.refresh || pamela->var.restart ){
630          headerFile->Close();          if ( pamela->GetL2() ) pamela->GetL2()->Reset();
631            if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
632            otr = NULL;
633            //      if ( headerFile ) headerFile->Close("R");
634          if ( pamela->var.refresh ) goto refresh;          if ( pamela->var.refresh ) goto refresh;
635          if ( pamela->var.restart ){          if ( pamela->var.restart ){
636            filename = pamela->var.thefilename.Data();            filename = pamela->var.thefilename.Data();

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.23