/[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.5 by mocchiut, Tue Mar 20 12:49:57 2007 UTC revision 1.13 by mocchiut, Mon Nov 26 08:29:55 2007 UTC
# Line 129  void ShowEvent(TString filename="help", Line 129  void ShowEvent(TString filename="help",
129    Float_t winy = (float)hw*0.80; // 95    Float_t winy = (float)hw*0.80; // 95
130    Float_t winrap = winx/winy;    Float_t winrap = winx/winy;
131    //    //
132      //
133      //
134      TString plugindir = (TString)gSystem->ExpandPathName("$FEV_PLUGIN");
135      if ( strcmp(plugindir,"$FEV_PLUGIN") ){
136        TString wdir = gSystem->WorkingDirectory();    
137        printf("\n\n Plugin directory is %s \n",plugindir.Data());
138        printf(" Loading plugins: \n");
139        //
140        TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(plugindir),plugindir);
141        TList *temp = datadir->GetListOfFiles();
142        TIter next(temp);
143        TSystemFile *questo = 0;
144        Int_t npl = 0;
145        while ( (questo = (TSystemFile*) next()) ) {
146          TString name =  questo->GetName();
147          if( name.EndsWith(".so") || name.EndsWith(".o") ){
148            npl++;
149            char *fullpath = gSystem->ConcatFileName(gSystem->DirName(plugindir),gSystem->BaseName(name));          
150            gSystem->Load(fullpath);
151            printf(" %i -> %s plugin loaded \n",npl,name.Data());
152            delete fullpath;
153          };
154        }
155        delete temp;
156        delete datadir;
157      };
158      //
159    //  book the canvas    //  book the canvas
160    //    //
161    TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy);    TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy);
# Line 157  void ShowEvent(TString filename="help", Line 184  void ShowEvent(TString filename="help",
184    TTree *otr8 = 0;    TTree *otr8 = 0;
185    //    //
186    pamela->var.fl0 = false;    pamela->var.fl0 = false;
187      pamela->var.restart = false;
188      Int_t i = 0;
189      Int_t isOK = 0;
190    //    //
191   restart:   restart:
192    //    //
193      if ( !pamela->var.restart ){
194        if ( i < 0 ){
195          i = -i;
196        } else {
197          i = 0;
198        };
199      };
200      //
201    // set boolean variables    // set boolean variables
202    //    //
   pamela->var.restart = false;  
203    pamela->var.waitforever = false;    pamela->var.waitforever = false;
204    pamela->var.jumprog = true;    pamela->var.jumprog = true;
205    pamela->var.jumpen = false;        pamela->var.jumpen = false;    
# Line 175  void ShowEvent(TString filename="help", Line 212  void ShowEvent(TString filename="help",
212    if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){    if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){
213      pamela->var.waitforever = true;      pamela->var.waitforever = true;
214    };    };
215    //  //   //
216    // chek if we are forcing level0  //   // chek if we are forcing level0
217    //  //   //
218    if ( pamela->var.fl0 == true ){  //   if ( pamela->var.fl0 == true ){
219      FORCELEV = 0;  //     FORCELEV = 0;
220    } else {  //   } else {
221      FORCELEV = -1;  //     FORCELEV = -1;
222    };  //   };
223    //    //
224    //  Define some variables    //  Define some variables
225    //    //
# Line 204  void ShowEvent(TString filename="help", Line 241  void ShowEvent(TString filename="help",
241    gStyle->SetNdivisions(1,"X");    gStyle->SetNdivisions(1,"X");
242    gStyle->SetNdivisions(1,"Y");    gStyle->SetNdivisions(1,"Y");
243    //    //
244    Int_t i = 0;    isOK = 0;
   Int_t isOK = 0;  
