/[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.20 by mocchiut, Fri Apr 23 10:33:12 2010 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            char *fullpath = gSystem->ConcatFileName(plugindir.Data(),gSystem->BaseName(name));            
151            if ( !gSystem->Load(fullpath) ) printf(" %i -> %s plugin loaded (%s)\n",npl,name.Data(),fullpath);
152            delete fullpath;
153          };
154        }
155        gSystem->cd(wdir.Data());
156        delete temp;
157        delete datadir;
158      };
159      //
160      // Add working directory to file names if no full path is provided
161      //
162      if ( !strcmp(gSystem->BaseName(filename),filename.Data()) ){
163        filename = startingdir+"/"+filename;
164      };
165      if ( !strcmp(gSystem->BaseName(selfile),selfile.Data()) && strcmp(selfile.Data(),"") ){
166        selfile = startingdir+"/"+selfile;
167      };
168      //
169    //  book the canvas    //  book the canvas
170    //    //
171    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 194  void ShowEvent(TString filename="help",
194    TTree *otr8 = 0;    TTree *otr8 = 0;
195    //    //
196    pamela->var.fl0 = false;    pamela->var.fl0 = false;
197      pamela->var.restart = false;
198      Int_t i = 0;
199      Int_t isOK = 0;
200    //    //
201   restart:   restart:
202    //    //
203      if ( !pamela->var.restart ){
204        if ( i < 0 ){
205          i = -i;
206        } else {
207          i = 0;
208        };
209      };
210      //
211    // set boolean variables    // set boolean variables
212    //    //
   pamela->var.restart = false;  
213    pamela->var.waitforever = false;    pamela->var.waitforever = false;
214    pamela->var.jumprog = true;    pamela->var.jumprog = true;
215    pamela->var.jumpen = false;        pamela->var.jumpen = false;    
# Line 172  void ShowEvent(TString filename="help", Line 219  void ShowEvent(TString filename="help",
219    //    //
220    // check if we have an input filename    // check if we have an input filename
221    //    //
222    if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){    //  if ( filename.Data() == "" || !strcmp(filename.Data(),"help") ){
223      if ( !strcmp(gSystem->BaseName(filename),"") || filename.Contains("help") ){
224      pamela->var.waitforever = true;      pamela->var.waitforever = true;
225    };    };
226    //  //   //
227    // chek if we are forcing level0  //   // chek if we are forcing level0
228    //  //   //
229    if ( pamela->var.fl0 == true ){  //   if ( pamela->var.fl0 == true ){
230      FORCELEV = 0;  //     FORCELEV = 0;
231    } else {  //   } else {
232      FORCELEV = -1;  //     FORCELEV = -1;
233    };  //   };
234    //    //
235    //  Define some variables    //  Define some variables
236    //    //
# Line 204  void ShowEvent(TString filename="help", Line 252  void ShowEvent(TString filename="help",
252    gStyle->SetNdivisions(1,"X");    gStyle->SetNdivisions(1,"X");
253    gStyle->SetNdivisions(1,"Y");    gStyle->SetNdivisions(1,"Y");
254    //    //
255    Int_t i = 0;    isOK = 0;
   Int_t isOK = 0;  
