/[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.6 by mocchiut, Tue Mar 20 15:22:01 2007 UTC revision 1.14 by mocchiut, Tue Nov 27 08:41:02 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      // Add working directory to file names if no full path is provided
160      //
161      if ( !strcmp(gSystem->BaseName(filename),filename.Data()) ){
162        filename = startingdir+"/"+filename;
163      };
164      if ( !strcmp(gSystem->BaseName(selfile),selfile.Data()) && strcmp(selfile.Data(),"") ){
165        selfile = startingdir+"/"+selfile;
166      };
167      //
168    //  book the canvas    //  book the canvas
169    //    //
170    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 193  void ShowEvent(TString filename="help",
193    TTree *otr8 = 0;    TTree *otr8 = 0;
194    //    //
195    pamela->var.fl0 = false;    pamela->var.fl0 = false;
196      pamela->var.restart = false;
197      Int_t i = 0;
198      Int_t isOK = 0;
199    //    //
200   restart:   restart:
201    //    //
202      if ( !pamela->var.restart ){
203        if ( i < 0 ){
204          i = -i;
205        } else {
206          i = 0;
207        };
208      };
209      //
210    // set boolean variables    // set boolean variables
211    //    //
   pamela->var.restart = false;  
212    pamela->var.waitforever = false;    pamela->var.waitforever = false;
213    pamela->var.jumprog = true;    pamela->var.jumprog = true;
214    pamela->var.jumpen = false;        pamela->var.jumpen = false;    
# Line 175  void ShowEvent(TString filename="help", Line 221  void ShowEvent(TString filename="help",
221    if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){    if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){
222      pamela->var.waitforever = true;      pamela->var.waitforever = true;
223    };    };
224    //  //   //
225    // chek if we are forcing level0  //   // chek if we are forcing level0
226    //  //   //
227    if ( pamela->var.fl0 == true ){  //   if ( pamela->var.fl0 == true ){
228      FORCELEV = 0;  //     FORCELEV = 0;
229    } else {  //   } else {
230      FORCELEV = -1;  //     FORCELEV = -1;
231    };  //   };
232    //    //
233    //  Define some variables    //  Define some variables
234    //    //
# Line 204  void ShowEvent(TString filename="help", Line 250  void ShowEvent(TString filename="help",
250    gStyle->SetNdivisions(1,"X");    gStyle->SetNdivisions(1,"X");
251    gStyle->SetNdivisions(1,"Y");    gStyle->SetNdivisions(1,"Y");
252    //    //
253    Int_t i = 0;    isOK = 0;
   Int_t isOK = 0;  