245    //    //
246    // from here to refresh    // from here to refresh
247    //    //
# Line 229  void ShowEvent(TString filename="help", Line 265  void ShowEvent(TString filename="help",
265    };    };
266    //    //
267    //    //
268    //  if ( pamela->var.fl0 == true ) {    if ( pamela->var.fl0 == true ) {
269    //    FORCELEV = 0;      FORCELEV = 0;
270    //  } else {    } else {
271    //    if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????      if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
272    //  };    };
273    //    //
274    // check the detectors to be shown    // check the detectors to be shown
275    //    //
# Line 257  void ShowEvent(TString filename="help", Line 293  void ShowEvent(TString filename="help",
293      gSystem->Sleep(10);      gSystem->Sleep(10);
294    };    };
295    //    //
296    if ( pamela->var.restart ){  //   if ( pamela->var.restart ){
297      filename = pamela->var.thefilename.Data();  //     filename = pamela->var.thefilename.Data();
298      goto restart;  //     goto restart;
299    };  //   };
300    //    //
301    // check if we are forcing level0 data    // check if we are forcing level0 data
302    //    //
# Line 292  void ShowEvent(TString filename="help", Line 328  void ShowEvent(TString filename="help",
328      //      //
329      // load the structure header      // load the structure header
330      //      //
331      carica.str("");       carica.str("");
332      carica << paminc.str().c_str() << "/feventvstruct.h";       carica << paminc.str().c_str() << "/feventvstruct.h";
333      gROOT->LoadMacro(carica.str().c_str());       gROOT->LoadMacro(carica.str().c_str());
334        //    carica.str("");
335        //    carica << paminc.str().c_str() << "/CaloNuclei.h";
336        //    gROOT->LoadMacro(carica.str().c_str());
337      //      //
338      // load the selection macro      // load the selection macro
339      //      //
# Line 360  void ShowEvent(TString filename="help", Line 399  void ShowEvent(TString filename="help",
399    //    //
400    // 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
401    //    //
402    
403    headerFile=new TFile(filename.Data());    headerFile=new TFile(filename.Data());
404     if ( FORCELEV == 0 ){    if ( FORCELEV == 0 ){
405      pamela->level.file = 0;      pamela->level.file = 0;
406      L0 = (TTree*)headerFile->Get("Physics");      L0 = (TTree*)headerFile->Get("Physics");
407      if ( !L0 ){      if ( !L0 ){
# Line 387  void ShowEvent(TString filename="help", Line 427  void ShowEvent(TString filename="help",
427      } else {      } else {
428        stringstream dddec;        stringstream dddec;
429        dddec.str("");        dddec.str("");
430        dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 ";        dddec << " +AUTO ";
431        if ( !otr0 ){        //      dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 -TRK0 -CAL0";
432          dddec << " -TRG ";         if ( !otr0 ){
433          pamela->var.TRG = 0;          dddec << " -TRG ";
434          otr0 = otr1;          pamela->var.TRG = 0;
435        };          otr0 = otr1;
436        if ( !otr1 ){         };
437          dddec << " -CAL ";         if ( !otr1 ){
438          pamela->var.CALO = 0;          dddec << " -CAL ";
439          if ( !otr0 ) otr0 = otr2;          pamela->var.CALO = 0;
440        };          if ( !otr0 ) otr0 = otr2;
441        if ( !otr2 ){         };
442          dddec << " -TRK2 -TRK ";         if ( !otr2 ){
443          pamela->var.TRK = 0;          dddec << " -TRK2 -TRK ";
444          if ( !otr0 ) otr0 = otr3;          pamela->var.TRK = 0;
445        };          if ( !otr0 ) otr0 = otr3;
446        if ( !otr3 ){         };
447          dddec << " -ND ";         if ( !otr3 ){
448          pamela->var.ND = 0;          dddec << " -ND ";
449          if ( !otr0 ) otr0 = otr4;          pamela->var.ND = 0;
450        };          if ( !otr0 ) otr0 = otr4;
451        if ( !otr4 ){         };
452          dddec << " -ORB ";         if ( !otr4 ){
453          pamela->var.ORB = 0;          dddec << " -ORB ";
454          if ( !otr0 ) otr0 = otr5;          pamela->var.ORB = 0;
455        };          if ( !otr0 ) otr0 = otr5;
456        if ( !otr5 ){         };
457          dddec << " -S4 ";         if ( !otr5 ){
458          pamela->var.S4 = 0;          dddec << " -S4 ";
459          if ( !otr0 ) otr0 = otr6;          pamela->var.S4 = 0;
460        };          if ( !otr0 ) otr0 = otr6;
461        if ( !otr6 ){         };
462          dddec << " -TOF ";         if ( !otr6 ){
463          pamela->var.TOF = 0;          dddec << " -TOF ";
464          if ( !otr0 ) otr0 = otr8;          pamela->var.TOF = 0;
465        };          if ( !otr0 ) otr0 = otr8;
466        if ( !otr7 ){         };
467          dddec << " -RUN ";         if ( !otr7 ){
468          pamela->var.RUN = 0;          dddec << " -RUN ";
469        };          pamela->var.RUN = 0;
470        if ( !otr8 ){         };
471          dddec << " -AC ";         if ( !otr8 ){
472          pamela->var.AC = 0;          dddec << " -AC ";
473        };          pamela->var.AC = 0;
474           };
475        pamela->SetDDEC(dddec.str().c_str());        pamela->SetDDEC(dddec.str().c_str());
476      };      };
477      if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 && !L0 ){      if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 && !L0 ){
# Line 441  void ShowEvent(TString filename="help", Line 482  void ShowEvent(TString filename="help",
482        goto refresh;        goto refresh;
483      };      };
484    };    };
485      headerFile->Close("R");
486    //    //
487    if ( pamela->level.file != 2 ){    if ( pamela->level.file != 2 ){
488      printf(" This is a YODA (level0) file \n");      printf(" This is a YODA (level0) file \n");
# Line 455  void ShowEvent(TString filename="help", Line 497  void ShowEvent(TString filename="help",
497    // Load the file    // Load the file
498    //    //
499    if ( otr0 || L0 ){    if ( otr0 || L0 ){
500      otr = pamela->Load(*headerFile);      otr = pamela->Load(filename.Data());
501      if ( !otr ){      if ( !otr ){
502        pamela->level.file = -1;        pamela->level.file = -1;
503        printf("ERROR: problems opening file...\n");        printf("ERROR: problems opening file...\n");
# Line 475  void ShowEvent(TString filename="help", Line 517  void ShowEvent(TString filename="help",
517    //    //
518    // get the number of entries    // get the number of entries
519    //    //
   //  otr = pamela->GetChain();  
520    if ( !otr ) printf(" AGH! \n");    if ( !otr ) printf(" AGH! \n");
521    //    //
522    Long64_t nevents = otr->GetEntries();    Long64_t nevents = otr->GetEntries();
# Line 484  void ShowEvent(TString filename="help", Line 525  void ShowEvent(TString filename="help",
525    // check we have at least one event    // check we have at least one event
526    //    //
527    if (nevents<=0) {    if (nevents<=0) {
528      headerFile->Close();      //    headerFile->Close();
529      printf("The file is empty, exiting...\n");      printf("The file is empty, exiting...\n");
530      pamgui->DIALOG(0," The file contains no physics data! ");      pamgui->DIALOG(0," The file contains no physics data! ");
531      pamela->var.waitforever = true;      pamela->var.waitforever = true;
# Line 504  void ShowEvent(TString filename="help", Line 545  void ShowEvent(TString filename="help",
545    //    //
546    // display the first event (unless we are refreshing only the window)    // display the first event (unless we are refreshing only the window)
547    //    //
548    if ( !pamela->var.refresh ) i = pamela->minevent;    if ( !pamela->var.refresh && !pamela->var.restart ) i = pamela->minevent;
549      pamela->var.restart = false;
550    pamela->var.refresh = false;    pamela->var.refresh = false;
551    //    //
552    pamgui->RefreshButtons();    pamgui->RefreshButtons();
# Line 617  void ShowEvent(TString filename="help", Line 659  void ShowEvent(TString filename="help",
659        //        //
660        pamela->var.goon = false;        pamela->var.goon = false;
661        if ( pamela->var.refresh || pamela->var.restart ){        if ( pamela->var.refresh || pamela->var.restart ){
662          //      if ( pamela->GetL2() ) pamela->GetL2()->Clear();          if ( pamela->GetL2() ) pamela->GetL2()->Reset();
663          if ( pamela->GetL2() ) pamela->GetL2()->Delete();          if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
664          //if ( pamela->GetL2() ) delete pamela->GetL2();          otr = NULL;
665          if ( headerFile ) headerFile->Close("R");          //      if ( headerFile ) headerFile->Close("R");
666          if ( pamela->var.refresh ) goto refresh;          if ( pamela->var.refresh ) goto refresh;
667          if ( pamela->var.restart ){          if ( pamela->var.restart ){
668              i = pamela->var.i;
669            filename = pamela->var.thefilename.Data();            filename = pamela->var.thefilename.Data();
670            goto restart;            goto restart;
671          };          };

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.23