From Alexandru: changes in TRD visualization.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Oct 2006 15:51:14 +0000 (15:51 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Oct 2006 15:51:14 +0000 (15:51 +0000)
12 files changed:
EVE/Alieve/LinkDef.h
EVE/Alieve/TRDData.cxx
EVE/Alieve/TRDData.h
EVE/Alieve/TRDLoader.cxx
EVE/Alieve/TRDLoader.h
EVE/Alieve/TRDLoaderSingle.cxx [new file with mode: 0644]
EVE/Alieve/TRDLoaderSingle.h [new file with mode: 0644]
EVE/Alieve/TRDModule.cxx
EVE/Alieve/TRDModule.h
EVE/Alieve/TRDModuleImp.cxx
EVE/Alieve/TRDModuleImp.h
EVE/alice-macros/init_trd.C

index e157214..ef6d71e 100644 (file)
@@ -54,6 +54,7 @@
 
 // TRD
 #pragma link C++ class Alieve::TRDLoader+;
+#pragma link C++ class Alieve::TRDLoaderSingle+;
 #pragma link C++ class Alieve::TRDLoaderEditor+;
 #pragma link C++ class Alieve::TRDModule+;
 #pragma link C++ class Alieve::TRDChamber+;
index 6f3e097..2e0e7e8 100644 (file)
@@ -4,6 +4,7 @@
 #include "AliTRDcalibDB.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDgeometry.h"
+#include "AliTRDdigitsManager.h"
 
 using namespace Reve;
 using namespace Alieve;
@@ -20,23 +21,19 @@ ClassImp(TRDHits)
 TRDDigits::TRDDigits(TRDChamber *p): OldQuadSet("digits", ""), RenderElement()
 {
        fChamber = p;
-       
-       kLog = kFALSE;
-       kBox  = kFALSE;
-       fThreshold = 10;
 }
 
 //________________________________________________________
-void   TRDDigits::SetData(AliTRDdataArrayI *digits)
+void   TRDDigits::SetData(AliTRDdigitsManager *digits)
 {
        
        fData.Allocate(fChamber->rowMax, fChamber->colMax, fChamber->timeMax);
-       digits->Expand();
+//     digits->Expand();
        for (Int_t  row = 0;  row <  fChamber->rowMax;  row++)
                for (Int_t  col = 0;  col <  fChamber->colMax;  col++)
                        for (Int_t time = 0; time < fChamber->timeMax; time++) {
-//             if(digits->GetDataUnchecked(row, col, time) > 20) printf("%d %d %d %d\n", row, col, time, digits->GetDataUnchecked(row, col, time));
-               fData.SetDataUnchecked(row, col, time, digits->GetDataUnchecked(row, col, time));
+                               if(digits->GetDigitAmp(row, col, time, fChamber->GetID()) < 0) continue;
+                               fData.SetDataUnchecked(row, col, time, digits->GetDigitAmp(row, col, time, fChamber->GetID()));
        }
 }
 
@@ -75,10 +72,10 @@ void        TRDDigits::ComputeRepresentation()
                        
                        for (Int_t time = 0; time < fChamber->timeMax; time++) {
                                charge = fData.GetDataUnchecked(row, col, time);
-                       if (charge < fThreshold) continue;
+                       if (charge < fChamber->GetDigitsThreshold()) continue;
                                
                                x = fChamber->fX0 - (time+0.5-t0)*timeBinSize;
-                               scale = kLog ? TMath::Log(float(charge))/TMath::Log(1024.) : charge/1024.;
+                               scale = fChamber->GetDigitsLog() ? TMath::Log(float(charge))/TMath::Log(1024.) : charge/1024.;
                                color  = 50+int(scale*50.);
                                
                                cloc[0][2] = z - rowSize * scale;
@@ -98,7 +95,7 @@ void  TRDDigits::ComputeRepresentation()
                                cloc[3][0] = x;
        
                                Float_t* p;
-                               if(kBox){
+                               if( fChamber->GetDigitsBox()){
                                        fBoxes.fBoxes.push_back(Reve::Box());
                                        fBoxes.fBoxes.back().color[0] = (UChar_t)color;
                                        fBoxes.fBoxes.back().color[1] = (UChar_t)color;
@@ -129,7 +126,7 @@ void        TRDDigits::ComputeRepresentation()
 //________________________________________________________
 void TRDDigits::Paint(Option_t *option)
 {
-       if(kBox) fBoxes.Paint(option);
+       if(fChamber->GetDigitsBox()) fBoxes.Paint(option);
        else OldQuadSet::Paint(option);
 }
 
index cd8ed81..562e3dd 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "AliTRDdataArrayI.h"
 
+class AliTRDdigitsManager;
 namespace Alieve {
        class TRDChamber;
        class TRDHits : public Reve::PointSet
@@ -46,16 +47,12 @@ namespace Alieve {
                void                    ComputeRepresentation();
                void                    Paint(Option_t *opt="");
                void                    Reset();
-               void                    SetShow(Bool_t log=kFALSE, Bool_t box=kFALSE){kLog = log; kBox=box;}
-               void                    SetData(AliTRDdataArrayI *digits);
-               void                    SetThreshold(Int_t t){fThreshold = t;}
+               void                    SetData(AliTRDdigitsManager *digits);
 
        protected:
                TRDChamber *fChamber;
        
        private:
-               Bool_t                                          kLog, kBox;
-               UShort_t                                        fThreshold;
                Reve::BoxSet                    fBoxes;
                AliTRDdataArrayI        fData;
                
index 2094912..58abb48 100644 (file)
@@ -41,16 +41,17 @@ ClassImp(Alieve::TRDLoaderEditor)
 
 
 //________________________________________________________
-TRDLoader::TRDLoader(const Text_t* n, const Text_t* t) : Reve::RenderElementListBase(), TNamed(n,t)
-{
-//     fChambers = 0x0;
-       fRunLoader = 0x0;
-//     fTRDLoader = 0x0;
-       
+TRDLoader::TRDLoader(const Text_t* n, const Text_t* t) : Reve::RenderElementListBase(), TNamed(n,t), fSM(-1), fStack(-1), fLy(-1), fEvent(0)
+{      
        kLoadHits = kFALSE;
        kLoadDigits = kFALSE;
        kLoadClusters = kFALSE;
        kLoadTracks = kFALSE;
+       fFilename = "";
+       fDir = ".";
+       
+       fRunLoader = 0x0;
+       fGeo = new AliTRDgeometry();
        
        AliCDBManager *fCDBManager=AliCDBManager::Instance();
        fCDBManager->SetDefaultStorage("local://$ALICE_ROOT");
@@ -113,11 +114,12 @@ void      TRDLoader::AddChambers(const int sm, const int stk, const int ly)
                                STK->FindListTreeItem(gReve->GetListTree())->SetTipText(Form("SM %2d Stack %1d", ism, istk));
                        }
                        for(int ily=ily_start; ily<ily_stop; ily++){
-                               det = AliTRDgeometry::GetDetector(ily, istk, ism);
+                               det = fGeo->GetDetector(ily, istk, ism);
                                ichmb = find_if(STK->begin(), STK->end(), ID<RenderElement*>(det));
                                if(ichmb != STK->end()) (*ichmb)->SetRnrElement(kTRUE);
                                else{
                                        gReve->AddRenderElement(STK, CHMB = new TRDChamber(det));
+                                       CHMB->SetGeometry(fGeo);
                                        CHMB->FindListTreeItem(gReve->GetListTree())->SetTipText(Form("SM %2d Stack %1d Layer %1d", ism, istk, ily));
                                }
                        }
@@ -130,11 +132,10 @@ void      TRDLoader::AddChambers(const int sm, const int stk, const int ly)
 TRDChamber*    TRDLoader::GetChamber(const int d)
 {
        lpRE_i ism, istack, ichmb;
-       AliTRDgeometry *geo = fTRD->GetGeometry();
        
-       ism = find_if(fChildren.begin(), fChildren.end(), ID<RenderElement*>(geo->GetSector(d)));
+       ism = find_if(fChildren.begin(), fChildren.end(), ID<RenderElement*>(fGeo->GetSector(d)));
        if(ism == fChildren.end()) return 0x0;
-       istack = find_if(((TRDNode*)(*ism))->begin(), ((TRDNode*)(*ism))->end(), ID<RenderElement*>(geo->GetChamber(d)));
+       istack = find_if(((TRDNode*)(*ism))->begin(), ((TRDNode*)(*ism))->end(), ID<RenderElement*>(fGeo->GetChamber(d)));
        if(istack == ((TRDNode*)(*ism))->end()) return 0x0;
        ichmb = find_if(((TRDNode*)(*istack))->begin(), ((TRDNode*)(*istack))->end(), ID<RenderElement*>(d));
        if(ichmb == ((TRDNode*)(*istack))->end()) return 0x0;
@@ -145,6 +146,8 @@ TRDChamber* TRDLoader::GetChamber(const int d)
 Bool_t TRDLoader::GoToEvent(const int ev)
 {
        Info("GoToEvent", Form("Event = %d", ev));
+       fEvent = ev;
+
        if(!fRunLoader) return kFALSE;
        fRunLoader->UnloadAll("TRD");
        Unload();
@@ -210,14 +213,14 @@ Bool_t    TRDLoader::LoadDigits(TTree *tD)
        if(!fChildren.size()) return kTRUE;
        
        TRDChamber *chmb;
-       AliTRDdataArrayI *digits;
        AliTRDdigitsManager dm;
        dm.ReadDigits(tD);
        for(int idet=0; idet<540; idet++){
                if(!(chmb=GetChamber(idet))) continue;
-               digits = dm.GetDigits(idet);
-               if(!digits) continue;
-               chmb->LoadDigits(digits);
+//             digits = dm.GetDigits(idet);
+//             if(!digits) continue;
+//             chmb->LoadDigits(digits);
+               chmb->LoadDigits(&dm);
        }
        return kTRUE;
 }
@@ -230,7 +233,7 @@ Bool_t      TRDLoader::LoadHits(TTree *tH)
        if(!fChildren.size()) return kTRUE;
        
        TRDChamber *chmb = 0x0;
-       AliTRDhit *hit;
+       AliTRDhit *hit = 0x0;
        Int_t d;
        for(int iTrack=0; iTrack<tH->GetEntries(); iTrack++){
                gAlice->ResetHits();
@@ -272,15 +275,21 @@ Bool_t    TRDLoader::LoadTracklets(TTree *tT)
 }
        
 //________________________________________________________
-Bool_t TRDLoader::Open(const char *filename)
+Bool_t TRDLoader::Open(const char *filename, const char *dir)
 {
-       fRunLoader = AliRunLoader::GetRunLoader();
+       fFilename = filename;
+       fDir = dir;
+       fDir += "/";
+       
+       fRunLoader = AliRunLoader::GetRunLoader();
        if(!fRunLoader) fRunLoader = AliRunLoader::Open(filename,
                                AliConfig::GetDefaultEventFolderName(),"read");
        if(!fRunLoader){
                Error("Open()", "Couldn't find run loader");
                return kFALSE;
        }
+       fRunLoader->SetDirName(fDir);
+       
        gAlice = fRunLoader->GetAliRun();
   if(!gAlice) fRunLoader->LoadgAlice();
        if(!gAlice){
@@ -292,7 +301,7 @@ Bool_t      TRDLoader::Open(const char *filename)
                Error("Open()", "Couldn't find TRD");
                return kFALSE;
        }
-
+       
        return kTRUE;
 }
 
@@ -326,7 +335,7 @@ TRDLoaderEditor::TRDLoaderEditor(const TGWindow* p, Int_t width, Int_t height, U
        MakeTitle("TRDLoader");
        
   fFile = 0x0;
-       fOpenFile = 0x0;
+       TGTextButton *fOpenFile = 0x0;
        Int_t labelW = 42;
   {
     TGHorizontalFrame* f = new TGHorizontalFrame(this);
@@ -365,46 +374,42 @@ TRDLoaderEditor::TRDLoaderEditor(const TGWindow* p, Int_t width, Int_t height, U
 
        // "Chamber(s) selector" group frame
        TGGroupFrame *fGroupFrame1974 = new TGGroupFrame(this,"Chamber(s) selector");
+       TGVerticalFrame *fVerticalFrame1974 = new TGVerticalFrame(fGroupFrame1974, 150, 50,kVerticalFrame);
+  
+       fSMNumber = new RGValuator(fVerticalFrame1974, "SM:", 0, 0);
+  fSMNumber->SetShowSlider(kFALSE);
+  fSMNumber->SetLabelWidth(labelW);
+  fSMNumber->SetNELength(6);
+  fSMNumber->Build();
+  fSMNumber->SetLimits(-1, 17);
+  fSMNumber->SetToolTip("Supermodule id [-1 for all]");
+       fVerticalFrame1974->AddFrame(fSMNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
+
+       fStackNumber = new RGValuator(fVerticalFrame1974, "Stack:", 0, 0);
+  fStackNumber->SetShowSlider(kFALSE);
+  fStackNumber->SetLabelWidth(labelW);
+  fStackNumber->SetNELength(6);
+  fStackNumber->Build();
+  fStackNumber->SetLimits(-1, 4);
+  fStackNumber->SetToolTip("Stack id [-1 for all in this SM]");
+       fVerticalFrame1974->AddFrame(fStackNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
+
+       fPlaneNumber = new RGValuator(fVerticalFrame1974, "Plane:", 0, 0);
+  fPlaneNumber->SetShowSlider(kFALSE);
+  fPlaneNumber->SetLabelWidth(labelW);
+  fPlaneNumber->SetNELength(6);
+  fPlaneNumber->Build();
+  fPlaneNumber->SetLimits(-1, 5);
+  fPlaneNumber->SetToolTip("Plane id [-1 for all in this stack]");
+
+       fVerticalFrame1974->AddFrame(fPlaneNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
        
-       TGVerticalFrame *fVerticalFrame1974 = new TGVerticalFrame(fGroupFrame1974,128,26,kVerticalFrame);
-
-       // horizontal frame
-       TGHorizontalFrame *fHorizontalFrame2020 = new TGHorizontalFrame(fVerticalFrame1974,128,26,kHorizontalFrame);
-       TGLabel *fLabel2170 = new TGLabel(fHorizontalFrame2020,"SM   ");
-       fLabel2170->SetTextJustify(kTextLeft | kTextCenterY);
-       fHorizontalFrame2020->AddFrame(fLabel2170, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-
-       fSMNumber = new TGNumberEntry(fHorizontalFrame2020, (Int_t) -1, 5, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, -1, 17);
-       fHorizontalFrame2020->AddFrame(fSMNumber, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsCenterY,2,2,2,2));
-
-       fVerticalFrame1974->AddFrame(fHorizontalFrame2020, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-
-       // horizontal frame
-       TGHorizontalFrame *fHorizontalFrame2025 = new TGHorizontalFrame(fVerticalFrame1974,128,28,kHorizontalFrame);
-       TGLabel *fLabel2186 = new TGLabel(fHorizontalFrame2025,"Stack");
-       fLabel2186->SetTextJustify(kTextLeft | kTextCenterY);
-       fHorizontalFrame2025->AddFrame(fLabel2186, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-       fStackNumber = new TGNumberEntry(fHorizontalFrame2025, (Int_t) -1, 5, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, -1, 4);
-       fHorizontalFrame2025->AddFrame(fStackNumber, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsCenterY,2,2,2,2));
-
-       fVerticalFrame1974->AddFrame(fHorizontalFrame2025, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-
-       // horizontal frame
-       TGHorizontalFrame *fHorizontalFrame2030 = new TGHorizontalFrame(fVerticalFrame1974,128,26,kHorizontalFrame);
-       TGLabel *fLabel2208 = new TGLabel(fHorizontalFrame2030,"Plane");
-       fLabel2208->SetTextJustify(kTextLeft | kTextCenterY);
-       fHorizontalFrame2030->AddFrame(fLabel2208, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-       fPlaneNumber = new TGNumberEntry(fHorizontalFrame2030, (Int_t) -1, 5, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, -1, 5);
-       fHorizontalFrame2030->AddFrame(fPlaneNumber, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsCenterY,2,2,2,2));
-
-       fVerticalFrame1974->AddFrame(fHorizontalFrame2030, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-       
-       fGroupFrame1974->AddFrame(fVerticalFrame1974, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandY | kLHintsExpandX,2,2,2,2));
+       fGroupFrame1974->AddFrame(fVerticalFrame1974, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandY | kLHintsCenterX,2,2,2,2));
 
        TGTextButton *fTextButton2037 = new TGTextButton(fGroupFrame1974,"Select");
        fTextButton2037->SetTextJustify(36);
-       fTextButton2037->Resize(128,22);
-       fGroupFrame1974->AddFrame(fTextButton2037, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
+//     fTextButton2037->Resize(128,22);
+       fGroupFrame1974->AddFrame(fTextButton2037, new TGLayoutHints(kLHintsExpandY | kLHintsCenterX,2,2,2,2));
        fTextButton2037->Connect("Clicked()",
                                        "Alieve::TRDLoaderEditor", this, "AddChambers()");
 
@@ -421,8 +426,8 @@ TRDLoaderEditor::TRDLoaderEditor(const TGWindow* p, Int_t width, Int_t height, U
        fGroupFrame1987->AddFrame(fLoadDigits, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
        fLoadClusters = new TGCheckButton(fGroupFrame1987,"  Clusters");
        fGroupFrame1987->AddFrame(fLoadClusters, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
-       fLoadESDs = new TGCheckButton(fGroupFrame1987,"  Tracklets ");
-       fGroupFrame1987->AddFrame(fLoadESDs, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
+       fLoadTracks = new TGCheckButton(fGroupFrame1987,"  Tracklets ");
+       fGroupFrame1987->AddFrame(fLoadTracks, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
 
        fGroupFrame1987->SetLayoutManager(new TGVerticalLayout(fGroupFrame1987));
 //     fGroupFrame1987->Resize(164,116);
@@ -445,31 +450,57 @@ TRDLoaderEditor::~TRDLoaderEditor()
 void TRDLoaderEditor::SetModel(TObject* obj)
 {
        fM = dynamic_cast<TRDLoader*>(obj);
+
+       fFile->SetText(gSystem->BaseName(fM->fFilename.Data()));
+
+       Bool_t kFile = kTRUE;
+       if(fM->fFilename.CompareTo("") == 0) kFile = kFALSE;
+
+       fEvent->SetEnabled(kFile);
+       if(kFile) fEvent->GetEntry()->SetIntNumber(fM->fEvent);
+       
+       fSMNumber->SetEnabled(kFile);
+       if(kFile) fSMNumber->GetEntry()->SetIntNumber(fM->fSM);
+       fStackNumber->SetEnabled(kFile);
+       if(kFile) fStackNumber->GetEntry()->SetIntNumber(fM->fStack);
+       fPlaneNumber->SetEnabled(kFile);
+       if(kFile) fPlaneNumber->GetEntry()->SetIntNumber(fM->fLy);
+       
+       fLoadHits->SetEnabled(kFile);
+       if(kFile) fLoadHits->SetState(fM->kLoadHits ? kButtonDown : kButtonUp);
+       fLoadDigits->SetEnabled(kFile);
+       if(kFile) fLoadDigits->SetState(fM->kLoadDigits ? kButtonDown : kButtonUp);
+       fLoadClusters->SetEnabled(kFile);
+       if(kFile) fLoadClusters->SetState(fM->kLoadClusters ? kButtonDown : kButtonUp);
+       fLoadTracks->SetEnabled(kFile);
+       if(kFile) fLoadTracks->SetState(fM->kLoadTracks ? kButtonDown : kButtonUp);
 }
 
 //________________________________________________________
 void TRDLoaderEditor::AddChambers()
 {
-       fM->AddChambers((int)fSMNumber->GetNumber(),
-               (int)fStackNumber->GetNumber(),
-               (int)fPlaneNumber->GetNumber());
+       fM->fSM    = (int)fSMNumber->GetEntry()->GetNumber();
+       fM->fStack = (int)fStackNumber->GetEntry()->GetNumber();
+       fM->fLy    = (int)fPlaneNumber->GetEntry()->GetNumber();
+       fM->AddChambers(fM->fSM, fM->fStack, fM->fLy);
 }
 
 //________________________________________________________
 void TRDLoaderEditor::FileOpen()
 {
   TGFileInfo fi;
-/*  fi.fIniDir    = StrDup(gSystem->DirName (fM->fFile));
-  fi.fFilename  = StrDup(gSystem->BaseName(fM->fFile));
-  fi.fFileTypes = tpcfiletypes;
-*/
+  fi.fIniDir    = StrDup(gSystem->DirName (fM->fFilename.Data()));
+  fi.fFilename  = StrDup(gSystem->BaseName(fM->fFilename.Data()));
+//  fi.fFileTypes = tpcfiletypes;
+
   new TGFileDialog(fClient->GetRoot(), gReve, kFDOpen, &fi);
   if (!fi.fFilename) return;
 
   fFile->SetToolTipText(gSystem->DirName (fi.fFilename));
   fFile->SetText       (gSystem->BaseName(fi.fFilename));
 
-       fM->Open(gSystem->BaseName(fi.fFilename));
+       fM->Open(gSystem->BaseName(fi.fFilename), gSystem->DirName (fi.fFilename));
+       SetModel(fM);
 }
 
 //________________________________________________________
@@ -482,7 +513,7 @@ void TRDLoaderEditor::Load()
        if(fLoadHits->IsDown()) fM->kLoadHits = kTRUE;
        if(fLoadDigits->IsDown()) fM->kLoadDigits = kTRUE;
        if(fLoadClusters->IsDown()) fM->kLoadClusters = kTRUE;
-       if(fLoadESDs->IsDown()) fM->kLoadTracks = kTRUE;
+       if(fLoadTracks->IsDown()) fM->kLoadTracks = kTRUE;
        
        fM->GoToEvent((int)fEvent->GetEntry()->GetNumber());
 }
index 341ea4e..3c05e90 100644 (file)
 #include <TNamed.h>
 #endif
 
+#ifndef ROOT_TString
+#include <TString.h>
+#endif
+
 #ifndef ROOT_TGedFrame
 #include <TGedFrame.h>
 #endif
 
-//#include <map>
-
 class AliRunLoader;
-class AliLoader;
-class AliTRDhit;
 class AliTRDv1;
+class AliTRDgeometry;
 
-class TGTextButton;
 class TGCheckButton;
 class TGNumberEntry;
 class TGColorSelect;
@@ -54,24 +54,28 @@ namespace Alieve {
                ~TRDLoader();
 
        protected:
-               virtual void    AddChambers(const int sm=-1, const int stk=-1, const int ly=-1);
-
-               TRDChamber*     GetChamber(const int d);
-               Bool_t                  GoToEvent(const int ev);
-               Bool_t                  LoadClusters(TTree *tC);
-               Bool_t                  LoadDigits(TTree *tD);
-               Bool_t                  LoadHits(TTree *tH);
-               Bool_t                  LoadTracklets(TTree *tT);
-               Bool_t                  Open(const char *filename);
-               virtual void Paint(Option_t *option="");
-               void                            Unload();
+               virtual void            AddChambers(const int sm=-1, const int stk=-1, const int ly=-1);
+               virtual TRDChamber*     GetChamber(const int d);
+               virtual Bool_t  GoToEvent(const int ev);
+               virtual Bool_t  LoadClusters(TTree *tC);
+               virtual Bool_t  LoadDigits(TTree *tD);
+               virtual Bool_t  LoadHits(TTree *tH);
+               virtual Bool_t  LoadTracklets(TTree *tT);
+               virtual Bool_t  Open(const char *file, const char *dir = ".");
+               virtual void            Paint(Option_t *option="");
+               virtual void            Unload();
                
        protected:
-               Bool_t kLoadHits, kLoadDigits, kLoadClusters, kLoadTracks;
-       
+               Bool_t  kLoadHits, kLoadDigits, kLoadClusters, kLoadTracks;
+               Int_t           fSM, fStack, fLy; // supermodule, stack, layer
+               TString fFilename; // name of data file 
+               TString fDir; // data directory
+               Int_t           fEvent; // current event to be displayed
+                       
        private:
-               AliRunLoader    *fRunLoader;
-               AliTRDv1                        *fTRD;
+               AliTRDv1                                *fTRD; // the TRD detector
+               AliTRDgeometry  *fGeo; // the TRD geometry
+               AliRunLoader            *fRunLoader; // Run Loader
                
                ClassDef(TRDLoader, 1) // Alieve Loader class for the TRD detector
        };
@@ -93,11 +97,10 @@ namespace Alieve {
        protected:
                TRDLoader* fM;
        TGTextEntry *fFile;
-               TGTextButton *fOpenFile;
                Reve::RGValuator *fEvent;
 
-               TGNumberEntry *fSMNumber, *fStackNumber, *fPlaneNumber;
-               TGCheckButton *fLoadHits, *fLoadDigits, *fLoadClusters, *fLoadESDs;
+               Reve::RGValuator *fSMNumber, *fStackNumber, *fPlaneNumber;
+               TGCheckButton *fLoadHits, *fLoadDigits, *fLoadClusters, *fLoadTracks;
                
                ClassDef(TRDLoaderEditor,1) // Editor for TRDLoader
        };
diff --git a/EVE/Alieve/TRDLoaderSingle.cxx b/EVE/Alieve/TRDLoaderSingle.cxx
new file mode 100644 (file)
index 0000000..3e101e1
--- /dev/null
@@ -0,0 +1,94 @@
+#include "TRDLoaderSingle.h"
+
+//#include "AliTRDv1.h"
+
+#include <Reve/RGTopFrame.h>
+
+#include "TString.h"
+#include "TObjString.h"
+#include "TObjArray.h"
+#include "TFile.h"
+
+using namespace Reve;
+using namespace Alieve;
+using namespace std;
+
+ClassImp(Alieve::TRDLoaderSingle)
+
+///////////////////////////////////////////////////////////
+/////////////     TRDLoaderSingle     /////////////////////
+///////////////////////////////////////////////////////////
+
+
+//________________________________________________________
+TRDLoaderSingle::TRDLoaderSingle(const Text_t* n, const Text_t* t) : TRDLoader(n, t)
+{
+}
+
+
+//________________________________________________________
+Bool_t TRDLoaderSingle::GoToEvent(const int ev)
+{
+       fEvent = ev;
+
+       Unload();
+       
+       TTree *t = 0x0;
+       TFile *f = new TFile(Form("%s/%s", fDir.Data(), fFilename.Data()));
+       if(! f->cd(Form("Event%d", ev))){
+               Error("GoToEvent()", Form("Could not find event %d in file %s.", ev, fFilename.Data()));
+               return kFALSE;
+       }
+       
+       if(kLoadHits){
+               t = (TTree*)gDirectory->Get("TreeH");
+               if(!t) return kFALSE;
+               if(!LoadHits(t)) return kFALSE;
+       }
+       if(kLoadDigits){
+               t = (TTree*)gDirectory->Get("TreeD");
+               if(!t) return kFALSE;
+               if(!LoadDigits(t)) return kFALSE;
+       }
+       if(kLoadClusters){
+               t = (TTree*)gDirectory->Get("TreeR");
+               if(!t) return kFALSE;
+               if(!LoadClusters(t)) return kFALSE;
+       }
+       if(kLoadTracks){
+               t = (TTree*)gDirectory->Get("TreeT");
+               if(!t) return kFALSE;
+               if(!LoadTracklets(t)) return kFALSE;
+       }
+       f->Close();
+       
+       gReve->Redraw3D();
+       
+       return kTRUE;
+}
+
+       
+//________________________________________________________
+Bool_t TRDLoaderSingle::Open(const char *filename, const char *dir)
+{
+       fFilename = filename;
+       fDir = dir;
+       
+       TObjArray *so = fFilename.Tokenize(".");
+
+       if(((TObjString*)(*so)[0])->GetString().CompareTo("TRD") != 0){
+               Error("Open()", "Filename didn't fulfill naming conventions. No TRD data.");
+               return kFALSE;
+       }
+       if(((TObjString*)(*so)[1])->GetString().CompareTo("Hits") == 0) kLoadHits = kTRUE;
+       else if(((TObjString*)(*so)[1])->GetString().CompareTo("Digits") == 0) kLoadDigits = kTRUE;
+       else if(((TObjString*)(*so)[1])->GetString().CompareTo("RecPoints") == 0) kLoadClusters = kTRUE;
+       else if(((TObjString*)(*so)[1])->GetString().CompareTo("Tracks") == 0) kLoadTracks = kTRUE;
+       else{
+               Error("Open()", "Filename didn't fulfill naming conventions. No data type specified.");
+               return kFALSE;
+       }
+       
+       return kTRUE;
+}
+
diff --git a/EVE/Alieve/TRDLoaderSingle.h b/EVE/Alieve/TRDLoaderSingle.h
new file mode 100644 (file)
index 0000000..27c232d
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef ALIEVE_TRDLoaderSingle_H
+#define ALIEVE_TRDLoaderSingle_H
+
+////////////////////////////////////////////////////////////////////////
+//                                                                     // - ALIEVE implementation -
+// Single event loader for the TRD detector
+//    - TRDLoader - loader of TRD data for one event
+//
+// by A.Bercuci (A.Bercuci@gsi.de)   Fri Oct 27 2006
+////////////////////////////////////////////////////////////////////////
+
+#ifndef ALIEVE_TRDLoade_H
+#include "TRDLoader.h"
+#endif
+
+namespace Alieve {
+       class TRDLoaderSingle : public TRDLoader
+       {
+       public:
+               TRDLoaderSingle(const Text_t* n="TRDLoaderSingle", const Text_t* t=0);
+
+//     protected:
+               Bool_t                  GoToEvent(const int ev);
+               Bool_t                  Open(const char *file, const char *dir=".");
+
+               ClassDef(TRDLoaderSingle, 1) // Alieve sigle event loader class for the TRD detector
+       };
+}
+#endif
index bb3baf3..2caf30a 100644 (file)
@@ -39,7 +39,7 @@ TRDModule::TRDModule(const char *typ, const Int_t det) :
 
        kDigitsNeedRecompute = kTRUE;
 
-       fDigitsThreshold = 10;
+       fDigitsThreshold = 15;
 }
 
 
@@ -160,23 +160,25 @@ void TRDModuleEditor::SetModel(TObject* obj)
 // Takes care to update UI state according to model state
 
        fM = dynamic_cast<TRDModule*>(obj);
-       if(dynamic_cast<TRDNode*>(fM)) dynamic_cast<TRDNode*>(fM)->UpdateNode();
+       if(TRDNode *node = dynamic_cast<TRDNode*>(fM)) node->UpdateNode();
        
-       if(fM->fLoadHits) fDisplayHits->SetState(fM->fRnrHits ? kButtonDown : kButtonUp);
-       else fDisplayHits->SetEnabled(kFALSE);
+       fDisplayHits->SetEnabled(fM->fLoadHits);
+       if(fM->fLoadHits) fDisplayHits->SetState( fM->fRnrHits ? kButtonDown : kButtonUp);
                
+       fDisplayDigits->SetEnabled(fM->fLoadDigits);
+       fToggleLog->SetEnabled(fM->fLoadDigits);
+       fToggleBox->SetEnabled(fM->fLoadDigits);
+       fThreshold->SetEnabled(fM->fLoadDigits);
+       fThresValue->GetNumberEntry()->SetEnabled(fM->fLoadDigits);
+       fThresValue->GetButtonDown()->SetEnabled(fM->fLoadDigits);
+       fThresValue->GetButtonUp()->SetEnabled(fM->fLoadDigits);
+       fThresValue->SetIntNumber(fM->fDigitsThreshold);
        if(fM->fLoadDigits){
                fDisplayDigits->SetState(fM->fRnrDigits ? kButtonDown : kButtonUp);
                fToggleLog->SetState(fM->fDigitsLog ? kButtonDown : kButtonUp);
                fToggleBox->SetState(fM->fDigitsBox ? kButtonDown : kButtonUp);
-               fThresValue->SetIntNumber(fM->fDigitsThreshold);
-       } else {
-               fDisplayDigits->SetEnabled(kFALSE);
-               fToggleLog->SetEnabled(kFALSE);
-               fToggleBox->SetEnabled(kFALSE);
+               fThreshold->SetState(fM->kDigitsNeedRecompute ? kButtonDown : kButtonUp);
        }
-       fThreshold->SetEnabled(fM->fLoadDigits);
-
        
        if(fM->fLoadRecPoints) fDisplayClusters->SetState(fM->fRnrRecPoints ? kButtonDown : kButtonUp);
        else fDisplayClusters->SetEnabled(kFALSE);
@@ -196,10 +198,9 @@ void TRDModuleEditor::ModifyDigitsView()
 void TRDModuleEditor::SetThreshold(Long_t tres)
 {
        if(!fM->fLoadDigits) return;
-       tres = (tres == 0) ? (int)fThresValue->GetNumber():tres;
        
-       fM->fDigitsThreshold = tres;
-       if(fThreshold->IsDown()) fM->kDigitsNeedRecompute = kTRUE;
+       fM->fDigitsThreshold = (tres == 0) ? (int)fThresValue->GetNumber():tres;
+       fM->kDigitsNeedRecompute = fThreshold->IsDown();
        UpdateChamber();
 }
 
index 8dec85a..ee04fd8 100644 (file)
@@ -36,6 +36,9 @@ namespace Alieve {
                TRDModule(const char *typ="XXX", const Int_t id=0);
                virtual ~TRDModule() {}
        
+               virtual Bool_t GetDigitsBox(){return fDigitsBox;}
+               virtual Bool_t GetDigitsLog(){return fDigitsLog;}
+               virtual UShort_t GetDigitsThreshold(){return fDigitsThreshold;}
                virtual Int_t   GetID(){return fDet;}
                virtual void    Paint(Option_t* option="")=0;
                virtual void    Reset()=0;
index f919cc8..f0e92ec 100644 (file)
@@ -55,13 +55,13 @@ void        TRDNode::Reset()
 }
 
 //________________________________________________________
-void TRDNode::Colapse()
+void TRDNode::Collapse()
 {
        TGListTree *list = gReve->GetListTree();
        TRDNode *node = 0x0;
        lpRE_i iter = fChildren.begin();
        while(iter != fChildren.end()){
-               if((node = dynamic_cast<TRDNode*>(*iter))) node->Colapse();
+               if((node = dynamic_cast<TRDNode*>(*iter))) node->Collapse();
                list->CloseItem(FindListTreeItem(list));
                iter++;
        }
@@ -204,42 +204,26 @@ void TRDNode::UpdateNode()
 
 //________________________________________________________
 TRDChamber::TRDChamber(const Int_t det) :
-  Reve::RenderElement(), TRDModule("Chmb", det)
+  Reve::RenderElement(), TRDModule("Chmb", det), rowMax(-1), colMax(-1), timeMax(22), fX0(0.), fPla(-1)
 {
   //
   // Constructor
   //
+       
        fDigits    = 0x0;
        fHits      = 0x0;
        fRecPoints = 0x0;
        fTracklets = 0x0;
        
-       fPadPlane = 0x0;
-       fGeo      = 0x0;        
-}
-
-//________________________________________________________
-void TRDChamber::Init()
-{
-       if(!gAlice) return;
-
-       AliTRDv1 *trd = (AliTRDv1*)gAlice->GetDetector("TRD");
-  fGeo = trd->GetGeometry();
-       fPla = fGeo->GetPlane(fDet);
-       timeMax = 22;
-       fX0 = fGeo->GetTime0(fPla);
-       
-       AliTRDCommonParam *parcom = AliTRDCommonParam::Instance();
-       fPadPlane = parcom->GetPadPlane(fPla,fGeo->GetChamber(fDet));
-       rowMax = fPadPlane->GetNrows();
-       colMax = fPadPlane->GetNcols();
-       
        AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
        samplingFrequency = calibration->GetSamplingFrequency();
+       
+       fGeo      = 0x0;
+       fPadPlane = 0x0;
 }
 
 //________________________________________________________
-TRDChamber::TRDChamber(const TRDChamber &mod) :
+TRDChamber::TRDChamber(const TRDChamber &mod):
   Reve::RenderElement(), TRDModule("Chmb", mod.fDet)
 {
   //
@@ -275,13 +259,17 @@ void TRDChamber::LoadClusters(TObjArray *clusters)
   // Draw clusters
   //
        
+       if(!fGeo){
+               Error("LoadClusters()", Form("Geometry not set for chamber %d. Please call first TRDChamber::SetGeometry().", fDet));
+               return;
+       }
+//     Info("LoadClusters()", Form("clusters = 0x%x", clusters));
        if(!fRecPoints){
                fRecPoints = new TRDHits("clusters");
                fRecPoints->SetMarkerSize(1.);
                fRecPoints->SetMarkerStyle(24);
                fRecPoints->SetMarkerColor(6);
-       }
-       if(!fGeo) Init();
+       } else fRecPoints->Reset();
 
        Float_t q, z0;
   Double_t cloc[3], cglo[3];
@@ -302,13 +290,17 @@ void TRDChamber::LoadClusters(TObjArray *clusters)
 }
 
 //________________________________________________________
-void TRDChamber::LoadDigits(AliTRDdataArrayI *digits)
+void TRDChamber::LoadDigits(AliTRDdigitsManager *digits)
 {
   //
   // Draw digits
   //
-
-       if(!fPadPlane) Init();
+       if(!fGeo){
+               Error("LoadDigits()", Form("Geometry not set for chamber %d. Please call first TRDChamber::SetGeometry().", fDet));
+               return;
+       }
+//     Info("LoadDigits()", Form("digits =0x%x", digits));
+       
        if(!fDigits) fDigits = new TRDDigits(this);
        else fDigits->Reset();
        
@@ -322,11 +314,14 @@ void TRDChamber::AddHit(AliTRDhit *hit)
   //
   // Draw hits
   //
+//     Info("AddHit()", Form("%s", GetName()));
+
        if(!fHits){
                fHits = new TRDHits("hits");
                fHits->SetMarkerSize(.1);
                fHits->SetMarkerColor(2);
        }
+       
        fHits->SetNextPoint(hit->X(), hit->Y(), hit->Z());
        fHits->SetPointId(this);
        fLoadHits = kTRUE;
@@ -338,11 +333,16 @@ void TRDChamber::LoadTracklets(TObjArray *tracks)
   //
   // Draw tracks
   //
+       if(!fGeo){
+               Error("LoadTracklets()", Form("Geometry not set for chamber %d. Please call first TRDChamber::SetGeometry().", fDet));
+               return;
+       }
+//     Info("LoadTracklets()", Form("tracks = 0x%x", tracks));
+       
        if(!fTracklets){
                fTracklets = new std::vector<Reve::Track*>;
-       }
+       } else fTracklets->clear();
        
-       if(!fGeo) Init();
        
        AliTRDmcmTracklet *trk = 0x0;
        Double_t cloc[3], cglo[3];
@@ -373,8 +373,6 @@ void        TRDChamber::Paint(Option_t* option)
        if(!fRnrElement) return;
        if(fDigits && fRnrDigits){
                if(kDigitsNeedRecompute){
-                       fDigits->SetShow(fDigitsLog, fDigitsBox);
-                       fDigits->SetThreshold(fDigitsThreshold);
                        fDigits->ComputeRepresentation();
                        kDigitsNeedRecompute = kFALSE;
                }
@@ -408,3 +406,17 @@ void       TRDChamber::Reset()
        }
 }
 
+//________________________________________________________
+void TRDChamber::SetGeometry(AliTRDgeometry *geo)
+{
+       fGeo = geo;
+               
+       fPla = fGeo->GetPlane(fDet);
+       fX0 = fGeo->GetTime0(fPla);
+       
+       AliTRDCommonParam *parcom = AliTRDCommonParam::Instance();
+       fPadPlane = parcom->GetPadPlane(fPla,fGeo->GetChamber(fDet));
+       rowMax = fPadPlane->GetNrows();
+       colMax = fPadPlane->GetNcols();
+}
+
index fae15c4..f23ca3c 100644 (file)
@@ -22,6 +22,7 @@ class AliTRDpadPlane;
 class AliTRDgeometry;
 class AliTRDhit;
 class AliTRDdataArrayI;
+class AliTRDdigitsManager;
 class TObjArray;
 
 namespace Reve {
@@ -41,14 +42,14 @@ namespace Alieve {
        
                TRDChamber(const TRDChamber&);
                TRDChamber& operator=(const TRDChamber&);
-               void    Init();
                
                void    AddHit(AliTRDhit *hit);
                void    LoadClusters(TObjArray *cs);
-               void    LoadDigits(AliTRDdataArrayI *digits);
+               void    LoadDigits(AliTRDdigitsManager *digits);
                void    LoadTracklets(TObjArray *ts);
                void    Paint(Option_t* option="");
                void    Reset();
+               void    SetGeometry(AliTRDgeometry *geo);
                
        protected:
                TRDDigits       *fDigits;   // digits representation
@@ -77,7 +78,7 @@ namespace Alieve {
                void    Paint(Option_t* option="");
                void    Reset();
 
-               void    Colapse(); // *MENU*
+               void    Collapse(); // *MENU*
                void    Expand(); // *MENU*
                void    EnableListElements(); // *MENU*
                void    DisableListElements(); // *MENU*
index cded4b5..4f4ff9e 100644 (file)
@@ -6,7 +6,15 @@ void init_trd()
     (new TSystemDirectory(macdir.Data(), macdir.Data()));
        Reve::AssertMacro("region_marker.C");
        
-       Alieve::TRDLoader *trdl=new Alieve::TRDLoader();
+       Alieve::TRDLoader *trdl=new Alieve::TRDLoader("Simulations", "TRDLoader for simulations");
        gReve->AddRenderElement(trdl);
        gReve->DrawRenderElement(trdl);
+       
+       Alieve::TRDLoader *trdld=new Alieve::TRDLoaderSingle("Digits", "TRDLoaderSingle for Digits");
+       gReve->AddRenderElement(trdld);
+       gReve->DrawRenderElement(trdld);
+       
+       Alieve::TRDLoader *trdlc=new Alieve::TRDLoaderSingle("Clusters", "TRDLoaderSingle for Clusters");
+       gReve->AddRenderElement(trdlc);
+       gReve->DrawRenderElement(trdlc);
 }
\ No newline at end of file