254    //    //
255    // from here to refresh    // from here to refresh
256    //    //
# Line 229  void ShowEvent(TString filename="help", Line 274  void ShowEvent(TString filename="help",
274    };    };
275    //    //
276    //    //
277    //  if ( pamela->var.fl0 == true ) {    if ( pamela->var.fl0 == true ) {
278    //    FORCELEV = 0;      FORCELEV = 0;
279    //  } else {    } else {
280    //    if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????      if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
281    //  };    };
282    //    //
283    // check the detectors to be shown    // check the detectors to be shown
284    //    //
# Line 257  void ShowEvent(TString filename="help", Line 302  void ShowEvent(TString filename="help",
302      gSystem->Sleep(10);      gSystem->Sleep(10);
303    };    };
304    //    //
305    if ( pamela->var.restart ){  //   if ( pamela->var.restart ){
306      filename = pamela->var.thefilename.Data();  //     filename = pamela->var.thefilename.Data();
307      goto restart;  //     goto restart;
308    };  //   };
309    //    //
310    // check if we are forcing level0 data    // check if we are forcing level0 data
311    //    //
# Line 292  void ShowEvent(TString filename="help", Line 337  void ShowEvent(TString filename="help",
337      //      //
338      // load the structure header      // load the structure header
339      //      //
340      carica.str("");       carica.str("");
341      carica << paminc.str().c_str() << "/feventvstruct.h";       carica << paminc.str().c_str() << "/feventvstruct.h";
342      gROOT->LoadMacro(carica.str().c_str());       gROOT->LoadMacro(carica.str().c_str());
343        //    carica.str("");
344        //    carica << paminc.str().c_str() << "/CaloNuclei.h";
345        //    gROOT->LoadMacro(carica.str().c_str());
346      //      //
347      // load the selection macro      // load the selection macro
348      //      //
# Line 360  void ShowEvent(TString filename="help", Line 408  void ShowEvent(TString filename="help",
408    //    //
409    // 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
410    //    //
411    
412    headerFile=new TFile(filename.Data());    headerFile=new TFile(filename.Data());
413     if ( FORCELEV == 0 ){    if ( FORCELEV == 0 ){
414      pamela->level.file = 0;      pamela->level.file = 0;
415      L0 = (TTree*)headerFile->Get("Physics");      L0 = (TTree*)headerFile->Get("Physics");
416      if ( !L0 ){      if ( !L0 ){
# Line 387  void ShowEvent(TString filename="help", Line 436  void ShowEvent(TString filename="help",
436      } else {      } else {
437        stringstream dddec;        stringstream dddec;
438        dddec.str("");        dddec.str("");
439        dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 ";        dddec << " +AUTO ";
440        if ( !otr0 ){        //      dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 -TRK0 -CAL0";
441          dddec << " -TRG ";         if ( !otr0 ){
442          pamela->var.TRG = 0;          dddec << " -TRG ";
443          otr0 = otr1;          pamela->var.TRG = 0;
444        };          otr0 = otr1;
445        if ( !otr1 ){         };
446          dddec << " -CAL ";         if ( !otr1 ){
447          pamela->var.CALO = 0;          dddec << " -CAL ";
448          if ( !otr0 ) otr0 = otr2;          pamela->var.CALO = 0;
449        };          if ( !otr0 ) otr0 = otr2;
450        if ( !otr2 ){         };
451          dddec << " -TRK2 -TRK ";         if ( !otr2 ){
452          pamela->var.TRK = 0;          dddec << " -TRK2 -TRK ";
453          if ( !otr0 ) otr0 = otr3;          pamela->var.TRK = 0;
454        };          if ( !otr0 ) otr0 = otr3;
455        if ( !otr3 ){         };
456          dddec << " -ND ";         if ( !otr3 ){
457          pamela->var.ND = 0;          dddec << " -ND ";
458          if ( !otr0 ) otr0 = otr4;          pamela->var.ND = 0;
459        };          if ( !otr0 ) otr0 = otr4;
460        if ( !otr4 ){         };
461          dddec << " -ORB ";         if ( !otr4 ){
462          pamela->var.ORB = 0;          dddec << " -ORB ";
463          if ( !otr0 ) otr0 = otr5;          pamela->var.ORB = 0;
464        };          if ( !otr0 ) otr0 = otr5;
465        if ( !otr5 ){         };
466          dddec << " -S4 ";         if ( !otr5 ){
467          pamela->var.S4 = 0;          dddec << " -S4 ";
468          if ( !otr0 ) otr0 = otr6;          pamela->var.S4 = 0;
469        };          if ( !otr0 ) otr0 = otr6;
470        if ( !otr6 ){         };
471          dddec << " -TOF ";         if ( !otr6 ){
472          pamela->var.TOF = 0;          dddec << " -TOF ";
473          if ( !otr0 ) otr0 = otr8;          pamela->var.TOF = 0;
474        };          if ( !otr0 ) otr0 = otr8;
475        if ( !otr7 ){         };
476          dddec << " -RUN ";         if ( !otr7 ){
477          pamela->var.RUN = 0;          dddec << " -RUN ";
478        };          pamela->var.RUN = 0;
479        if ( !otr8 ){         };
480          dddec << " -AC ";         if ( !otr8 ){
481          pamela->var.AC = 0;          dddec << " -AC ";
482        };          pamela->var.AC = 0;
483           };
484        pamela->SetDDEC(dddec.str().c_str());        pamela->SetDDEC(dddec.str().c_str());
485      };      };
486      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 491  void ShowEvent(TString filename="help",
491        goto refresh;        goto refresh;
492      };      };
493    };    };
494      headerFile->Close("R");
495    //    //
496    if ( pamela->level.file != 2 ){    if ( pamela->level.file != 2 ){
497      printf(" This is a YODA (level0) file \n");      printf(" This is a YODA (level0) file \n");
# Line 455  void ShowEvent(TString filename="help", Line 506  void ShowEvent(TString filename="help",
506    // Load the file    // Load the file
507    //    //
508    if ( otr0 || L0 ){    if ( otr0 || L0 ){
509      otr = pamela->Load(*headerFile);      otr = pamela->Load(filename.Data());
510      if ( !otr ){      if ( !otr ){
511        pamela->level.file = -1;        pamela->level.file = -1;
512        printf("ERROR: problems opening file...\n");        printf("ERROR: problems opening file...\n");
# Line 475  void ShowEvent(TString filename="help", Line 526  void ShowEvent(TString filename="help",
526    //    //
527    // get the number of entries    // get the number of entries
528    //    //
   //  otr = pamela->GetChain();  
529    if ( !otr ) printf(" AGH! \n");    if ( !otr ) printf(" AGH! \n");
530    //    //
531    Long64_t nevents = otr->GetEntries();    Long64_t nevents = otr->GetEntries();
# Line 484  void ShowEvent(TString filename="help", Line 534  void ShowEvent(TString filename="help",
534    // check we have at least one event    // check we have at least one event
535    //    //
536    if (nevents<=0) {    if (nevents<=0) {
537      headerFile->Close();      //    headerFile->Close();
538      printf("The file is empty, exiting...\n");      printf("The file is empty, exiting...\n");
539      pamgui->DIALOG(0," The file contains no physics data! ");      pamgui->DIALOG(0," The file contains no physics data! ");
540      pamela->var.waitforever = true;      pamela->var.waitforever = true;
# Line 504  void ShowEvent(TString filename="help", Line 554  void ShowEvent(TString filename="help",
554    //    //
555    // display the first event (unless we are refreshing only the window)    // display the first event (unless we are refreshing only the window)
556    //    //
557    if ( !pamela->var.refresh ) i = pamela->minevent;    if ( !pamela->var.refresh && !pamela->var.restart ) i = pamela->minevent;
558      pamela->var.restart = false;
559    pamela->var.refresh = false;    pamela->var.refresh = false;
560    //    //
561    pamgui->RefreshButtons();    pamgui->RefreshButtons();
# Line 617  void ShowEvent(TString filename="help", Line 668  void ShowEvent(TString filename="help",
668        //        //
669        pamela->var.goon = false;        pamela->var.goon = false;
670        if ( pamela->var.refresh || pamela->var.restart ){        if ( pamela->var.refresh || pamela->var.restart ){
671          if ( pamela->GetL2() ) pamela->GetL2()->Clear();          if ( pamela->GetL2() ) pamela->GetL2()->Reset();
672          if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();          if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
673          if ( headerFile ) headerFile->Close("R");          otr = NULL;
674            //      if ( headerFile ) headerFile->Close("R");
675          if ( pamela->var.refresh ) goto refresh;          if ( pamela->var.refresh ) goto refresh;
676          if ( pamela->var.restart ){          if ( pamela->var.restart ){
677              i = pamela->var.i;
678            filename = pamela->var.thefilename.Data();            filename = pamela->var.thefilename.Data();
679            goto restart;            goto restart;
680          };          };

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.23