From: hristov Date: Wed, 18 Feb 2004 21:21:59 +0000 (+0000) Subject: One class per file. Coding conventions. Removing warnings on Sun X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=7bb7ac149204bc704ac7b94182c0b736bc6c0c30;p=u%2Fmrichter%2FAliRoot.git One class per file. Coding conventions. Removing warnings on Sun --- diff --git a/DISPLAY/AliDetectorFrame.cxx b/DISPLAY/AliDetectorFrame.cxx new file mode 100644 index 00000000000..777ecdbbaee --- /dev/null +++ b/DISPLAY/AliDetectorFrame.cxx @@ -0,0 +1,187 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE DETECTOR FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#include "AliDetectorFrame.h" +#include "AliDisplay2.h" +#include "AliModuleInfo.h" + +#include "AliModule.h" + +ClassImp(AliDetectorFrame); + +int AliDetectorFrame::fgBaseId = 1000; + +//_____________________________________________________________ +AliDetectorFrame::AliDetectorFrame(const TGWindow *p, Int_t w, Int_t h,UInt_t bgc) +{ + // Constructor + fMainFrame = new TGCompositeFrame(p,w,h,kVerticalFrame,bgc); + TGLayoutHints *layout = new TGLayoutHints(kLHintsTop | kLHintsLeft,2,2,2,2); + TGLayoutHints *layout2 = new TGLayoutHints(kLHintsTop | kLHintsRight,2,2,2,2); + TGLayoutHints *layout3 = new TGLayoutHints(kLHintsTop | kLHintsExpandX,2,2,2,2); + fCheckButton = new TGCheckButton*[gAliDisplay2->GetNbModules()]; + fCheckedButton = new Bool_t[gAliDisplay2->GetNbModules()]; + fCheckButtonId = new Int_t[gAliDisplay2->GetNbModules()]; + TGCompositeFrame *dframe; + TGButton *button; + char text[32]; + AliModule *mod; + fCheckedMode = kFALSE; + for(Int_t i=0;iGetNbModules();i++){ + mod = dynamic_cast (gAliDisplay2->GetModules()->At(i)); + if(!mod) continue; + dframe = new TGCompositeFrame(fMainFrame,150,20,kHorizontalFrame); + fCheckButton[i] = new TGCheckButton(dframe,mod->GetName(),fgBaseId); + fCheckButtonId[i]=fgBaseId; + fCheckButton[i]->Connect("Clicked()","AliDetectorFrame",this,"DoCheckButton(Int_t)"); + fCheckedButton[i]=kTRUE; + dframe->AddFrame(fCheckButton[i],layout); + fCheckButton[i]->SetState(kButtonDown); + sprintf(text,"Specific %s view",mod->GetName()); + button = new TGTextButton(dframe,"Display",fgBaseId); + button->SetToolTipText(text); + button->Connect("Clicked()","AliDetectorFrame",this,"DoSpecific()"); + dframe->AddFrame(button,layout2); + fMainFrame->AddFrame(dframe,layout3); + gAliDisplay2->GetModuleInfo()->SetId((char*)mod->GetName(),fgBaseId); + fgBaseId++; + } + gAliDisplay2->GetModuleInfo()->Print(); + fButtonFrame = new TGCompositeFrame(fMainFrame,w,100,kHorizontalFrame,bgc); + fButtonAll = new TGTextButton(fButtonFrame,"All",kIdbSelectALL); + fButtonAll->Connect("Clicked()","AliDetectorFrame",this,"DoButton(Int_t)"); + fButtonFrame->AddFrame(fButtonAll,new TGLayoutHints(kLHintsBottom | kLHintsLeft,2,2,2,2)); + fButtonInvert = new TGTextButton(fButtonFrame,"Invert",kIdbSelectINVERT); + fButtonInvert->Connect("Clicked()","AliDetectorFrame",this,"DoButton(Int_t)"); + fButtonFrame->AddFrame(fButtonInvert,new TGLayoutHints(kLHintsBottom | kLHintsRight,2,2,2,2)); + fMainFrame->AddFrame(fButtonFrame,new TGLayoutHints(kLHintsBottom | kLHintsLeft|kLHintsExpandX,0,0,2,2)); + fCheckedMode = kTRUE; +} + +//_____________________________________________________________ +AliDetectorFrame::~AliDetectorFrame() +{ + // Destructor + for(Int_t i=0;iGetNbModules();i++){ + delete fCheckButton[i]; + } + delete fCheckButton; + delete fCheckedButton; + delete fCheckButtonId; + //delete [] fDetectorName; + delete fButtonFrame; + delete fMainFrame; + delete fButtonAll; + delete fButtonInvert; +} + +//_____________________________________________________________ +void AliDetectorFrame::DoButton(Int_t /*pos*/) +{ + // Update display if a button was used + TGFrame *frame = (TGFrame *) gTQSender; + TGButton *bu= (TGButton *) frame; + int id = bu->WidgetId(); + fCheckedMode = kFALSE; + AliModule *mo; + switch(id){ + case kIdbSelectALL:{ + for(Int_t i=0;iGetNbModules();i++){ + mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); + if(!mo) continue; + fCheckButton[i]->SetState(kButtonDown); + fCheckedButton[i]=kTRUE; + gAliDisplay2->EnableDetector(mo->GetName()); + } + } + break; + case kIdbSelectINVERT:{ + for(Int_t i=0;iGetNbModules();i++){ + mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); + if(!mo) continue; + if(fCheckedButton[i]==kTRUE) { + fCheckButton[i]->SetState(kButtonUp); + fCheckedButton[i]=kFALSE; + gAliDisplay2->DisableDetector(mo->GetName()); + } + else if(fCheckedButton[i]==kFALSE) { + fCheckButton[i]->SetState(kButtonDown); + fCheckedButton[i]=kTRUE; + gAliDisplay2->EnableDetector(mo->GetName()); + } + } + } + break; + default:break; + } + gAliDisplay2->Update(kmMODULES); + fCheckedMode = kTRUE; +} + +//_____________________________________________________________ +void AliDetectorFrame::DoCheckButton(Int_t /*pos*/) +{ + // Chech if any button was used + if(fCheckedMode == kFALSE) return; + TGFrame *frame = (TGFrame *) gTQSender; + TGCheckButton *bu= (TGCheckButton *) frame; + Int_t id = bu->WidgetId(); + AliModule *mo; + for(Int_t i=0;iGetNbModules();i++){ + mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); + if(!mo) continue; + if(id==fCheckButtonId[i]){ + if(fCheckedButton[i]==kTRUE) { + fCheckedButton[i]=kFALSE; + gAliDisplay2->DisableDetector(mo->GetName()); + } + else { + fCheckedButton[i]=kTRUE; + gAliDisplay2->EnableDetector(mo->GetName()); + } + } + } + gAliDisplay2->Update(kmMODULES); +} + +//_____________________________________________________________ +void AliDetectorFrame::DoSpecific() const +{ + // Draw detectors + TGFrame *frame = (TGFrame *) gTQSender; + TGCheckButton *bu= (TGCheckButton *) frame; + Int_t id = bu->WidgetId(); + AliModule *mo; + for(Int_t i=0;iGetNbModules();i++){ + mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); + if(!mo) continue; + if(id==fCheckButtonId[i]){ + gAliDisplay2->DrawDetector(mo->GetName()); + } + } +} diff --git a/DISPLAY/AliDetectorFrame.h b/DISPLAY/AliDetectorFrame.h new file mode 100644 index 00000000000..ad94a0f84c7 --- /dev/null +++ b/DISPLAY/AliDetectorFrame.h @@ -0,0 +1,54 @@ +#ifndef ALIDETECTORFRAME_H +#define ALIDETECTORFRAME_H + +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE DETECTOR FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TGWindow; +class TGCompositeFrame; +class TGCheckButton; +class TGTextButton; + +class AliDetectorFrame{ + //This classe implements the frame which contains the list of enabled detectors + //and allows the user to change the current status of the detector (enabled/disabled) + +public: + + AliDetectorFrame(const TGWindow *p, Int_t w, Int_t h,UInt_t bgc); + virtual ~AliDetectorFrame(); + + TGCompositeFrame* GetDetectorFrame(){return fMainFrame;}; + + //Slots + void DoButton(Int_t pos=0); + void DoCheckButton(Int_t pos=0); + void DoSpecific() const; + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGCompositeFrame *fButtonFrame; // Button frame + TGCheckButton **fCheckButton; // Array of checked buttons + TGTextButton *fButtonAll; // Button for "All" + TGTextButton *fButtonInvert; // Button for "Invert" + Bool_t *fCheckedButton; //fEnabledButton[i]=kTRUE if button checked + Int_t *fCheckButtonId; // Array of IDs for checked buttons + Bool_t fCheckedMode; // Flag for checked mode + static int fgBaseId; // Base ID??? + + RQ_OBJECT("AliDetectorFrame") + + ClassDef(AliDetectorFrame,0); +}; +#endif diff --git a/DISPLAY/AliDisplay2.cxx b/DISPLAY/AliDisplay2.cxx index 8b571a86ea3..6df56f8b9f1 100644 --- a/DISPLAY/AliDisplay2.cxx +++ b/DISPLAY/AliDisplay2.cxx @@ -12,6 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +///////////////////////////////////////////////////////////////////////// +// ALICE EVENT DISPLAY CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// #define do_mc @@ -22,1939 +28,159 @@ //ROOT -#include -#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include -#include -#include #include -#include -#include -#include #include #include -#include -#include -#include +#include //AliRoot Module #include "AliModule.h" #include "AliDetector.h" -#include "AliHeader.h" -#include "AliPoints.h" #include "AliRun.h" -#include "AliStack.h" -#include "AliITSclusterV2.h" -#include "AliITSgeom.h" -#include "AliITSLoader.h" -#include "AliITS.h" -#include "AliTPCcluster.h" -#include "AliTPCLoader.h" -#include "AliTPC.h" -#include "AliClusters.h" -#include "AliTPCParam.h" #include "AliMC.h" -#ifdef ALI_HLT -//HLT Module -#include "AliL3Logging.h" -#include "AliL3Display.h" -#include "AliL3Transform.h" -#include "AliL3Track.h" -#include "AliL3TrackArray.h" -#include "AliL3SpacePointData.h" -#include "AliL3MemHandler.h" -#endif +#include "AliModuleInfo.h" +#include "AliSliderFrame.h" +#include "AliShutterFrame.h" +#include "AliDisplayFrame.h" +#include "AliInfoFrame.h" +#include "AliDetectorFrame.h" +#include "AliMenu.h" #include "AliDisplay2.h" - AliDisplay2 *gAliDisplay2; - -//extern filetypes; -const char *filetypes[] = {"ROOT files","*.root","All files","*",0,0}; -const char *imgtypes[] = {"GIF files","*.gif",0,0}; - -ClassImp(AliModuleInfo); - -//_____________________________________________________________ -AliModuleInfo::AliModuleInfo(int n) -{ - fName = new char*[n]; - fId = new Int_t[n]; - fEnabled = new Bool_t[n]; - fNb = 0; -} - -//_____________________________________________________________ -AliModuleInfo::~AliModuleInfo(){ - delete [] fName; - delete [] fId; - delete [] fEnabled; -} -//_____________________________________________________________ -void AliModuleInfo::Add(const char *name,Int_t i) -{ - fName[fNb]=new char[strlen(name)]; - strcpy(fName[fNb],name); - fId[fNb]=i; - fEnabled[fNb]=kTRUE; - fNb++; -} + AliDisplay2 *gAliDisplay2; -//_____________________________________________________________ -void AliModuleInfo::SetId(char *name,Int_t id) -{ - Int_t i=0; - while((strcmp(name,fName[i])!=0)&&(i!=fNb)) i++; - if(strcmp(name,fName[i])==0) fId[i]=id; -} +ClassImp(AliDisplay2); //_____________________________________________________________ -char* AliModuleInfo::Name(Int_t id) +AliDisplay2::AliDisplay2(const TGWindow *p, UInt_t w, UInt_t h) + :TObject() { - Int_t i=0; - while((fId[i]!=id)&&(i!=fNb)) i++; - if(fId[i]==id) return fName[i]; - return 0; -} + // Constructor + //gAlice->SetDisplay(this); + gAliDisplay2=this; + fSliderUpdate = kFALSE; + fZoomMode = kFALSE; + fZoomStep = 1.2; + fZoomFactor = 1.5; + fNbParticles = 0; + fEventNumber = 0; + fNbHits = 0; + fSliderStep = 0.01; + fClustersLoaded = kFALSE; + fHitsLoaded = kFALSE; + fHLTLoaded = kFALSE; + fTracksLoaded = kFALSE; + fMode =0; + FindModules(); -//_____________________________________________________________ -Int_t AliModuleInfo::Id(char *name) -{ - Int_t i=0; - while((strcmp(name,fName[i])!=0)&&(i!=fNb)) i++; - if(strcmp(name,fName[i])==0) return fId[i]; - return -1; -} - -//_____________________________________________________________ -Bool_t AliModuleInfo::IsEnabled(Int_t id) -{ - //return the current status of the detector - Int_t i=0; - while((fId[i]!=id)&&(i!=fNb)) i++; - if(fId[i]==id) return fEnabled[i]; - return kFALSE; -} - -//_____________________________________________________________ -void AliModuleInfo::Disable(Int_t id) -{ - //Disable the detector - Int_t i=0; - while((fId[i]!=id)&&(i!=fNb)) i++; - if(fId[i]==id) fEnabled[i]=kFALSE; -} - -//_____________________________________________________________ -void AliModuleInfo::Enable(Int_t id) -{ - //Enable the detector - Int_t i=0; - while((fId[i]!=id)&&(i!=fNb)) i++; - if(fId[i]==id) fEnabled[i]=kTRUE; -} - -//_____________________________________________________________ -void AliModuleInfo::Print() -{ - printf("\n***Modules***"); - printf("\nName\tId\tEnabled"); - for(Int_t i=0;iGetNbModules()]; - fName = new char*[gAliDisplay2->GetNbModules()]; - fNb=0; - for(Int_t i=0;iGetNbModules();i++){ - fPoints[i].SetMarkerSize(0.2); - fPoints[i].SetMarkerColor(2); - fPoints[i].SetMarkerStyle(1); - } -} - -//_____________________________________________________________ -AliDisplayClusters::~AliDisplayClusters() -{ - delete [] fPoints; -} - -//_____________________________________________________________ -Int_t AliDisplayClusters::GetNbClusters() -{ - Int_t r=0; - for(Int_t i=0;iGetModuleInfo()->IsEnabled(fName[i])) r+=fPoints[i].GetN(); - } - return r; -} - -//_____________________________________________________________ -void AliDisplayClusters::LoadClusters(char *name,Int_t nevent) -{ - if(strstr(name,"ITS")) LoadITSClusters(nevent); - if(strstr(name,"TPC")) LoadTPCClusters(nevent); -} - -//_____________________________________________________________ -void AliDisplayClusters::LoadITSClusters(Int_t nevent) -{ - fName[fNb]=new char[strlen("ITS")]; - strcpy(fName[fNb],"ITS"); - AliRunLoader *rl = AliRunLoader::Open("galice.root"); - if(!rl) { - cerr<<"Can't open galice.root"; - return; - } - AliITSLoader *itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); - AliITS *its = (AliITS*)gAlice->GetModule("ITS"); + fIconsPath = new char[32]; + strcpy(fIconsPath,gSystem->Getenv("ALICE_ROOT")); + strcat(fIconsPath,"/DISPLAY/icons/"); + LoadFromRC(); + fMainFrame = new TGMainFrame(p,w,h,kVerticalFrame); + fSubFrame = new TGCompositeFrame(fMainFrame,w,h,kHorizontalFrame); + fLeftFrame = new TGCompositeFrame(fSubFrame,150,h,kVerticalFrame|kFixedWidth); + fRightFrame = new TGCompositeFrame(fSubFrame,600,h,kVerticalFrame); + //fMainFrame->Connect("ProcessedEvent(Event_t*)", "AliDisplay2", this,"HandleMouseWheel(Event_t*)"); + fMainFrame->Connect("ProcessedEvent(Event_t*)", "AliDisplay2",this,"HandleResize(Event_t*)"); + //MenuBar + fMenu = new AliMenu(fMainFrame,1,1,kRaisedFrame|kHorizontalFrame); - rl->GetEvent(nevent); - itsl->LoadRecPoints(); - TTree *cTree=itsl->TreeR(); - if(!cTree) - { - cerr<<"Error occured during ITS clusters load"; - return; - } - - AliITSgeom *geom=its->GetITSgeom(); - Int_t count = 0; - - TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000); - TBranch *branch=cTree->GetBranch("Clusters"); - branch->SetAddress(&clusters); - Int_t nentr=(Int_t)cTree->GetEntries(); - for (Int_t i=0; iGetEvent(i)) continue; - - Double_t rot[9]; - geom->GetRotMatrix(i,rot); - Int_t lay,lad,det; - geom->GetModuleId(i,lay,lad,det); - Float_t tx,ty,tz; - geom->GetTrans(lay,lad,det,tx,ty,tz); - - Double_t r=-tx*rot[1]+ty*rot[0]; - if (lay==1) r=-r; - Double_t phi=TMath::ATan2(rot[1],rot[0]); - if (lay==1) phi-=3.1415927; - Double_t cp=TMath::Cos(phi), sp=TMath::Sin(phi); - - Int_t ncl=clusters->GetEntriesFast(); - while (ncl--) { - AliITSclusterV2 *c=(AliITSclusterV2*)clusters->UncheckedAt(ncl); - Double_t g[3]; - g[0]= r*cp + c->GetY()*sp; // - g[1]=-r*sp + c->GetY()*cp; // - g[2]=c->GetZ(); - fPoints[fNb].SetPoint(count,g[0],g[1],g[2]); - count++; - } - } - fNb++; -} - -//_____________________________________________________________ -void AliDisplayClusters::LoadTPCClusters(Int_t nevent) -{ + //Slider Frame + fSliderFrameLayout = new TGLayoutHints( kLHintsBottom| kLHintsRight| kLHintsExpandX | kLHintsCenterX, 2, 2, 2, 2); + fSliderFrame = new AliSliderFrame(fRightFrame,600,150); + fRightFrame->AddFrame(fSliderFrame->GetSliderFrame(),fSliderFrameLayout); - fName[fNb]=new char[strlen("TPC")]; - strcpy(fName[fNb],"TPC"); - TFile *file = TFile::Open("galice.root"); - AliTPCParam *dig=(AliTPCParam *)file->Get("75x40_100x60_150x60"); - if (!dig) {cerr<<"TPC parameters have not been found !\n";} - file->Close(); - - AliRunLoader *rl = AliRunLoader::Open("galice.root"); - if(!rl) { - cerr<<"Can't open galice.root"; - return; - } - AliTPCLoader *itsl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); - if(!itsl){ - cerr<<"Can't find Loader"; - return; - } + //Info Frame + fInfoFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX ,0,0,0,0); + fInfoFrame = new AliInfoFrame(fLeftFrame,150,200); + fLeftFrame->AddFrame(fInfoFrame->GetInfoFrame(),fInfoFrameLayout); - rl->GetEvent(nevent); - itsl->LoadRecPoints(); - TTree *cTree=itsl->TreeR(); - if(!cTree) - { - cerr<<"Error during TPC clusters load"; - return; - } - - Int_t count = 0; - Float_t noiseth = 10; - - AliClusters *clusters=new AliClusters(); - clusters->SetClass("AliTPCcluster"); - - cTree->SetBranchAddress("Segment",&clusters); - - Int_t nrows=Int_t(cTree->GetEntries()); - for (Int_t n=0; nGetEvent(n); - Int_t sec,row; - dig->AdjustSectorRow(clusters->GetID(),sec,row); - TClonesArray &clrow=*clusters->GetArray(); - Int_t ncl=clrow.GetEntriesFast(); - while (ncl--) { - AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl]; - Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ(); - if (cl->GetQ()AdjustCosSin(sec,cs,sn); - tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; - fPoints[fNb].SetPoint(count,x,y,z); - count++; - } - clrow.Clear(); - - } - delete cTree; - delete dig; - fNb++; -} - -//_____________________________________________________________ -void AliDisplayClusters::Draw() -{ - for(Int_t i=0;iGetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw(); - } -} - - -ClassImp(AliDisplayHLT); - -//_____________________________________________________________ -AliDisplayHLT::AliDisplayHLT() -{ - fPoints = new TPolyMarker3D[gAliDisplay2->GetNbModules()]; - fName = new char*[gAliDisplay2->GetNbModules()]; - fNb=0; - for(Int_t i=0;iGetNbModules();i++){ - fPoints[i].SetMarkerSize(0.2); - fPoints[i].SetMarkerColor(2); - fPoints[i].SetMarkerStyle(1); - } -} - -//_____________________________________________________________ -AliDisplayHLT::~AliDisplayHLT() -{ - delete [] fPoints; -} - -//_____________________________________________________________ -void AliDisplayHLT::LoadHLT(char *name,Int_t nevent) -{ - if(strstr(name,"TPC")) LoadHLTTPC(nevent); -} - -//_____________________________________________________________ -void AliDisplayHLT::LoadHLTTPC(Int_t nevent) -{ -#ifdef ALI_HLT - //load TPC Clusters from the raw data - //raw data must be in the directorie $ALICE_ROOT/raw - //First we read the data from files - //do_mc MUST BE DEFINED AND USED FOR RAW DATA GENERATION - - fName[fNb]=new char[strlen("TPC")]; - strcpy(fName[fNb],"TPC"); - Char_t fname[256]; - AliL3MemHandler *clusterfile[36][6]; - AliL3SpacePointData *fClusters[36][6]; - UInt_t fNcl[36][6]; - memset(fClusters,0,36*6*sizeof(AliL3SpacePointData*)); - // strcpy(path,gSystem->Getenv("ALICE_ROOT")); - //strcat(path,"/raw"); - //printf("\nRaw data path %s",path); - char path[128]; - strcpy(path,gAliDisplay2->GetRawDataPath()); - for(Int_t s=0; s<36; s++) - { - for(Int_t p=0; pSetBinaryInput(fname)) - { - LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open") - <<"Inputfile "<Allocate(); - clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]); - clusterfile[s][p]->CloseBinaryInput(); - break; - } - } - - //Second step: we assign the clusters to the fPoints array - Int_t nbc=0; - for(Int_t s=0; s<36; s++){ - for(Int_t p=0;p<6;p++){ - AliL3SpacePointData *points = fClusters[s][p]; - if(!points) continue; - Float_t xyz[3]; - for(UInt_t i=0; iGetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw(); - } -} - - -ClassImp(AliSliderFrame); - -//_____________________________________________________________ -AliSliderFrame::AliSliderFrame(const TGWindow *p, UInt_t w, UInt_t h) -{ - fMainFrame = new TGCompositeFrame(p, w, h, kVerticalFrame | kRaisedFrame); - fLayout = new TGLayoutHints( kLHintsBottom | kLHintsRight | kLHintsExpandX,5,5,2,2); - - //Momentum Slider - fMomentumFrame = new TGCompositeFrame(fMainFrame,0,0, kHorizontalFrame); - fMomentumLayout = new TGLayoutHints( kLHintsLeft | kLHintsTop | kLHintsExpandX ,5,5,2,2); - fMomentumSlider = new TGDoubleHSlider(fMomentumFrame, 400, kDoubleScaleBoth, kIdsMOMENTUM); - fMomentumSlider->Connect("PositionChanged()","AliSliderFrame",this,"DoSlider()"); - fMomentumSlider->Connect("PositionChanged()","AliSliderFrame",this,"DoPositionChanged(Int_t)"); - fMomentumSlider->Connect("Released()","AliSliderFrame",this,"DoReleased()"); - SetMomentumRange(0,2); - fMomentumSlider->SetPosition(0,2); - fMomentumLabel = new TGLabel(fMomentumFrame,"Momentum"); - - fMomentumMinValue = new TGNumberEntry(fMomentumFrame,GetMomentumMin(),7,kIdsMomentumMIN); - fMomentumMinValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); - fMomentumMinValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); - fMomentumMinValue->SetButtonToNum(kFALSE); - - fMomentumMaxValue = new TGNumberEntry(fMomentumFrame,GetMomentumMax(),7,kIdsMomentumMAX); - fMomentumMaxValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); - fMomentumMaxValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); - fMomentumMaxValue->SetButtonToNum(kFALSE); - - fMomentumFrame->AddFrame(fMomentumLabel,new TGLayoutHints( kLHintsLeft | kLHintsCenterY,5,5,2,2)); - fMomentumFrame->AddFrame(fMomentumMinValue,new TGLayoutHints( kLHintsLeft ,5,5,2,2)); - fMomentumFrame->AddFrame(fMomentumSlider,fMomentumLayout); - fMomentumFrame->AddFrame(fMomentumMaxValue,new TGLayoutHints( kLHintsRight,5,5,2,2)); - fMomentumFrame->Resize(700,100); - - - //Rapidity Slider - fRapidityFrame = new TGCompositeFrame(fMainFrame,0,0, kHorizontalFrame); - fRapidityLayout = new TGLayoutHints( kLHintsLeft | kLHintsTop | kLHintsExpandX,5,5,2,2); - fRapiditySlider = new TGDoubleHSlider(fRapidityFrame, 400, kDoubleScaleBoth, kIdsRAPIDITY); - fRapiditySlider->Connect("PositionChanged()","AliSliderFrame",this,"DoSlider()"); - fRapiditySlider->Connect("PositionChanged()","AliSliderFrame",this,"DoPositionChanged(Int_t)"); - fRapiditySlider->Connect("Released()","AliSliderFrame",this,"DoReleased()"); - SetRapidityRange(-1.5,1.5); - fRapiditySlider->SetPosition(-1.5,1.5); - fRapidityLabel = new TGLabel(fRapidityFrame,"Rapidity "); - fRapidityMinValue = new TGNumberEntry(fRapidityFrame,GetRapidityMin(),7,kIdsRapidityMIN); - fRapidityMinValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); - fRapidityMinValue->SetButtonToNum(kFALSE); - fRapidityMinValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); - - fRapidityMaxValue = new TGNumberEntry(fRapidityFrame,GetRapidityMax(),7,kIdsRapidityMAX); - fRapidityMaxValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); - fRapidityMaxValue->SetButtonToNum(kFALSE); - fRapidityMaxValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); - - fRapidityFrame->AddFrame(fRapidityLabel,new TGLayoutHints( kLHintsLeft | kLHintsCenterY,5,5,2,2)); - fRapidityFrame->AddFrame(fRapidityMinValue,new TGLayoutHints( kLHintsLeft ,5,5,2,2)); - fRapidityFrame->AddFrame(fRapiditySlider,fRapidityLayout); - fRapidityFrame->AddFrame(fRapidityMaxValue,new TGLayoutHints( kLHintsRight ,5,5,2,2)); - fRapidityFrame->Resize(700,100); - - fMainFrame->AddFrame(fMomentumFrame,fLayout); - fMainFrame->AddFrame(fRapidityFrame,fLayout); - fMainFrame->MapSubwindows(); - fMainFrame->MapWindow(); - fMainFrame->Resize(700,100); - LoadFromRC(); -} - -//_____________________________________________________________ -AliSliderFrame::~AliSliderFrame(void) -{ - delete fLayout; - delete fRapidityLayout; - delete fMomentumLayout; - delete fMomentumMinValue; - delete fMomentumMaxValue; - delete fMainFrame; - delete fRapidityFrame; - delete fMomentumFrame; - delete fMomentumSlider; - delete fRapiditySlider; - delete fMomentumLabel; - delete fRapidityLabel; - delete fRapidityMinValue; - delete fRapidityMaxValue; -} - -//_____________________________________________________________ -void AliSliderFrame::CloseWindow(void) -{ - delete this; -} - -//_____________________________________________________________ -void AliSliderFrame::DoSlider(Int_t /*pos*/) -{ - TGFrame *frame = (TGFrame *) gTQSender; - TGDoubleSlider * ds = (TGDoubleSlider *) frame; - int id = ds->WidgetId(); - char min[8]; - char max[8]; - switch(id){ - case kIdsMOMENTUM:{ - //sprintf(buf,"momentum min:%f max:%f",GetMomentumMin(),GetMomentumMax()); - //printf("\n%s",buf); - sprintf(min,"%.4f",GetMomentumMin()); - sprintf(max,"%.4f",GetMomentumMax()); - fMomentumMaxValue->SetText(max); - fMomentumMinValue->SetText(min); - } - break; - case kIdsRAPIDITY:{ - sprintf(min,"%.4f",GetRapidityMin()); - sprintf(max,"%.4f",GetRapidityMax()); - fRapidityMaxValue->SetText(max); - fRapidityMinValue->SetText(min); - } - break; - default:break; - } -} - -//_____________________________________________________________ -void AliSliderFrame::DoReleased(Int_t /*pos*/) -{ - TGFrame *frame = (TGFrame *) gTQSender; - TGDoubleSlider * ds = (TGDoubleSlider *) frame; - int id = ds->WidgetId(); - switch(id){ - case kIdsRAPIDITY: - case kIdsMOMENTUM: - gAliDisplay2->Update(kmCUTS); - break; - default: break; - } -} - -//_____________________________________________________________ -void AliSliderFrame::DoPositionChanged(Int_t /*pos*/) -{ - if(!gAliDisplay2->GetSliderUpdate()) return; - TGFrame *frame = (TGFrame *) gTQSender; - TGDoubleSlider * ds = (TGDoubleSlider *) frame; - int id = ds->WidgetId(); - switch(id){ - case kIdsRapidityMIN: - case kIdsRapidityMAX: - case kIdsMomentumMIN: - case kIdsMomentumMAX:{ - gAliDisplay2->Update(kmCUTS); - } - break; - default: break; - } -} - -//_____________________________________________________________ -void AliSliderFrame::DoField(Long_t pos) -{ - TGNumberEntry *ne = (TGNumberEntry *) gTQSender; - int id = ne->WidgetId(); - char max[8],min[8]; - Int_t sign=0; - Float_t step=gAliDisplay2->GetSliderStep(); - if((pos/10000)==0){//Up button pressed - sign = 1; - } - else sign = -1; - - switch(id){ - case kIdsMomentumMIN:{ - fMomentumMinValue->SetNumber(fMomentumMinValue->GetNumber()+step*sign); - sprintf(min,"%.4f",fMomentumMinValue->GetNumber()); - fMomentumMinValue->SetText(min); - } - break; - case kIdsMomentumMAX:{ - fMomentumMaxValue->SetNumber(fMomentumMaxValue->GetNumber()+step*sign); - sprintf(max,"%.4f",fMomentumMaxValue->GetNumber()); - fMomentumMaxValue->SetText(max); - } - break; - case kIdsRapidityMIN:{ - fRapidityMinValue->SetNumber(fRapidityMinValue->GetNumber()+step*sign); - sprintf(min,"%.4f",fRapidityMinValue->GetNumber()); - fRapidityMinValue->SetText(min); - } - break; - case kIdsRapidityMAX:{ - fRapidityMaxValue->SetNumber(fRapidityMaxValue->GetNumber()+step*sign); - sprintf(max,"%.4f",fRapidityMaxValue->GetNumber()); - fRapidityMaxValue->SetText(max); - } - break; - default:break; - } - - fMomentumSlider->SetPosition(fMomentumMinValue->GetNumber(),fMomentumMaxValue->GetNumber()); - fRapiditySlider->SetPosition(fRapidityMinValue->GetNumber(),fRapidityMaxValue->GetNumber()); -// gAliDisplay2->Draw(); - gAliDisplay2->Update(kmCUTS); -} - -//_____________________________________________________________ -void AliSliderFrame::SaveToRC() -{ - TEnv *rc=new TEnv(".alidisplayrc"); - rc->SetValue("AliDisplay.MomentumMin",GetMomentumMin()); - rc->SetValue("AliDisplay.MomentumMax",GetMomentumMax()); - rc->SetValue("AliDisplay.RapidityMin",GetRapidityMin()); - rc->SetValue("AliDisplay.RapidityMax",GetRapidityMax()); - rc->SaveLevel(kEnvLocal); - rc->Save(); -} - -//_____________________________________________________________ -void AliSliderFrame::LoadFromRC() -{ - TEnv *rc=new TEnv(".alidisplayrc"); - Float_t a,b; - a=rc->GetValue("AliDisplay.MomentumMin",0); - b=rc->GetValue("AliDisplay.MomentumMax",2); - fMomentumSlider->SetPosition(a,b); - a=rc->GetValue("AliDisplay.RapidityMin",-1.5); - b=rc->GetValue("AliDisplay.RapidityMax",1.5); - fRapiditySlider->SetPosition(a,b); -} - - -ClassImp(AliDetectorFrame); - -int AliDetectorFrame::fgBaseId = 1000; - -//_____________________________________________________________ -AliDetectorFrame::AliDetectorFrame(const TGWindow *p, Int_t w, Int_t h,UInt_t bgc) -{ - fMainFrame = new TGCompositeFrame(p,w,h,kVerticalFrame,bgc); - TGLayoutHints *layout = new TGLayoutHints(kLHintsTop | kLHintsLeft,2,2,2,2); - TGLayoutHints *layout2 = new TGLayoutHints(kLHintsTop | kLHintsRight,2,2,2,2); - TGLayoutHints *layout3 = new TGLayoutHints(kLHintsTop | kLHintsExpandX,2,2,2,2); - fCheckButton = new TGCheckButton*[gAliDisplay2->GetNbModules()]; - fCheckedButton = new Bool_t[gAliDisplay2->GetNbModules()]; - fCheckButtonId = new Int_t[gAliDisplay2->GetNbModules()]; - TGCompositeFrame *dframe; - TGButton *button; - char text[32]; - AliModule *mod; - fCheckedMode = kFALSE; - for(Int_t i=0;iGetNbModules();i++){ - mod = dynamic_cast (gAliDisplay2->GetModules()->At(i)); - if(!mod) continue; - dframe = new TGCompositeFrame(fMainFrame,150,20,kHorizontalFrame); - fCheckButton[i] = new TGCheckButton(dframe,mod->GetName(),fgBaseId); - fCheckButtonId[i]=fgBaseId; - fCheckButton[i]->Connect("Clicked()","AliDetectorFrame",this,"DoCheckButton(Int_t)"); - fCheckedButton[i]=kTRUE; - dframe->AddFrame(fCheckButton[i],layout); - fCheckButton[i]->SetState(kButtonDown); - sprintf(text,"Specific %s view",mod->GetName()); - button = new TGTextButton(dframe,"Display",fgBaseId); - button->SetToolTipText(text); - button->Connect("Clicked()","AliDetectorFrame",this,"DoSpecific()"); - dframe->AddFrame(button,layout2); - fMainFrame->AddFrame(dframe,layout3); - gAliDisplay2->GetModuleInfo()->SetId((char*)mod->GetName(),fgBaseId); - fgBaseId++; - } - gAliDisplay2->GetModuleInfo()->Print(); - fButtonFrame = new TGCompositeFrame(fMainFrame,w,100,kHorizontalFrame,bgc); - fButtonAll = new TGTextButton(fButtonFrame,"All",kIdbSelectALL); - fButtonAll->Connect("Clicked()","AliDetectorFrame",this,"DoButton(Int_t)"); - fButtonFrame->AddFrame(fButtonAll,new TGLayoutHints(kLHintsBottom | kLHintsLeft,2,2,2,2)); - fButtonInvert = new TGTextButton(fButtonFrame,"Invert",kIdbSelectINVERT); - fButtonInvert->Connect("Clicked()","AliDetectorFrame",this,"DoButton(Int_t)"); - fButtonFrame->AddFrame(fButtonInvert,new TGLayoutHints(kLHintsBottom | kLHintsRight,2,2,2,2)); - fMainFrame->AddFrame(fButtonFrame,new TGLayoutHints(kLHintsBottom | kLHintsLeft|kLHintsExpandX,0,0,2,2)); - fCheckedMode = kTRUE; -} - -//_____________________________________________________________ -AliDetectorFrame::~AliDetectorFrame() -{ - for(Int_t i=0;iGetNbModules();i++){ - delete fCheckButton[i]; - } - delete fCheckButton; - delete fCheckedButton; - delete fCheckButtonId; - //delete [] fDetectorName; - delete fButtonFrame; - delete fMainFrame; - delete fButtonAll; - delete fButtonInvert; -} - -//_____________________________________________________________ -void AliDetectorFrame::DoButton(Int_t /*pos*/) -{ - TGFrame *frame = (TGFrame *) gTQSender; - TGButton *bu= (TGButton *) frame; - int id = bu->WidgetId(); - fCheckedMode = kFALSE; - AliModule *mo; - switch(id){ - case kIdbSelectALL:{ - for(Int_t i=0;iGetNbModules();i++){ - mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); - if(!mo) continue; - fCheckButton[i]->SetState(kButtonDown); - fCheckedButton[i]=kTRUE; - gAliDisplay2->EnableDetector(mo->GetName()); - } - } - break; - case kIdbSelectINVERT:{ - for(Int_t i=0;iGetNbModules();i++){ - mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); - if(!mo) continue; - if(fCheckedButton[i]==kTRUE) { - fCheckButton[i]->SetState(kButtonUp); - fCheckedButton[i]=kFALSE; - gAliDisplay2->DisableDetector(mo->GetName()); - } - else if(fCheckedButton[i]==kFALSE) { - fCheckButton[i]->SetState(kButtonDown); - fCheckedButton[i]=kTRUE; - gAliDisplay2->EnableDetector(mo->GetName()); - } - } - } - break; - default:break; - } - gAliDisplay2->Update(kmMODULES); - fCheckedMode = kTRUE; -} - -//_____________________________________________________________ -void AliDetectorFrame::DoCheckButton(Int_t /*pos*/) -{ - if(fCheckedMode == kFALSE) return; - TGFrame *frame = (TGFrame *) gTQSender; - TGCheckButton *bu= (TGCheckButton *) frame; - Int_t id = bu->WidgetId(); - AliModule *mo; - for(Int_t i=0;iGetNbModules();i++){ - mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); - if(!mo) continue; - if(id==fCheckButtonId[i]){ - if(fCheckedButton[i]==kTRUE) { - fCheckedButton[i]=kFALSE; - gAliDisplay2->DisableDetector(mo->GetName()); - } - else { - fCheckedButton[i]=kTRUE; - gAliDisplay2->EnableDetector(mo->GetName()); - } - } - } - gAliDisplay2->Update(kmMODULES); -} - -//_____________________________________________________________ -void AliDetectorFrame::DoSpecific() -{ - TGFrame *frame = (TGFrame *) gTQSender; - TGCheckButton *bu= (TGCheckButton *) frame; - Int_t id = bu->WidgetId(); - AliModule *mo; - for(Int_t i=0;iGetNbModules();i++){ - mo = dynamic_cast (gAliDisplay2->GetModules()->At(i)); - if(!mo) continue; - if(id==fCheckButtonId[i]){ - gAliDisplay2->DrawDetector(mo->GetName()); - } - } -} - - -ClassImp(AliShutterItem); - -//_____________________________________________________________ -AliShutterItem::AliShutterItem(TGShutter *s,char *text, UInt_t id) -{ - fShutterItem = new TGShutterItem(s, new TGHotString(text), id); - fMainFrame = (TGCompositeFrame *) fShutterItem->GetContainer(); - s->AddItem(fShutterItem); -} - -//_____________________________________________________________ -AliShutterItem::~AliShutterItem(void) -{ - delete fButton; - delete fShutterItem; - delete fMainFrame; -} - -//_____________________________________________________________ -void AliShutterItem::AddTextButton(char* text,char *tiptext, UInt_t idb) -{ - //Add a TGTextButton in the TGShutterItem. This button will execute the fonction - fButton = new TGTextButton(fMainFrame,new TGHotString(text),idb); - fButton->Resize(100,fButton->GetDefaultHeight()); - fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); - fButton->SetToolTipText(tiptext); - //fButton->Connect("Clicked()","AliDisplay2",gAliDisplay2,"DoViews(Int_t)"); - fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); -} - -//_____________________________________________________________ -void AliShutterItem::AddPictureButton(char* file, char *tiptext, UInt_t idb) -{ - //Add a TGPictureButton in the TGShutterItem. The icon file must be in DISPLAY/icons - TString filename=StrDup(gAliDisplay2->GetIconsPath()); - filename.Append(file); - TGPicture *picture = (TGPicture *) gClient->GetPicture(filename); - fButton = new TGPictureButton(fMainFrame,picture,idb); - fButton->SetToolTipText(tiptext); - fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); - fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); -} - -//_____________________________________________________________ -void AliShutterItem::AddCheckButton(char *text,Int_t idb) -{ - fButton = new TGCheckButton(fMainFrame,new TGHotString(text),idb); - fButton->Resize(100,fButton->GetDefaultHeight()); - fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); - fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsLeft ,5,5,10,10)); -} - -//_____________________________________________________________ -void AliShutterItem::DoButton(Int_t /*pos*/){ - TGFrame *frame = (TGFrame *) gTQSender; - TGButton *bu= (TGButton *) frame; - int id = bu->WidgetId(); - switch(id){ - case kIdbNextEVENT:{ - gAliDisplay2->ShowNextEvent(1); - } - break; - case kIdbPrevEVENT:{ - gAliDisplay2->ShowNextEvent(-1); - } - break; - case kIdbCheckHITS:{ - if(gAliDisplay2->IsEnabled(kHits)) gAliDisplay2->Disable(kHits); - else gAliDisplay2->Enable(kHits); - } - break; - case kIdbCheckCLUSTERS:{ - if(gAliDisplay2->IsEnabled(kClusters)) gAliDisplay2->Disable(kClusters); - else gAliDisplay2->Enable(kClusters); - } - break; - case kIdbCheckHLT:{ - if(gAliDisplay2->IsEnabled(kHLT)) gAliDisplay2->Disable(kHLT); - else gAliDisplay2->Enable(kHLT); - } - break; - case kIdbCheckTRACKS:{ - if(gAliDisplay2->IsEnabled(kTracks)) gAliDisplay2->Disable(kTracks); - else gAliDisplay2->Enable(kTracks); - } - break; - case kIdbSIDEVIEW:{ - gAliDisplay2->DoView(kIdbSIDEVIEW); - } - break; - case kIdbFRONTVIEW:{ - gAliDisplay2->DoView(kIdbFRONTVIEW); - } - break; - case kIdbTOPVIEW:{ - gAliDisplay2->DoView(kIdbTOPVIEW); - } - break; - case kIdbALLVIEW:{ - gAliDisplay2->DoView(kIdbALLVIEW); - } - break; - default:break; - } -} - -ClassImp(AliShutterFrame); - -//_____________________________________________________________ -AliShutterFrame::AliShutterFrame(TGCompositeFrame *p, UInt_t /*w*/, UInt_t h){ - fShutter = new TGShutter(p,kSunkenFrame); - fLayout = new TGLayoutHints(kLHintsExpandY | kLHintsTop | kLHintsLeft); - fMainFrame = (TGCompositeFrame *) fShutter; - - //Event Shutter - AliShutterItem *item = new AliShutterItem(fShutter,"Event",kIdsEVENT); - - item->AddPictureButton("next.xpm","Show next event",kIdbNextEVENT); - item->AddPictureButton("prev.xpm","Show previous event",kIdbPrevEVENT); - - //View Shutter - item = new AliShutterItem(fShutter,"View",kIdsVIEW); - item->AddPictureButton("top.xpm","Top view",kIdbTOPVIEW); - item->AddPictureButton("side.xpm","Side view",kIdbSIDEVIEW); - item->AddPictureButton("front.xpm","Front view",kIdbFRONTVIEW); - item->AddPictureButton("four.xpm","Four views",kIdbALLVIEW); - - //Detector Shutter - item = new AliShutterItem(fShutter,"Detectors",kIdsDETECTORS); - TGCompositeFrame *frame = item->GetShutterItemFrame(); - fDetectorFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft| kLHintsExpandX | kLHintsCenterX,5,5,5,5); - fDetectorFrame = new AliDetectorFrame(frame,200,200,item->GetShutterItem()->GetDefaultFrameBackground()); - frame->AddFrame(fDetectorFrame->GetDetectorFrame(),fDetectorFrameLayout); - - //Options Shutter - item = new AliShutterItem(fShutter,"Options",kIdsOPTIONS); - item->AddCheckButton("Display Hits",kIdbCheckHITS); - item->AddCheckButton("Display Clusters",kIdbCheckCLUSTERS); - item->AddCheckButton("Display HLT Clusters",kIdbCheckHLT); - // item->AddCheckButton("Display Tracks",kIdbCheckTRACKS); - - fMainFrame->Resize(150,h); -} - -//_____________________________________________________________ -AliShutterFrame::~AliShutterFrame(void) -{ - delete fLayout; - delete fShutter; - delete fMainFrame; - delete fDetectorFrame; - delete fDetectorFrameLayout; -} - - -ClassImp(AliDisplayFrame); - -//_____________________________________________________________ -AliDisplayFrame::AliDisplayFrame(const TGWindow *p, UInt_t w, UInt_t h) -{ - fClipMin=-20; - fClipMax=20; - fPreviousW=0; - fPreviousH=0; - fRange = 500; - fPolyMarkers = new TObjArray(1000); - - fMainFrame = new TGCompositeFrame(p,w,h); - fMainTab = new TGTab(fMainFrame, w, h); - TGCompositeFrame *fFrame1 = fMainTab->AddTab("Main View"); - fMainEmbeddedCanvas = new TRootEmbeddedCanvas("Main12",fFrame1,w,h,kFixedWidth); - fFrame1->AddFrame(fMainEmbeddedCanvas,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX| kLHintsExpandY, 0, 0, 0, 0)); - fMainCanvas = fMainEmbeddedCanvas->GetCanvas(); - fMainCanvas->SetFillColor(1); - fMainCanvas->SetBorderMode(0); - fMainCanvas->cd(); - fMainCanvas->SetFixedAspectRatio(); - fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliDisplayFrame",this,"ExecuteEvent(Int_t,Int_t,Int_t,TObject*)"); - //fView = new TView(1); - //DoView(kIdbFRONTVIEW); - - gAliDisplay2->SetCurrentView(kIdbFRONTVIEW); - - TGCompositeFrame *fFrame2 = fMainTab->AddTab("No detector"); - fSelectionEmbeddedCanvas = new TRootEmbeddedCanvas("Selection",fFrame2,w,h); - fSelectionCanvas = fSelectionEmbeddedCanvas->GetCanvas(); - fSelectionCanvas->SetFillColor(1); - fSelectionCanvas->SetBorderMode(0); - fSelectionCanvas->cd(); - fFrame2->AddFrame(fSelectionEmbeddedCanvas,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX| kLHintsExpandY, 0, 0, 0, 0)); - fMainFrame->AddFrame(fMainTab,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); - fAllViews = kFALSE; - fMainFrame->MapSubwindows(); - fMainFrame->MapWindow(); -} - -//_____________________________________________________________ -AliDisplayFrame::~AliDisplayFrame(void) -{ - delete fMainTab; - delete fSelectionEmbeddedCanvas; - delete fMainEmbeddedCanvas; - delete fFrame1; - delete fFrame2; - delete fMainCanvas; - delete fSelectionCanvas; - delete fPoints2; - delete fPoints; - delete fModules; - delete fMainFrame; - delete [] fActivePoints; - delete [] fClustersPos; -} - -//_____________________________________________________________ -void AliDisplayFrame::DoView(Int_t view) -{ - Int_t x,y; - char vname[16]; - y=fMainFrame->GetDefaultHeight(); - x=fMainFrame->GetDefaultWidth(); - gAliDisplay2->SetCurrentView(view); - switch(view){ - case kIdbALLVIEW:{ - fAllViews=kTRUE; - strcpy(vname,"All views"); - fMainCanvas->cd(); - gPad->Clear(); - fMainCanvas->SetFillColor(15); - fMainCanvas->Divide(2,2,0.005,0.005,1); - - fMainCanvas->cd(1); - Draw(30,30,0); - - gAliDisplay2->SetCurrentView(kIdbTOPVIEW); - fMainCanvas->cd(2); - Draw(90,-90,90); - - gAliDisplay2->SetCurrentView(kIdbSIDEVIEW); - fMainCanvas->cd(3); - Draw(90,0,-90); - - gAliDisplay2->SetCurrentView(kIdbFRONTVIEW); - fMainCanvas->cd(4); - Draw(0,-90,0); - - //fMainCanvas->cd(); - - } - break; - case kIdbTOPVIEW:{ - strcpy(vname,"Top view "); - fAllViews=kFALSE; - fMainCanvas->cd(); - gPad->SetFillColor(1); - gPad->Clear(); - gPad->Draw(); - Draw(90,-90,90); - } - break; - case kIdbSIDEVIEW:{ - strcpy(vname,"Side view"); - fAllViews=kFALSE; - fMainCanvas->cd(); - gPad->SetFillColor(1); - gPad->Clear(); - gPad->Draw(); - Draw(90,0,-90); - } - break; - case kIdbFRONTVIEW:{ - strcpy(vname,"Front view"); - fAllViews=kFALSE; - fMainCanvas->cd(); - gPad->SetFillColor(1); - gPad->Clear(); - gPad->Draw(); - - Draw(0,-90,0); - } - break; - default: break; - } - (fMainTab->GetTabTab(0))->SetText(new TGString(vname)); -} - -//_____________________________________________________________ -void AliDisplayFrame::DrawDetector(const char *name) -{ - (fMainTab->GetTabTab(1))->SetText(new TGString(name)); -} - -//_____________________________________________________________ -void AliDisplayFrame::EnableDetector(const char *name) -{ - AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); - if(!module) return; - gAliDisplay2->GetModuleInfo()->Enable((char*)name); - module->Enable(); -} - -//_____________________________________________________________ -void AliDisplayFrame::DisableDetector(const char *name) -{ - AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); - if(!module) return; - gAliDisplay2->GetModuleInfo()->Disable((char*)name); - module->Disable(); -} - -//_____________________________________________________________ -void AliDisplayFrame::Draw(Float_t theta, Float_t phi, Float_t psi) -{ - //clock_t t1,t2; - time_t t1,t2; - //t1 = clock(); - TStopwatch timer; - timer.Start(); - time(&t1); - gPad->SetCursor(kWatch); - gPad->SetEditable(kTRUE); - gPad->SetFillColor(1); - gPad->Clear(); - - Int_t iret; - - TView *view = new TView(1); - TGDimension dim=((TGCanvas*)fMainEmbeddedCanvas)->GetViewPort()->GetDefaultSize(); - Float_t aspectRatio = dim.fWidth/(Float_t) dim.fHeight; - //printf("Dimension %d %d",dim.fWidth,dim.fHeight); - if(gAliDisplay2->GetCurrentView()==kIdbFRONTVIEW){ - view->SetRange(-fRange*aspectRatio,-fRange,-fRange,fRange*aspectRatio,fRange,fRange); - } - if(gAliDisplay2->GetCurrentView()==kIdbTOPVIEW){ - view->SetRange(-fRange,-fRange,-fRange*aspectRatio,fRange,fRange,fRange*aspectRatio); - } - if(gAliDisplay2->GetCurrentView()==kIdbSIDEVIEW){ - view->SetRange(-fRange,-fRange,-fRange*aspectRatio,fRange,fRange,fRange*aspectRatio); - } - - gAlice->GetGeometry()->Draw("same"); - if(gAliDisplay2->IsEnabled(kHits)) DrawHits(); - if(gAliDisplay2->IsEnabled(kClusters)) fClusters->Draw(); - if(gAliDisplay2->IsEnabled(kHLT)) fHLT->Draw(); - - gAliDisplay2->AppendPad(); - view->SetView(phi,theta,psi,iret); - - view->ZoomView(gPad,gAliDisplay2->GetZoomFactor()); - //t2 = clock(); - time(&t2); - // printf("\nDrawn in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); - printf("\nDrawn in....%2lf sec", difftime(t2,t1)); - timer.Stop(); - timer.Print("m"); -} - -//_____________________________________________________________ -void AliDisplayFrame::DrawHits() -{ - AliPoints *p; - if(!fPoints2) return; - for(Int_t i=0;iGetEntries();i++){ - if(fActivePoints[i]){ - p=dynamic_cast(fPoints2->UncheckedAt(i)); - if(!p) continue; - p->Draw(); - } - } -} - -//_____________________________________________________________ -void AliDisplayFrame::LoadEnabledModules() -{ - clock_t t1,t2; - t1=clock(); - TIter next(gAlice->Modules()); - AliModule *module; - fModules = new TObjArray(0,32); - while((module = dynamic_cast (next()))){ - if(!module) continue; - if(!module->IsActive()) continue; - fModules->AddLast(module); - } - t2=clock(); - fNbModules = fModules->GetEntriesFast(); - // printf("\nModules loaded in.....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); -} - -//_____________________________________________________________ -void AliDisplayFrame::LoadClusters(Int_t nevent) -{ - fClusters = new AliDisplayClusters(); - fClusters->LoadClusters("ITS TPC",nevent); -} - -//_____________________________________________________________ -void AliDisplayFrame::LoadHLTClusters(Int_t nevent) -{ - fHLT = new AliDisplayHLT(); - fHLT->LoadHLT("TPC",nevent); -} - -//_____________________________________________________________ -void AliDisplayFrame::LoadHits() -{ - clock_t t1,t2; - - t1=clock(); - fPoints2 = new TObjArray(0,1000); - AliModule *module; - TObjArray *points; - for(Int_t i=0;i(fModules->UncheckedAt(i)); - if(!module) continue; - points = module->Points(); - if(!points) { - continue; - } - for(Int_t j=0;jGetEntriesFast();j++){ - if(!points->UncheckedAt(j)) continue; - fPoints2->AddLast((points->UncheckedAt(j))); - } - } - fActivePoints = new Bool_t[fPoints2->GetEntries()]; - for(Int_t k=0;kGetEntriesFast();k++){ - fActivePoints[k]=kTRUE; - } - printf("\n nb hits %d",fPoints2->GetEntries()); - t2=clock(); - // printf("\nPoints loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); -} - -//_____________________________________________________________ -void AliDisplayFrame::ApplyCuts() -{ - clock_t t1,t2; - t1=clock(); - - Float_t *pxyz; - Float_t r,theta,eta,cutmin,cutmax,etamin,etamax,pmom,smin,smax; - Int_t nbhits=0; - AliPoints *pm; - TParticle *particle; - - //Get momentum cut - smin = gAliDisplay2->GetMomentumMin(); - smax = gAliDisplay2->GetMomentumMax(); - cutmin = 2.0*smin; - if(smax<0.98) cutmax = 2.0*smax; - else cutmax = 100000; - - //Get rapidity cut - smax = gAliDisplay2->GetRapidityMax(); - smin = gAliDisplay2->GetRapidityMin(); - //etamin = 1.5*(2*smin-1); - //etamax = 1.5*(2*smax-1); - etamin = smin; - etamax = smax; - if(smin<-1.46) etamin = -1000; - if(smax>1.46) etamax = 1000; - - - if(!fPoints2) return; - for(Int_t i=0;iGetEntries();i++){ - pm = dynamic_cast(fPoints2->UncheckedAt(i)); - if(!pm) { - fActivePoints[i]=kFALSE; - continue; - } - particle = pm->GetParticle(); - if(!particle) { - fActivePoints[i]=kFALSE; - continue; - } - pmom = particle->P(); - if(pmom < cutmin) { - fActivePoints[i]=kFALSE; - continue; - } - if(pmom > cutmax) { - fActivePoints[i]=kFALSE; - continue; - } - pxyz = pm->GetP(); - r = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]); - theta = TMath::ATan2(r,TMath::Abs(pxyz[2])); - if(theta) eta = -TMath::Log(TMath::Abs(TMath::Tan(0.5*theta))); - else eta = 1e10; - if(pxyz[2] < 0) eta = -eta; - if((eta < etamin) || (eta > etamax)) { - fActivePoints[i]=kFALSE; - continue; - } - fActivePoints[i]=kTRUE; - //pm->Draw(); - nbhits += pm->GetN(); - } - gAliDisplay2->SetNbHits(nbhits); - t2=clock(); - // printf("\nCuts applied in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); - gAliDisplay2->SetNbParticles(GetNbActivePoints()); -} - -//_____________________________________________________________ -Int_t AliDisplayFrame::GetNbActivePoints() -{ - Int_t ans=0; - for(Int_t i=0;iGetEntries();i++){ - if(fActivePoints[i]) ans++; - } - return ans; -} -//_____________________________________________________________ -void AliDisplayFrame::DrawX3d() -{ - TPad *pad = dynamic_cast(gPad); - pad->cd(); - TView *view = pad->GetView(); - if(!view) return; - pad->x3d(); -} - -//_____________________________________________________________ -void AliDisplayFrame::SavePadGIF(const char *file) -{ - if(!gPad){ - printf("\nThere is no active pad"); - return; - } - gPad->SaveAs(file); -} - -//_____________________________________________________________ -void AliDisplayFrame::DrawGL() -{ - TPad *pad = dynamic_cast(gPad); - pad->cd(); - TView *view = pad->GetView(); - if(!view) return; - pad->x3d("OPENGL"); -} - -//_____________________________________________________________ -void AliDisplayFrame::ExecuteEvent(Int_t event, Int_t px,Int_t py,TObject *) -{ - static Float_t x0,y0,x1,y1; - static Int_t pxold,pyold; - static Int_t px0,py0; - static Int_t linedrawn; - Float_t temp; - - - switch(event){ - case kMouseMotion:{ - - AliPoints *p=dynamic_cast (gPad->GetSelected()); - if(p){ - gAliDisplay2->SetStatusBar(p->GetName(),1); - gAliDisplay2->SetStatusBar(p->GetDetector()->GetName(),2); - } - } - break; - default:break; - } - - if((!gAliDisplay2->GetZoomMode())&&(gPad->GetView())){ - gPad->GetView()->ExecuteRotateView(event,px,py); - return; - } - - - - if(gAliDisplay2->GetZoomMode()==kTRUE){ - switch(event){ - - case kButton1Down:{ - gVirtualX->SetLineColor(-1); - gPad->TAttLine::Modify(); - x0 = gPad->AbsPixeltoX(px); - y0 = gPad->AbsPixeltoY(py); - px0 = px; - py0 = py; - pxold = px; - pyold = py; - linedrawn = 0; - } - break; - case kButton1Motion:{ - if(linedrawn) gVirtualX->DrawBox(px0,py0,pxold,pyold,TVirtualX::kHollow); - pxold = px; - pyold = py; - linedrawn = 1; - gVirtualX->DrawBox(px0,py0,pxold,pyold,TVirtualX::kHollow); - } - break; - - case kButton1Up:{ - gPad->GetCanvas()->FeedbackMode(kFALSE); - if(px == px0) break; - if(py == py0) break; - x1 = gPad->AbsPixeltoX(px); - y1 = gPad->AbsPixeltoY(py); - if(x1SetEditable(kTRUE); - //gPad->Range(x0,y0,x1,y1); - gPad->SetEditable(kFALSE); - //gPad->Range(0.5,0.5,1,1); - //gAliDisplay2->SetZoomFactor(1); - gPad->Modified(kTRUE); - gAliDisplay2->Draw(); - gAliDisplay2->SetZoomMode(kFALSE); - gPad->SetEditable(kTRUE); - } - break; - default: break; - } - } -} - -ClassImp(AliInfoFrame); - -//_____________________________________________________________ -AliInfoFrame::AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h) -{ - fMainFrame = new TGCompositeFrame(p, w, h, kVerticalFrame); - - fTitleFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); - AddLabel("ALICE",kLHintsTop | kLHintsCenterX); - AddLabel("Event Display",kLHintsTop | kLHintsCenterX); - - TString filename=StrDup(gAliDisplay2->GetIconsPath()); - filename.Append("Alice.xpm"); - TGPicture *alicelogo = (TGPicture *) gClient->GetPicture(filename); - TGIcon *alice = new TGIcon(fTitleFrame,alicelogo,50,50); - fTitleFrame->AddFrame(alice,new TGLayoutHints(kLHintsTop | kLHintsCenterX,0,0,0,0)); - - AddLabel("Powered by",kLHintsTop | kLHintsCenterX); - AddLabel("AliRoot",kLHintsTop | kLHintsCenterX); - fMainFrame->AddFrame(fTitleFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,3)); - - //Feedback - fFiguresFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); - TGCompositeFrame *frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); - fNbEventLabel = new TGLabel(frame,""); - TGLabel * label = new TGLabel(frame,"Event number"); - fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); - frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft ,10,0,0,0)); - frame->AddFrame(fNbEventLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); - - fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); - - frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); - label = new TGLabel(frame,"Nb Particles"); - fNbParticuleLabel = new TGLabel(frame,""); - fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); - frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); - frame->AddFrame(fNbParticuleLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); - - fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); - - frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); - label = new TGLabel(frame,"Nb Hits"); - fNbHitsLabel = new TGLabel(frame,""); - fNbHitsLabel->SetText("--"); - frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); - frame->AddFrame(fNbHitsLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); - frame->Layout(); - fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); - - frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); - label = new TGLabel(frame,"Nb Clusters"); - fNbClustersLabel = new TGLabel(frame,""); - fNbClustersLabel->SetText("--"); - frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); - frame->AddFrame(fNbClustersLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); - frame->Layout(); - fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); - fMainFrame->AddFrame(fFiguresFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,2,0)); - - fMainFrame->Layout(); - fMainFrame->MapSubwindows(); - fMainFrame->MapWindow(); -}; - -//_____________________________________________________________ -AliInfoFrame::~AliInfoFrame(void){ - - delete fMainFrame; - delete fTitleFrame; - delete fFiguresFrame; - delete fNbParticuleLabel; - delete fNbEventLabel; - delete fNbHitsLabel; -} - -//_____________________________________________________________ -void AliInfoFrame::AddLabel(char *text, UInt_t options){ - TGLabel * label = new TGLabel(fTitleFrame,text); - fTitleFrame->AddFrame(label,new TGLayoutHints(options,0,0,0,0)); -} - -//_____________________________________________________________ -void AliInfoFrame::Update() -{ - fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); - fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); - if(gAliDisplay2->IsEnabled(kHits))fNbHitsLabel->SetText(gAliDisplay2->GetNbHits()); - else fNbHitsLabel->SetText("--"); - if(gAliDisplay2->IsEnabled(kClusters))fNbClustersLabel->SetText(gAliDisplay2->GetNbClusters()); - else fNbClustersLabel->SetText("--"); - fMainFrame->Layout(); -} - - -ClassImp(AliSettingFrame); - -//_____________________________________________________________ -AliSettingFrame::AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) - :TGTransientFrame(p,main,w,h) -{ - fMainFrame = new TGCompositeFrame((TGWindow *)((TGTransientFrame *)this),w,h,kVerticalFrame); - - fZoomStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); - fZoomStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); - fZoomStepEntry = new TGNumberEntryField(fZoomStepFrame,kIdtZoomSTEP,gAliDisplay2->GetZoomStep()); - fZoomStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)"); - fZoomStepLabel = new TGLabel(fZoomStepFrame,"Zoom step"); - fZoomStepFrame->AddFrame(fZoomStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); - fZoomStepFrame->AddFrame(fZoomStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0)); - fMainFrame->AddFrame(fZoomStepFrame,fZoomStepLayout); - - fSliderStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); - fSliderStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); - fSliderStepEntry = new TGNumberEntryField(fSliderStepFrame,kIdtSliderSTEP,gAliDisplay2->GetSliderStep()); - fSliderStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)"); - fSliderStepLabel = new TGLabel(fSliderStepFrame,"Slider step"); - fSliderStepFrame->AddFrame(fSliderStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); - fSliderStepFrame->AddFrame(fSliderStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0)); - fMainFrame->AddFrame(fSliderStepFrame,fSliderStepLayout); - - fSliderUpdateFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); - fSliderUpdateLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); - fSliderUpdateButton = new TGCheckButton(fSliderUpdateFrame,"Update display on slider move",kIdtSliderUPDATE); - fSliderUpdateButton->Connect("Clicked()","AliSettingFrame",this,"DoSettings(Int_t)"); - fIsLoading = kTRUE; - if(gAliDisplay2->GetSliderUpdate()) fSliderUpdateButton->SetState(kButtonDown); - else fSliderUpdateButton->SetState(kButtonUp); - fIsLoading = kFALSE; - - fSliderUpdateFrame->AddFrame(fSliderUpdateButton,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); - fMainFrame->AddFrame(fSliderUpdateFrame,fSliderUpdateLayout); - - AddFrame(fMainFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,0,0,0,0)); - fMainFrame->Layout(); - // position relative to the parent's window - Window_t wdum; - int ax, ay; - gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), - (Int_t)(((TGFrame *) main)->GetWidth() - GetWidth()) >> 1, - (Int_t)(((TGFrame *) main)->GetHeight() - GetHeight()) >> 1, - ax, ay, wdum); - Move(ax, ay); - - SetWindowName("Setting frame"); - MapSubwindows(); - MapWindow(); - Layout(); -} - -//_____________________________________________________________ -AliSettingFrame::~AliSettingFrame() -{ - delete fZoomStepLayout; - delete fZoomStepEntry; - delete fZoomStepLabel; - delete fSliderStepLayout; - delete fSliderStepEntry; - delete fSliderStepLabel; - - delete fSliderUpdateLayout; - delete fSliderUpdateButton; - - delete fMainFrame; - delete fZoomStepFrame; - delete fSliderUpdateFrame; - delete fSliderStepLayout; -} - -//_____________________________________________________________ -void AliSettingFrame::DoSettings(Int_t /*pos*/) -{ - TGNumberEntryField *ne = (TGNumberEntryField *) gTQSender; - int id = ne->WidgetId(); - switch(id){ - case kIdtZoomSTEP:{ - gAliDisplay2->SetZoomStep(ne->GetNumber()); - } - break; - case kIdtSliderSTEP:{ - gAliDisplay2->SetSliderStep(ne->GetNumber()); - } - break; - case kIdtSliderUPDATE:{ - if(fIsLoading) return ; - if(gAliDisplay2->GetSliderUpdate()) gAliDisplay2->SetSliderUpdate(kFALSE); - else gAliDisplay2->SetSliderUpdate(kTRUE); - } - break; - default: break; - } -} - - -ClassImp(AliMenu); - -//_____________________________________________________________ -AliMenu::AliMenu(TGCompositeFrame *p, UInt_t w, UInt_t h, UInt_t options) -{ - fMenuBar = new TGMenuBar(p,w,h,options); - fToolBar = new TGToolBar(p,60,20,options); - - fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsLeft ,0,0,0,0); - fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0); - - fMenuFile = new TGPopupMenu(gClient->GetRoot()); - fMenuFile->AddEntry("Open",kIdmOPEN); - fMenuFile->AddEntry("Save as",kIdmSAVEAS); - fMenuFile->AddEntry("Close",kIdmCLOSE); - fMenuFile->AddSeparator(); - fMenuFile->AddEntry("Print",kIdmPRINT); - fMenuFile->AddEntry("Print setup",kIdmPRINTSETUP); - fMenuFile->AddSeparator(); - fMenuFile->AddEntry("Exit",kIdmEXIT); - fMenuFile->DisableEntry(kIdmSAVEAS); - fMenuFile->Associate(p); - fMenuBar->AddPopup("File",fMenuFile,fMenuBarItemLayout); - fMenuFile->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); - - fMenuOptions = new TGPopupMenu(gClient->GetRoot()); - fMenuOptions->AddEntry("Settings",kIdmSETTINGS); - fMenuOptions->AddEntry("Save settings",kIdmSAVESETTINGS); - fMenuOptions->Associate(p); - fMenuBar->AddPopup("Options",fMenuOptions,fMenuBarItemLayout); - fMenuOptions->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); - - fMenuView = new TGPopupMenu(gClient->GetRoot()); - fMenuView->AddEntry("X3d ",kIdmVIEWX3D); - fMenuView->AddEntry("OpenGL",kIdmVIEWGL); - fMenuView->Associate(p); - fMenuBar->AddPopup("View",fMenuView,fMenuBarItemLayout); - fMenuView->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); - - fMenuHelp = new TGPopupMenu(gClient->GetRoot()); - fMenuHelp->AddEntry("Help",kIdmHELP); - fMenuHelp->AddSeparator(); - fMenuHelp->AddEntry("About",kIdmABOUT); - fMenuHelp->Associate(p); - fMenuBar->AddPopup("Help",fMenuHelp,fMenuBarItemLayout); - fMenuHelp->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); - - p->AddFrame(fMenuBar,fMenuBarLayout); - fTBD = new ToolBarData_t; - - fToolBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX,0,0,0,0); - AddPictureButton("open.xpm","Open file",kIdmOPEN,5); - AddPictureButton("save.xpm","Save current pad as gif file",kIdmSAVEAS,0); - AddPictureButton("settings.xpm","Settings",kIdmSETTINGS,5); - AddPictureButton("help.xpm","Help",kIdmHELP,5); - AddPictureButton("quit.xpm","Exit AliDisplay",kIdmEXIT,5); - AddPictureButton("opengl.xpm","Open GL view",kIdmVIEWGL,5); - AddPictureButton("x3d.xpm","x3d view",kIdmVIEWX3D,0); - AddPictureButton("zoomplus16.xpm","Zoom in",kIdbZoomIN,5); - AddPictureButton("zoommoins16.xpm","Zoom out",kIdbZoomOUT,0); - AddPictureButton("zoomzone.xpm","Zoom on zone",kIdbZoomZONE,0); - p->AddFrame(fToolBar,fToolBarLayout); -} - -//_____________________________________________________________ -AliMenu::~AliMenu() -{ - delete fMenuBarLayout; - delete fMenuBarItemLayout; - delete fMenuFile; - delete fMenuOptions; - delete fMenuView; - delete fMenuHelp; - delete fToolBarLayout; - delete fToolBar; - delete fMenuBar; - delete fTBD; -} - -//_____________________________________________________________ -void AliMenu::DoMenu(Int_t id) -{ - switch(id){ - case kIdmOPEN:{ - TGFileInfo fi; - static TString dir("."); - fi.fFileTypes = filetypes; - fi.fIniDir = StrDup(dir.Data()); - new TGFileDialog(gClient->GetRoot(),gAliDisplay2->GetMainFrame(),kFDOpen,&fi); - if(!fi.fFilename) return; - } - break; - case kIdmEXIT:{ - gApplication->Terminate(0); - } - break; - case kIdmSAVEAS:{ - TGFileInfo fi; - static TString dir("."); - fi.fFileTypes = imgtypes; - fi.fIniDir = StrDup(dir.Data()); - new TGFileDialog(gClient->GetRoot(),gAliDisplay2->GetMainFrame(),kFDSave,&fi); - if(!fi.fFilename) return; - gAliDisplay2->SavePadGIF(fi.fFilename); - } - break; - case kIdmSETTINGS:{ - new AliSettingFrame((TGWindow *)gClient->GetRoot(),(TGWindow *)gAliDisplay2->GetMainFrame(),200,150); - } - break; - case kIdmHELP:{ - TRootHelpDialog *hd=new TRootHelpDialog((TGWindow *)gClient->GetRoot(),"Help",300,300); - hd->SetText(helpTxt); - hd->Popup(); - } - break; - - case kIdmSAVESETTINGS:{ - gAliDisplay2->DoSaveSettings(); - } - break; - case kIdmVIEWX3D:{ - gAliDisplay2->DrawX3d(); - } - break; - case kIdmVIEWGL:{ - gAliDisplay2->DrawGL(); - } - break; - case kIdbZoomIN:{ - gAliDisplay2->SetZoomFactor(gAliDisplay2->GetZoomFactor()*gAliDisplay2->GetZoomStep()); - gAliDisplay2->Draw(); - } - break; - case kIdbZoomZONE:{ - gAliDisplay2->SetZoomMode(kTRUE); - gAliDisplay2->SetEditable(kFALSE); - } - break; - case kIdbZoomOUT:{ - gAliDisplay2->SetZoomFactor(gAliDisplay2->GetZoomFactor()/gAliDisplay2->GetZoomStep()); - gAliDisplay2->Draw(); - } - break; - default:break; - } -} - -//_____________________________________________________________ -void AliMenu::DoToolBar(Int_t /*id*/) -{ - TGFrame *frame = (TGFrame *) gTQSender; - TGButton *bu = (TGButton *) frame; - DoMenu(bu->WidgetId()); -} - -//_____________________________________________________________ -void AliMenu::AddPictureButton(char *fname,char *tiptext,UInt_t id, UInt_t spacing) -{ - TString filename = StrDup(gAliDisplay2->GetIconsPath()); - filename.Append(fname); - - fTBD->fPixmap=filename.Data(); - fTBD->fTipText = tiptext; - fTBD->fId = id; - fTBD->fStayDown = kFALSE; - - fToolBar->AddButton(fToolBar,fTBD,spacing); - if(fTBD->fButton) - fTBD->fButton->Connect("Clicked()","AliMenu",this,"DoToolBar(Int_t)"); -} - -ClassImp(AliDisplay2); -//_____________________________________________________________ -AliDisplay2::AliDisplay2(const TGWindow *p, UInt_t w, UInt_t h) - :TObject() -{ - //gAlice->SetDisplay(this); - gAliDisplay2=this; - fSliderUpdate = kFALSE; - fZoomMode = kFALSE; - fZoomStep = 1.2; - fZoomFactor = 1.5; - fNbParticles = 0; - fEventNumber = 0; - fNbHits = 0; - fSliderStep = 0.01; - fClustersLoaded = kFALSE; - fHitsLoaded = kFALSE; - fHLTLoaded = kFALSE; - fTracksLoaded = kFALSE; - fMode =0; - FindModules(); - - fIconsPath = new char[32]; - strcpy(fIconsPath,gSystem->Getenv("ALICE_ROOT")); - strcat(fIconsPath,"/DISPLAY/icons/"); - LoadFromRC(); - fMainFrame = new TGMainFrame(p,w,h,kVerticalFrame); - fSubFrame = new TGCompositeFrame(fMainFrame,w,h,kHorizontalFrame); - fLeftFrame = new TGCompositeFrame(fSubFrame,150,h,kVerticalFrame|kFixedWidth); - fRightFrame = new TGCompositeFrame(fSubFrame,600,h,kVerticalFrame); - //fMainFrame->Connect("ProcessedEvent(Event_t*)", "AliDisplay2", this,"HandleMouseWheel(Event_t*)"); - fMainFrame->Connect("ProcessedEvent(Event_t*)", "AliDisplay2",this,"HandleResize(Event_t*)"); - //MenuBar - fMenu = new AliMenu(fMainFrame,1,1,kRaisedFrame|kHorizontalFrame); - - //Slider Frame - fSliderFrameLayout = new TGLayoutHints( kLHintsBottom| kLHintsRight| kLHintsExpandX | kLHintsCenterX, 2, 2, 2, 2); - fSliderFrame = new AliSliderFrame(fRightFrame,600,150); - fRightFrame->AddFrame(fSliderFrame->GetSliderFrame(),fSliderFrameLayout); - - //Info Frame - fInfoFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX ,0,0,0,0); - fInfoFrame = new AliInfoFrame(fLeftFrame,150,200); - fLeftFrame->AddFrame(fInfoFrame->GetInfoFrame(),fInfoFrameLayout); - - - //Shutter Frame - fShutterFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandY |kLHintsExpandX, 0, 0, 5, 0); - fShutterFrame = new AliShutterFrame(fLeftFrame,150,300); - fLeftFrame->AddFrame(fShutterFrame->GetShutterFrame(),fShutterFrameLayout); - - //Display Frame - fDisplayFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsRight | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2); - fDisplayFrame = new AliDisplayFrame(fRightFrame, w-150,w-110); - fRightFrame->AddFrame(fDisplayFrame->GetDisplayFrame(),fDisplayFrameLayout); - fDisplayFrame->GetDisplayFrame()->Connect("ProcessedEvent(Event_t*)", "AliDisplay2", this,"HandleMouseWheel(Event_t*)"); - - - fLeftFrame->Layout(); - - fSubFrame->AddFrame(fLeftFrame, new TGLayoutHints( kLHintsBottom | kLHintsLeft | kLHintsExpandY, 5, 5, 2, 2)); - fSubFrame->AddFrame(fRightFrame, new TGLayoutHints( kLHintsBottom | kLHintsRight | kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 2)); - - Int_t parts[] = {45,45,10}; - fStatusBar = new TGStatusBar(fMainFrame,50,10,kHorizontalFrame); - fStatusBar->SetParts(parts,3); - fStatusBar->SetText("AliDisplay v2.0",0); - fMainFrame->AddFrame(fStatusBar,new TGLayoutHints(kLHintsBottom | kLHintsExpandX,0,0,0,0)); - - fMainFrame->AddFrame(fSubFrame,new TGLayoutHints( kLHintsBottom | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 2)); - fMainFrame->SetWindowName("Ali Display"); - - fMainFrame->MapSubwindows(); - fMainFrame->MapWindow(); - LoadSettings(); + //Shutter Frame + fShutterFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandY |kLHintsExpandX, 0, 0, 5, 0); + fShutterFrame = new AliShutterFrame(fLeftFrame,150,300); + fLeftFrame->AddFrame(fShutterFrame->GetShutterFrame(),fShutterFrameLayout); + + //Display Frame + fDisplayFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsRight | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2); + fDisplayFrame = new AliDisplayFrame(fRightFrame, w-150,w-110); + fRightFrame->AddFrame(fDisplayFrame->GetDisplayFrame(),fDisplayFrameLayout); + fDisplayFrame->GetDisplayFrame()->Connect("ProcessedEvent(Event_t*)", "AliDisplay2", this,"HandleMouseWheel(Event_t*)"); + + + fLeftFrame->Layout(); + + fSubFrame->AddFrame(fLeftFrame, new TGLayoutHints( kLHintsBottom | kLHintsLeft | kLHintsExpandY, 5, 5, 2, 2)); + fSubFrame->AddFrame(fRightFrame, new TGLayoutHints( kLHintsBottom | kLHintsRight | kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 2)); + + Int_t parts[] = {45,45,10}; + fStatusBar = new TGStatusBar(fMainFrame,50,10,kHorizontalFrame); + fStatusBar->SetParts(parts,3); + fStatusBar->SetText("AliDisplay v2.0",0); + fMainFrame->AddFrame(fStatusBar,new TGLayoutHints(kLHintsBottom | kLHintsExpandX,0,0,0,0)); + + fMainFrame->AddFrame(fSubFrame,new TGLayoutHints( kLHintsBottom | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 2)); + fMainFrame->SetWindowName("Ali Display"); + + fMainFrame->MapSubwindows(); + fMainFrame->MapWindow(); + LoadSettings(); - fMainFrame->Resize(w-10,h); - fMainFrame->Resize(w,h); - fMainFrame->SetWMSizeHints(500,500,1280, 1200,1,1); + fMainFrame->Resize(w-10,h); + fMainFrame->Resize(w,h); + fMainFrame->SetWMSizeHints(500,500,1280, 1200,1,1); } //_____________________________________________________________ AliDisplay2::~AliDisplay2(void) { + //Destructor delete fModules; delete [] fEnabledModules; delete fModuleInfo; - - delete fSliderFrameLayout; - delete fSliderFrame; - delete fDisplayFrameLayout; - delete fDisplayFrame; - // delete fZoomFrameLayout; - // delete fZoomFrame; - delete fShutterFrameLayout; - delete fShutterFrame; - delete fInfoFrameLayout; - delete fInfoFrame; - delete fDetectorFrameLayout; - delete fDetectorFrame; - - delete fSubFrame; - delete fLeftFrame; - delete fRightFrame; - delete fMainFrame; - delete fAliDisplay2rc; - - delete fMenu; - delete fStatusBar; + + delete fSliderFrameLayout; + delete fSliderFrame; + delete fDisplayFrameLayout; + delete fDisplayFrame; + // delete fZoomFrameLayout; + // delete fZoomFrame; + delete fShutterFrameLayout; + delete fShutterFrame; + delete fInfoFrameLayout; + delete fInfoFrame; + delete fDetectorFrameLayout; + delete fDetectorFrame; + + delete fSubFrame; + delete fLeftFrame; + delete fRightFrame; + delete fMainFrame; + delete fAliDisplay2rc; + + delete fMenu; + delete fStatusBar; } //_____________________________________________________________ void AliDisplay2::CloseWindow(void) { - delete this; + // Deletes the current display + delete this; } //_____________________________________________________________ void AliDisplay2::LoadFromRC() { + // Load the environment settings from .alidisplayrc file TEnv *rc=new TEnv(".alidisplayrc"); SetSliderUpdate(rc->GetValue("AliDisplay.SliderUpdate",kFALSE)); SetZoomStep(rc->GetValue("AliDisplay.ZoomStep",1.2)); @@ -1967,8 +193,9 @@ void AliDisplay2::LoadFromRC() } //_____________________________________________________________ -void AliDisplay2::SaveToRC() +void AliDisplay2::SaveToRC() const { + // Saves the environment settings in .alidisplayrc file TEnv *rc=new TEnv(".alidisplayrc"); rc->SetValue("AliDisplay.SliderUpdate",GetSliderUpdate()); rc->SetValue("AliDisplay.ZoomStep",GetZoomStep()); @@ -1981,6 +208,7 @@ void AliDisplay2::SaveToRC() //_____________________________________________________________ void AliDisplay2::DoSaveSettings(void) { + // Saves the environment settings for the slider frame and display fSliderFrame->SaveToRC(); SaveToRC(); } @@ -1988,117 +216,122 @@ void AliDisplay2::DoSaveSettings(void) //_____________________________________________________________ void AliDisplay2::LoadSettings() { + // Loads settings LoadFromRC(); } //_____________________________________________________________ void AliDisplay2::Draw(Option_t */*options*/) { - fDisplayFrame->DoView(fCurrentView); + // Draws display frame + fDisplayFrame->DoView(fCurrentView); } //_____________________________________________________________ void AliDisplay2::DrawX3d() { - fDisplayFrame->DrawX3d(); + // Draws display frame using X3d + fDisplayFrame->DrawX3d(); } //_____________________________________________________________ void AliDisplay2::DrawGL() { - fDisplayFrame->DrawGL(); + // Draws display frame using GL + fDisplayFrame->DrawGL(); } //_____________________________________________________________ void AliDisplay2::ShowNextEvent(Int_t delta) { - //Load the next event - clock_t t1,t2; - t1=clock(); - Int_t newEvent=0; - if(delta!=0){ - gAlice->Clear(); - //Int_t currentEvent = gAlice->GetHeader()->GetEvent(); - newEvent = fEventNumber + delta; - if( newEvent < 0) return; - gAlice->GetEvent(newEvent); - fEventNumber += delta; - // if(!gAlice->TreeH()) return; - } - if(IsEnabled(kHits)) LoadHits(); - if(IsEnabled(kClusters)) LoadClusters(newEvent); - if(IsEnabled(kHLT)) LoadHLTClusters(newEvent); - t2=clock(); - // printf("\nEvent loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); - Update(kmMODULES); + //Load the next event + clock_t t1,t2; + t1=clock(); + Int_t newEvent=0; + if(delta!=0){ + gAlice->Clear(); + newEvent = fEventNumber + delta; + if( newEvent < 0) return; + gAlice->GetEvent(newEvent); + fEventNumber += delta; + // if(!gAlice->TreeH()) return; + } + if(IsEnabled(kHits)) LoadHits(); + if(IsEnabled(kClusters)) LoadClusters(newEvent); + if(IsEnabled(kHLT)) LoadHLTClusters(newEvent); + t2=clock(); + // printf("\nEvent loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); + Update(kmMODULES); } //_____________________________________________________________ void AliDisplay2::FindModules() { - //Find the modules used for the simulation and assign these modules to the array fModules - fModules = new TObjArray; - TObjArray *modules = gAlice->Modules(); - AliModule *mod; - Int_t nbm = 0; - for(Int_t i=0;iGetEntriesFast();i++){ - mod = (AliModule *) modules->At(i); - if(!mod) continue; - const char *avoid = strstr("BODY MAG ABSO DIPO HALL FRAME SHIL PIPE",mod->GetName()); - if(avoid) continue; - fModules->AddLast(mod); - nbm++; - } - fEnabledModules = new Bool_t[nbm]; - fNbModules = nbm; - fModuleInfo = new AliModuleInfo(nbm); - for(Int_t j=0;jGetEntriesFast();j++){ - fModuleInfo->Add(fModules->At(j)->GetName(),j); - fEnabledModules[j]=kTRUE; - } + // Find the modules used for the simulation and assign + // these modules to the array fModules + fModules = new TObjArray; + TObjArray *modules = gAlice->Modules(); + AliModule *mod; + Int_t nbm = 0; + for(Int_t i=0;iGetEntriesFast();i++){ + mod = (AliModule *) modules->At(i); + if(!mod) continue; + const char *avoid = strstr("BODY MAG ABSO DIPO HALL FRAME SHIL PIPE",mod->GetName()); + if(avoid) continue; + fModules->AddLast(mod); + nbm++; + } + fEnabledModules = new Bool_t[nbm]; + fNbModules = nbm; + fModuleInfo = new AliModuleInfo(nbm); + for(Int_t j=0;jGetEntriesFast();j++){ + fModuleInfo->Add(fModules->At(j)->GetName(),j); + fEnabledModules[j]=kTRUE; + } } //_____________________________________________________________ void AliDisplay2::LoadHits() { - //Load the detected hits from each detector to memory - gAlice->ResetPoints(); - TIter next(gAlice->Modules()); - AliModule *module; - Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); - while((module = (AliModule*)next())) + //Load the detected hits from each detector to memory + gAlice->ResetPoints(); + TIter next(gAlice->Modules()); + AliModule *module; + Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); + while((module = (AliModule*)next())) { - AliDetector* detector = dynamic_cast(module); - if(detector) detector->SetTreeAddress(); + AliDetector* detector = dynamic_cast(module); + if(detector) detector->SetTreeAddress(); + } + next.Reset(); + for (Int_t track=0; trackResetHits(); + while((module = (AliModule*)next())) { + AliDetector* detector = dynamic_cast(module); + if(detector) + { + detector->TreeH()->GetEvent(track); + detector->LoadPoints(track); + } } - next.Reset(); - for (Int_t track=0; trackResetHits(); - while((module = (AliModule*)next())) { - AliDetector* detector = dynamic_cast(module); - if(detector) - { - detector->TreeH()->GetEvent(track); - detector->LoadPoints(track); - } - } - next.Reset(); - } - fHitsLoaded = kTRUE; + next.Reset(); + } + fHitsLoaded = kTRUE; } //_____________________________________________________________ void AliDisplay2::LoadClusters(Int_t nevent) { //clock_t t1,t2; - fDisplayFrame->LoadClusters(nevent); - fClustersLoaded = kTRUE; - // printf("\nClusters loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); + fDisplayFrame->LoadClusters(nevent); + fClustersLoaded = kTRUE; + // printf("\nClusters loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); } //_____________________________________________________________ void AliDisplay2::LoadHLTClusters(Int_t nevent) { + // Loads HLT clusters fDisplayFrame->LoadHLTClusters(nevent); fHLTLoaded = kTRUE; } @@ -2106,6 +339,7 @@ void AliDisplay2::LoadHLTClusters(Int_t nevent) //_____________________________________________________________ void AliDisplay2::Enable(Int_t m) { + // Enables the given mode m if(m==kHits){ if((fMode&kHits)==kHits) return; fMode = kHits|fMode; @@ -2136,6 +370,7 @@ void AliDisplay2::Enable(Int_t m) //_____________________________________________________________ void AliDisplay2::Disable(Int_t m) { + // Disables the given mode m if(m==kHits){ fMode = fMode|kHits; fMode = fMode^kHits; @@ -2156,8 +391,9 @@ void AliDisplay2::Disable(Int_t m) } //_____________________________________________________________ -Bool_t AliDisplay2::IsEnabled(Int_t m) +Bool_t AliDisplay2::IsEnabled(Int_t m) const { + // Checks if the mode m is enabled if(m==kHits){ if((fMode&kHits)==kHits) return kTRUE; return kFALSE; @@ -2180,52 +416,56 @@ Bool_t AliDisplay2::IsEnabled(Int_t m) //_____________________________________________________________ void AliDisplay2::HandleMouseWheel(Event_t *event) { - if(event->fType != kButtonPress && event->fType != kButtonRelease) return; - - if(event->fCode == kButton4){ - fZoomFactor *= fZoomStep; - Draw(); - } - - if(event->fCode == kButton5){ - fZoomFactor /= fZoomStep; - Draw(); - } + //Handle mouve event, not working yet + if(event->fType != kButtonPress && event->fType != kButtonRelease) return; + + if(event->fCode == kButton4){ + fZoomFactor *= fZoomStep; + Draw(); + } + + if(event->fCode == kButton5){ + fZoomFactor /= fZoomStep; + Draw(); + } } //_____________________________________________________________ void AliDisplay2::HandleResize(Event_t *event) { - switch(event->fType){ - case kConfigureNotify:{ - Draw(); - } - break; - default:break; - } + // Handle resize event + switch(event->fType){ + case kConfigureNotify:{ + Draw(); + } + break; + default:break; + } } //_____________________________________________________________ void AliDisplay2::Update(Int_t tag) { - if(tag==kmMODULES){ - LoadEnabledModules(); - if(((fMode)&kHits)==kHits){ - LoadEnabledHits(); - ApplyCuts(); - } - } - if(tag==kmCUTS){ - if(((fMode)&kHits)==kHits)ApplyCuts(); - } - if(tag==kmPOINTS){ - if(((fMode)&kHits)==kHits){ - LoadEnabledHits(); - ApplyCuts(); - } - } - Draw(); - fInfoFrame->Update(); + // Update the view, if loading only the modified data from the previous + // changes, the integer tag indicates the kind of modification + if(tag==kmMODULES){ + LoadEnabledModules(); + if(((fMode)&kHits)==kHits){ + LoadEnabledHits(); + ApplyCuts(); + } + } + if(tag==kmCUTS){ + if(((fMode)&kHits)==kHits)ApplyCuts(); + } + if(tag==kmPOINTS){ + if(((fMode)&kHits)==kHits){ + LoadEnabledHits(); + ApplyCuts(); + } + } + Draw(); + fInfoFrame->Update(); } diff --git a/DISPLAY/AliDisplay2.h b/DISPLAY/AliDisplay2.h index 30cfa7df136..96ff9bf5cb9 100644 --- a/DISPLAY/AliDisplay2.h +++ b/DISPLAY/AliDisplay2.h @@ -11,35 +11,22 @@ #ifndef AliDISPLAY2_H #define AliDISPLAY2_H +#include #include -#include -#include -#include #include -#include -#include -#include - -class TGButton; -class TGMenu; -class TGMenuBar; -class TGPopupMenu; -class TGPopupMenu; -class TGPopupMenu; -class TGTab; -class TGLayoutHints; + +#include "AliDisplayFrame.h" +#include "AliSliderFrame.h" + class TObjArray; -class TPolyMarker3D; -class TGNumberEntry; -class TGNumberEntryField; -class TGCheckButton; -class TGTextButton; -class TGShutter; -class TGShutterItem; class TGWindow; class TEnv; -class TGLabel; -class TCanvas; + +class AliModuleInfo; +class AliShutterFrame; +class AliInfoFrame; +class AliDetectorFrame; +class AliMenu; enum AliDisplay2Id { kIdsVIEW, //id of the view shutter @@ -113,399 +100,13 @@ enum AliDisplay2Id { kmPOINTS }; -const char helpTxt[] = "\tAliDisplay v2.0\n\t\tHelp\n\n\nWelcome in the AliDisplay help.\nHere is a list of useful subjects which discribes\nthe main functionnalities of the software\n \nEvent:Use the arrows to get the next or previous event\nView:Each button corresponds to a different view\nDetectors:Select the module you want to see\nOptions:Select the view mode\nSliders:Use the rapidity (or eta) slider to cut the set of hits\n\tAnd the momentum slider to cut with respect to the momentum\n"; - - -//const char *filetypes[] = {"ROOT files","*.root","All files","*",0,0}; - - //Constants to set the display mode const Int_t kHits = BIT(0); const Int_t kClusters = BIT(1); const Int_t kHLT = BIT(2); const Int_t kTracks = BIT(3); -//***Class ModulesInfo***// -class AliModuleInfo{ - public: - AliModuleInfo(int n); - virtual ~AliModuleInfo(); - - void SetId(char* name,Int_t id); - void Add(const char * name,Int_t i); - Int_t Id(char *name); - char* Name(Int_t id); - Bool_t IsEnabled(Int_t id); - Bool_t IsEnabled(char *name){return IsEnabled(Id(name));}; - void Disable(Int_t id); - void Disable(char* name){Disable(Id(name));}; - void Enable(Int_t id); - void Enable(char *name){Enable(Id(name));}; - void Print(); - - private: - //The purposes of this class is to link each module to its Id - char **fName; - Int_t *fId; - Bool_t *fEnabled; - Int_t fNb; - - ClassDef(AliModuleInfo,0); -}; - -//***Class DisplayCluster***// - -class AliDisplayClusters{ - //This class is an interface to the clusters data - -public: - AliDisplayClusters(); - virtual ~AliDisplayClusters(); - - void LoadClusters(char * name,Int_t nevent); - void LoadITSClusters(Int_t nevent); - void LoadTPCClusters(Int_t nevent); - void Draw(); - Int_t GetNbClusters(); - -private: - TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i; - Int_t fNb; - char **fName; //fName[i]=name of the detector i - - RQ_OBJECT("AliDisplayClusters") - - ClassDef(AliDisplayClusters,0); -}; - -//***class AliDisplayHLT***// - -class AliDisplayHLT{ - //This classes is an interface to the HLT data - //For the moment only for TPC, for adding modules there is two choices: - //1) add the function LoadHLT[module](Int_t) and update the function LoadHLT - //2) or inherit your class from AliDisplayHLT and overload LoadHLT - - public: - - AliDisplayHLT(); - virtual ~AliDisplayHLT(); - - virtual void LoadHLT(char *name,Int_t e);//Load L3 datas whose belong to detector name and from the event e - virtual void LoadHLTTPC(Int_t nevent); - virtual void Draw(); - - private: - TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i; - Int_t fNb; - char **fName; //fName[i]=name of the detector i - - ClassDef(AliDisplayHLT,0); -}; - -//***Class AliSliderFrame***// -class AliSliderFrame{ - //This class implements the cuts manager - -public: - - AliSliderFrame(const TGWindow *p, UInt_t w, UInt_t h); - virtual ~AliSliderFrame(); - - //Setters - void SetMomentumRange(Float_t min, Float_t max){fMomentumSlider->SetRange(min,max);}; - void SetRapidityRange(Float_t min, Float_t max){fRapiditySlider->SetRange(min,max);}; - - Float_t GetMomentumMax(){return fMomentumSlider->GetMaxPosition();}; - Float_t GetMomentumMin(){return fMomentumSlider->GetMinPosition();}; - Float_t GetRapidityMax(){return fRapiditySlider->GetMaxPosition();}; - Float_t GetRapidityMin(){return fRapiditySlider->GetMinPosition();}; - TGCompositeFrame* GetSliderFrame(){return fMainFrame;}; - - //Slots - void CloseWindow(); - void DoSlider(Int_t pos=0); - void DoField(Long_t pos=0); - void DoReleased(Int_t pos=0); - void DoPositionChanged(Int_t pos=0); - - //I/O - void SaveToRC(); - void LoadFromRC(); - -private: - - TGCompositeFrame *fMainFrame; - TGCompositeFrame *fMomentumFrame; - TGCompositeFrame *fRapidityFrame; - TGLayoutHints *fLayout;//Layout of the frame - TGLayoutHints *fMomentumLayout; - TGLayoutHints *fRapidityLayout; - TGDoubleHSlider *fMomentumSlider; - TGDoubleHSlider *fRapiditySlider; - TGLabel *fMomentumLabel; - TGLabel *fRapidityLabel; - TGNumberEntry *fMomentumMaxValue; - TGNumberEntry *fMomentumMinValue; - TGNumberEntry *fRapidityMaxValue; - TGNumberEntry *fRapidityMinValue; - - RQ_OBJECT("AliSliderFrame") - - ClassDef(AliSliderFrame,0); -}; - -//***Class AliDetectorFrame***// -class AliDetectorFrame{ - //This classe implements the frame which contains the list of enabled detectors - //and allows the user to change the current status of the detector (enabled/disabled) - -public: - - AliDetectorFrame(const TGWindow *p, Int_t w, Int_t h,UInt_t bgc); - virtual ~AliDetectorFrame(); - - TGCompositeFrame* GetDetectorFrame(){return fMainFrame;}; - - //Slots - void DoButton(Int_t pos=0); - void DoCheckButton(Int_t pos=0); - void DoSpecific(); - -private: - - TGCompositeFrame *fMainFrame; - TGCompositeFrame *fButtonFrame; - TGCheckButton **fCheckButton; - TGTextButton *fButtonAll; - TGTextButton *fButtonInvert; - Bool_t *fCheckedButton; //fEnabledButton[i]=kTRUE if button checked - Int_t *fCheckButtonId; - Bool_t fCheckedMode; - static int fgBaseId; - - RQ_OBJECT("AliDetectorFrame") - - ClassDef(AliDetectorFrame,0); -}; - -//***Class AliShutterItem**// -class AliShutterItem{ - //This class implements the shutter item, ie the base element of a shutter and provides functions to add button... in the shutter -public: - - AliShutterItem(TGShutter *s,char *text,UInt_t id); - virtual ~AliShutterItem(); - - //Getters - TGShutterItem* GetShutterItem(){return fShutterItem;}; - TGCompositeFrame* GetShutterItemFrame(){return fMainFrame;}; - - //Fill functions - void AddTextButton(char *text,char *tiptext, UInt_t idb); - void AddPictureButton(char *file,char *tiptext,UInt_t idb); - void AddCheckButton(char *txt,Int_t idb); - - //Slot - void DoButton(Int_t pos=0); - -private: - TGCompositeFrame *fMainFrame; - TGShutterItem *fShutterItem; - TGButton *fButton; - - RQ_OBJECT("AliShutterItem") - - ClassDef(AliShutterItem,0); -}; - - -//***Class AliShutterFrame***// -class AliShutterFrame{ - //This class implements the shutter frame -public: - - AliShutterFrame(TGCompositeFrame *p, UInt_t w, UInt_t h); - virtual ~AliShutterFrame(); - - TGCompositeFrame* GetShutterFrame(){return fMainFrame;}; - -private: - - TGCompositeFrame *fMainFrame; - TGLayoutHints *fLayout; - TGShutter *fShutter; - AliDetectorFrame *fDetectorFrame; - TGLayoutHints *fDetectorFrameLayout; - - RQ_OBJECT("AliShutterFrame") - - ClassDef(AliShutterFrame,0); -}; - -//***Class AliDisplayFrame***// -class AliDisplayFrame{ - //This class implements the display of the event - -public: - - AliDisplayFrame(const TGWindow *p, UInt_t w, UInt_t h); - virtual ~AliDisplayFrame(); - - //Getters - TGCompositeFrame* GetDisplayFrame(){return fMainFrame;}; - TCanvas* GetMainCanvas(){return fMainCanvas;}; - Int_t GetPreviousW(){return fPreviousW;}; - Int_t GetPreviousH(){return fPreviousH;}; - TGDimension GetFrameDimension(){return ((TGCanvas*)fMainEmbeddedCanvas)->GetViewPort()->GetDefaultSize();}; - Int_t GetNbActivePoints(); - Int_t GetNbClusters(){return fClusters->GetNbClusters();}; - - //Setters - void SetPreviousW(Int_t w){fPreviousW=w;}; - void SetPreviousH(Int_t h){fPreviousH=h;}; - void SetEditable(Bool_t b){gPad->SetEditable(b);}; - - void DoView(Int_t view); - void Draw(Float_t theta,Float_t phi,Float_t psi); - void DrawDetector(const char *name); - void DrawHits(); - void DrawX3d(); - void DrawGL(); - void LoadEnabledModules(); - void LoadClusters(Int_t nevent); - void LoadHLTClusters(Int_t nevent); - void LoadHits(); - void ApplyCuts(); - void EnableDetector(const char *name); - void DisableDetector(const char *name); - void ExecuteEvent(Int_t event, Int_t px,Int_t py,TObject *); - void SavePadGIF(const char *file); - -private: - - TGCompositeFrame *fMainFrame,*fFrame1,*fFrame2; - TGTab *fMainTab; - Bool_t fAllViews; - TRootEmbeddedCanvas *fMainEmbeddedCanvas;//embedded Canvas which contains the main view(s) - TRootEmbeddedCanvas *fSelectionEmbeddedCanvas; - TCanvas *fMainCanvas; - TCanvas *fSelectionCanvas; - Float_t fClipMin,fClipMax; - Int_t fPreviousW,fPreviousH; - Float_t fRange; - AliDisplayClusters *fClusters; - AliDisplayHLT *fHLT; - TObjArray *fPoints; - TObjArray *fPoints2; - TObjArray *fModules; - Int_t fNbModules; - Bool_t *fActivePoints; - TObjArray *fPolyMarkers;//Array for TPolyMarker3D - Float_t *fClustersPos; - Int_t fNbClusters; - - RQ_OBJECT("AliDisplayFrame") - - ClassDef(AliDisplayFrame,0); -}; - -//***Class AliInfoFrame***// -class AliInfoFrame{ - //This class implements the info frame where the number of particles... are displayed - -public: - - AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h); - virtual ~AliInfoFrame(void); - - void AddLabel(char *text, UInt_t options); - TGCompositeFrame *GetInfoFrame(){return fMainFrame;}; - void Update(); - -private: - - TGCompositeFrame *fMainFrame,*fTitleFrame,*fFiguresFrame; - TGLabel *fNbParticuleLabel; - TGLabel *fNbEventLabel; - TGLabel *fNbHitsLabel; - TGLabel *fNbClustersLabel; - - RQ_OBJECT("AliInfoFrame") - - ClassDef(AliInfoFrame,0); -}; - - -//***Class AliSettingFrame***// -class AliSettingFrame:public TGTransientFrame{ - //This classe implement the setting frame where the different otption can be set - -public: - - AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h); - virtual ~AliSettingFrame(); - - //Slots - void DoSettings(Int_t id=0); - -private: - - TGCompositeFrame *fMainFrame; - TGCompositeFrame *fZoomStepFrame; - TGLayoutHints *fZoomStepLayout; - TGNumberEntryField *fZoomStepEntry; - TGLabel *fZoomStepLabel; - TGCompositeFrame *fSliderStepFrame; - TGLayoutHints *fSliderStepLayout; - TGNumberEntryField *fSliderStepEntry; - TGLabel *fSliderStepLabel; - TGCompositeFrame *fSliderUpdateFrame; - TGLayoutHints *fSliderUpdateLayout; - TGCheckButton *fSliderUpdateButton; - Bool_t fIsLoading;//Used when retrieving the state of the check button - - RQ_OBJECT("AliSettingFrame") - - ClassDef(AliSettingFrame,0); -}; - - -//***Class AliMenu***// -class AliMenu { - //This class implement both the menu and the toolbar - -public: - - AliMenu(TGCompositeFrame *p, UInt_t w, UInt_t h, UInt_t options); - virtual ~AliMenu(); - - void AddPictureButton(char *fname,char *tiptext,UInt_t id, UInt_t spacing);//add a picture button to the toolbar - //slots - void DoMenu(Int_t id=0); - void DoToolBar(Int_t id=0); - -private: - - TGMenuBar *fMenuBar; - TGToolBar *fToolBar; - TGLayoutHints *fMenuBarLayout; - TGLayoutHints *fMenuBarItemLayout; - TGPopupMenu *fMenuFile; - TGPopupMenu *fMenuOptions; - TGPopupMenu *fMenuHelp; - TGPopupMenu *fMenuView; - TGLayoutHints *fToolBarLayout; - ToolBarData_t *fTBD; - TGButton *fButton; - - RQ_OBJECT("AliMenu") - - ClassDef(AliMenu,0); -}; - -//***Class AliDisplay2***// class AliDisplay2 : public TObject{ //This classe is the main component of the new display. //It aggregates all the subframes and manage the relationnships @@ -524,34 +125,34 @@ public: void LoadSettings();//load the settings from the ressource file //Getter - Int_t GetCurrentView(void){return fCurrentView;};//return current view - TGMainFrame* GetMainFrame(){return fMainFrame;};// - Float_t GetZoomStep(){return fZoomStep;};// - Float_t GetZoomFactor(){return fZoomFactor;};// - Float_t GetRapidityMin(){return fSliderFrame->GetRapidityMin();};// - Float_t GetRapidityMax(){return fSliderFrame->GetRapidityMax();};// - Float_t GetMomentumMin(){return fSliderFrame->GetMomentumMin();};// - Float_t GetMomentumMax(){return fSliderFrame->GetMomentumMax();};// - Int_t GetNbParticles(){return fNbParticles;};// - Int_t GetEventNumber(){return fEventNumber;};// - Int_t GetNbHits(){return fNbHits;};// - Int_t GetNbClusters(){return fDisplayFrame->GetNbClusters();};// - Float_t GetSliderStep(){return fSliderStep;};// - Bool_t GetZoomMode(){return fZoomMode;};// - Int_t GetMode(){return fMode;};// - TObjArray* GetModules(){return fModules;};// - Bool_t* GetEnabledModules(){return fEnabledModules;};// - Int_t GetNbModules(){return fNbModules;};// - char* GetIconsPath(){return fIconsPath;};// - AliModuleInfo* GetModuleInfo(){return fModuleInfo;};// - Bool_t GetSliderUpdate(){return fSliderUpdate;};// - char* GetRawDataPath(){return fRawDataPath;}; + Int_t GetCurrentView(void) const {return fCurrentView;};//return current view + TGMainFrame* GetMainFrame() const {return fMainFrame;};// + Float_t GetZoomStep() const {return fZoomStep;};// + Float_t GetZoomFactor() const {return fZoomFactor;};// + Float_t GetRapidityMin() const {return fSliderFrame->GetRapidityMin();};// + Float_t GetRapidityMax() const {return fSliderFrame->GetRapidityMax();};// + Float_t GetMomentumMin() const {return fSliderFrame->GetMomentumMin();};// + Float_t GetMomentumMax() const {return fSliderFrame->GetMomentumMax();};// + Int_t GetNbParticles() const {return fNbParticles;};// + Int_t GetEventNumber() const {return fEventNumber;};// + Int_t GetNbHits() const {return fNbHits;};// + Int_t GetNbClusters() const {return fDisplayFrame->GetNbClusters();};// + Float_t GetSliderStep() const {return fSliderStep;};// + Bool_t GetZoomMode() const {return fZoomMode;};// + Int_t GetMode() const {return fMode;};// + TObjArray* GetModules() const {return fModules;};// + Bool_t* GetEnabledModules() const {return fEnabledModules;};// + Int_t GetNbModules() const {return fNbModules;};// + char* GetIconsPath() const {return fIconsPath;};// + AliModuleInfo* GetModuleInfo() const {return fModuleInfo;};// + Bool_t GetSliderUpdate() const {return fSliderUpdate;};// + char* GetRawDataPath() const {return fRawDataPath;}; //Setter void SetSliderUpdate(Bool_t b){fSliderUpdate = b;};// void SetMode(Int_t m){fMode=m;};// void Enable(Int_t m);//Enable the given mode - Bool_t IsEnabled(Int_t m);//Return if the given mode is enabled + Bool_t IsEnabled(Int_t m) const;//Return if the given mode is enabled void Disable(Int_t m);//Disable the given mode void SetZoomMode(Bool_t b=kTRUE){fZoomMode = b;};// void SetCurrentView(Int_t id){fCurrentView = id;};// @@ -585,7 +186,7 @@ public: //I/O void LoadFromRC(); - void SaveToRC(); + void SaveToRC() const; private: @@ -615,35 +216,37 @@ private: TGCompositeFrame *fSubFrame;//frame used for the layout //Slider Frame - TGLayoutHints *fSliderFrameLayout; + TGLayoutHints *fSliderFrameLayout; // Slider Frame Layout AliSliderFrame *fSliderFrame;//Frame which contains the rapidity and momentum sliders //Shutter Frame - TGLayoutHints *fShutterFrameLayout; - AliShutterFrame *fShutterFrame; + TGLayoutHints *fShutterFrameLayout; // Shutter Frame Layout + AliShutterFrame *fShutterFrame;// Shutter Frame //Display Frame - TGLayoutHints *fDisplayFrameLayout; - AliDisplayFrame *fDisplayFrame; + TGLayoutHints *fDisplayFrameLayout; // Display Frame Layout + AliDisplayFrame *fDisplayFrame;// Display Frame //Info Frame - TGLayoutHints *fInfoFrameLayout; - AliInfoFrame *fInfoFrame; + TGLayoutHints *fInfoFrameLayout; // Info Frame Layout + AliInfoFrame *fInfoFrame; // Info Frame //Detector Option Frame - TGLayoutHints *fDetectorFrameLayout; - AliDetectorFrame *fDetectorFrame; + TGLayoutHints *fDetectorFrameLayout;// Detector Frame Layout + AliDetectorFrame *fDetectorFrame; // Detector Frame //MenuBar - AliMenu *fMenu; + AliMenu *fMenu; // Menu //Status bar - TGStatusBar *fStatusBar; + TGStatusBar *fStatusBar; // Status Bar RQ_OBJECT("AliDisplay2") ClassDef(AliDisplay2,0); }; +R__EXTERN AliDisplay2* gAliDisplay2; + #endif diff --git a/DISPLAY/AliDisplayClusters.cxx b/DISPLAY/AliDisplayClusters.cxx new file mode 100644 index 00000000000..f8574bed886 --- /dev/null +++ b/DISPLAY/AliDisplayClusters.cxx @@ -0,0 +1,216 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +///////////////////////////////////////////////////////////////////////// +// ALICE DISPLAY CLUSTERS CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +#include "AliDisplayClusters.h" +#include "AliModuleInfo.h" + +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliITS.h" +#include "AliITSLoader.h" +#include "AliITSgeom.h" +#include "AliITSclusterV2.h" +#include "AliTPCParam.h" +#include "AliTPCLoader.h" +#include "AliClusters.h" +#include "AliTPCcluster.h" + +#include "AliDisplay2.h" + +ClassImp(AliDisplayClusters); + +//_____________________________________________________________ +AliDisplayClusters::AliDisplayClusters() +{ + //Default constructor + fPoints = new TPolyMarker3D[gAliDisplay2->GetNbModules()]; + fName = new char*[gAliDisplay2->GetNbModules()]; + fNb=0; + for(Int_t i=0;iGetNbModules();i++){ + fPoints[i].SetMarkerSize(0.2); + fPoints[i].SetMarkerColor(2); + fPoints[i].SetMarkerStyle(1); + } +} + +//_____________________________________________________________ +AliDisplayClusters::~AliDisplayClusters() +{ + // Destructor + delete [] fPoints; +} + +//_____________________________________________________________ +Int_t AliDisplayClusters::GetNbClusters() +{ + // Returns the number of clusters + Int_t r=0; + for(Int_t i=0;iGetModuleInfo()->IsEnabled(fName[i])) r+=fPoints[i].GetN(); + } + return r; +} + +//_____________________________________________________________ +void AliDisplayClusters::LoadClusters(const char *name,Int_t nevent) +{ + // Loads ITS and TPC clusters + if(strstr(name,"ITS")) LoadITSClusters(nevent); + if(strstr(name,"TPC")) LoadTPCClusters(nevent); +} + +//_____________________________________________________________ +void AliDisplayClusters::LoadITSClusters(Int_t nevent) +{ + // Loads ITS clusters + fName[fNb]=new char[strlen("ITS")]; + strcpy(fName[fNb],"ITS"); + AliRunLoader *rl = AliRunLoader::Open("galice.root"); + if(!rl) { + cerr<<"Can't open galice.root"; + return; + } + AliITSLoader *itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); + AliITS *its = (AliITS*)gAlice->GetModule("ITS"); + + rl->GetEvent(nevent); + itsl->LoadRecPoints(); + TTree *cTree=itsl->TreeR(); + if(!cTree) + { + cerr<<"Error occured during ITS clusters load"; + return; + } + + AliITSgeom *geom=its->GetITSgeom(); + Int_t count = 0; + + TClonesArray *clusters=new TClonesArray("AliITSclusterV2",10000); + TBranch *branch=cTree->GetBranch("Clusters"); + branch->SetAddress(&clusters); + Int_t nentr=(Int_t)cTree->GetEntries(); + for (Int_t i=0; iGetEvent(i)) continue; + + Double_t rot[9]; + geom->GetRotMatrix(i,rot); + Int_t lay,lad,det; + geom->GetModuleId(i,lay,lad,det); + Float_t tx,ty,tz; + geom->GetTrans(lay,lad,det,tx,ty,tz); + + Double_t r=-tx*rot[1]+ty*rot[0]; + if (lay==1) r=-r; + Double_t phi=TMath::ATan2(rot[1],rot[0]); + if (lay==1) phi-=3.1415927; + Double_t cp=TMath::Cos(phi), sp=TMath::Sin(phi); + + Int_t ncl=clusters->GetEntriesFast(); + while (ncl--) { + AliITSclusterV2 *c=(AliITSclusterV2*)clusters->UncheckedAt(ncl); + Double_t g[3]; + g[0]= r*cp + c->GetY()*sp; // + g[1]=-r*sp + c->GetY()*cp; // + g[2]=c->GetZ(); + fPoints[fNb].SetPoint(count,g[0],g[1],g[2]); + count++; + } + } + fNb++; +} + +//_____________________________________________________________ +void AliDisplayClusters::LoadTPCClusters(Int_t nevent) +{ + // Loads TPC clusters + fName[fNb]=new char[strlen("TPC")]; + strcpy(fName[fNb],"TPC"); + TFile *file = TFile::Open("galice.root"); + AliTPCParam *dig=(AliTPCParam *)file->Get("75x40_100x60_150x60"); + if (!dig) {cerr<<"TPC parameters have not been found !\n";} + file->Close(); + + AliRunLoader *rl = AliRunLoader::Open("galice.root"); + if(!rl) { + cerr<<"Can't open galice.root"; + return; + } + AliTPCLoader *itsl = (AliTPCLoader*)rl->GetLoader("TPCLoader"); + if(!itsl){ + cerr<<"Can't find Loader"; + return; + } + + rl->GetEvent(nevent); + itsl->LoadRecPoints(); + TTree *cTree=itsl->TreeR(); + if(!cTree) + { + cerr<<"Error during TPC clusters load"; + return; + } + + Int_t count = 0; + Float_t noiseth = 10; + + AliClusters *clusters=new AliClusters(); + clusters->SetClass("AliTPCcluster"); + + cTree->SetBranchAddress("Segment",&clusters); + + Int_t nrows=Int_t(cTree->GetEntries()); + for (Int_t n=0; nGetEvent(n); + Int_t sec,row; + dig->AdjustSectorRow(clusters->GetID(),sec,row); + TClonesArray &clrow=*clusters->GetArray(); + Int_t ncl=clrow.GetEntriesFast(); + while (ncl--) { + AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl]; + Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ(); + if (cl->GetQ()AdjustCosSin(sec,cs,sn); + tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; + fPoints[fNb].SetPoint(count,x,y,z); + count++; + } + clrow.Clear(); + + } + delete cTree; + delete dig; + fNb++; + +} + +//_____________________________________________________________ +void AliDisplayClusters::Draw() +{ + // Draws clusters + for(Int_t i=0;iGetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw(); + } +} + diff --git a/DISPLAY/AliDisplayClusters.h b/DISPLAY/AliDisplayClusters.h new file mode 100644 index 00000000000..01c80694d31 --- /dev/null +++ b/DISPLAY/AliDisplayClusters.h @@ -0,0 +1,39 @@ +#ifndef ALIDISPLAYCLUSTERS_H +#define ALIDISPLAYCLUSTERS_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +///////////////////////////////////////////////////////////////////////// +// ALICE DISPLAY CLUSTERS CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TPolyMarker3D; + +class AliDisplayClusters{ + //This class is an interface to the clusters data + +public: + AliDisplayClusters(); + virtual ~AliDisplayClusters(); + + void LoadClusters(const char * name,Int_t nevent); + void LoadITSClusters(Int_t nevent); + void LoadTPCClusters(Int_t nevent); + void Draw(); + Int_t GetNbClusters(); + +private: + TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i; + Int_t fNb; //Nimber of clusters + char **fName; //fName[i]=name of the detector i + + RQ_OBJECT("AliDisplayClusters") + + ClassDef(AliDisplayClusters,0); +}; +#endif diff --git a/DISPLAY/AliDisplayFrame.cxx b/DISPLAY/AliDisplayFrame.cxx new file mode 100644 index 00000000000..d4c11898655 --- /dev/null +++ b/DISPLAY/AliDisplayFrame.cxx @@ -0,0 +1,535 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE DISPLAY FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliModuleInfo.h" +#include "AliDisplayHLT.h" +#include "AliDisplay2.h" +#include "AliModule.h" +#include "AliDetector.h" +#include "AliPoints.h" +#include "AliRun.h" + + +ClassImp(AliDisplayFrame); + +//_____________________________________________________________ +AliDisplayFrame::AliDisplayFrame(const TGWindow *p, UInt_t w, UInt_t h) +{ + // Constructor + fClipMin=-20; + fClipMax=20; + fPreviousW=0; + fPreviousH=0; + fRange = 500; + fPolyMarkers = new TObjArray(1000); + + fMainFrame = new TGCompositeFrame(p,w,h); + fMainTab = new TGTab(fMainFrame, w, h); + fFrame1 = fMainTab->AddTab("Main View"); + fMainEmbeddedCanvas = new TRootEmbeddedCanvas("Main12",fFrame1,w,h,kFixedWidth); + fFrame1->AddFrame(fMainEmbeddedCanvas,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX| kLHintsExpandY, 0, 0, 0, 0)); + fMainCanvas = fMainEmbeddedCanvas->GetCanvas(); + fMainCanvas->SetFillColor(1); + fMainCanvas->SetBorderMode(0); + fMainCanvas->cd(); + fMainCanvas->SetFixedAspectRatio(); + fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliDisplayFrame",this,"ExecuteEvent(Int_t,Int_t,Int_t,TObject*)"); + //fView = new TView(1); + //DoView(kIdbFRONTVIEW); + + gAliDisplay2->SetCurrentView(kIdbFRONTVIEW); + + fFrame2 = fMainTab->AddTab("No detector"); + fSelectionEmbeddedCanvas = new TRootEmbeddedCanvas("Selection",fFrame2,w,h); + fSelectionCanvas = fSelectionEmbeddedCanvas->GetCanvas(); + fSelectionCanvas->SetFillColor(1); + fSelectionCanvas->SetBorderMode(0); + fSelectionCanvas->cd(); + fFrame2->AddFrame(fSelectionEmbeddedCanvas,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX| kLHintsExpandY, 0, 0, 0, 0)); + fMainFrame->AddFrame(fMainTab,new TGLayoutHints( kLHintsTop | kLHintsLeft|kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); + fAllViews = kFALSE; + fMainFrame->MapSubwindows(); + fMainFrame->MapWindow(); +} + +//_____________________________________________________________ +AliDisplayFrame::~AliDisplayFrame(void) +{ + // Destructor + delete fMainTab; + delete fSelectionEmbeddedCanvas; + delete fMainEmbeddedCanvas; + delete fFrame1; + delete fFrame2; + delete fMainCanvas; + delete fSelectionCanvas; + delete fPoints2; + delete fPoints; + delete fModules; + delete fMainFrame; + delete [] fActivePoints; + delete [] fClustersPos; +} + +//_____________________________________________________________ +void AliDisplayFrame::DoView(Int_t view) +{ + // Draws selected view + Int_t x,y; + char vname[16]; + y=fMainFrame->GetDefaultHeight(); + x=fMainFrame->GetDefaultWidth(); + gAliDisplay2->SetCurrentView(view); + switch(view){ + case kIdbALLVIEW:{ + fAllViews=kTRUE; + strcpy(vname,"All views"); + fMainCanvas->cd(); + gPad->Clear(); + fMainCanvas->SetFillColor(15); + fMainCanvas->Divide(2,2,0.005,0.005,1); + + fMainCanvas->cd(1); + Draw(30,30,0); + + gAliDisplay2->SetCurrentView(kIdbTOPVIEW); + fMainCanvas->cd(2); + Draw(90,-90,90); + + gAliDisplay2->SetCurrentView(kIdbSIDEVIEW); + fMainCanvas->cd(3); + Draw(90,0,-90); + + gAliDisplay2->SetCurrentView(kIdbFRONTVIEW); + fMainCanvas->cd(4); + Draw(0,-90,0); + + //fMainCanvas->cd(); + + } + break; + case kIdbTOPVIEW:{ + strcpy(vname,"Top view "); + fAllViews=kFALSE; + fMainCanvas->cd(); + gPad->SetFillColor(1); + gPad->Clear(); + gPad->Draw(); + Draw(90,-90,90); + } + break; + case kIdbSIDEVIEW:{ + strcpy(vname,"Side view"); + fAllViews=kFALSE; + fMainCanvas->cd(); + gPad->SetFillColor(1); + gPad->Clear(); + gPad->Draw(); + Draw(90,0,-90); + } + break; + case kIdbFRONTVIEW:{ + strcpy(vname,"Front view"); + fAllViews=kFALSE; + fMainCanvas->cd(); + gPad->SetFillColor(1); + gPad->Clear(); + gPad->Draw(); + + Draw(0,-90,0); + } + break; + default: break; + } + (fMainTab->GetTabTab(0))->SetText(new TGString(vname)); +} + +//_____________________________________________________________ +void AliDisplayFrame::DrawDetector(const char *name) +{ + // Draws detector + (fMainTab->GetTabTab(1))->SetText(new TGString(name)); +} + +//_____________________________________________________________ +void AliDisplayFrame::EnableDetector(const char *name) +{ + // Enables detector + AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); + if(!module) return; + gAliDisplay2->GetModuleInfo()->Enable((char*)name); + module->Enable(); +} + +//_____________________________________________________________ +void AliDisplayFrame::DisableDetector(const char *name) +{ + // Disables detector + AliModule *module = dynamic_cast(gAlice->Modules()->FindObject(name)); + if(!module) return; + gAliDisplay2->GetModuleInfo()->Disable((char*)name); + module->Disable(); +} + +//_____________________________________________________________ +void AliDisplayFrame::Draw(Float_t theta, Float_t phi, Float_t psi) +{ + // Draws everything??? + //clock_t t1,t2; + time_t t1,t2; + //t1 = clock(); + TStopwatch timer; + timer.Start(); + time(&t1); + gPad->SetCursor(kWatch); + gPad->SetEditable(kTRUE); + gPad->SetFillColor(1); + gPad->Clear(); + + Int_t iret; + + TView *view = new TView(1); + TGDimension dim=((TGCanvas*)fMainEmbeddedCanvas)->GetViewPort()->GetDefaultSize(); + Float_t aspectRatio = dim.fWidth/(Float_t) dim.fHeight; + //printf("Dimension %d %d",dim.fWidth,dim.fHeight); + if(gAliDisplay2->GetCurrentView()==kIdbFRONTVIEW){ + view->SetRange(-fRange*aspectRatio,-fRange,-fRange,fRange*aspectRatio,fRange,fRange); + } + if(gAliDisplay2->GetCurrentView()==kIdbTOPVIEW){ + view->SetRange(-fRange,-fRange,-fRange*aspectRatio,fRange,fRange,fRange*aspectRatio); + } + if(gAliDisplay2->GetCurrentView()==kIdbSIDEVIEW){ + view->SetRange(-fRange,-fRange,-fRange*aspectRatio,fRange,fRange,fRange*aspectRatio); + } + + gAlice->GetGeometry()->Draw("same"); + if(gAliDisplay2->IsEnabled(kHits)) DrawHits(); + if(gAliDisplay2->IsEnabled(kClusters)) fClusters->Draw(); + if(gAliDisplay2->IsEnabled(kHLT)) fHLT->Draw(); + + gAliDisplay2->AppendPad(); + view->SetView(phi,theta,psi,iret); + + view->ZoomView(gPad,gAliDisplay2->GetZoomFactor()); + //t2 = clock(); + time(&t2); + // printf("\nDrawn in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); + printf("\nDrawn in....%2lf sec", difftime(t2,t1)); + timer.Stop(); + timer.Print("m"); +} + +//_____________________________________________________________ +void AliDisplayFrame::DrawHits() +{ + // Draws hits + AliPoints *p; + if(!fPoints2) return; + for(Int_t i=0;iGetEntries();i++){ + if(fActivePoints[i]){ + p=dynamic_cast(fPoints2->UncheckedAt(i)); + if(!p) continue; + p->Draw(); + } + } +} + +//_____________________________________________________________ +void AliDisplayFrame::LoadEnabledModules() +{ + // Loads enabled modules + clock_t t1,t2; + t1=clock(); + TIter next(gAlice->Modules()); + AliModule *module; + fModules = new TObjArray(0,32); + while((module = dynamic_cast (next()))){ + if(!module) continue; + if(!module->IsActive()) continue; + fModules->AddLast(module); + } + t2=clock(); + fNbModules = fModules->GetEntriesFast(); + // printf("\nModules loaded in.....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); +} + +//_____________________________________________________________ +void AliDisplayFrame::LoadClusters(Int_t nevent) +{ + // Loads clusters + fClusters = new AliDisplayClusters(); + fClusters->LoadClusters("ITS TPC",nevent); +} + +//_____________________________________________________________ +void AliDisplayFrame::LoadHLTClusters(Int_t nevent) +{ + // Loads HLT clusters + fHLT = new AliDisplayHLT(); + fHLT->LoadHLT("TPC",nevent); +} + +//_____________________________________________________________ +void AliDisplayFrame::LoadHits() +{ + // Loads hits + clock_t t1,t2; + + t1=clock(); + fPoints2 = new TObjArray(0,1000); + AliModule *module; + TObjArray *points; + for(Int_t i=0;i(fModules->UncheckedAt(i)); + if(!module) continue; + points = module->Points(); + if(!points) { + continue; + } + for(Int_t j=0;jGetEntriesFast();j++){ + if(!points->UncheckedAt(j)) continue; + fPoints2->AddLast((points->UncheckedAt(j))); + } + } + fActivePoints = new Bool_t[fPoints2->GetEntries()]; + for(Int_t k=0;kGetEntriesFast();k++){ + fActivePoints[k]=kTRUE; + } + printf("\n nb hits %d",fPoints2->GetEntries()); + t2=clock(); + // printf("\nPoints loaded in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); +} + +//_____________________________________________________________ +void AliDisplayFrame::ApplyCuts() +{ + // Applies cuts + clock_t t1,t2; + t1=clock(); + + Float_t *pxyz; + Float_t r,theta,eta,cutmin,cutmax,etamin,etamax,pmom,smin,smax; + Int_t nbhits=0; + AliPoints *pm; + TParticle *particle; + + //Get momentum cut + smin = gAliDisplay2->GetMomentumMin(); + smax = gAliDisplay2->GetMomentumMax(); + cutmin = 2.0*smin; + if(smax<0.98) cutmax = 2.0*smax; + else cutmax = 100000; + + //Get rapidity cut + smax = gAliDisplay2->GetRapidityMax(); + smin = gAliDisplay2->GetRapidityMin(); + //etamin = 1.5*(2*smin-1); + //etamax = 1.5*(2*smax-1); + etamin = smin; + etamax = smax; + if(smin<-1.46) etamin = -1000; + if(smax>1.46) etamax = 1000; + + + if(!fPoints2) return; + for(Int_t i=0;iGetEntries();i++){ + pm = dynamic_cast(fPoints2->UncheckedAt(i)); + if(!pm) { + fActivePoints[i]=kFALSE; + continue; + } + particle = pm->GetParticle(); + if(!particle) { + fActivePoints[i]=kFALSE; + continue; + } + pmom = particle->P(); + if(pmom < cutmin) { + fActivePoints[i]=kFALSE; + continue; + } + if(pmom > cutmax) { + fActivePoints[i]=kFALSE; + continue; + } + pxyz = pm->GetP(); + r = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]); + theta = TMath::ATan2(r,TMath::Abs(pxyz[2])); + if(theta) eta = -TMath::Log(TMath::Abs(TMath::Tan(0.5*theta))); + else eta = 1e10; + if(pxyz[2] < 0) eta = -eta; + if((eta < etamin) || (eta > etamax)) { + fActivePoints[i]=kFALSE; + continue; + } + fActivePoints[i]=kTRUE; + //pm->Draw(); + nbhits += pm->GetN(); + } + gAliDisplay2->SetNbHits(nbhits); + t2=clock(); + // printf("\nCuts applied in....%f sec", ((double)t2-t1)/(10000*CLK_TCK)); + gAliDisplay2->SetNbParticles(GetNbActivePoints()); +} + +//_____________________________________________________________ +Int_t AliDisplayFrame::GetNbActivePoints() const +{ + // Returns the number of active points + Int_t ans=0; + for(Int_t i=0;iGetEntries();i++){ + if(fActivePoints[i]) ans++; + } + return ans; +} +//_____________________________________________________________ +void AliDisplayFrame::DrawX3d() +{ + // Draws using X3d + TPad *pad = dynamic_cast(gPad); + pad->cd(); + TView *view = pad->GetView(); + if(!view) return; + pad->x3d(); +} + +//_____________________________________________________________ +void AliDisplayFrame::SavePadGIF(const char *file) +{ + // Save the current pad in a GIF file + if(!gPad){ + printf("\nThere is no active pad"); + return; + } + gPad->SaveAs(file); +} + +//_____________________________________________________________ +void AliDisplayFrame::DrawGL() +{ + // Draws using GL + TPad *pad = dynamic_cast(gPad); + pad->cd(); + TView *view = pad->GetView(); + if(!view) return; + pad->x3d("OPENGL"); +} + +//_____________________________________________________________ +void AliDisplayFrame::ExecuteEvent(Int_t event, Int_t px,Int_t py,TObject *) +{ + static Float_t x0,y0,x1,y1; + static Int_t pxold,pyold; + static Int_t px0,py0; + static Int_t linedrawn; + Float_t temp; + + + switch(event){ + case kMouseMotion:{ + + AliPoints *p=dynamic_cast (gPad->GetSelected()); + if(p){ + gAliDisplay2->SetStatusBar(p->GetName(),1); + gAliDisplay2->SetStatusBar(p->GetDetector()->GetName(),2); + } + } + break; + default:break; + } + + if((!gAliDisplay2->GetZoomMode())&&(gPad->GetView())){ + gPad->GetView()->ExecuteRotateView(event,px,py); + return; + } + + + + if(gAliDisplay2->GetZoomMode()==kTRUE){ + switch(event){ + + case kButton1Down:{ + gVirtualX->SetLineColor(-1); + gPad->TAttLine::Modify(); + x0 = gPad->AbsPixeltoX(px); + y0 = gPad->AbsPixeltoY(py); + px0 = px; + py0 = py; + pxold = px; + pyold = py; + linedrawn = 0; + } + break; + case kButton1Motion:{ + if(linedrawn) gVirtualX->DrawBox(px0,py0,pxold,pyold,TVirtualX::kHollow); + pxold = px; + pyold = py; + linedrawn = 1; + gVirtualX->DrawBox(px0,py0,pxold,pyold,TVirtualX::kHollow); + } + break; + + case kButton1Up:{ + gPad->GetCanvas()->FeedbackMode(kFALSE); + if(px == px0) break; + if(py == py0) break; + x1 = gPad->AbsPixeltoX(px); + y1 = gPad->AbsPixeltoY(py); + if(x1SetEditable(kTRUE); + //gPad->Range(x0,y0,x1,y1); + gPad->SetEditable(kFALSE); + //gPad->Range(0.5,0.5,1,1); + //gAliDisplay2->SetZoomFactor(1); + gPad->Modified(kTRUE); + gAliDisplay2->Draw(); + gAliDisplay2->SetZoomMode(kFALSE); + gPad->SetEditable(kTRUE); + } + break; + default: break; + } + } +} diff --git a/DISPLAY/AliDisplayFrame.h b/DISPLAY/AliDisplayFrame.h new file mode 100644 index 00000000000..4ffdcf17e7d --- /dev/null +++ b/DISPLAY/AliDisplayFrame.h @@ -0,0 +1,100 @@ +#ifndef ALIDISPLAYFRAME_H +#define ALIDISPLAYFRAME_H + +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE DISPLAY FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#include "AliDisplayClusters.h" + +class TGCompositeFrame; +class TGTab; +class TObjArray; + +class AliDisplayHLT; + +class AliDisplayFrame{ + //This class implements the display of the event + +public: + + AliDisplayFrame(const TGWindow *p, UInt_t w, UInt_t h); + virtual ~AliDisplayFrame(); + + //Getters + TGCompositeFrame* GetDisplayFrame() const {return fMainFrame;}; + TCanvas* GetMainCanvas() const {return fMainCanvas;}; + Int_t GetPreviousW() const {return fPreviousW;}; + Int_t GetPreviousH() const {return fPreviousH;}; + TGDimension GetFrameDimension() const + {return ((TGCanvas*)fMainEmbeddedCanvas)->GetViewPort()->GetDefaultSize();}; + Int_t GetNbActivePoints() const; + Int_t GetNbClusters() const + {return fClusters->GetNbClusters();}; + + //Setters + void SetPreviousW(Int_t w){fPreviousW=w;}; + void SetPreviousH(Int_t h){fPreviousH=h;}; + void SetEditable(Bool_t b){gPad->SetEditable(b);}; + + void DoView(Int_t view); + void Draw(Float_t theta,Float_t phi,Float_t psi); + void DrawDetector(const char *name); + void DrawHits(); + void DrawX3d(); + void DrawGL(); + void LoadEnabledModules(); + void LoadClusters(Int_t nevent); + void LoadHLTClusters(Int_t nevent); + void LoadHits(); + void ApplyCuts(); + void EnableDetector(const char *name); + void DisableDetector(const char *name); + void ExecuteEvent(Int_t event, Int_t px,Int_t py,TObject *); + void SavePadGIF(const char *file); + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGCompositeFrame *fFrame1; // First frame + TGCompositeFrame *fFrame2; // Second frame + TGTab *fMainTab; // Main tab + Bool_t fAllViews; // Flag for all views + TRootEmbeddedCanvas *fMainEmbeddedCanvas;//embedded Canvas which contains the main view(s) + TRootEmbeddedCanvas *fSelectionEmbeddedCanvas; // Selected embedded canvas + TCanvas *fMainCanvas; // Main canvas + TCanvas *fSelectionCanvas; // Selection canvas + Float_t fClipMin; // Min. clip + Float_t fClipMax; // Max. clip + Int_t fPreviousW;// Previous width + Int_t fPreviousH;// Previous height + Float_t fRange; // Range + AliDisplayClusters *fClusters; // Clusters + AliDisplayHLT *fHLT; // HLT display + TObjArray *fPoints; // Array of points + TObjArray *fPoints2;// Array of points + TObjArray *fModules;// Array of modules + Int_t fNbModules; // Number of modules + Bool_t *fActivePoints; // Flags for active points + TObjArray *fPolyMarkers;//Array for TPolyMarker3D + Float_t *fClustersPos;// Cluster position + Int_t fNbClusters;// Number of clusters + + RQ_OBJECT("AliDisplayFrame") + + ClassDef(AliDisplayFrame,0); +}; + +#endif diff --git a/DISPLAY/AliDisplayHLT.cxx b/DISPLAY/AliDisplayHLT.cxx new file mode 100644 index 00000000000..48285253421 --- /dev/null +++ b/DISPLAY/AliDisplayHLT.cxx @@ -0,0 +1,134 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +///////////////////////////////////////////////////////////////////////// +// ALICE HLT DISPLAY CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include + +#include "AliDisplayHLT.h" +#include "AliDisplay2.h" +#include "AliModuleInfo.h" + +ClassImp(AliDisplayHLT); + +//_____________________________________________________________ +AliDisplayHLT::AliDisplayHLT() +{ + // Default constructor + fPoints = new TPolyMarker3D[gAliDisplay2->GetNbModules()]; + fName = new char*[gAliDisplay2->GetNbModules()]; + fNb=0; + for(Int_t i=0;iGetNbModules();i++){ + fPoints[i].SetMarkerSize(0.2); + fPoints[i].SetMarkerColor(2); + fPoints[i].SetMarkerStyle(1); + } +} + +//_____________________________________________________________ +AliDisplayHLT::~AliDisplayHLT() +{ + delete [] fPoints; +} + +//_____________________________________________________________ +void AliDisplayHLT::LoadHLT(const char *name,Int_t nevent) +{ + // Loads HLT clusters of TPC + if(strstr(name,"TPC")) LoadHLTTPC(nevent); +} + +//_____________________________________________________________ +void AliDisplayHLT::LoadHLTTPC(Int_t nevent) +{ + //load TPC Clusters from the raw data + //raw data must be in the directorie $ALICE_ROOT/raw + //First we read the data from files + //do_mc MUST BE DEFINED AND USED FOR RAW DATA GENERATION +#ifdef ALI_HLT + + fName[fNb]=new char[strlen("TPC")]; + strcpy(fName[fNb],"TPC"); + Char_t fname[256]; + AliL3MemHandler *clusterfile[36][6]; + AliL3SpacePointData *fClusters[36][6]; + UInt_t fNcl[36][6]; + memset(fClusters,0,36*6*sizeof(AliL3SpacePointData*)); + // strcpy(path,gSystem->Getenv("ALICE_ROOT")); + //strcat(path,"/raw"); + //printf("\nRaw data path %s",path); + char path[128]; + strcpy(path,gAliDisplay2->GetRawDataPath()); + for(Int_t s=0; s<36; s++) + { + for(Int_t p=0; pSetBinaryInput(fname)) + { + LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open") + <<"Inputfile "<Allocate(); + clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]); + clusterfile[s][p]->CloseBinaryInput(); + break; + } + } + + //Second step: we assign the clusters to the fPoints array + Int_t nbc=0; + for(Int_t s=0; s<36; s++){ + for(Int_t p=0;p<6;p++){ + AliL3SpacePointData *points = fClusters[s][p]; + if(!points) continue; + Float_t xyz[3]; + for(UInt_t i=0; iGetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw(); + } +} + diff --git a/DISPLAY/AliDisplayHLT.h b/DISPLAY/AliDisplayHLT.h new file mode 100644 index 00000000000..3c7553286df --- /dev/null +++ b/DISPLAY/AliDisplayHLT.h @@ -0,0 +1,41 @@ +#ifndef AliDISPLAYHLT_H +#define AliDISPLAYHLT_H + +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE HLT DISPLAY CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include + +class TPolyMarker3D; + +class AliDisplayHLT{ + //This classes is an interface to the HLT data + //For the moment only for TPC, for adding modules there is two choices: + //1) add the function LoadHLT[module](Int_t) and update the function LoadHLT + //2) or inherit your class from AliDisplayHLT and overload LoadHLT + + public: + + AliDisplayHLT(); + virtual ~AliDisplayHLT(); + + virtual void LoadHLT(const char *name,Int_t e);//Load L3 datas whose belong to detector name and from the event e + virtual void LoadHLTTPC(Int_t nevent); + virtual void Draw(); + + private: + TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i; + Int_t fNb; // Number of HLT clusters + char **fName; //fName[i]=name of the detector i + + ClassDef(AliDisplayHLT,0); +}; + +#endif diff --git a/DISPLAY/AliInfoFrame.cxx b/DISPLAY/AliInfoFrame.cxx new file mode 100644 index 00000000000..e17d0d2a1f5 --- /dev/null +++ b/DISPLAY/AliInfoFrame.cxx @@ -0,0 +1,127 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +///////////////////////////////////////////////////////////////////////// +// ALICE INFO FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "AliInfoFrame.h" +#include "AliDisplay2.h" + +ClassImp(AliInfoFrame); + +//_____________________________________________________________ +AliInfoFrame::AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h) +{ + // Constructor + fMainFrame = new TGCompositeFrame(p, w, h, kVerticalFrame); + + fTitleFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); + AddLabel("ALICE",kLHintsTop | kLHintsCenterX); + AddLabel("Event Display",kLHintsTop | kLHintsCenterX); + + TString filename=StrDup(gAliDisplay2->GetIconsPath()); + filename.Append("Alice.xpm"); + TGPicture *alicelogo = (TGPicture *) gClient->GetPicture(filename); + TGIcon *alice = new TGIcon(fTitleFrame,alicelogo,50,50); + fTitleFrame->AddFrame(alice,new TGLayoutHints(kLHintsTop | kLHintsCenterX,0,0,0,0)); + + AddLabel("Powered by",kLHintsTop | kLHintsCenterX); + AddLabel("AliRoot",kLHintsTop | kLHintsCenterX); + fMainFrame->AddFrame(fTitleFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,3)); + + //Feedback + fFiguresFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); + TGCompositeFrame *frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); + fNbEventLabel = new TGLabel(frame,""); + TGLabel * label = new TGLabel(frame,"Event number"); + fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); + frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft ,10,0,0,0)); + frame->AddFrame(fNbEventLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); + + fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); + + frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); + label = new TGLabel(frame,"Nb Particles"); + fNbParticuleLabel = new TGLabel(frame,""); + fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); + frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); + frame->AddFrame(fNbParticuleLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); + + fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); + + frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); + label = new TGLabel(frame,"Nb Hits"); + fNbHitsLabel = new TGLabel(frame,""); + fNbHitsLabel->SetText("--"); + frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); + frame->AddFrame(fNbHitsLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); + frame->Layout(); + fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); + + frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); + label = new TGLabel(frame,"Nb Clusters"); + fNbClustersLabel = new TGLabel(frame,""); + fNbClustersLabel->SetText("--"); + frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); + frame->AddFrame(fNbClustersLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); + frame->Layout(); + fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); + fMainFrame->AddFrame(fFiguresFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,2,0)); + + fMainFrame->Layout(); + fMainFrame->MapSubwindows(); + fMainFrame->MapWindow(); +}; + +//_____________________________________________________________ +AliInfoFrame::~AliInfoFrame(void){ + // Destructor + delete fMainFrame; + delete fTitleFrame; + delete fFiguresFrame; + delete fNbParticuleLabel; + delete fNbEventLabel; + delete fNbHitsLabel; +} + +//_____________________________________________________________ +void AliInfoFrame::AddLabel(const char *text, UInt_t options){ + // Adds new label + TGLabel * label = new TGLabel(fTitleFrame,text); + fTitleFrame->AddFrame(label,new TGLayoutHints(options,0,0,0,0)); +} + +//_____________________________________________________________ +void AliInfoFrame::Update() +{ + // Updates the layout + fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); + fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); + if(gAliDisplay2->IsEnabled(kHits))fNbHitsLabel->SetText(gAliDisplay2->GetNbHits()); + else fNbHitsLabel->SetText("--"); + if(gAliDisplay2->IsEnabled(kClusters))fNbClustersLabel->SetText(gAliDisplay2->GetNbClusters()); + else fNbClustersLabel->SetText("--"); + fMainFrame->Layout(); +} + diff --git a/DISPLAY/AliInfoFrame.h b/DISPLAY/AliInfoFrame.h new file mode 100644 index 00000000000..29303ee3f12 --- /dev/null +++ b/DISPLAY/AliInfoFrame.h @@ -0,0 +1,46 @@ +#ifndef ALIINFOFRAME_H +#define ALIINFOFRAME_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE INFO FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TGCompositeFrame; +class TGLabel; + +class AliInfoFrame{ + //This class implements the info frame where the number of particles... are displayed + +public: + + AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h); + virtual ~AliInfoFrame(void); + + void AddLabel(const char *text, UInt_t options); + TGCompositeFrame *GetInfoFrame() const {return fMainFrame;}; + void Update(); + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGCompositeFrame *fTitleFrame; // Title frame + TGCompositeFrame *fFiguresFrame; // Fugures frame + TGLabel *fNbParticuleLabel; // Label for particle number + TGLabel *fNbEventLabel; // Label for event number + TGLabel *fNbHitsLabel; // Label for hits number + TGLabel *fNbClustersLabel; // Label for clusters number + + RQ_OBJECT("AliInfoFrame") + + ClassDef(AliInfoFrame,0); +}; + +#endif diff --git a/DISPLAY/AliMenu.cxx b/DISPLAY/AliMenu.cxx new file mode 100644 index 00000000000..72e08ba27ed --- /dev/null +++ b/DISPLAY/AliMenu.cxx @@ -0,0 +1,215 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE MENU CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +//extern filetypes; +const char *gAliFileTypes[] = {"ROOT files","*.root","All files","*",0,0}; +const char *gAliImgTypes[] = {"GIF files","*.gif",0,0}; + +// Help text +const char helpTxt[] = "\tAliDisplay v2.0\n\t\tHelp\n\n\nWelcome in the AliDisplay help.\nHere is a list of useful subjects which discribes\nthe main functionnalities of the software\n \nEvent:Use the arrows to get the next or previous event\nView:Each button corresponds to a different view\nDetectors:Select the module you want to see\nOptions:Select the view mode\nSliders:Use the rapidity (or eta) slider to cut the set of hits\n\tAnd the momentum slider to cut with respect to the momentum\n"; + + +ClassImp(AliMenu); + +//_____________________________________________________________ +AliMenu::AliMenu(TGCompositeFrame *p, UInt_t w, UInt_t h, UInt_t options) +{ + // Constructor + fMenuBar = new TGMenuBar(p,w,h,options); + fToolBar = new TGToolBar(p,60,20,options); + + fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsLeft ,0,0,0,0); + fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0); + + fMenuFile = new TGPopupMenu(gClient->GetRoot()); + fMenuFile->AddEntry("Open",kIdmOPEN); + fMenuFile->AddEntry("Save as",kIdmSAVEAS); + fMenuFile->AddEntry("Close",kIdmCLOSE); + fMenuFile->AddSeparator(); + fMenuFile->AddEntry("Print",kIdmPRINT); + fMenuFile->AddEntry("Print setup",kIdmPRINTSETUP); + fMenuFile->AddSeparator(); + fMenuFile->AddEntry("Exit",kIdmEXIT); + fMenuFile->DisableEntry(kIdmSAVEAS); + fMenuFile->Associate(p); + fMenuBar->AddPopup("File",fMenuFile,fMenuBarItemLayout); + fMenuFile->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); + + fMenuOptions = new TGPopupMenu(gClient->GetRoot()); + fMenuOptions->AddEntry("Settings",kIdmSETTINGS); + fMenuOptions->AddEntry("Save settings",kIdmSAVESETTINGS); + fMenuOptions->Associate(p); + fMenuBar->AddPopup("Options",fMenuOptions,fMenuBarItemLayout); + fMenuOptions->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); + + fMenuView = new TGPopupMenu(gClient->GetRoot()); + fMenuView->AddEntry("X3d ",kIdmVIEWX3D); + fMenuView->AddEntry("OpenGL",kIdmVIEWGL); + fMenuView->Associate(p); + fMenuBar->AddPopup("View",fMenuView,fMenuBarItemLayout); + fMenuView->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); + + fMenuHelp = new TGPopupMenu(gClient->GetRoot()); + fMenuHelp->AddEntry("Help",kIdmHELP); + fMenuHelp->AddSeparator(); + fMenuHelp->AddEntry("About",kIdmABOUT); + fMenuHelp->Associate(p); + fMenuBar->AddPopup("Help",fMenuHelp,fMenuBarItemLayout); + fMenuHelp->Connect("Activated(Int_t)","AliMenu",this,"DoMenu(Int_t)"); + + p->AddFrame(fMenuBar,fMenuBarLayout); + fTBD = new ToolBarData_t; + + fToolBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX,0,0,0,0); + AddPictureButton("open.xpm","Open file",kIdmOPEN,5); + AddPictureButton("save.xpm","Save current pad as gif file",kIdmSAVEAS,0); + AddPictureButton("settings.xpm","Settings",kIdmSETTINGS,5); + AddPictureButton("help.xpm","Help",kIdmHELP,5); + AddPictureButton("quit.xpm","Exit AliDisplay",kIdmEXIT,5); + AddPictureButton("opengl.xpm","Open GL view",kIdmVIEWGL,5); + AddPictureButton("x3d.xpm","x3d view",kIdmVIEWX3D,0); + AddPictureButton("zoomplus16.xpm","Zoom in",kIdbZoomIN,5); + AddPictureButton("zoommoins16.xpm","Zoom out",kIdbZoomOUT,0); + AddPictureButton("zoomzone.xpm","Zoom on zone",kIdbZoomZONE,0); + p->AddFrame(fToolBar,fToolBarLayout); +} + +//_____________________________________________________________ +AliMenu::~AliMenu() +{ + // Destructor + delete fMenuBarLayout; + delete fMenuBarItemLayout; + delete fMenuFile; + delete fMenuOptions; + delete fMenuView; + delete fMenuHelp; + delete fToolBarLayout; + delete fToolBar; + delete fMenuBar; + delete fTBD; +} + +//_____________________________________________________________ +void AliMenu::DoMenu(Int_t id) +{ + switch(id){ + case kIdmOPEN:{ + TGFileInfo fi; + static TString dir("."); + fi.fFileTypes = gAliFileTypes; + fi.fIniDir = StrDup(dir.Data()); + new TGFileDialog(gClient->GetRoot(),gAliDisplay2->GetMainFrame(),kFDOpen,&fi); + if(!fi.fFilename) return; + } + break; + case kIdmEXIT:{ + gApplication->Terminate(0); + } + break; + case kIdmSAVEAS:{ + TGFileInfo fi; + static TString dir("."); + fi.fFileTypes = gAliImgTypes; + fi.fIniDir = StrDup(dir.Data()); + new TGFileDialog(gClient->GetRoot(),gAliDisplay2->GetMainFrame(),kFDSave,&fi); + if(!fi.fFilename) return; + gAliDisplay2->SavePadGIF(fi.fFilename); + } + break; + case kIdmSETTINGS:{ + new AliSettingFrame((TGWindow *)gClient->GetRoot(),(TGWindow *)gAliDisplay2->GetMainFrame(),200,150); + } + break; + case kIdmHELP:{ + TRootHelpDialog *hd=new TRootHelpDialog((TGWindow *)gClient->GetRoot(),"Help",300,300); + hd->SetText(helpTxt); + hd->Popup(); + } + break; + + case kIdmSAVESETTINGS:{ + gAliDisplay2->DoSaveSettings(); + } + break; + case kIdmVIEWX3D:{ + gAliDisplay2->DrawX3d(); + } + break; + case kIdmVIEWGL:{ + gAliDisplay2->DrawGL(); + } + break; + case kIdbZoomIN:{ + gAliDisplay2->SetZoomFactor(gAliDisplay2->GetZoomFactor()*gAliDisplay2->GetZoomStep()); + gAliDisplay2->Draw(); + } + break; + case kIdbZoomZONE:{ + gAliDisplay2->SetZoomMode(kTRUE); + gAliDisplay2->SetEditable(kFALSE); + } + break; + case kIdbZoomOUT:{ + gAliDisplay2->SetZoomFactor(gAliDisplay2->GetZoomFactor()/gAliDisplay2->GetZoomStep()); + gAliDisplay2->Draw(); + } + break; + default:break; + } +} + +//_____________________________________________________________ +void AliMenu::DoToolBar(Int_t /*id*/) +{ + TGFrame *frame = (TGFrame *) gTQSender; + TGButton *bu = (TGButton *) frame; + DoMenu(bu->WidgetId()); +} + +//_____________________________________________________________ +void AliMenu::AddPictureButton( const char *fname, const char *tiptext,UInt_t id, UInt_t spacing) +{ + TString filename = StrDup(gAliDisplay2->GetIconsPath()); + filename.Append(fname); + + fTBD->fPixmap=filename.Data(); + fTBD->fTipText = tiptext; + fTBD->fId = id; + fTBD->fStayDown = kFALSE; + + fToolBar->AddButton(fToolBar,fTBD,spacing); + if(fTBD->fButton) + fTBD->fButton->Connect("Clicked()","AliMenu",this,"DoToolBar(Int_t)"); +} diff --git a/DISPLAY/AliMenu.h b/DISPLAY/AliMenu.h new file mode 100644 index 00000000000..5945a438c9f --- /dev/null +++ b/DISPLAY/AliMenu.h @@ -0,0 +1,54 @@ +#ifndef ALIMENU_H +#define ALIMENU_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE MENU CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +class TGMenuBar; +class TGLayoutHints; +class TGPopupMenu; +class TGButton; + +class AliMenu { + //This class implement both the menu and the toolbar + +public: + + AliMenu(TGCompositeFrame *p, UInt_t w, UInt_t h, UInt_t options); + virtual ~AliMenu(); + + void AddPictureButton( const char *fname, const char *tiptext,UInt_t id, UInt_t spacing);//add a picture button to the toolbar + //slots + void DoMenu(Int_t id=0); + void DoToolBar(Int_t id=0); + +private: + + TGMenuBar *fMenuBar; // Menu bar + TGToolBar *fToolBar; // Tool bar + TGLayoutHints *fMenuBarLayout; // Menu bar layout + TGLayoutHints *fMenuBarItemLayout; // Menu bar item layout + TGPopupMenu *fMenuFile; // Menu file + TGPopupMenu *fMenuOptions; // Menu options + TGPopupMenu *fMenuHelp; // Menu help + TGPopupMenu *fMenuView; // Menu view + TGLayoutHints *fToolBarLayout; // Tool bar layout + ToolBarData_t *fTBD; // Tool bar data + TGButton *fButton; // Button + + RQ_OBJECT("AliMenu") + + ClassDef(AliMenu,0); +}; + +#endif diff --git a/DISPLAY/AliModuleInfo.cxx b/DISPLAY/AliModuleInfo.cxx new file mode 100644 index 00000000000..dff47fff9aa --- /dev/null +++ b/DISPLAY/AliModuleInfo.cxx @@ -0,0 +1,160 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +///////////////////////////////////////////////////////////////////////// +// ALICE MODULE INFORMATION CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include + +#include "AliModuleInfo.h" + +ClassImp(AliModuleInfo); + +//_____________________________________________________________ +AliModuleInfo::AliModuleInfo(int n) +{ + // Constructor + fName = new char*[n]; + fId = new Int_t[n]; + fEnabled = new Bool_t[n]; + fNb = 0; +} + +//_____________________________________________________________ +AliModuleInfo::AliModuleInfo(const AliModuleInfo& rh) +{ + // Copy constructor + fName = new char*[rh.fNb]; + fId = new Int_t[rh.fNb]; + fEnabled = new Bool_t[rh.fNb]; + fNb = rh.fNb; + + for (Int_t i=0; i + +class AliModuleInfo{ + public: + AliModuleInfo(int n); + AliModuleInfo(const AliModuleInfo& rh); + AliModuleInfo& operator = (const AliModuleInfo& rh); + + virtual ~AliModuleInfo(); + + void SetId(const char* name,Int_t id); + void Add(const char * name,Int_t i); + Int_t Id(const char *name) const; + const char* Name(Int_t id) const; + Bool_t IsEnabled(Int_t id) const; + Bool_t IsEnabled(const char *name) const {return IsEnabled(Id(name));}; + void Disable(Int_t id); + void Disable(const char* name){Disable(Id(name));}; + void Enable(Int_t id); + void Enable(const char *name){Enable(Id(name));}; + void Print() const; + + private: + //The purposes of this class is to link each module to its Id + char **fName; // Array containing the names of the modules + Int_t *fId; // Array of module's Ids + Bool_t *fEnabled; // Array of flags to enable/disable modules + Int_t fNb; // Number of modules + + ClassDef(AliModuleInfo,0); +}; + +#endif diff --git a/DISPLAY/AliSettingFrame.cxx b/DISPLAY/AliSettingFrame.cxx new file mode 100644 index 00000000000..621bf8834ff --- /dev/null +++ b/DISPLAY/AliSettingFrame.cxx @@ -0,0 +1,133 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE SETTING FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + +#include "AliDisplay2.h" +#include "AliSettingFrame.h" + +ClassImp(AliSettingFrame); + +//_____________________________________________________________ +AliSettingFrame::AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) + :TGTransientFrame(p,main,w,h) +{ + // Constructor + fMainFrame = new TGCompositeFrame((TGWindow *)((TGTransientFrame *)this),w,h,kVerticalFrame); + + fZoomStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); + fZoomStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); + fZoomStepEntry = new TGNumberEntryField(fZoomStepFrame,kIdtZoomSTEP,gAliDisplay2->GetZoomStep()); + fZoomStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)"); + fZoomStepLabel = new TGLabel(fZoomStepFrame,"Zoom step"); + fZoomStepFrame->AddFrame(fZoomStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); + fZoomStepFrame->AddFrame(fZoomStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0)); + fMainFrame->AddFrame(fZoomStepFrame,fZoomStepLayout); + + fSliderStepFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); + fSliderStepLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); + fSliderStepEntry = new TGNumberEntryField(fSliderStepFrame,kIdtSliderSTEP,gAliDisplay2->GetSliderStep()); + fSliderStepEntry->Connect("ReturnPressed()","AliSettingFrame",this,"DoSettings(Int_t)"); + fSliderStepLabel = new TGLabel(fSliderStepFrame,"Slider step"); + fSliderStepFrame->AddFrame(fSliderStepLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); + fSliderStepFrame->AddFrame(fSliderStepEntry,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX ,5,5,0,0)); + fMainFrame->AddFrame(fSliderStepFrame,fSliderStepLayout); + + fSliderUpdateFrame = new TGCompositeFrame(fMainFrame,w,50,kHorizontalFrame); + fSliderUpdateLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,5,5,5,5); + fSliderUpdateButton = new TGCheckButton(fSliderUpdateFrame,"Update display on slider move",kIdtSliderUPDATE); + fSliderUpdateButton->Connect("Clicked()","AliSettingFrame",this,"DoSettings(Int_t)"); + fIsLoading = kTRUE; + if(gAliDisplay2->GetSliderUpdate()) fSliderUpdateButton->SetState(kButtonDown); + else fSliderUpdateButton->SetState(kButtonUp); + fIsLoading = kFALSE; + + fSliderUpdateFrame->AddFrame(fSliderUpdateButton,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,0,0)); + fMainFrame->AddFrame(fSliderUpdateFrame,fSliderUpdateLayout); + + AddFrame(fMainFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft |kLHintsExpandX,0,0,0,0)); + fMainFrame->Layout(); + // position relative to the parent's window + Window_t wdum; + int ax, ay; + gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), + (Int_t)(((TGFrame *) main)->GetWidth() - GetWidth()) >> 1, + (Int_t)(((TGFrame *) main)->GetHeight() - GetHeight()) >> 1, + ax, ay, wdum); + Move(ax, ay); + + SetWindowName("Setting frame"); + MapSubwindows(); + MapWindow(); + Layout(); +} + +//_____________________________________________________________ +AliSettingFrame::~AliSettingFrame() +{ + // Destructor + delete fZoomStepLayout; + delete fZoomStepEntry; + delete fZoomStepLabel; + delete fSliderStepLayout; + delete fSliderStepEntry; + delete fSliderStepLabel; + + delete fSliderUpdateLayout; + delete fSliderUpdateButton; + + delete fMainFrame; + delete fZoomStepFrame; + delete fSliderUpdateFrame; + delete fSliderStepLayout; +} + +//_____________________________________________________________ +void AliSettingFrame::DoSettings(Int_t /*pos*/) const +{ + // Updates settings + TGNumberEntryField *ne = (TGNumberEntryField *) gTQSender; + int id = ne->WidgetId(); + switch(id){ + case kIdtZoomSTEP:{ + gAliDisplay2->SetZoomStep(ne->GetNumber()); + } + break; + case kIdtSliderSTEP:{ + gAliDisplay2->SetSliderStep(ne->GetNumber()); + } + break; + case kIdtSliderUPDATE:{ + if(fIsLoading) return ; + if(gAliDisplay2->GetSliderUpdate()) gAliDisplay2->SetSliderUpdate(kFALSE); + else gAliDisplay2->SetSliderUpdate(kTRUE); + } + break; + default: break; + } +} + diff --git a/DISPLAY/AliSettingFrame.h b/DISPLAY/AliSettingFrame.h new file mode 100644 index 00000000000..aaa1ffa847e --- /dev/null +++ b/DISPLAY/AliSettingFrame.h @@ -0,0 +1,55 @@ +#ifndef ALISETTINGFRAME_H +#define ALISETTINGFRAME_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE SETTING FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TGWindow; +class TGCompositeFrame; +class TGLayoutHints; +class TGNumberEntryField; +class TGLabel; +class TGCheckButton; + +class AliSettingFrame:public TGTransientFrame{ + //This classe implement the setting frame where the different otption can be set + +public: + + AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h); + virtual ~AliSettingFrame(); + + //Slots + void DoSettings(Int_t id=0) const; + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGCompositeFrame *fZoomStepFrame; // Zoom step frame + TGLayoutHints *fZoomStepLayout; // Zoom step layout + TGNumberEntryField *fZoomStepEntry; // Zoom step entry + TGLabel *fZoomStepLabel; // zoom step label + TGCompositeFrame *fSliderStepFrame; // Slider step frame + TGLayoutHints *fSliderStepLayout; // Slider step layout + TGNumberEntryField *fSliderStepEntry; // Slider step entry + TGLabel *fSliderStepLabel; // Slider step label + TGCompositeFrame *fSliderUpdateFrame; // Slider update frame + TGLayoutHints *fSliderUpdateLayout;// Slider update layout + TGCheckButton *fSliderUpdateButton; // Slider update button + Bool_t fIsLoading;//Used when retrieving the state of the check button + + RQ_OBJECT("AliSettingFrame") + + ClassDef(AliSettingFrame,0); +}; + +#endif diff --git a/DISPLAY/AliShutterFrame.cxx b/DISPLAY/AliShutterFrame.cxx new file mode 100644 index 00000000000..7bf377acf2d --- /dev/null +++ b/DISPLAY/AliShutterFrame.cxx @@ -0,0 +1,84 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE SHUTTER FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "AliDetectorFrame.h" +#include "AliDisplay2.h" +#include "AliShutterItem.h" + +#include "AliShutterFrame.h" + + +ClassImp(AliShutterFrame); + +//_____________________________________________________________ +AliShutterFrame::AliShutterFrame(TGCompositeFrame *p, UInt_t /*w*/, UInt_t h) +{ + // Constructor + fShutter = new TGShutter(p,kSunkenFrame); + fLayout = new TGLayoutHints(kLHintsExpandY | kLHintsTop | kLHintsLeft); + fMainFrame = (TGCompositeFrame *) fShutter; + + //Event Shutter + AliShutterItem *item = new AliShutterItem(fShutter,"Event",kIdsEVENT); + + item->AddPictureButton("next.xpm","Show next event",kIdbNextEVENT); + item->AddPictureButton("prev.xpm","Show previous event",kIdbPrevEVENT); + + //View Shutter + item = new AliShutterItem(fShutter,"View",kIdsVIEW); + item->AddPictureButton("top.xpm","Top view",kIdbTOPVIEW); + item->AddPictureButton("side.xpm","Side view",kIdbSIDEVIEW); + item->AddPictureButton("front.xpm","Front view",kIdbFRONTVIEW); + item->AddPictureButton("four.xpm","Four views",kIdbALLVIEW); + + //Detector Shutter + item = new AliShutterItem(fShutter,"Detectors",kIdsDETECTORS); + TGCompositeFrame *frame = item->GetShutterItemFrame(); + fDetectorFrameLayout = new TGLayoutHints( kLHintsTop | kLHintsLeft| kLHintsExpandX | kLHintsCenterX,5,5,5,5); + fDetectorFrame = new AliDetectorFrame(frame,200,200,item->GetShutterItem()->GetDefaultFrameBackground()); + frame->AddFrame(fDetectorFrame->GetDetectorFrame(),fDetectorFrameLayout); + + //Options Shutter + item = new AliShutterItem(fShutter,"Options",kIdsOPTIONS); + item->AddCheckButton("Display Hits",kIdbCheckHITS); + item->AddCheckButton("Display Clusters",kIdbCheckCLUSTERS); + item->AddCheckButton("Display HLT Clusters",kIdbCheckHLT); + // item->AddCheckButton("Display Tracks",kIdbCheckTRACKS); + + fMainFrame->Resize(150,h); +} + +//_____________________________________________________________ +AliShutterFrame::~AliShutterFrame(void) +{ + // Destructor + delete fLayout; + delete fShutter; + delete fMainFrame; + delete fDetectorFrame; + delete fDetectorFrameLayout; +} + diff --git a/DISPLAY/AliShutterFrame.h b/DISPLAY/AliShutterFrame.h new file mode 100644 index 00000000000..b2838fbe7fd --- /dev/null +++ b/DISPLAY/AliShutterFrame.h @@ -0,0 +1,43 @@ +#ifndef ALISHUTTERFRAME_H +#define ALISHUTTERFRAME_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE SHUTTER FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TGCompositeFrame; +class TGLayoutHints; +class TGShutter; +class AliDetectorFrame; + +class AliShutterFrame{ + //This class implements the shutter frame +public: + + AliShutterFrame(TGCompositeFrame *p, UInt_t w, UInt_t h); + virtual ~AliShutterFrame(); + + TGCompositeFrame* GetShutterFrame(){return fMainFrame;}; + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGLayoutHints *fLayout; // Layout + TGShutter *fShutter; // Shutter + AliDetectorFrame *fDetectorFrame; // Detector frame + TGLayoutHints *fDetectorFrameLayout; // Detector frame layout + + RQ_OBJECT("AliShutterFrame") + + ClassDef(AliShutterFrame,0); +}; + +#endif diff --git a/DISPLAY/AliShutterItem.cxx b/DISPLAY/AliShutterItem.cxx new file mode 100644 index 00000000000..05e48e0e93f --- /dev/null +++ b/DISPLAY/AliShutterItem.cxx @@ -0,0 +1,140 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +///////////////////////////////////////////////////////////////////////// +// ALICE SHUTTER ITEM CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "AliShutterItem.h" +#include "AliDisplay2.h" + +ClassImp(AliShutterItem); + +//_____________________________________________________________ +AliShutterItem::AliShutterItem(TGShutter *s, const char *text, UInt_t id) +{ + // Constructor + fShutterItem = new TGShutterItem(s, new TGHotString(text), id); + fMainFrame = (TGCompositeFrame *) fShutterItem->GetContainer(); + s->AddItem(fShutterItem); +} + +//_____________________________________________________________ +AliShutterItem::~AliShutterItem(void) +{ + // Destructor + delete fButton; + delete fShutterItem; + delete fMainFrame; +} + +//_____________________________________________________________ +void AliShutterItem::AddTextButton(const char* text, const char *tiptext, UInt_t idb) +{ + //Add a TGTextButton in the TGShutterItem. This button will execute the fonction + fButton = new TGTextButton(fMainFrame,new TGHotString(text),idb); + fButton->Resize(100,fButton->GetDefaultHeight()); + fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); + fButton->SetToolTipText(tiptext); + //fButton->Connect("Clicked()","AliDisplay2",gAliDisplay2,"DoViews(Int_t)"); + fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); +} + +//_____________________________________________________________ +void AliShutterItem::AddPictureButton(const char* file, const char *tiptext, UInt_t idb) +{ + //Add a TGPictureButton in the TGShutterItem. The icon file must be in DISPLAY/icons + TString filename=StrDup(gAliDisplay2->GetIconsPath()); + filename.Append(file); + TGPicture *picture = (TGPicture *) gClient->GetPicture(filename); + fButton = new TGPictureButton(fMainFrame,picture,idb); + fButton->SetToolTipText(tiptext); + fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); + fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); +} + +//_____________________________________________________________ +void AliShutterItem::AddCheckButton(const char *text,Int_t idb) +{ + // Add check button + fButton = new TGCheckButton(fMainFrame,new TGHotString(text),idb); + fButton->Resize(100,fButton->GetDefaultHeight()); + fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); + fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsLeft ,5,5,10,10)); +} + +//_____________________________________________________________ +void AliShutterItem::DoButton(Int_t /*pos*/) const +{ + // Show next/previous event if the buttom was used + TGFrame *frame = (TGFrame *) gTQSender; + TGButton *bu= (TGButton *) frame; + int id = bu->WidgetId(); + switch(id){ + case kIdbNextEVENT:{ + gAliDisplay2->ShowNextEvent(1); + } + break; + case kIdbPrevEVENT:{ + gAliDisplay2->ShowNextEvent(-1); + } + break; + case kIdbCheckHITS:{ + if(gAliDisplay2->IsEnabled(kHits)) gAliDisplay2->Disable(kHits); + else gAliDisplay2->Enable(kHits); + } + break; + case kIdbCheckCLUSTERS:{ + if(gAliDisplay2->IsEnabled(kClusters)) gAliDisplay2->Disable(kClusters); + else gAliDisplay2->Enable(kClusters); + } + break; + case kIdbCheckHLT:{ + if(gAliDisplay2->IsEnabled(kHLT)) gAliDisplay2->Disable(kHLT); + else gAliDisplay2->Enable(kHLT); + } + break; + case kIdbCheckTRACKS:{ + if(gAliDisplay2->IsEnabled(kTracks)) gAliDisplay2->Disable(kTracks); + else gAliDisplay2->Enable(kTracks); + } + break; + case kIdbSIDEVIEW:{ + gAliDisplay2->DoView(kIdbSIDEVIEW); + } + break; + case kIdbFRONTVIEW:{ + gAliDisplay2->DoView(kIdbFRONTVIEW); + } + break; + case kIdbTOPVIEW:{ + gAliDisplay2->DoView(kIdbTOPVIEW); + } + break; + case kIdbALLVIEW:{ + gAliDisplay2->DoView(kIdbALLVIEW); + } + break; + default:break; + } +} + diff --git a/DISPLAY/AliShutterItem.h b/DISPLAY/AliShutterItem.h new file mode 100644 index 00000000000..f9fd175472c --- /dev/null +++ b/DISPLAY/AliShutterItem.h @@ -0,0 +1,52 @@ +#ifndef ALISHUTTERITEM_H +#define ALISHUTTERITEM_H + +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE SHUTTER ITEM CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include + +class TGShutter; +class TGShutterItem; +class TGCompositeFrame; +class TGButton; + +class AliShutterItem{ + //This class implements the shutter item, ie the base element of a shutter and provides functions to add button... in the shutter +public: + + AliShutterItem(TGShutter *s, const char *text,UInt_t id); + virtual ~AliShutterItem(); + + //Getters + TGShutterItem* GetShutterItem()const {return fShutterItem;}; + TGCompositeFrame* GetShutterItemFrame()const {return fMainFrame;}; + + //Fill functions + void AddTextButton(const char *text, const char *tiptext, UInt_t idb); + void AddPictureButton(const char *file, const char *tiptext,UInt_t idb); + void AddCheckButton(const char *txt,Int_t idb); + + //Slot + void DoButton(Int_t pos=0) const; + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGShutterItem *fShutterItem; // Shutter item + TGButton *fButton; // Button + + RQ_OBJECT("AliShutterItem") + + ClassDef(AliShutterItem,0); +}; + +#endif diff --git a/DISPLAY/AliSliderFrame.cxx b/DISPLAY/AliSliderFrame.cxx new file mode 100644 index 00000000000..0d2a502fe89 --- /dev/null +++ b/DISPLAY/AliSliderFrame.cxx @@ -0,0 +1,271 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +///////////////////////////////////////////////////////////////////////// +// ALICE SLIDER FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#include "AliSliderFrame.h" +#include "AliDisplay2.h" + +ClassImp(AliSliderFrame); + +//_____________________________________________________________ +AliSliderFrame::AliSliderFrame(const TGWindow *p, UInt_t w, UInt_t h) +{ + // Constructor + fMainFrame = new TGCompositeFrame(p, w, h, kVerticalFrame | kRaisedFrame); + fLayout = new TGLayoutHints( kLHintsBottom | kLHintsRight | kLHintsExpandX,5,5,2,2); + + //Momentum Slider + fMomentumFrame = new TGCompositeFrame(fMainFrame,0,0, kHorizontalFrame); + fMomentumLayout = new TGLayoutHints( kLHintsLeft | kLHintsTop | kLHintsExpandX ,5,5,2,2); + fMomentumSlider = new TGDoubleHSlider(fMomentumFrame, 400, kDoubleScaleBoth, kIdsMOMENTUM); + fMomentumSlider->Connect("PositionChanged()","AliSliderFrame",this,"DoSlider()"); + fMomentumSlider->Connect("PositionChanged()","AliSliderFrame",this,"DoPositionChanged(Int_t)"); + fMomentumSlider->Connect("Released()","AliSliderFrame",this,"DoReleased()"); + SetMomentumRange(0,2); + fMomentumSlider->SetPosition(0,2); + fMomentumLabel = new TGLabel(fMomentumFrame,"Momentum"); + + fMomentumMinValue = new TGNumberEntry(fMomentumFrame,GetMomentumMin(),7,kIdsMomentumMIN); + fMomentumMinValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); + fMomentumMinValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); + fMomentumMinValue->SetButtonToNum(kFALSE); + + fMomentumMaxValue = new TGNumberEntry(fMomentumFrame,GetMomentumMax(),7,kIdsMomentumMAX); + fMomentumMaxValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); + fMomentumMaxValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); + fMomentumMaxValue->SetButtonToNum(kFALSE); + + fMomentumFrame->AddFrame(fMomentumLabel,new TGLayoutHints( kLHintsLeft | kLHintsCenterY,5,5,2,2)); + fMomentumFrame->AddFrame(fMomentumMinValue,new TGLayoutHints( kLHintsLeft ,5,5,2,2)); + fMomentumFrame->AddFrame(fMomentumSlider,fMomentumLayout); + fMomentumFrame->AddFrame(fMomentumMaxValue,new TGLayoutHints( kLHintsRight,5,5,2,2)); + fMomentumFrame->Resize(700,100); + + + //Rapidity Slider + fRapidityFrame = new TGCompositeFrame(fMainFrame,0,0, kHorizontalFrame); + fRapidityLayout = new TGLayoutHints( kLHintsLeft | kLHintsTop | kLHintsExpandX,5,5,2,2); + fRapiditySlider = new TGDoubleHSlider(fRapidityFrame, 400, kDoubleScaleBoth, kIdsRAPIDITY); + fRapiditySlider->Connect("PositionChanged()","AliSliderFrame",this,"DoSlider()"); + fRapiditySlider->Connect("PositionChanged()","AliSliderFrame",this,"DoPositionChanged(Int_t)"); + fRapiditySlider->Connect("Released()","AliSliderFrame",this,"DoReleased()"); + SetRapidityRange(-1.5,1.5); + fRapiditySlider->SetPosition(-1.5,1.5); + fRapidityLabel = new TGLabel(fRapidityFrame,"Rapidity "); + fRapidityMinValue = new TGNumberEntry(fRapidityFrame,GetRapidityMin(),7,kIdsRapidityMIN); + fRapidityMinValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); + fRapidityMinValue->SetButtonToNum(kFALSE); + fRapidityMinValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); + + fRapidityMaxValue = new TGNumberEntry(fRapidityFrame,GetRapidityMax(),7,kIdsRapidityMAX); + fRapidityMaxValue->Connect("ValueChanged(Long_t)","AliSliderFrame",this,"DoField(Long_t)"); + fRapidityMaxValue->SetButtonToNum(kFALSE); + fRapidityMaxValue->GetNumberEntry()->Connect("ReturnPressed()","AliSliderFrame",this,"DoField(Long_t)"); + + fRapidityFrame->AddFrame(fRapidityLabel,new TGLayoutHints( kLHintsLeft | kLHintsCenterY,5,5,2,2)); + fRapidityFrame->AddFrame(fRapidityMinValue,new TGLayoutHints( kLHintsLeft ,5,5,2,2)); + fRapidityFrame->AddFrame(fRapiditySlider,fRapidityLayout); + fRapidityFrame->AddFrame(fRapidityMaxValue,new TGLayoutHints( kLHintsRight ,5,5,2,2)); + fRapidityFrame->Resize(700,100); + + fMainFrame->AddFrame(fMomentumFrame,fLayout); + fMainFrame->AddFrame(fRapidityFrame,fLayout); + fMainFrame->MapSubwindows(); + fMainFrame->MapWindow(); + fMainFrame->Resize(700,100); + LoadFromRC(); +} + +//_____________________________________________________________ +AliSliderFrame::~AliSliderFrame(void) +{ + // Destructor + delete fLayout; + delete fRapidityLayout; + delete fMomentumLayout; + delete fMomentumMinValue; + delete fMomentumMaxValue; + delete fMainFrame; + delete fRapidityFrame; + delete fMomentumFrame; + delete fMomentumSlider; + delete fRapiditySlider; + delete fMomentumLabel; + delete fRapidityLabel; + delete fRapidityMinValue; + delete fRapidityMaxValue; +} + +//_____________________________________________________________ +void AliSliderFrame::CloseWindow(void) +{ + // Deletes this window + delete this; +} + +//_____________________________________________________________ +void AliSliderFrame::DoSlider(Int_t /*pos*/) +{ + // Updates the values in case one moves a slider + TGFrame *frame = (TGFrame *) gTQSender; + TGDoubleSlider * ds = (TGDoubleSlider *) frame; + int id = ds->WidgetId(); + char min[8]; + char max[8]; + switch(id){ + case kIdsMOMENTUM:{ + //sprintf(buf,"momentum min:%f max:%f",GetMomentumMin(),GetMomentumMax()); + //printf("\n%s",buf); + sprintf(min,"%.4f",GetMomentumMin()); + sprintf(max,"%.4f",GetMomentumMax()); + fMomentumMaxValue->SetText(max); + fMomentumMinValue->SetText(min); + } + break; + case kIdsRAPIDITY:{ + sprintf(min,"%.4f",GetRapidityMin()); + sprintf(max,"%.4f",GetRapidityMax()); + fRapidityMaxValue->SetText(max); + fRapidityMinValue->SetText(min); + } + break; + default:break; + } +} + +//_____________________________________________________________ +void AliSliderFrame::DoReleased(Int_t /*pos*/) const +{ + // Updates the display when the slider is released + TGFrame *frame = (TGFrame *) gTQSender; + TGDoubleSlider * ds = (TGDoubleSlider *) frame; + int id = ds->WidgetId(); + switch(id){ + case kIdsRAPIDITY: + case kIdsMOMENTUM: + gAliDisplay2->Update(kmCUTS); + break; + default: break; + } +} + +//_____________________________________________________________ +void AliSliderFrame::DoPositionChanged(Int_t /*pos*/) const +{ + // Updates the display when a slider has changed + if(!gAliDisplay2->GetSliderUpdate()) return; + TGFrame *frame = (TGFrame *) gTQSender; + TGDoubleSlider * ds = (TGDoubleSlider *) frame; + int id = ds->WidgetId(); + switch(id){ + case kIdsRapidityMIN: + case kIdsRapidityMAX: + case kIdsMomentumMIN: + case kIdsMomentumMAX:{ + gAliDisplay2->Update(kmCUTS); + } + break; + default: break; + } +} + +//_____________________________________________________________ +void AliSliderFrame::DoField(Long_t pos) +{ + // Updates the display in case of changed min/max values for + // momentum and/or rapidity + TGNumberEntry *ne = (TGNumberEntry *) gTQSender; + int id = ne->WidgetId(); + char max[8],min[8]; + Int_t sign=0; + Float_t step=gAliDisplay2->GetSliderStep(); + if((pos/10000)==0){//Up button pressed + sign = 1; + } + else sign = -1; + + switch(id){ + case kIdsMomentumMIN:{ + fMomentumMinValue->SetNumber(fMomentumMinValue->GetNumber()+step*sign); + sprintf(min,"%.4f",fMomentumMinValue->GetNumber()); + fMomentumMinValue->SetText(min); + } + break; + case kIdsMomentumMAX:{ + fMomentumMaxValue->SetNumber(fMomentumMaxValue->GetNumber()+step*sign); + sprintf(max,"%.4f",fMomentumMaxValue->GetNumber()); + fMomentumMaxValue->SetText(max); + } + break; + case kIdsRapidityMIN:{ + fRapidityMinValue->SetNumber(fRapidityMinValue->GetNumber()+step*sign); + sprintf(min,"%.4f",fRapidityMinValue->GetNumber()); + fRapidityMinValue->SetText(min); + } + break; + case kIdsRapidityMAX:{ + fRapidityMaxValue->SetNumber(fRapidityMaxValue->GetNumber()+step*sign); + sprintf(max,"%.4f",fRapidityMaxValue->GetNumber()); + fRapidityMaxValue->SetText(max); + } + break; + default:break; + } + + fMomentumSlider->SetPosition(fMomentumMinValue->GetNumber(),fMomentumMaxValue->GetNumber()); + fRapiditySlider->SetPosition(fRapidityMinValue->GetNumber(),fRapidityMaxValue->GetNumber()); + // gAliDisplay2->Draw(); + gAliDisplay2->Update(kmCUTS); +} + +//_____________________________________________________________ +void AliSliderFrame::SaveToRC() const +{ + // Saves settings in the .alidisplayrc file + TEnv *rc=new TEnv(".alidisplayrc"); + rc->SetValue("AliDisplay.MomentumMin",GetMomentumMin()); + rc->SetValue("AliDisplay.MomentumMax",GetMomentumMax()); + rc->SetValue("AliDisplay.RapidityMin",GetRapidityMin()); + rc->SetValue("AliDisplay.RapidityMax",GetRapidityMax()); + rc->SaveLevel(kEnvLocal); + rc->Save(); +} + +//_____________________________________________________________ +void AliSliderFrame::LoadFromRC() +{ + // Loads settings from the .alidisplayrc file + // and uses the default momentum and rapidity ranges + TEnv *rc=new TEnv(".alidisplayrc"); + Float_t a,b; + a=rc->GetValue("AliDisplay.MomentumMin",0); + b=rc->GetValue("AliDisplay.MomentumMax",2); + fMomentumSlider->SetPosition(a,b); + a=rc->GetValue("AliDisplay.RapidityMin",-1.5); + b=rc->GetValue("AliDisplay.RapidityMax",1.5); + fRapiditySlider->SetPosition(a,b); +} + diff --git a/DISPLAY/AliSliderFrame.h b/DISPLAY/AliSliderFrame.h new file mode 100644 index 00000000000..c456683e344 --- /dev/null +++ b/DISPLAY/AliSliderFrame.h @@ -0,0 +1,73 @@ +#ifndef ALISLIDERFRAME_H +#define ALISLIDERFRAME_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +///////////////////////////////////////////////////////////////////////// +// ALICE SLIDER FRAME CLASS // +// Author: Mayeul ROUSSELET // +// e-mail: Mayeul.Rousselet@cern.ch // +// Last update:26/08/2003 // +///////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +class TGCompositeFrame; +class TGLayoutHints; +class TGLabel; +class TGNumberEntry; + +class AliSliderFrame{ + //This class implements the cuts manager + +public: + + AliSliderFrame(const TGWindow *p, UInt_t w, UInt_t h); + virtual ~AliSliderFrame(); + + //Setters + void SetMomentumRange(Float_t min, Float_t max){fMomentumSlider->SetRange(min,max);}; + void SetRapidityRange(Float_t min, Float_t max){fRapiditySlider->SetRange(min,max);}; + + Float_t GetMomentumMax() const {return fMomentumSlider->GetMaxPosition();}; + Float_t GetMomentumMin() const {return fMomentumSlider->GetMinPosition();}; + Float_t GetRapidityMax() const {return fRapiditySlider->GetMaxPosition();}; + Float_t GetRapidityMin() const {return fRapiditySlider->GetMinPosition();}; + TGCompositeFrame* GetSliderFrame() const {return fMainFrame;}; + + //Slots + void CloseWindow(); + void DoSlider(Int_t pos=0); + void DoField(Long_t pos=0); + void DoReleased(Int_t pos=0) const; + void DoPositionChanged(Int_t pos=0) const; + + //I/O + void SaveToRC() const; + void LoadFromRC(); + +private: + + TGCompositeFrame *fMainFrame; // Main frame + TGCompositeFrame *fMomentumFrame; // Momentum frame + TGCompositeFrame *fRapidityFrame; // Rapidity frame + TGLayoutHints *fLayout;//Layout of the frame + TGLayoutHints *fMomentumLayout; // Layout of momentum frame + TGLayoutHints *fRapidityLayout; // Layout of rapidity frame + TGDoubleHSlider *fMomentumSlider; // Momentum slider + TGDoubleHSlider *fRapiditySlider; // Rapidity slider + TGLabel *fMomentumLabel; // Momentum label + TGLabel *fRapidityLabel; // Rapidity label + TGNumberEntry *fMomentumMaxValue;// Max. value of momentum + TGNumberEntry *fMomentumMinValue;// Min. value of momentum + TGNumberEntry *fRapidityMaxValue;// Max. value of rapidity + TGNumberEntry *fRapidityMinValue;// Min. value of rapidity + + RQ_OBJECT("AliSliderFrame") + + ClassDef(AliSliderFrame,0); +}; + +#endif diff --git a/DISPLAY/libDISPLAY.pkg b/DISPLAY/libDISPLAY.pkg index f7bda8a1bbe..9bd0b2997bf 100644 --- a/DISPLAY/libDISPLAY.pkg +++ b/DISPLAY/libDISPLAY.pkg @@ -1,4 +1,7 @@ -SRCS = AliDisplay2.cxx +SRCS = AliDisplay2.cxx AliModuleInfo.cxx AliDisplayClusters.cxx \ + AliMenu.cxx AliDisplayHLT.cxx AliSliderFrame.cxx \ + AliDetectorFrame.cxx AliShutterItem.cxx AliShutterFrame.cxx \ + AliDisplayFrame.cxx AliInfoFrame.cxx AliSettingFrame.cxx HDRS:= $(SRCS:.cxx=.h)