/[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.1 by mocchiut, Fri Jul 14 14:18:06 2006 UTC revision 1.8 by mocchiut, Wed Apr 11 13:28:42 2007 UTC
# Line 141  void ShowEvent(TString filename="help", Line 141  void ShowEvent(TString filename="help",
141    //    //
142    PAMevcontrol *pamgui = 0;    PAMevcontrol *pamgui = 0;
143    //    //
144    if ( !popup ) {    pamgui = new PAMevcontrol(gClient->GetRoot(),400,800,pamela->var,pamela->level,*figure);
145      pamgui = new PAMevcontrol(gClient->GetRoot(),400,800,pamela->var,pamela->level,*figure);    popup = true;
146      popup = true;    pamela->SetGUIPtr(*pamgui);
147      pamela->SetGUIPtr(*pamgui);    if ( outDir == "" ) outDir = startingdir;    
148    };    //
149      TTree *otr0 = 0;
150      TTree *otr1 = 0;
151      TTree *otr2 = 0;
152      TTree *otr3 = 0;
153      TTree *otr4 = 0;
154      TTree *otr5 = 0;
155      TTree *otr6 = 0;
156      TTree *otr7 = 0;
157      TTree *otr8 = 0;
158      //
159      pamela->var.fl0 = false;
160      Int_t i = 0;
161      Int_t isOK = 0;
162    //    //
163   restart:   restart:
164    //    //
# Line 157  void ShowEvent(TString filename="help", Line 170  void ShowEvent(TString filename="help",
170    pamela->var.jumpen = false;        pamela->var.jumpen = false;    
171    pamela->var.goon = false;    pamela->var.goon = false;
172    pamela->var.refresh = false;    pamela->var.refresh = false;
   pamela->var.fl0 = false;  
173    pamela->var.alrforc = false;    pamela->var.alrforc = false;
174    //    //
175    // check if we have an input filename    // check if we have an input filename
# Line 194  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    // set selection file variables    // reset pointers
221    //    //
222    pamela->var.selex = true;    TFile *headerFile = 0;
223    selfile = pamela->var.thefilter.Data();    TChain *otr = 0;
224      TTree *L0 = 0;
225    //    //
226    if ( outDir == "" ) outDir = startingdir;        //  gROOT->Reset();
227    //    //
228    if ( pamela->var.fl0 == true ) {    // set selection file variables
229      FORCELEV = 0;    //
230    } else {    if ( pamela->var.refresh ){
231      if ( pamela->var.refresh ) FORCELEV = -1;      if ( pamela->var.selex ){
232          //      pamela->var.selex = true;                               //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
233          selfile = pamela->var.thefilter.Data();
234        };
235    };    };
236    //    //
237      //
238      //  if ( pamela->var.fl0 == true ) {
239      //    FORCELEV = 0;
240      //  } else {
241      //    if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
242      //  };
243      //
244    // check the detectors to be shown    // check the detectors to be shown
245    //    //
246    if ( !pamela->var.refresh ) pamela->checkctrlword();    //  if ( !pamela->var.refresh ) pamela->checkctrlword();
247      //pamela->checkctrlword();
248    //    //
249    // open a dialog if the program is launched without input filename    // open a dialog if the program is launched without input filename
250    //    //
# Line 253  void ShowEvent(TString filename="help", Line 281  void ShowEvent(TString filename="help",
281    // LOAD SELECTION FILE    // LOAD SELECTION FILE
282    //        //    
283    if ( selfile == ""  ){    if ( selfile == ""  ){
284      if ( !pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");      //if ( !pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");
285        if ( pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");
286      pamela->var.selex = false;      pamela->var.selex = false;
287    } else {    } else {
288      //      //
# Line 272  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 290  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 309  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    //    //
354    ifstream myfile;    ifstream myfile;
355    myfile.open(filename.Data());    myfile.open(filename.Data());
356    if ( !myfile ){    if ( !myfile ){
357      printf("ERROR: no such file, exiting...\n");      if ( filename != "" ){
358      stringstream hfile;        printf("ERROR: no such file, exiting...\n");
359      hfile.str("");        stringstream hfile;
360      hfile << filename.Data();        hfile.str("");
361      hfile << " : no such file! ";        hfile << filename.Data();
362      pamgui->DIALOG(2,hfile.str().c_str());        hfile << " : no such file! ";
363          pamgui->DIALOG(2,hfile.str().c_str());
364        };
365      pamela->var.waitforever = true;      pamela->var.waitforever = true;
366      goto refresh;      goto refresh;
367    };    };
# Line 331  void ShowEvent(TString filename="help", Line 370  void ShowEvent(TString filename="help",
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    headerFile=new TFile(filename.Data());    headerFile=new TFile(filename.Data());
373    if ( FORCELEV == 0 ){     if ( FORCELEV == 0 ){
374      pamela->level.file = 0;      pamela->level.file = 0;
375      otr = (TTree*)headerFile->Get("Physics");      L0 = (TTree*)headerFile->Get("Physics");
376      if ( !otr ){      if ( !L0 ){
377        printf("ERROR: no Physics tree...\n");        printf("ERROR: no Physics tree...\n");
378        pamgui->DIALOG(2,"No Physics tree in this file");        pamgui->DIALOG(2,"No Physics tree in this file");
379        pamela->var.waitforever = true;        pamela->var.waitforever = true;
# Line 342  void ShowEvent(TString filename="help", Line 381  void ShowEvent(TString filename="help",
381      }      }
382    } else {    } else {
383      pamela->level.file = 2;      pamela->level.file = 2;
384      otr = (TTree*)headerFile->Get("Trigger");      otr0 = (TTree*)headerFile->Get("Trigger");
385      if ( !otr ){      otr1 = (TTree*)headerFile->Get("Calorimeter");
386        otr = (TTree*)headerFile->Get("Physics");            otr2 = (TTree*)headerFile->Get("Tracker");
387        otr3 = (TTree*)headerFile->Get("NeutronD");
388        otr4 = (TTree*)headerFile->Get("OrbitalInfo");
389        otr5 = (TTree*)headerFile->Get("S4");
390        otr6 = (TTree*)headerFile->Get("ToF");
391        otr7 = (TTree*)headerFile->Get("Run");
392        otr8 = (TTree*)headerFile->Get("Anticounter");
393        if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 ){
394          L0 = (TTree*)headerFile->Get("Physics");      
395        pamela->level.file = -1;        pamela->level.file = -1;
396        } else {
397          stringstream dddec;
398          dddec.str("");
399          dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 ";
400          if ( !otr0 ){
401            dddec << " -TRG ";
402            pamela->var.TRG = 0;
403            otr0 = otr1;
404          };
405          if ( !otr1 ){
406            dddec << " -CAL ";
407            pamela->var.CALO = 0;
408            if ( !otr0 ) otr0 = otr2;
409          };
410          if ( !otr2 ){
411            dddec << " -TRK2 -TRK ";
412            pamela->var.TRK = 0;
413            if ( !otr0 ) otr0 = otr3;
414          };
415          if ( !otr3 ){
416            dddec << " -ND ";
417            pamela->var.ND = 0;
418            if ( !otr0 ) otr0 = otr4;
419          };
420          if ( !otr4 ){
421            dddec << " -ORB ";
422            pamela->var.ORB = 0;
423            if ( !otr0 ) otr0 = otr5;
424          };
425          if ( !otr5 ){
426            dddec << " -S4 ";
427            pamela->var.S4 = 0;
428            if ( !otr0 ) otr0 = otr6;
429          };
430          if ( !otr6 ){
431            dddec << " -TOF ";
432            pamela->var.TOF = 0;
433            if ( !otr0 ) otr0 = otr8;
434          };
435          if ( !otr7 ){
436            dddec << " -RUN ";
437            pamela->var.RUN = 0;
438          };
439          if ( !otr8 ){
440            dddec << " -AC ";
441            pamela->var.AC = 0;
442          };
443          pamela->SetDDEC(dddec.str().c_str());
444      };      };
445      if ( !otr ){      if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 && !L0 ){
446        pamela->level.file = -1;        pamela->level.file = -1;
447        printf("ERROR: nor Physics nor Run tree...\n");        printf("ERROR: nor Physics nor Run tree...\n");
448        pamgui->DIALOG(2,"Nor Physics nor Run tree in this file");        pamgui->DIALOG(2,"Nor Physics nor Run tree in this file");
# Line 368  void ShowEvent(TString filename="help", Line 463  void ShowEvent(TString filename="help",
463    //    //
464    // Load the file    // Load the file
465    //    //
466    pamela->Load(*otr,*headerFile);    if ( otr0 || L0 ){
467        otr = pamela->Load(*headerFile);
468        if ( !otr ){
469          pamela->level.file = -1;
470          printf("ERROR: problems opening file...\n");
471          pamgui->DIALOG(2,"Problems opening file");
472          pamela->var.waitforever = true;
473          goto refresh;
474        };
475      } else {
476        pamela->level.file = -1;
477        printf("ERROR: problems with TTree while opening file...\n");
478        pamgui->DIALOG(2,"Problems opening file");
479        pamela->var.waitforever = true;
480        goto refresh;
481      };
482    //    //
483    printf("\n");    printf("\n");
484    //    //
485    // get the number of entries    // get the number of entries
486    //    //
487      //  otr = pamela->GetChain();
488      if ( !otr ) printf(" AGH! \n");
489      //
490    Long64_t nevents = otr->GetEntries();    Long64_t nevents = otr->GetEntries();
491    printf(" The file contains %i physics events \n",(int)nevents);    printf(" The file contains %i physics events \n",(int)nevents);
492    //    //
# Line 403  void ShowEvent(TString filename="help", Line 516  void ShowEvent(TString filename="help",
516    if ( !pamela->var.refresh ) i = pamela->minevent;    if ( !pamela->var.refresh ) i = pamela->minevent;
517    pamela->var.refresh = false;    pamela->var.refresh = false;
518    //    //
519      pamgui->RefreshButtons();
520      //
521    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
522    //  MAIN LOOP STARTS HERE:    //  MAIN LOOP STARTS HERE:
523    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
# Line 489  void ShowEvent(TString filename="help", Line 604  void ShowEvent(TString filename="help",
604        figsave << (pamela->var.i+1);        figsave << (pamela->var.i+1);
605        figsave << bw;        figsave << bw;
606        pamela->var.svas=figsave.str().c_str();        pamela->var.svas=figsave.str().c_str();
607    
608          //      printf(" qua %s \n",figsave.str().c_str());
609        //        //
610        // upgrade the figure filename in the GUI        // upgrade the figure filename in the GUI
611        //        //
# Line 509  void ShowEvent(TString filename="help", Line 626  void ShowEvent(TString filename="help",
626        //        //
627        pamela->var.goon = false;        pamela->var.goon = false;
628        if ( pamela->var.refresh || pamela->var.restart ){        if ( pamela->var.refresh || pamela->var.restart ){
629          headerFile->Close();          if ( pamela->GetL2() ) pamela->GetL2()->Reset();
630            if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
631            otr = NULL;
632            if ( headerFile ) headerFile->Close("R");
633          if ( pamela->var.refresh ) goto refresh;          if ( pamela->var.refresh ) goto refresh;
634          if ( pamela->var.restart ){          if ( pamela->var.restart ){
635            filename = pamela->var.thefilename.Data();            filename = pamela->var.thefilename.Data();

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

  ViewVC Help
Powered by ViewVC 1.1.23