From: jniedzie Date: Wed, 18 Feb 2015 14:15:36 +0000 (+0100) Subject: saveViews macro fixed. Some macros are now being compiled before using to fix issues... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=13f4dce08c9a50bd64cc3d7fd5d2234a33cf3144;hp=3af6e8a6002d04fd5ff9e0cbd1b44d766e9d6718 saveViews macro fixed. Some macros are now being compiled before using to fix issues on Mac OS. --- diff --git a/EVE/EveBase/CMakeLists.txt b/EVE/EveBase/CMakeLists.txt index b47cda901aa..138149cdeed 100644 --- a/EVE/EveBase/CMakeLists.txt +++ b/EVE/EveBase/CMakeLists.txt @@ -25,9 +25,9 @@ include_directories( ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSISalice ${AliRoot_SOURCE_DIR}/ITS/ITSbase ${AliRoot_SOURCE_DIR}/ITS/ITSrec - ${AliRoot_SOURCE_DIR}/MONITOR/alionlinereco + ${AliRoot_SOURCE_DIR}/MONITOR/alionlinereco ${AliRoot_SOURCE_DIR}/MONITOR/alistoragemanager - ${AliRoot_SOURCE_DIR}/MONITOR/MONITORzmq + ${AliRoot_SOURCE_DIR}/MONITOR/MONITORzmq ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec ${AliRoot_SOURCE_DIR}/STEER/AOD diff --git a/EVE/macros/alieve_online_new.C b/EVE/macros/alieve_online_new.C index cab9922f131..2894625728c 100644 --- a/EVE/macros/alieve_online_new.C +++ b/EVE/macros/alieve_online_new.C @@ -11,26 +11,27 @@ class AliTriggerAnalysis; class AliSysInfo; TH2D* V0StateHistogram; - Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE; +Int_t g_pic_id = 0; +Int_t g_pic_max = 100; +TTimeStamp g_pic_prev(0, 0); + void alieve_online_new() { - if (gSystem->Getenv("ALICE_ROOT") != 0) - { - gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT"))); - gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT"))); - } + // set OCDB path: + //AliEveEventManager::SetCdbUri("local://$ALICE_ROOT/OCDB"); // default OCDB from aliroot + //AliEveEventManager::SetCdbUri("local:///local/OCDB/2013"); // OCDB snapshot for particular run + AliEveEventManager::SetCdbUri("local:///local/cdb"); // current OCDB snapshot + //AliEveEventManager::SetCdbUri("raw://"); // reading OCDB from alien + - //AliEveEventManager::SetCdbUri("local://$ALICE_ROOT/OCDB"); - //AliEveEventManager::SetCdbUri("local:///local/OCDB/2013"); - AliEveEventManager::SetCdbUri("local:///local/cdb"); - - - //AliEveEventManager::SetCdbUri("raw://"); Info("alieve_init", "Adding standard macros."); TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding alieve_init_import_macros(); + gSystem->cd(Form("%s/../src/",gSystem->Getenv("ALICE_ROOT"))); + gROOT->ProcessLine(".L saveViews.C++"); + TEveUtil::LoadMacro("saveViews.C"); gSystem->cd(hack); new AliEveEventManager("online", -1); @@ -39,8 +40,7 @@ void alieve_online_new() TEveUtil::AssertMacro("VizDB_scan.C"); gSystem->ProcessEvents(); - AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); - TEveBrowser *browser = gEve->GetBrowser(); + TEveBrowser *browser = gEve->GetBrowser(); browser->ShowCloseTab(kFALSE); AliEveMultiView *multiView = new AliEveMultiView(kTRUE); @@ -50,19 +50,20 @@ void alieve_online_new() geom_gentle_rhoz(), geom_gentle_rhoz()); - //These macros crashes on mac os. To be checked. Problems on SLC as well. + gROOT->ProcessLine(".L geom_gentle_trd.C++"); + TEveUtil::LoadMacro("geom_gentle_trd.C"); + multiView->InitGeomGentleTrd(geom_gentle_trd()); - //TEveUtil::LoadMacro("geom_gentle_trd.C"); - //multiView->InitGeomGentleTrd(geom_gentle_trd()); + gROOT->ProcessLine(".L geom_gentle_muon.C++"); + TEveUtil::LoadMacro("geom_gentle_muon.C"); + multiView->InitGeomGentleMuon(geom_gentle_muon(), kFALSE, kFALSE, kTRUE); - //TEveUtil::LoadMacro("geom_gentle_muon.C"); - //multiView->InitGeomGentleMuon(geom_gentle_muon(), kFALSE, kFALSE, kTRUE); //============================================================================ // Standard macros to execute -- not all are enabled by default. //============================================================================ - printf("============ Setting macro executor\n"); + printf("============ Setting macro executor ============\n"); AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); @@ -75,30 +76,10 @@ void alieve_online_new() exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE)); exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE)); exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE)); - - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C", "its_clusters")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C", "tpc_clusters")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C", "trd_clusters")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C", "tof_clusters")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus HMPID", "hmpid_clusters.C", "hmpid_clusters")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus MUON", "muon_clusters.C", "muon_clusters")); - - - exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG EMCAL", "emcal_digits.C", "emcal_digits")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw")); - // exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE)); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE)); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C", "muon_raw")); - exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw")); - - exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE)); exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE)); exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track MUON", "esd_muon_tracks.C", "esd_muon_tracks", "kTRUE,kFALSE", kTRUE)); - // these macros were leaking: exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));// just a little exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC FMD", "fmd_esd.C", "fmd_esd", "", kTRUE));//huge leak @@ -120,7 +101,6 @@ void alieve_online_new() // Final GUI setup //============================================================================ - // browser->GetTabRight()->SetTab(1); browser->StartEmbedding(TRootBrowser::kBottom); new AliEveEventManagerWindow(AliEveEventManager::GetMaster()); @@ -128,33 +108,27 @@ void alieve_online_new() browser->MoveResize(0, 0, gClient->GetDisplayWidth(),gClient->GetDisplayHeight() - 32); -// browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32); - gEve->FullRedraw3D(kTRUE); gSystem->ProcessEvents(); + // move and rotate sub-views TGLViewer *glv1 = multiView->Get3DView()->GetGLViewer(); TGLViewer *glv2 = multiView->GetRPhiView()->GetGLViewer(); TGLViewer *glv3 = multiView->GetRhoZView()->GetGLViewer(); - glv1->CurrentCamera().RotateRad(-0.4, -1.8); - glv2->CurrentCamera().Dolly(450, kFALSE, kFALSE); - glv3->CurrentCamera().Dolly(1500, kFALSE, kFALSE); + glv1->CurrentCamera().RotateRad(-0.4, 0.6); + glv2->CurrentCamera().Dolly(90, kFALSE, kFALSE); + glv3->CurrentCamera().Dolly(1700, kFALSE, kFALSE); AliEveEventManager::GetMaster()->AddNewEventCommand("alieve_online_on_new_event();"); gEve->FullRedraw3D(); gSystem->ProcessEvents(); gEve->Redraw3D(kTRUE); + // set autoload by default AliEveEventManager::GetMaster()->SetAutoLoad(true); - } - -Int_t g_pic_id = 0; -Int_t g_pic_max = 100; -TTimeStamp g_pic_prev(0, 0); - void alieve_online_on_new_event() { AliSysInfo::AddStamp("on_new_event_start"); @@ -216,7 +190,6 @@ void alieve_online_on_new_event() Int_t status; // create screenshots from OpenGL views - TEveUtil::LoadMacro("saveViews.C"); saveViews(pic.Data()); // send screenshot to AMORE @@ -241,8 +214,14 @@ void alieve_init_import_macros() // Put macros in the list of browsables, add a macro browser to // top-level GUI. - TString macdir("$(ALICE_ROOT)/EVE/alice-macros"); - gSystem->ExpandPathName(macdir); + if (gSystem->Getenv("ALICE_ROOT") != 0) + { + gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT"))); + gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT"))); + TString macdir("$(ALICE_ROOT)/EVE/alice-macros"); + gSystem->ExpandPathName(macdir); + } + TFolder* f = gEve->GetMacroFolder(); void* dirhandle = gSystem->OpenDirectory(macdir.Data()); diff --git a/EVE/macros/saveViews.C b/EVE/macros/saveViews.C index 922fe806eea..3bc60120b46 100644 --- a/EVE/macros/saveViews.C +++ b/EVE/macros/saveViews.C @@ -3,13 +3,13 @@ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * * full copyright notice. * **************************************************************************/ - // Author: Mihai Niculescu 2013 - - - /* +// Author: Mihai Niculescu 2013 + + +/* * This script creates a collage containing all OpenGL views from a running AliEve * - * Given Collage size (width, height), the size for all OpenGL + * Given Collage size (width, height), the size for all OpenGL * views are computed using the same aspect ratio (width/height) as the main 3D View */ @@ -20,171 +20,177 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include #include -#include -#include +#include +#include #include TString getEventInfo(); /***********Save all OpenGL views into one picture - compositeImgFileName - save final image to this file - showLiveBar - whether to show the LIVE bar, useful when not online (using offline) + compositeImgFileName - save final image to this file + showLiveBar - whether to show the LIVE bar, useful when not online (using offline) width - of the collage image height -of the collage image -*/ + */ void saveViews(const char* compositeImgFileName="views.png", Bool_t showLiveBar=kTRUE, Int_t width = 1440, Int_t height= 900) { - Info("saveViews.C", "saving views to [%s]", compositeImgFileName); - - Int_t heightInfoBar = 65; // hold height of the Information bar - - TASImage* compositeImg=0; // this holds the final image - TASImage* tempImg=0; // temporary used for loading images - - TEveViewerList* viewers = gEve->GetViewers(); - Int_t Nviewers = viewers->NumChildren()-2; // remark: 3D view is counted twice - - compositeImg = new TASImage(width, height); - - // 3D View size - Int_t width3DView = TMath::FloorNint((float)Nviewers*width/(float)(Nviewers+1)); // the width of the 3D view - Int_t height3DView= height-heightInfoBar; // the height of the 3D view - Float_t aspectRatio = (float)width3DView/(float)height3DView; // 3D View aspect ratio - - // Children View Size - Int_t heightChildView = TMath::FloorNint((float)height3DView/(float)Nviewers); - Int_t widthChildView = TMath::FloorNint(aspectRatio*heightChildView); // has the same aspect ratio as the 3D view - - int index=0; // iteration counter - int x = width3DView; // x position of the child view - int y = 0;// y position of the child view - TString viewFilename; // save view to this file - for(TEveElement::List_i i = (++viewers->BeginChildren()); i != viewers->EndChildren(); i++){ // NB: this skips the first children (first 3D View) - TEveViewer* view = ((TEveViewer*)*i); - viewFilename = Form("view-%d.png", index); - - // Save OpenGL views in files - if(index==0){ - view->GetGLViewer()->SavePictureUsingFBO(viewFilename, width3DView, height3DView); - } - else { - view->GetGLViewer()->SavePictureUsingFBO(viewFilename, widthChildView, heightChildView); - } - - tempImg = new TASImage(viewFilename); - - // copy view image in the composite image - if(index==0){ - tempImg->CopyArea(compositeImg, 0,0, width3DView, height3DView); - } - else { - tempImg->CopyArea(compositeImg, 0,0, widthChildView, heightChildView, x,y); - - // draw a border around child views - compositeImg->DrawRectangle(x,y, widthChildView, heightChildView, "#C0C0C0"); + Info("saveViews.C", "saving views to [%s]", compositeImgFileName); + + Int_t heightInfoBar = 65; // hold height of the Information bar + + TASImage* compositeImg=0; // this holds the final image + TASImage* tempImg=0; // temporary used for loading images + + TEveViewerList* viewers = gEve->GetViewers(); + Int_t Nviewers = viewers->NumChildren()-2; // remark: 3D view is counted twice + + compositeImg = new TASImage(width, height); + + // 3D View size + Int_t width3DView = TMath::FloorNint((float)Nviewers*width/(float)(Nviewers+1)); // the width of the 3D view + Int_t height3DView= height-heightInfoBar; // the height of the 3D view + Float_t aspectRatio = (float)width3DView/(float)height3DView; // 3D View aspect ratio + + // Children View Size + Int_t heightChildView = TMath::FloorNint((float)height3DView/(float)Nviewers); + Int_t widthChildView = TMath::FloorNint(aspectRatio*heightChildView); // has the same aspect ratio as the 3D view + + int index=0; // iteration counter + int x = width3DView; // x position of the child view + int y = 0;// y position of the child view + TString viewFilename; // save view to this file + + for(TEveElement::List_i i = (++viewers->BeginChildren()); i != viewers->EndChildren(); i++) + { // NB: this skips the first children (first 3D View) + TEveViewer* view = ((TEveViewer*)*i); + viewFilename = Form("view-%d.png", index); + + // Save OpenGL views in files + if(index==0){ + view->GetGLViewer()->SavePictureUsingFBO(viewFilename, width3DView, height3DView); + } + else { + view->GetGLViewer()->SavePictureUsingFBO(viewFilename, widthChildView, heightChildView); + } + + tempImg = new TASImage(viewFilename); + + // copy view image in the composite image + if(index==0){ + tempImg->CopyArea(compositeImg, 0,0, width3DView, height3DView); + } + else { + tempImg->CopyArea(compositeImg, 0,0, widthChildView, heightChildView, x,y); + + // draw a border around child views + compositeImg->DrawRectangle(x,y, widthChildView, heightChildView, "#C0C0C0"); + } + + /* + final touches inside loop + */ + delete tempImg; + if(index>0) // skip 3D View + y+=heightChildView; + + index++; } - /* - final touches inside loop - */ - delete tempImg; - if(index>0) // skip 3D View - y+=heightChildView; - - index++; - } - - // Create a glow (bloom) effect - tempImg = (TASImage*)compositeImg->Clone("tempImg"); - tempImg->Blur(10.0,10.0); - compositeImg->Merge(tempImg, "lighten"); - delete tempImg; tempImg = 0; - - - // show LIVE bar - if(showLiveBar){ - TTimeStamp ts; - TString tNow = ts.AsString("s"); // display date & time - - compositeImg->Gradient( 90, "#EAEAEA #D2D2D2 #FFFFFF", 0, 75, 0, 239, 95); - compositeImg->Gradient( 90, "#D6D6D6 #242424 #000000", 0, 155, 60, 152, 26); - compositeImg->BeginPaint(); - compositeImg->DrawRectangle(50,0, 264, 94); - compositeImg->DrawText(162, 6, "LIVE", 70, "#FF2D00", "FreeSansBold.otf"); - compositeImg->DrawText(162, 65, tNow, 16, "#FFFFFF", "arial.ttf"); - compositeImg->EndPaint(); - //include ALICE Logo - tempImg = new TASImage( Form("%s/picts/2012-Jul-04-4_Color_Logo_small_CB.png", gSystem->Getenv("ALICE_ROOT")) ); - tempImg->Scale(64,86); - //tempImg->CopyArea(compositeImg, 0,0, 236, 319, 59, 4); - compositeImg->Merge(tempImg, "alphablend", 82, 4); - delete tempImg; tempImg = 0; - } - - // show Information bar - TString stringInfo; - stringInfo = getEventInfo(); - compositeImg->Gradient( 90, "#1B58BF #1D5CDF #0194FF", 0, 0, height-heightInfoBar, width, heightInfoBar); - compositeImg->BeginPaint(); - compositeImg->DrawText(10, height-heightInfoBar+15, stringInfo, 28, "#FFFFFF", "FreeSansBold.otf"); - compositeImg->EndPaint(); - - - // write composite image to disk - compositeImg->CopyArea(compositeImg, 0,0, width, height); - compositeImg->WriteImage(compositeImgFileName); - - delete compositeImg; - - return; + // Create a glow (bloom) effect + tempImg = (TASImage*)compositeImg->Clone("tempImg"); + tempImg->Blur(10.0,10.0); + compositeImg->Merge(tempImg, "lighten"); + delete tempImg; tempImg = 0; + + + // show LIVE bar + if(showLiveBar){ + TTimeStamp ts; + TString tNow = ts.AsString("s"); // display date & time + + compositeImg->Gradient( 90, "#EAEAEA #D2D2D2 #FFFFFF", 0, 75, 0, 239, 95); + compositeImg->Gradient( 90, "#D6D6D6 #242424 #000000", 0, 155, 60, 152, 26); + compositeImg->BeginPaint(); + compositeImg->DrawRectangle(50,0, 264, 94); + compositeImg->DrawText(162, 6, "LIVE", 70, "#FF2D00", "FreeSansBold.otf"); + compositeImg->DrawText(162, 65, tNow, 16, "#FFFFFF", "arial.ttf"); + compositeImg->EndPaint(); + //include ALICE Logo + tempImg = new TASImage( Form("%s/picts/2012-Jul-04-4_Color_Logo_small_CB.png", gSystem->Getenv("ALICE_ROOT")) ); + tempImg->Scale(64,86); + //tempImg->CopyArea(compositeImg, 0,0, 236, 319, 59, 4); + compositeImg->Merge(tempImg, "alphablend", 82, 4); + delete tempImg; tempImg = 0; + } + + // show Information bar + TString stringInfo; + stringInfo = getEventInfo(); + compositeImg->Gradient( 90, "#1B58BF #1D5CDF #0194FF", 0, 0, height-heightInfoBar, width, heightInfoBar); + compositeImg->BeginPaint(); + compositeImg->DrawText(10, height-heightInfoBar+15, stringInfo, 28, "#FFFFFF", "FreeSansBold.otf"); + compositeImg->EndPaint(); + + + // write composite image to disk + compositeImg->CopyArea(compositeImg, 0,0, width, height); + compositeImg->WriteImage(compositeImgFileName); + + delete compositeImg; + + return; } // This function retrieves a string containing some information regarding the current event TString getEventInfo() { - // For general public please show as less or technical information as possible - - TString rawInfo, esdInfo; - - if (!AliEveEventManager::HasRawReader()) - { - rawInfo = ""; - } - else - { - AliRawReader* rawReader = AliEveEventManager::AssertRawReader(); - if(!rawReader) return ""; - rawInfo.Form("Run: %d Event#: %d (%s)", - rawReader->GetRunNumber(), - AliEveEventManager::CurrentEventId(), - AliRawEventHeaderBase::GetTypeName(rawReader->GetType()) - ); - - return rawInfo; - } - - if (!AliEveEventManager::HasESD()) - { - esdInfo = ""; - } - else - { - AliESDEvent* esd = AliEveEventManager::AssertESD(); - - esdInfo.Form("Colliding: %s Run: %d Event: %d (%s)", - esd->GetESDRun()->GetBeamType(), - esd->GetRunNumber(), - AliEveEventManager::CurrentEventId(), - "PHYSICS_EVENT" - /*AliRawEventHeaderBase::GetTypeName(esd->GetEventType())*/ - ); - } - - return esdInfo; + // For general public please show as less or technical information as possible + + TString rawInfo, esdInfo; + + if (!AliEveEventManager::HasRawReader()) + { + rawInfo = ""; + } + else + { + AliRawReader* rawReader = AliEveEventManager::AssertRawReader(); + if(!rawReader) return ""; + rawInfo.Form("Run: %d Event#: %d (%s)", + rawReader->GetRunNumber(), + AliEveEventManager::CurrentEventId(), + AliRawEventHeaderBase::GetTypeName(rawReader->GetType()) + ); + + return rawInfo; + } + + if (!AliEveEventManager::HasESD()) + { + esdInfo = ""; + } + else + { + AliESDEvent* esd = AliEveEventManager::AssertESD(); + + esdInfo.Form("Colliding: %s Run: %d Event: %d (%s)", + esd->GetESDRun()->GetBeamType(), + esd->GetRunNumber(), + AliEveEventManager::CurrentEventId(), + "PHYSICS_EVENT" + /*AliRawEventHeaderBase::GetTypeName(esd->GetEventType())*/ + ); + } + + return esdInfo; }