256    //    //
257    // from here to refresh    // from here to refresh
258    //    //
# Line 229  void ShowEvent(TString filename="help", Line 276  void ShowEvent(TString filename="help",
276    };    };
277    //    //
278    //    //
279    //  if ( pamela->var.fl0 == true ) {    if ( pamela->var.fl0 == true ) {
280    //    FORCELEV = 0;      FORCELEV = 0;
281    //  } else {    } else {
282    //    if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????      if ( pamela->var.refresh ) FORCELEV = -1;           //<<<<<<<<<<<<<<<<<<<<<<<<<<?????????????????????
283    //  };    };
284    //    //
285    // check the detectors to be shown    // check the detectors to be shown
286    //    //
# Line 244  void ShowEvent(TString filename="help", Line 291  void ShowEvent(TString filename="help",
291    //    //
292    if ( firsttime ){    if ( firsttime ){
293      firsttime = false;      firsttime = false;
294      if ( filename == "" ) pamgui->DIALOG(0," Insert the filename and press load to start ");      if ( !strcmp(gSystem->BaseName(filename),"") || filename.Contains("help") ) pamgui->DIALOG(3," - Insert the filename and press load to start \n - To unload selection file clean the line and press the \"Load\" button \n - run with \"-v\" option to have STDOUT on the screen \n - select a detector and press \"Show Data\" to print data event by event on the screen ");
295        //    if ( filename.Contains("help") ) pamgui->DIALOG(3," - Insert the filename and press load to start \n - To unload selection file clean the line and press the \"Load\" button \n - run with \"-v\" option to have STDOUT on the screen \n - select a detector and press \"Show Data\" to print data event by event on the screen ");
296        //        printf(" - %s - %s =\n",gSystem->BaseName(filename),filename.Data());
297    };    };
298    //    //
299    // WAIT for an input filename    // WAIT for an input filename
# Line 253  void ShowEvent(TString filename="help", Line 302  void ShowEvent(TString filename="help",
302      if ( !gROOT->GetListOfCanvases()->FindObject(figure)  ) {      if ( !gROOT->GetListOfCanvases()->FindObject(figure)  ) {
303        pamgui->Terminate();        pamgui->Terminate();
304      };      };
305        pamgui->Refresh();
306      gSystem->ProcessEvents();      gSystem->ProcessEvents();
307      gSystem->Sleep(10);      gSystem->Sleep(10);
308    };    };
309    //    //
310    if ( pamela->var.restart ){  //   if ( pamela->var.restart ){
311      filename = pamela->var.thefilename.Data();  //     filename = pamela->var.thefilename.Data();
312      goto restart;  //     goto restart;
313    };  //   };
314    //    //
315    // check if we are forcing level0 data    // check if we are forcing level0 data
316    //    //
# Line 274  void ShowEvent(TString filename="help", Line 324  void ShowEvent(TString filename="help",
324    //    //
325    // LOAD SELECTION FILE    // LOAD SELECTION FILE
326    //        //    
327    if ( selfile == ""  ){    if (  !strcmp(gSystem->BaseName(selfile),"") ){ //selfile == ""  ){
328      //if ( !pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");      //if ( !pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");
329      if ( pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");      if ( pamela->var.selex ) pamgui->DIALOG(0," Selection file unloaded ");
330      pamela->var.selex = false;      pamela->var.selex = false;
# Line 292  void ShowEvent(TString filename="help", Line 342  void ShowEvent(TString filename="help",
342      //      //
343      // load the structure header      // load the structure header
344      //      //
345      carica.str("");       carica.str("");
346      carica << paminc.str().c_str() << "/feventvstruct.h";       carica << paminc.str().c_str() << "/feventvstruct.h";
347      gROOT->LoadMacro(carica.str().c_str());       gROOT->LoadMacro(carica.str().c_str());
348        //    carica.str("");
349        //    carica << paminc.str().c_str() << "/CaloNuclei.h";
350        //    gROOT->LoadMacro(carica.str().c_str());
351      //      //
352      // load the selection macro      // load the selection macro
353      //      //
# Line 335  void ShowEvent(TString filename="help", Line 388  void ShowEvent(TString filename="help",
388    //  LOAD FILES        //  LOAD FILES    
389    //    //
390    //    //
391  //   if ( headerFile ) headerFile->Close();    //   if ( headerFile ) headerFile->Close();
392  //   if ( otr ) otr->Delete();    //   if ( otr ) otr->Delete();
393  //   if ( L0 ) L0->Delete();    //   if ( L0 ) L0->Delete();
394    
395    //    //
396    // check if user has given as input a correct path    // check if user has given as input a correct path
# Line 360  void ShowEvent(TString filename="help", Line 413  void ShowEvent(TString filename="help",
413    //    //
414    // 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
415    //    //
416    
417    headerFile=new TFile(filename.Data());    headerFile=new TFile(filename.Data());
418     if ( FORCELEV == 0 ){    if ( FORCELEV == 0 ){
419      pamela->level.file = 0;      pamela->level.file = 0;
420      L0 = (TTree*)headerFile->Get("Physics");      L0 = (TTree*)headerFile->Get("Physics");
421      if ( !L0 ){      if ( !L0 ){
# Line 387  void ShowEvent(TString filename="help", Line 441  void ShowEvent(TString filename="help",
441      } else {      } else {
442        stringstream dddec;        stringstream dddec;
443        dddec.str("");        dddec.str("");
444        dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 ";        dddec << " +AUTO ";
445        if ( !otr0 ){        //      dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 -TRK0 -CAL0";
446          dddec << " -TRG ";         if ( !otr0 ){
447          pamela->var.TRG = 0;          dddec << " -TRG ";
448          otr0 = otr1;          pamela->var.TRG = 0;
449        };          otr0 = otr1;
450        if ( !otr1 ){         };
451          dddec << " -CAL ";         if ( !otr1 ){
452          pamela->var.CALO = 0;          dddec << " -CAL ";
453          if ( !otr0 ) otr0 = otr2;          pamela->var.CALO = 0;
454        };          if ( !otr0 ) otr0 = otr2;
455        if ( !otr2 ){         };
456          dddec << " -TRK2 -TRK ";         if ( !otr2 ){
457          pamela->var.TRK = 0;          dddec << " -TRK2 -TRK ";
458          if ( !otr0 ) otr0 = otr3;          pamela->var.TRK = 0;
459        };          if ( !otr0 ) otr0 = otr3;
460        if ( !otr3 ){         };
461          dddec << " -ND ";         if ( !otr3 ){
462          pamela->var.ND = 0;          dddec << " -ND ";
463          if ( !otr0 ) otr0 = otr4;          pamela->var.ND = 0;
464        };          if ( !otr0 ) otr0 = otr4;
465        if ( !otr4 ){         };
466          dddec << " -ORB ";         if ( !otr4 ){
467          pamela->var.ORB = 0;          dddec << " -ORB ";
468          if ( !otr0 ) otr0 = otr5;          pamela->var.ORB = 0;
469        };          if ( !otr0 ) otr0 = otr5;
470        if ( !otr5 ){         };
471          dddec << " -S4 ";         if ( !otr5 ){
472          pamela->var.S4 = 0;          dddec << " -S4 ";
473          if ( !otr0 ) otr0 = otr6;          pamela->var.S4 = 0;
474        };          if ( !otr0 ) otr0 = otr6;
475        if ( !otr6 ){         };
476          dddec << " -TOF ";         if ( !otr6 ){
477          pamela->var.TOF = 0;          dddec << " -TOF ";
478          if ( !otr0 ) otr0 = otr8;          pamela->var.TOF = 0;
479        };          if ( !otr0 ) otr0 = otr8;
480        if ( !otr7 ){         };
481          dddec << " -RUN ";         if ( !otr7 ){
482          pamela->var.RUN = 0;          dddec << " -RUN ";
483        };          pamela->var.RUN = 0;
484        if ( !otr8 ){         };
485          dddec << " -AC ";         if ( !otr8 ){
486          pamela->var.AC = 0;          dddec << " -AC ";
487        };          pamela->var.AC = 0;
488           };
489        pamela->SetDDEC(dddec.str().c_str());        pamela->SetDDEC(dddec.str().c_str());
490      };      };
491      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 496  void ShowEvent(TString filename="help",
496        goto refresh;        goto refresh;
497      };      };
498    };    };
499      headerFile->Close("R");
500    //    //
501    if ( pamela->level.file != 2 ){    if ( pamela->level.file != 2 ){
502      printf(" This is a YODA (level0) file \n");      printf(" This is a YODA (level0) file \n");
# Line 455  void ShowEvent(TString filename="help", Line 511  void ShowEvent(TString filename="help",
511    // Load the file    // Load the file
512    //    //
513    if ( otr0 || L0 ){    if ( otr0 || L0 ){
514      otr = pamela->Load(*headerFile);      otr = pamela->Load(filename.Data());
515      if ( !otr ){      if ( !otr ){
516        pamela->level.file = -1;        pamela->level.file = -1;
517        printf("ERROR: problems opening file...\n");        printf("ERROR: problems opening file...\n");
# Line 475  void ShowEvent(TString filename="help", Line 531  void ShowEvent(TString filename="help",
531    //    //
532    // get the number of entries    // get the number of entries
533    //    //
   //  otr = pamela->GetChain();  
534    if ( !otr ) printf(" AGH! \n");    if ( !otr ) printf(" AGH! \n");
535    //    //
536    Long64_t nevents = otr->GetEntries();    Long64_t nevents = otr->GetEntries();
# Line 484  void ShowEvent(TString filename="help", Line 539  void ShowEvent(TString filename="help",
539    // check we have at least one event    // check we have at least one event
540    //    //
541    if (nevents<=0) {    if (nevents<=0) {
542      headerFile->Close();      //    headerFile->Close();
543      printf("The file is empty, exiting...\n");      printf("The file is empty, exiting...\n");
544      pamgui->DIALOG(0," The file contains no physics data! ");      pamgui->DIALOG(0," The file contains no physics data! ");
545      pamela->var.waitforever = true;      pamela->var.waitforever = true;
# Line 504  void ShowEvent(TString filename="help", Line 559  void ShowEvent(TString filename="help",
559    //    //
560    // display the first event (unless we are refreshing only the window)    // display the first event (unless we are refreshing only the window)
561    //    //
562    if ( !pamela->var.refresh ) i = pamela->minevent;    if ( !pamela->var.refresh && !pamela->var.restart ) i = pamela->minevent;
563      pamela->var.restart = false;
564    pamela->var.refresh = false;    pamela->var.refresh = false;
565    //    //
566    pamgui->RefreshButtons();    pamgui->RefreshButtons();
# Line 527  void ShowEvent(TString filename="help", Line 583  void ShowEvent(TString filename="help",
583      //      //
584      pamela->GetEntry(i);      pamela->GetEntry(i);
585      //      //
586        // 9RED feature
587        //
588        if ( pamela->level.file == 2 ){
589          if ( pamela->L2->GetOrbitalInfo() ){
590            if ( pamela->L2->GetOrbitalInfo()->absTime==1158278754 && pamela->L2->GetOrbitalInfo()->pkt_num==355447 ) pamgui->DIALOG(0," Emiliano!! ");
591            if ( pamela->L2->GetOrbitalInfo()->absTime==1158213863 && pamela->L2->GetOrbitalInfo()->pkt_num==11522442 ) pamgui->DIALOG(0," Cecilia!! ");
592            if ( pamela->L2->GetOrbitalInfo()->absTime==1158211486 && pamela->L2->GetOrbitalInfo()->pkt_num==11433603 ) pamgui->DIALOG(0," Nicola!! ");
593            if ( pamela->L2->GetOrbitalInfo()->absTime==1158192175 && pamela->L2->GetOrbitalInfo()->pkt_num==10961128 ) pamgui->DIALOG(0," Massimo!! ");
594            if ( pamela->L2->GetOrbitalInfo()->absTime==1158200475 && pamela->L2->GetOrbitalInfo()->pkt_num==11165923 ) pamgui->DIALOG(0," Donatella!! ");
595            if ( pamela->L2->GetOrbitalInfo()->absTime==1158192513 && pamela->L2->GetOrbitalInfo()->pkt_num==10970370 ) pamgui->DIALOG(0," Rita!! ");
596          };
597        };
598        //
599      // call the filter to select events (if filter file is given)      // call the filter to select events (if filter file is given)
600      //        //  
601      isOK = pamela->SelectEvent();      isOK = pamela->SelectEvent();
# Line 569  void ShowEvent(TString filename="help", Line 638  void ShowEvent(TString filename="help",
638        //        //
639        // prepare the string for the figure filename        // prepare the string for the figure filename
640        //        //
641        char *bw;        const char *bw;
642        if ( pamela->var.bw ){        if ( pamela->var.bw ){
643          bw = "_bw";          bw = "_bw";
644        } else {        } else {
# Line 617  void ShowEvent(TString filename="help", Line 686  void ShowEvent(TString filename="help",
686        //        //
687        pamela->var.goon = false;        pamela->var.goon = false;
688        if ( pamela->var.refresh || pamela->var.restart ){        if ( pamela->var.refresh || pamela->var.restart ){
689          //      if ( pamela->GetL2() ) pamela->GetL2()->Clear();          //      printf(" qua \n");
690            if ( pamela->GetL2() ) pamela->GetL2()->Clear();
691            if ( pamela->GetL2() ) pamela->GetL2()->Reset();
692          if ( pamela->GetL2() ) pamela->GetL2()->Delete();          if ( pamela->GetL2() ) pamela->GetL2()->Delete();
693          //if ( pamela->GetL2() ) delete pamela->GetL2();          pamela->Reset();
694          if ( headerFile ) headerFile->Close("R");          if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
695            otr = NULL;
696            //      if ( headerFile ) headerFile->Close("R");
697            //      if ( pamela->var.refresh ){
698            //        pamela->var.refresh = false;
699            //        pamela->var.restart = true;
700            //      };
701          if ( pamela->var.refresh ) goto refresh;          if ( pamela->var.refresh ) goto refresh;
702          if ( pamela->var.restart ){          if ( pamela->var.restart ){
703              //      if ( pamela->GetL2() ) pamela->GetL2()->Reset();
704              //      pamela->Reset();
705              //      if ( pamela->level.file != 2 ) pamela->GetChain()->Delete();
706              //      otr = NULL;
707              i = pamela->var.i;
708            filename = pamela->var.thefilename.Data();            filename = pamela->var.thefilename.Data();
709            goto restart;            goto restart;
710          };          };
711        };        };
712        //        //
713          //      printf(" que %i \n",i);
714          //      if ( i < 0 ) i = 0; // boh
715        i = pamela->var.i;        i = pamela->var.i;
716        if ( i != pamela->si ) pamela->OOBT = 1000000000;        if ( i != pamela->si ) pamela->OOBT = 1000000000;
717        if ( pamela->maxevent < i ) {        if ( pamela->maxevent < i ) {

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

  ViewVC Help
Powered by ViewVC 1.1.23