From Annalisa: new files for TOF visualization.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jun 2007 14:29:34 +0000 (14:29 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jun 2007 14:29:34 +0000 (14:29 +0000)
12 files changed:
EVE/Alieve/TOFDigitsInfo.cxx [new file with mode: 0644]
EVE/Alieve/TOFDigitsInfo.h [new file with mode: 0644]
EVE/Alieve/TOFDigitsInfoEditor.cxx [new file with mode: 0644]
EVE/Alieve/TOFDigitsInfoEditor.h [new file with mode: 0644]
EVE/Alieve/TOFSector.cxx [new file with mode: 0644]
EVE/Alieve/TOFSector.h [new file with mode: 0644]
EVE/Alieve/TOFSectorEditor.cxx [new file with mode: 0644]
EVE/Alieve/TOFSectorEditor.h [new file with mode: 0644]
EVE/Alieve/TOFStrip.cxx [new file with mode: 0644]
EVE/Alieve/TOFStrip.h [new file with mode: 0644]
EVE/Alieve/TOFStripEditor.cxx [new file with mode: 0644]
EVE/Alieve/TOFStripEditor.h [new file with mode: 0644]

diff --git a/EVE/Alieve/TOFDigitsInfo.cxx b/EVE/Alieve/TOFDigitsInfo.cxx
new file mode 100644 (file)
index 0000000..ca42ca7
--- /dev/null
@@ -0,0 +1,247 @@
+//
+// TOFDigitsInfo
+//
+
+#include <Reve/TTreeTools.h>
+
+#include "TOFDigitsInfo.h"
+#include <AliTOFdigit.h>
+#include <AliTOFGeometryV5.h>
+//#include <AliTOFDigitMap.h>
+
+using namespace Reve;
+using namespace Alieve;
+using namespace std;
+
+//_________________________________________________________
+
+ClassImp(TOFDigitsInfo)
+
+  TOFDigitsInfo::TOFDigitsInfo(): 
+    TObject(),
+    ReferenceCount(),
+    fTree (0),
+    fNewTree (0),
+    fGeom (0),
+    fTOFdigitMap(new AliTOFDigitMap())
+{}
+/* ******************************************************* */
+
+TOFDigitsInfo:: ~TOFDigitsInfo() 
+{
+
+  delete fGeom;
+  delete fTree;
+  delete fNewTree;
+  delete fTOFdigitMap;
+
+}
+/* ******************************************************* */
+
+void TOFDigitsInfo::SetTree(TTree* tree)
+{
+  static const Exc_t eH("TOFDigitsInfo::SetTree ");
+  
+  if(fGeom == 0) {
+    fGeom = new AliTOFGeometryV5();
+  }
+  
+  fTree = tree;
+  /*
+  DecRefCount();
+  IncRefCount();
+  */
+}
+/* ******************************************************* */
+
+void TOFDigitsInfo::LoadDigits()
+{
+
+  TClonesArray *digitsTOF = 0x0;
+  AliTOFdigit *digs;
+
+  fTree->SetBranchAddress("TOF",&digitsTOF);
+  fTree->GetEntry(0);
+
+  Int_t vol[5] = {-1,-1,-1,-1,-1};
+
+  for (Int_t digitNumber=0; digitNumber<digitsTOF->GetEntries(); digitNumber++) {
+
+    //if (digitNumber==digitsTOF->GetEntries()-1) printf(" Hello  4 -> %3i digit of %i \n", digitNumber+1, digitsTOF->GetEntries());
+  
+    digs = (AliTOFdigit*)digitsTOF->UncheckedAt(digitNumber);
+
+    vol[0] = digs->GetSector(); // Sector Number (0-17)
+    vol[1] = digs->GetPlate();  // Plate Number (0-4)
+    vol[2] = digs->GetStrip();  // Strip Number (0-14/18)
+    vol[3] = digs->GetPadx();   // Pad Number in x direction (0-47)
+    vol[4] = digs->GetPadz();   // Pad Number in z direction (0-1)
+
+    fTOFdigitMap->AddDigit(vol, digitNumber);
+    //if (digitNumber==digitsTOF->GetEntries()-1) printf(" I am inside LoadDigits %3i \n", digitNumber);
+
+  }
+
+}
+
+/* ******************************************************* */
+
+void TOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
+                             Int_t nStrip, Int_t nPadZ, Int_t nPadX,
+                             Int_t indexDigit[3])
+{
+
+  Int_t vol[5] = {nSector,nPlate,nStrip,nPadX,nPadZ};
+
+  fTOFdigitMap->GetDigitIndex(vol, indexDigit);
+
+}
+/* ******************************************************* */
+
+TClonesArray* TOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
+                                      Int_t nStrip)
+{
+
+  Int_t newCounter = 0;
+  Int_t nDigitsInVolume[3] = {-1, -1, -1};
+  Int_t dummy[3] = {-1, -1, -1};
+  Int_t informations[4] = {-1, -1, -1, -1};
+
+  TClonesArray* digitsTOFnew = new TClonesArray("AliTOFdigit",  300);
+  TClonesArray &ldigits = *digitsTOFnew;
+
+  AliTOFdigit *digs;
+
+  TClonesArray *digitsTOF = 0x0;
+  fTree->SetBranchAddress("TOF",&digitsTOF);
+  fTree->GetEntry(0);
+
+
+  Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
+
+  for(Int_t iPadZ=0; iPadZ<fGeom->NpadZ(); iPadZ++){
+    vol[4] = iPadZ;
+    for(Int_t iPadX=0; iPadX<fGeom->NpadX(); iPadX++) {
+      vol[3] = iPadX;
+
+      //GetDigits(vol[0], vol[1], vol[2], vol[3], vol[4], nDigitsInVolume)
+
+      fTOFdigitMap->GetDigitIndex(vol, nDigitsInVolume);
+
+      for (Int_t ii=0; ii<3; ii++) {
+
+       if (nDigitsInVolume[ii]>=0 ) {
+         //printf("  nDigitsInVolume[%2i]  = %3i\n ", ii, nDigitsInVolume[ii]);
+         digs = (AliTOFdigit*)digitsTOF->UncheckedAt(nDigitsInVolume[ii]);
+         informations[0] = digs->GetTdc();
+         informations[1] = digs->GetAdc();
+         informations[2] = digs->GetToT();
+         informations[3] = digs->GetTdcND();
+         new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations);
+       }
+
+      }
+
+      for (Int_t ii=0; ii<4; ii++) informations[ii]=-1;
+      for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1;
+      for (Int_t ii=0; ii<3; ii++) nDigitsInVolume[ii]=-1;
+
+    }
+  }
+
+  /*
+  if (digitsTOFnew)
+    printf("Sector %2i   Plate %1i  Strip %2i  -> number of digits %3i \n",
+          nSector, nPlate, nStrip, digitsTOFnew->GetEntries());
+  */
+  return digitsTOFnew;
+
+}
+/* ******************************************************* */
+
+TClonesArray* TOFDigitsInfo::GetDigits(Int_t nSector)
+{
+
+  Int_t newCounter = 0;
+  Int_t nDigitsInVolume[3] = {-1, -1, -1};
+  Int_t dummy[3] = {-1, -1, -1};
+  Int_t informations[4] = {-1, -1, -1, -1};
+
+  Int_t nStrips=19;
+
+  TClonesArray* digitsTOFnew = new TClonesArray("AliTOFdigit",  300);
+  TClonesArray &ldigits = *digitsTOFnew;
+
+  AliTOFdigit *digs;
+
+  TClonesArray *digitsTOF = 0x0;
+  fTree->SetBranchAddress("TOF",&digitsTOF);
+  fTree->GetEntry(0);
+
+  //Int_t nSector = 1;
+  Int_t vol[5] = {nSector,-1,-1,-1,-1};
+  for(Int_t iPlate=0; iPlate<fGeom->NPlates(); iPlate++){
+    vol[1] = iPlate;
+    if(iPlate==2) nStrips=15;
+    else nStrips=19;
+      
+    for(Int_t iStrip=0; iStrip<nStrips; iStrip++){
+      vol[2] = iStrip;
+       
+      for(Int_t iPadZ=0; iPadZ<fGeom->NpadZ(); iPadZ++){
+       vol[4] = iPadZ;
+
+       for(Int_t iPadX=0; iPadX<fGeom->NpadX(); iPadX++) {
+         vol[3] = iPadX;
+
+         //GetDigits(vol[0], vol[1], vol[2], vol[3], vol[4], nDigitsInVolume)
+
+         fTOFdigitMap->GetDigitIndex(vol, nDigitsInVolume);
+
+         for (Int_t ii=0; ii<3; ii++) {
+
+           if (nDigitsInVolume[ii]>=0 ) {
+             //printf("  nDigitsInVolume[%2i]  = %3i\n ", ii, nDigitsInVolume[ii]);
+             digs = (AliTOFdigit*)digitsTOF->UncheckedAt(nDigitsInVolume[ii]);
+             informations[0] = digs->GetTdc();
+             informations[1] = digs->GetAdc();
+             informations[2] = digs->GetToT();
+             informations[3] = digs->GetTdcND();
+             new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations);
+           }
+
+         }
+
+         for (Int_t ii=0; ii<4; ii++) informations[ii]=-1;
+         for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1;
+         for (Int_t ii=0; ii<3; ii++) nDigitsInVolume[ii]=-1;
+           
+       }
+      }
+    }
+  }
+
+  /*
+  if (digitsTOFnew)
+    printf("Sector %2i   Plate %1i  Strip %2i  -> number of digits %3i \n",
+          nSector, nPlate, nStrip, digitsTOFnew->GetEntries());
+  */
+  return digitsTOFnew;
+
+}
+/* ******************************************************* */
+
+void TOFDigitsInfo::GetDigits()
+{
+
+  for (Int_t iSector=0; iSector<fGeom->NSectors(); iSector++) {
+
+    fNewTree = new TTree();
+
+
+
+
+  }
+
+}
diff --git a/EVE/Alieve/TOFDigitsInfo.h b/EVE/Alieve/TOFDigitsInfo.h
new file mode 100644 (file)
index 0000000..9c659c0
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef ALIEVE_TOFDigitsInfo_H
+#define ALIEVE_TOFDigitsInfo_H
+
+#include <Reve/VSD.h>
+
+//#include <map>
+
+#include <TObject.h>
+#include <TClonesArray.h>
+#include <TTree.h>
+
+#include <AliTOF.h>
+#include <AliTOFGeometry.h>
+#include <AliTOFDigitMap.h>
+
+namespace Alieve {
+  
+class TOFDigitsInfo : public TObject, public Reve::ReferenceCount
+  {
+    TOFDigitsInfo(const TOFDigitsInfo&);            // Not implemented
+    TOFDigitsInfo& operator=(const TOFDigitsInfo&); // Not implemented
+    
+  private:
+
+  protected:
+
+    void        SetTOFSegmentation();
+
+  public:
+    TTree*                fTree;
+    TTree*                fNewTree;
+    AliTOFGeometry*       fGeom;
+    AliTOFDigitMap*       fTOFdigitMap;
+
+    TOFDigitsInfo();
+    virtual ~TOFDigitsInfo();
+    
+    void SetTree(TTree* tree);
+    void LoadDigits();
+
+    //TClonesArray* GetDigits(Int_t nSector,
+    void GetDigits(Int_t nSector, Int_t nPlate, Int_t nStrip,
+                  Int_t nPadZ, Int_t nPadX,
+                  Int_t indexDigit[3]);
+    TClonesArray* GetDigits(Int_t nSector, Int_t nPlate, Int_t nStrip);
+    TClonesArray* GetDigits(Int_t nSector);
+    void GetDigits();
+  
+    ClassDef(TOFDigitsInfo, 1);
+  }; // endclass TOFDigitsInfo
+  
+}
+#endif
diff --git a/EVE/Alieve/TOFDigitsInfoEditor.cxx b/EVE/Alieve/TOFDigitsInfoEditor.cxx
new file mode 100644 (file)
index 0000000..96e7c18
--- /dev/null
@@ -0,0 +1,59 @@
+// $Header$
+
+#include "TOFDigitsInfoEditor.h"
+#include <Alieve/TOFDigitsInfo.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGDoubleSlider.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TOFDigitsInfoEditor
+//
+
+ClassImp(TOFDigitsInfoEditor)
+
+TOFDigitsInfoEditor::TOFDigitsInfoEditor(const TGWindow *p, Int_t width, Int_t height,
+            UInt_t options, Pixel_t back) :
+  TGedFrame(p, width, height, options | kVerticalFrame, back),
+  fM(0)
+  // Initialize widget pointers to 0
+{
+  MakeTitle("TOFDigitsInfo");
+
+  // Create widgets
+  // fXYZZ = new TGSomeWidget(this, ...);
+  // AddFrame(fXYZZ, new TGLayoutHints(...));
+  // fXYZZ->Connect("SignalName()", "Alieve::TOFDigitsInfoEditor", this, "DoXYZZ()");
+}
+
+TOFDigitsInfoEditor::~TOFDigitsInfoEditor()
+{}
+
+/**************************************************************************/
+
+void TOFDigitsInfoEditor::SetModel(TObject* obj)
+{
+  fM = dynamic_cast<TOFDigitsInfo*>(obj);
+
+  // Set values of widgets
+  // fXYZZ->SetValue(fM->GetXYZZ());
+}
+
+/**************************************************************************/
+
+// Implements callback/slot methods
+
+// void TOFDigitsInfoEditor::DoXYZZ()
+// {
+//   fM->SetXYZZ(fXYZZ->GetValue());
+//   Update();
+// }
diff --git a/EVE/Alieve/TOFDigitsInfoEditor.h b/EVE/Alieve/TOFDigitsInfoEditor.h
new file mode 100644 (file)
index 0000000..1e95328
--- /dev/null
@@ -0,0 +1,42 @@
+// $Header$
+
+#ifndef ALIEVE_TOFDigitsInfoEditor_H
+#define ALIEVE_TOFDigitsInfoEditor_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+
+namespace Alieve {
+
+class TOFDigitsInfo;
+
+class TOFDigitsInfoEditor : public TGedFrame
+{
+private:
+  TOFDigitsInfoEditor(const TOFDigitsInfoEditor&);            // Not implemented
+  TOFDigitsInfoEditor& operator=(const TOFDigitsInfoEditor&); // Not implemented
+
+protected:
+  TOFDigitsInfo* fM; // fModel dynamic-casted to TOFDigitsInfoEditor
+
+  // Declare widgets
+  // TGSomeWidget*   fXYZZ;
+
+public:
+  TOFDigitsInfoEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+  virtual ~TOFDigitsInfoEditor();
+
+  virtual void SetModel(TObject* obj);
+
+  // Declare callback/slot methods
+  // void DoXYZZ();
+
+  ClassDef(TOFDigitsInfoEditor, 0); // Editor for TOFDigitsInfo
+}; // endclass TOFDigitsInfoEditor
+
+}
+
+#endif
diff --git a/EVE/Alieve/TOFSector.cxx b/EVE/Alieve/TOFSector.cxx
new file mode 100644 (file)
index 0000000..942a8b0
--- /dev/null
@@ -0,0 +1,383 @@
+#include "TOFSector.h"
+
+#include <Reve/RGTopFrame.h>
+
+#include <AliTOFdigit.h>
+#include <AliTOFGeometryV5.h>
+
+#include <TStyle.h>
+
+using namespace Reve;
+using namespace Alieve;
+using namespace std;
+
+Bool_t       TOFSector::fgStaticInitDone = kFALSE;
+FrameBox*    TOFSector::fgTOFsectorFrameBox = 0;
+RGBAPalette* TOFSector::fgTOFsectorPalette  = 0;
+
+//_______________________________________________________
+ClassImp(TOFSector)
+
+/* ************************************************************************ */
+
+TOFSector::TOFSector(const Text_t* n, const Text_t* t) :
+  QuadSet(n, t),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(0x0),
+  fTOFtree(0x0),
+  fSector(-1),
+  fDx(0), fDy(0), fDz(0),
+  fAutoTrans (kTRUE),
+  //fPlateFlag0(kTRUE), fPlateFlag1(kTRUE), fPlateFlag2(kTRUE), fPlateFlag3(kTRUE), fPlateFlag4(kTRUE),
+  fThreshold (5), fMaxVal    (80),
+  fSectorID  (0),
+  fGeoManager(0)
+{
+
+  fPlateFlag = new Bool_t[5];
+  for (Int_t ii=0; ii<5; ii++) fPlateFlag[ii]=kTRUE;
+
+
+  fGeoManager = (TGeoManager*)gReve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
+  if (!fGeoManager) {
+    printf("ERROR: no TGeo\n");
+  }
+
+}
+/* ************************************************************************ */
+
+TOFSector::TOFSector(TGeoManager *localGeoManager,
+                    Int_t nSector)
+  :
+  QuadSet(Form("Sector%i",nSector)),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(0x0),
+  fTOFtree(0x0),
+  fSector(nSector),
+  fDx(0), fDy(0), fDz(0),
+  fAutoTrans (kTRUE),
+  //fPlateFlag0(kTRUE), fPlateFlag1(kTRUE), fPlateFlag2(kTRUE), fPlateFlag3(kTRUE), fPlateFlag4(kTRUE),
+  fThreshold (5), fMaxVal    (80),
+  fSectorID  (nSector),
+  fGeoManager(localGeoManager)
+{
+
+  fPlateFlag = new Bool_t[5];
+  for (Int_t ii=0; ii<5; ii++) fPlateFlag[ii]=kTRUE;
+
+  /*
+  if (!fGeoManager) {
+    printf("ERROR: no TGeo\n");
+  }
+  */
+
+  InitModule();
+
+}
+/* ************************************************************************ */
+
+TOFSector::TOFSector(TGeoManager *localGeoManager,
+                    Int_t nSector,
+                    TClonesArray *tofArray)
+  :
+  QuadSet(Form("Sector%i",nSector)),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(tofArray),
+  fTOFtree(0x0),
+  fSector(nSector),
+  fDx(0), fDy(0), fDz(0),
+  fAutoTrans (kTRUE),
+  //fPlateFlag0(kTRUE), fPlateFlag1(kTRUE), fPlateFlag2(kTRUE), fPlateFlag3(kTRUE), fPlateFlag4(kTRUE),
+  fThreshold (5), fMaxVal    (80),
+  fSectorID  (nSector),
+  fGeoManager(localGeoManager)
+{
+
+  fPlateFlag = new Bool_t[5];
+  for (Int_t ii=0; ii<5; ii++) fPlateFlag[ii]=kTRUE;
+
+  InitModule();
+
+}
+/* ************************************************************************ */
+
+TOFSector::TOFSector(TGeoManager *localGeoManager,
+                    Int_t nSector,
+                    TTree *tofTree)
+  :
+  QuadSet(Form("Sector%i",nSector)),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(0x0),
+  fTOFtree(tofTree),
+  fSector(nSector),
+  fDx(0), fDy(0), fDz(0),
+  fAutoTrans (kTRUE),
+  //fPlateFlag0(kTRUE), fPlateFlag1(kTRUE), fPlateFlag2(kTRUE), fPlateFlag3(kTRUE), fPlateFlag4(kTRUE),
+  fThreshold (5), fMaxVal    (80),
+  fSectorID  (nSector),
+  fGeoManager(localGeoManager)
+{
+
+  fPlateFlag = new Bool_t[5];
+  for (Int_t ii=0; ii<5; ii++) fPlateFlag[ii]=kTRUE;
+
+  InitModule();
+
+}
+/* ************************************************************************ */
+
+TOFSector::~TOFSector()
+{
+  /*
+  fGeoManager = 0x0;
+  delete fGeoManager;
+
+  delete fTOFarray;
+  fTOFarray = 0x0;
+  */
+  delete fPlateFlag;
+
+}
+
+/* ************************************************************************ */
+/*
+void TOFSector::SetDigitsInfo(TOFDigitsInfo* info)
+{
+  if(fInfo) fInfo->DecRefCount();
+  fInfo = info;
+  if(fInfo) fInfo->IncRefCount();
+
+}
+*/
+/* ************************************************************************ */
+void TOFSector::InitStatics()
+{
+  if (fgStaticInitDone) return;
+
+  Float_t dx = 124.5;
+  Float_t dz =  29.;
+  Float_t dy = 370.6*2.;
+  fgTOFsectorFrameBox = new FrameBox();
+
+  fgTOFsectorFrameBox->SetAABox(-dx*0.5, -dy*0.5, -dz*0.5, dx, dy, dz);
+  fgTOFsectorFrameBox->SetFrameColor((Color_t) 32);//31);
+
+  //fgTOFsectorPalette  = new RGBAPalette(0, 2048); // TOT
+  fgTOFsectorPalette  = new RGBAPalette(0, 8192/*1024*/); // TDC
+  fgTOFsectorPalette->SetLimits(0, 8192); 
+
+  fgStaticInitDone = kTRUE;
+}
+
+/* ************************************************************************ */
+void TOFSector::InitModule()
+{
+
+  fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
+  //fDy = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
+  fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
+
+  if (!fgStaticInitDone) InitStatics();
+
+  SetFrame(fgTOFsectorFrameBox);
+  SetPalette(fgTOFsectorPalette);
+  //fFrame   = fgTOFsectorFrameBox;
+  //fPalette = fgTOFsectorPalette;
+
+  LoadQuads();  
+  ComputeBBox();
+  SetTrans();
+
+}
+
+/* ************************************************************************ */
+void TOFSector::LoadQuads()
+{
+
+  Reset(QT_FreeQuad, kFALSE, 32);
+
+  //Int_t n_col = gStyle->GetNumberOfColors();
+
+  Int_t vol[5] = {fSectorID, -1, -1, -1, -1};
+  Int_t informations[4] = {-1, -1, -1, -1};
+  Int_t dummy[3] = {-1, -1, -1};
+  Int_t tdc = -1;
+  Int_t tot = -1;
+
+  Double_t **coord = new Double_t*[4];
+  for (Int_t ii=0; ii<4; ii++) coord[ii] = new Double_t[3];
+
+  //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
+
+  if (fTOFtree && !fTOFarray) {
+    //printf("Hello world\n");
+    TClonesArray* digitsTOFnew = new TClonesArray("AliTOFdigit",  300);
+
+    fTOFarray = new TClonesArray("AliTOFdigit",  300);
+    TClonesArray &ldigits = *fTOFarray;
+    Int_t newCounter = 0;
+
+    AliTOFdigit *digs;
+
+    fTOFtree->SetBranchAddress("TOF",&digitsTOFnew);
+    fTOFtree->GetEntry(0);
+    for (Int_t digitNumber=0; digitNumber<digitsTOFnew->GetEntries(); digitNumber++) {
+
+      //if (digitNumber==digitsTOF->GetEntries()-1) printf(" Hello  4 -> %3i digit of %i \n", digitNumber+1, digitsTOF->GetEntries());
+  
+      digs = (AliTOFdigit*)digitsTOFnew->UncheckedAt(digitNumber);
+
+      if (digs->GetSector()!=fSectorID) continue;
+
+      vol[1] = digs->GetPlate();  // Plate Number (0-4)
+      vol[2] = digs->GetStrip();  // Strip Number (0-14/18)
+      vol[3] = digs->GetPadx();   // Pad Number in x direction (0-47)
+      vol[4] = digs->GetPadz();   // Pad Number in z direction (0-1)
+
+      informations[0] = digs->GetTdc();
+      informations[1] = digs->GetAdc();
+      informations[2] = digs->GetToT();
+      informations[3] = digs->GetTdcND();
+      new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations);
+    }
+  }
+
+  AliTOFdigit *tofDigit;
+  //printf("  0x%lx\n",fTOFarray);
+  for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
+
+    tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
+   
+    if (fPlateFlag[tofDigit->GetPlate()]) {
+
+      vol[1] = tofDigit->GetPlate();
+      vol[2] = tofDigit->GetStrip();
+      vol[3] = tofDigit->GetPadz();
+      vol[4] = tofDigit->GetPadx();
+
+      tot = tofDigit->GetToT();
+      tdc = tofDigit->GetTdc();
+
+      //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i  %1i\n", iPadX, iPadZ);
+      //if (iPadX==23 || iPadX==24) printf(" %2i  %1i %2i \n", fSector, fPlate, fStrip);
+      //if (vol[0]==4 && vol[1]==2 && vol[2]==7) {
+
+      for (Int_t kk=0; kk<4; kk++) for (Int_t jj=0; jj<3; jj++) coord[kk][jj]=0.;
+
+      fTOFgeometry->DetToSectorRF(vol, coord);
+      /*
+       printf("\n");
+       printf("  %1i   %2i,   %f  %f  %f \n", vol[3], vol[4], coord[0][0], coord[0][1], coord[0][2]);
+       printf("  %1i   %2i,   %f  %f  %f \n", vol[3], vol[4], coord[1][0], coord[1][1], coord[1][2]);
+       printf("  %1i   %2i,   %f  %f  %f \n", vol[3], vol[4], coord[2][0], coord[2][1], coord[2][2]);
+       printf("  %1i   %2i,   %f  %f  %f \n", vol[3], vol[4], coord[3][0], coord[3][1], coord[3][2]);
+      */
+      Float_t vertices[12]={(Float_t)coord[0][0], (Float_t)coord[0][1], (Float_t)coord[0][2],
+                           (Float_t)coord[1][0], (Float_t)coord[1][1], (Float_t)coord[1][2],
+                           (Float_t)coord[2][0], (Float_t)coord[2][1], (Float_t)coord[2][2],
+                           (Float_t)coord[3][0], (Float_t)coord[3][1], (Float_t)coord[3][2]};
+      
+      AddQuad(vertices);
+      //AddQuad((Float_t*)coord);
+      //AddQuad(coord[0], coord[1], coord[2], 2.5, 3.5);
+      //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
+
+      // In principle could have color based on number of neigbours. We
+      // can insert the time-of-flight value for each pad
+      //QuadValue((Int_t)tot);
+      QuadValue((Int_t)tdc);
+      QuadId(tofDigit);
+      
+    //}
+    } // closed if control on plates switched on
+  } // closed loop on TOF sector digits
+
+  RefitPlex();
+
+  fTOFarray = 0x0;
+}
+
+/* ************************************************************ */
+void TOFSector::SetTrans()
+{
+  fHMTrans.UnitTrans();
+
+  //Int_t det[5] = {fSector, -1, -1, -1, -1};
+  Char_t path[100];
+
+  Int_t localSector = fSector;
+  if (!fAutoTrans) localSector = 4;
+
+  //fTOFgeometry->GetVolumePath(det,path);
+  fTOFgeometry->GetVolumePath(localSector,path);
+  fGeoManager->cd(path);
+  TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
+  Double_t *rotMat = global.GetRotationMatrix();
+  Double_t *tr = global.GetTranslation();
+
+  fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
+  fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
+  fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
+
+  fHMTrans.SetBaseVec(4, tr);
+}
+
+//-----------------------------------------------------
+
+void TOFSector::SetSectorID(Int_t id)
+{
+  fSectorID = id;
+  fSector   = id;
+  if (fAutoTrans)
+    SetTrans(); // Force repositioning.
+
+  LoadQuads();
+}
+
+//-----------------------------------------------------
+
+void TOFSector::SetPlate(Int_t nPlate, Bool_t r)
+{
+
+  fPlateFlag[nPlate] = r;
+
+  //printf("   HELLO World ! %i %i %i \n", nPlate, r, fPlateFlag[nPlate]);
+}
+
+/**************************************************************************/
+
+void TOFSector::SetThreshold(Short_t t)
+{
+  fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1));
+  // ClearColorArray();
+}
+
+/**************************************************************************/
+
+void TOFSector::SetMaxVal(Int_t mv)
+{
+  fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1));
+  //ClearColorArray();
+}
+
+/**************************************************************************/
+
+void TOFSector::QuadSelected(Int_t idx)
+{
+  // Override control-click from QuadSet
+
+  QuadBase* qb   = GetQuad(idx);
+  TObject* obj   = qb->fId.GetObject();
+  AliTOFdigit* digs = dynamic_cast<AliTOFdigit*>(obj);
+  // printf("TOFSector::QuadSelected "); Print();
+  printf("  idx = %5i, value = %5d, obj = 0x%lx, digit = 0x%lx  ",
+        idx, qb->fValue, (ULong_t)obj, (ULong_t)digs);
+  if (digs)
+    printf("-> Sector = %2i  Plate = %1i  Strip = %2i  ToT = %3i  Tof = %5i\n",
+          fSector , digs->GetPlate(), digs->GetStrip(), digs->GetToT(), digs->GetTdc());
+  else printf("\n");
+
+}
+
+/**************************************************************************/
diff --git a/EVE/Alieve/TOFSector.h b/EVE/Alieve/TOFSector.h
new file mode 100644 (file)
index 0000000..e8bebc0
--- /dev/null
@@ -0,0 +1,103 @@
+#ifndef ALIEVE_TOFSector_H
+#define ALIEVE_TOFSector_H
+
+#include <Reve/QuadSet.h>
+#include <Reve/RenderElement.h>
+
+#include <Reve/RGBAPalette.h>
+#include <Reve/FrameBox.h>
+
+#include <TGeoManager.h>
+#include <TClonesArray.h>
+#include <TTree.h>
+
+#include <AliTOFGeometry.h>
+#include <AliTOFGeometryV5.h>
+
+namespace Alieve {
+  
+  class TOFSector : public Reve::QuadSet
+                   
+  {
+    TOFSector(const TOFSector&);            // Not implemented
+    TOFSector& operator=(const TOFSector&); // Not implemented
+    //Int_t       fSectorID;
+  private:
+
+    void LoadQuads();
+    
+  protected:
+    
+    AliTOFGeometry *fTOFgeometry;
+    
+    TClonesArray   *fTOFarray;
+    TTree          *fTOFtree;
+    
+    Int_t fSector;
+    //Int_t fPlate;
+    //Int_t fStrip;
+    
+    Float_t  fDx;
+    Float_t  fDy;
+    Float_t  fDz;
+    ///////////////////////////////
+
+    Bool_t      fAutoTrans; 
+    Int_t       fMinTime;     
+    Int_t       fMaxTime;
+    Short_t     fThreshold;
+    Int_t       fMaxVal;
+    Int_t       fSectorID; 
+    Bool_t      *fPlateFlag;
+
+    Bool_t      fPlateFlag0;
+    Bool_t      fPlateFlag1;
+    Bool_t      fPlateFlag2;
+    Bool_t      fPlateFlag3;
+    Bool_t      fPlateFlag4;
+    
+    Color_t     fFrameColor;
+    Bool_t      fRnrFrame;
+    
+    TGeoManager *fGeoManager;
+    
+  public: 
+    // Bool_t       fAutoTrans;
+    
+    virtual void InitModule();
+    virtual void SetTrans(); 
+    TOFSector(const Text_t* n="TOFSector", const Text_t* t=0);
+    TOFSector(TGeoManager *localGeoManager, Int_t nSector);
+    
+    TOFSector(TGeoManager *localGeoManager, Int_t nSector,
+             TClonesArray *tofArray);
+    TOFSector(TGeoManager *localGeoManager,
+             Int_t nSector, TTree *tofTree);
+    virtual ~TOFSector();
+    
+    
+    static Bool_t    fgStaticInitDone;
+    static void      InitStatics();
+    void SetSectorID(Int_t id);
+    void SetAutoTrans(Bool_t r){fAutoTrans=r;};
+    void SetThreshold(Short_t t);
+    void SetMaxVal(Int_t mv);
+    Bool_t GetPlate(Int_t nPlate) const {return fPlateFlag[nPlate];};
+    Short_t GetThreshold() const {return fThreshold;};
+    Int_t GetMaxVal() const {return fMaxVal;};
+    Bool_t GetAutoTrans() const {return fAutoTrans;};
+    Int_t GetSectorID() const {return fSectorID;};
+    virtual void QuadSelected(Int_t idx);
+    ///////////////////////////////////////////
+   
+    void SetPlate(Int_t nPlate, Bool_t r);
+
+  static Reve::FrameBox* fgTOFsectorFrameBox;
+  
+  static Reve::RGBAPalette* fgTOFsectorPalette;
+
+  ClassDef(TOFSector, 1);
+  }; 
+}
+#endif
diff --git a/EVE/Alieve/TOFSectorEditor.cxx b/EVE/Alieve/TOFSectorEditor.cxx
new file mode 100644 (file)
index 0000000..493cf96
--- /dev/null
@@ -0,0 +1,260 @@
+// $Header$
+
+#include "TOFSectorEditor.h"
+#include <Alieve/TOFSector.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+#include <Reve/RGValuators.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TOFSectorEditor
+//
+
+ClassImp(TOFSectorEditor)
+  
+  TOFSectorEditor::TOFSectorEditor(const TGWindow *p, Int_t width, Int_t height,
+                                  UInt_t options, Pixel_t back) :
+    TGedFrame(p, width, height, options | kVerticalFrame, back),
+    fM(0) ,
+    //fHMTrans   (0),
+    fSectorID  (0), fAutoTrans (0),
+    fPlate0(0x0), fPlate1(0x0), fPlate2(0x0), fPlate3(0x0), fPlate4(0x0),
+    fThreshold (0), fMaxVal    (0)
+    // fTime      (0)
+    // Initialize widget pointers to 0
+    //{
+    
+    /*
+      fHMTrans = new ZTransSubEditor(this);
+      fHMTrans->Connect("UseTrans()",     "Alieve::TPCSectorVizEditor", this, "Update()");
+      fHMTrans->Connect("TransChanged()", "Alieve::TPCSectorVizEditor", this, "Update()");
+      AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
+      
+      MakeTitle("TPCSectorViz");*/
+{
+  
+  fPlate = new TGCheckButton*[5];
+  for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
+  
+  //fPriority = 40;
+  MakeTitle("TOFSector");  
+
+  fSectorID = new RGValuator(this, "SectorID", 110, 0);
+  fSectorID->SetLabelWidth(60);
+  fSectorID->SetShowSlider(kFALSE);
+  fSectorID->SetNELength(4);
+  fSectorID->Build();
+  fSectorID->SetLimits(0, 17);
+  fSectorID->SetToolTip("The 18 Tof Sector's");
+  fSectorID->Connect("ValueSet(Double_t)",
+                    "Alieve::TOFSectorEditor", this, "DoSectorID()");
+  // Reuse sectorID for auto-transformation button
+  fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
+  fAutoTrans->SetToolTipText("Automatically set transformation to true position");
+  fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
+  fAutoTrans->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoAutoTrans()");
+  AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  
+  // Create widgets
+  // fXYZZ = new TGSomeWidget(this, ...);
+  // AddFrame(fXYZZ, new TGLayoutHints(...));
+  // fXYZZ->Connect("SignalName()", "Alieve::TOFSectorEditor", this, "DoXYZZ()"); {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+
+    Int_t nPlate = 0;
+    fPlate0 = new TGCheckButton(f, "Plate0");
+    f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fPlate0->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate0()");
+    //fPlate0->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
+
+    nPlate = 1;
+    fPlate1 = new TGCheckButton(f, "Plate 1");
+    f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fPlate1->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate1()");
+    //fPlate1->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
+
+    nPlate = 2;
+    fPlate2 = new TGCheckButton(f, "Plate 2");
+    f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fPlate2->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate2()");
+    //fPlate2->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
+
+    nPlate = 3;
+    fPlate3 = new TGCheckButton(f, "Plate 3");
+    f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fPlate3->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate3()");
+    //fPlate3->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
+
+    nPlate = 4;
+    fPlate4 = new TGCheckButton(f, "Plate 4");
+    f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fPlate4->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate4()");
+    //fPlate4->Connect("Toggled(Bool_t)","Alieve::TOFSectorEditor", this, "DoPlate(Int_t)");
+
+
+    fPlate[0] = fPlate0;
+    fPlate[1] = fPlate1;
+    fPlate[2] = fPlate2;
+    fPlate[3] = fPlate3;
+    fPlate[4] = fPlate4;
+
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+
+    fThreshold = new RGValuator(this, "Threshold", 200, 0);
+    fThreshold->SetNELength(4);
+    fThreshold->SetLabelWidth(60);
+    fThreshold->Build();
+    fThreshold->GetSlider()->SetWidth(120);
+    fThreshold->SetLimits(0,250);
+    fThreshold->Connect("ValueSet(Double_t)",
+                       "Alieve::TOFSectorEditor", this, "DoThreshold()");
+    AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+    
+    fMaxVal = new RGValuator(this,"MaxVal", 200, 0);
+    fMaxVal->SetNELength(4);
+    fMaxVal->SetLabelWidth(60);
+    fMaxVal->Build();
+    fMaxVal->GetSlider()->SetWidth(60);
+    fMaxVal->SetLimits(0, 500);
+    fMaxVal->Connect("ValueSet(Double_t)",
+                    "Alieve::TOFSectorEditor", this, "DoMaxVal()");
+    AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+    
+}
+
+
+
+
+TOFSectorEditor::~TOFSectorEditor()
+{}
+
+/**************************************************************************/
+
+void TOFSectorEditor::SetModel(TObject* obj)
+{
+  fM = dynamic_cast<TOFSector*>(obj);
+
+  fSectorID->SetValue(fM->GetSectorID());
+  fAutoTrans->SetState(fM->GetAutoTrans()  ? kButtonDown : kButtonUp);
+
+  fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
+  fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
+  fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
+  fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
+  fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
+
+  // Set values of widgets
+  // fXYZZ->SetValue(fM->GetXYZZ());
+}
+
+/**************************************************************************/
+void TOFSectorEditor::DoSectorID()
+{
+  fM->SetSectorID((Int_t) fSectorID->GetValue());
+  Update();
+}
+
+void TOFSectorEditor::DoAutoTrans()
+{
+  fM->SetAutoTrans(fAutoTrans->IsOn());
+  Update();
+}
+
+/**************************************************************************/
+
+void TOFSectorEditor::DoPlate(Int_t nPlate)
+{
+  fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
+  Update();
+}
+
+void TOFSectorEditor::DoPlate0()
+{
+  fM->SetPlate(0, fPlate0->IsOn());
+  Update();
+}
+
+void TOFSectorEditor::DoPlate1()
+{
+  fM->SetPlate(1, fPlate1->IsOn());
+  Update();
+}
+
+void TOFSectorEditor::DoPlate2()
+{
+  fM->SetPlate(2, fPlate2->IsOn());
+  Update();
+}
+void TOFSectorEditor::DoPlate3()
+{
+  fM->SetPlate(3, fPlate3->IsOn());
+  Update();
+}
+
+void TOFSectorEditor::DoPlate4()
+{
+  fM->SetPlate(4, fPlate4->IsOn());
+  Update();
+}
+
+
+void TOFSectorEditor::DoThreshold()
+{
+  fM->SetThreshold((Short_t) fThreshold->GetValue());
+  fThreshold->SetValue(fM->GetThreshold());
+  Update();
+}
+
+void TOFSectorEditor::DoMaxVal()
+{
+  fM->SetMaxVal((Int_t) fMaxVal->GetValue());
+  fMaxVal->SetValue(fM->GetMaxVal());
+  Update();
+}
+
+/**************************************************************************/
+/*
+void TOFSectorEditor::DoTime()
+{ 
+  fM->SetMinTime((Int_t) fTime->GetMin());
+  fM->SetMaxTime((Int_t) fTime->GetMax());
+  Update();
+}
+*/
+
+/**************************************************************************/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// Implements callback/slot methods
+
+// void TOFSectorEditor::DoXYZZ()
+// {
+//   fM->SetXYZZ(fXYZZ->GetValue());
+//   Update();
+// }
diff --git a/EVE/Alieve/TOFSectorEditor.h b/EVE/Alieve/TOFSectorEditor.h
new file mode 100644 (file)
index 0000000..23ce680
--- /dev/null
@@ -0,0 +1,79 @@
+// $Header$
+
+#ifndef ALIEVE_TOFSectorEditor_H
+#define ALIEVE_TOFSectorEditor_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+class TGDoubleHSlider;
+
+class TGHSlider;
+
+namespace Reve {
+  class RGValuator;
+  class RGDoubleValuator;
+  class ZTransSubEditor;
+}
+
+namespace Alieve {
+  
+  class TOFSector;
+  
+  class TOFSectorEditor : public TGedFrame
+  {
+    //private:
+    TOFSectorEditor(const TOFSectorEditor&);            // Not implemented
+    TOFSectorEditor& operator=(const TOFSectorEditor&); // Not implemented
+
+  protected:
+    TOFSector* fM; // fModel dynamic-casted to TOFSectorEditor
+    
+    Reve::RGValuator* fSectorID;
+    
+    TGCheckButton*    fAutoTrans;
+
+    TGCheckButton**    fPlate;
+
+    TGCheckButton*    fPlate0;
+    TGCheckButton*    fPlate1;
+    TGCheckButton*    fPlate2;
+    TGCheckButton*    fPlate3;
+    TGCheckButton*    fPlate4;
+
+    Reve::RGValuator* fThreshold;
+    Reve::RGValuator* fMaxVal;   
+
+
+    // Declare widgets
+    // TGSomeWidget*   fXYZZ;
+    
+  public:
+    TOFSectorEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+    virtual ~TOFSectorEditor();
+    
+    virtual void SetModel(TObject* obj);
+    void DoSectorID();
+    void DoAutoTrans(); 
+    void DoPlate0();
+    void DoPlate1();
+    void DoPlate2();
+    void DoPlate3();
+    void DoPlate4();
+
+    void DoPlate(Int_t nPlate);
+    void DoThreshold();
+    void DoMaxVal();
+
+
+    // Declare callback/slot methods
+    // void DoXYZZ();
+    
+    ClassDef(TOFSectorEditor, 0); // Editor for TOFSector
+  }; // endclass TOFSectorEditor
+  
+}
+
+#endif
diff --git a/EVE/Alieve/TOFStrip.cxx b/EVE/Alieve/TOFStrip.cxx
new file mode 100644 (file)
index 0000000..a0e72cb
--- /dev/null
@@ -0,0 +1,210 @@
+#include "TOFStrip.h"
+
+#include <Reve/RGTopFrame.h>
+
+#include <AliTOFdigit.h>
+#include <AliTOFGeometryV5.h>
+
+#include <TStyle.h>
+
+using namespace Reve;
+using namespace Alieve;
+using namespace std;
+
+Bool_t       TOFStrip::fgStaticInitDone = kFALSE;
+FrameBox*    TOFStrip::fgTOFstripFrameBox = 0;
+RGBAPalette* TOFStrip::fgTOFstripPalette  = 0;
+
+//_______________________________________________________
+ClassImp(TOFStrip)
+
+/* ************************************************************************ */
+
+TOFStrip::TOFStrip(const Text_t* n, const Text_t* t) :
+  QuadSet(n, t),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(0),
+  fSector(-1), fPlate(-1), fStrip(-1),
+  fDx(0), fDz(0)
+{
+
+  fGeoManager = (TGeoManager*)gReve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
+  if (!fGeoManager) printf("ERROR: no TGeo\n");
+
+}
+/* ************************************************************************ */
+
+TOFStrip::TOFStrip(TGeoManager *localGeoManager,
+                  Int_t nSector, Int_t nPlate, Int_t nStrip)
+  :
+  QuadSet(Form("Strip%i",nStrip)),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(0),
+  fSector(nSector), fPlate(nPlate), fStrip(nStrip),
+  fDx(0), fDz(0),
+  fGeoManager(localGeoManager)
+{
+  
+  //if (!fGeoManager) printf("ERROR: no TGeo\n");
+
+  InitModule();
+
+}
+/* ************************************************************************ */
+
+TOFStrip::TOFStrip(TGeoManager *localGeoManager,
+                  Int_t nSector, Int_t nPlate, Int_t nStrip,
+                  TClonesArray *tofArray)
+  :
+  QuadSet(Form("Strip%i",nStrip)),
+  fTOFgeometry(new AliTOFGeometryV5()),
+  fTOFarray(tofArray),
+  fSector(nSector), fPlate(nPlate), fStrip(nStrip),
+  fDx(0), fDz(0),
+  fGeoManager(localGeoManager)
+{
+
+  InitModule();
+
+}
+/* ************************************************************************ */
+
+TOFStrip::~TOFStrip()
+{
+
+  fGeoManager = 0x0;
+  delete fGeoManager;
+
+  fTOFarray = 0x0;
+  delete fTOFarray;
+
+}
+
+/* ************************************************************************ */
+/*
+void TOFStrip::SetDigitsInfo(TOFDigitsInfo* info)
+{
+  if(fInfo) fInfo->DecRefCount();
+  fInfo = info;
+  if(fInfo) fInfo->IncRefCount();
+
+}
+*/
+/* ************************************************************************ */
+void TOFStrip::InitStatics()
+{
+  if (fgStaticInitDone) return;
+
+  Float_t dx = 2.5*48;
+  Float_t dz = 3.5*2;
+  fgTOFstripFrameBox = new FrameBox();
+
+  fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
+  fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
+
+  //fgTOFstripPalette  = new RGBAPalette(0, 2048); // TOT
+  fgTOFstripPalette  = new RGBAPalette(0, 8192); // TDC
+
+  fgStaticInitDone = kTRUE;
+}
+
+/* ************************************************************************ */
+void TOFStrip::InitModule()
+{
+
+  fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
+  fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
+
+  if (!fgStaticInitDone) InitStatics();
+
+  SetFrame(fgTOFstripFrameBox);
+  SetPalette(fgTOFstripPalette);
+  //fFrame   = fgTOFstripFrameBox;
+  //fPalette = fgTOFstripPalette;
+
+  LoadQuads();  
+  ComputeBBox();
+  SetTrans();
+
+}
+
+/* ************************************************************************ */
+void TOFStrip::LoadQuads()
+{
+
+  //Int_t n_col = gStyle->GetNumberOfColors();
+
+  Int_t iPadX = -1;
+  Int_t iPadZ = -1;
+  Int_t tdc = -1;
+  Int_t tot = -1;
+  Float_t x = -1;
+  Float_t z = -1;
+
+  Reset(QT_RectangleXZFixedY, kFALSE, 32);
+
+  AliTOFdigit *tofDigit;
+
+  //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
+
+  for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
+
+    tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
+
+    iPadX = tofDigit->GetPadx();
+    iPadZ = tofDigit->GetPadz();
+
+    tot = tofDigit->GetToT();
+    tdc = tofDigit->GetTdc();
+
+    //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i  %1i\n", iPadX, iPadZ);
+    //if (iPadX==23 || iPadX==24) printf(" %2i  %1i %2i \n", fSector, fPlate, fStrip);
+
+    fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
+
+    AddQuad(x, z, 2.5, 3.5);
+    //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
+
+    // In principle could have color based on number of neigbours. We
+    // can insert the time-of-flight value for each pad
+    //QuadValue((Int_t)tot);
+    QuadValue((Int_t)tdc);
+
+    //if (fSector==4 && fPlate==2  && fStrip==0) printf("  %1i   %2i    %f  %f \n", iPadZ, iPadX, x, z);
+
+  }
+
+  RefitPlex();
+}
+
+/* ************************************************************ */
+void TOFStrip::SetTrans()
+{
+
+  fHMTrans.UnitTrans();
+
+  //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
+  Char_t path[100];
+  //fTOFgeometry->GetVolumePath(det,path);
+  fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
+
+  fGeoManager->cd(path);
+  TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
+  Double_t *rotMat = global.GetRotationMatrix();
+  
+  /*
+  // ok till 19 April 2007
+  fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
+  fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
+  fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
+  */
+
+  fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
+  fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
+  fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
+
+  Double_t *tr = global.GetTranslation();
+  fHMTrans.SetBaseVec(4, tr);
+
+}
diff --git a/EVE/Alieve/TOFStrip.h b/EVE/Alieve/TOFStrip.h
new file mode 100644 (file)
index 0000000..d391e1e
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIEVE_TOFStrip_H
+#define ALIEVE_TOFStrip_H
+
+#include <Reve/QuadSet.h>
+#include <Reve/RenderElement.h>
+
+#include <Reve/RGBAPalette.h>
+#include <Reve/FrameBox.h>
+
+#include <TGeoManager.h>
+#include <TClonesArray.h>
+
+#include <AliTOFGeometry.h>
+#include <AliTOFGeometryV5.h>
+
+namespace Alieve {
+
+class TOFStrip : public Reve::QuadSet
+{
+  TOFStrip(const TOFStrip&);            // Not implemented
+  TOFStrip& operator=(const TOFStrip&); // Not implemented
+
+private:
+  void LoadQuads();
+  
+protected:
+  virtual void InitModule();
+  virtual void SetTrans();
+
+  AliTOFGeometry* fTOFgeometry;
+
+  TClonesArray *fTOFarray;
+
+  Int_t fSector;
+  Int_t fPlate;
+  Int_t fStrip;
+
+  Float_t  fDx;
+  Float_t  fDz;
+
+  TGeoManager *fGeoManager;
+
+public:
+  TOFStrip(const Text_t* n="TOFStrip", const Text_t* t=0);
+  TOFStrip(TGeoManager *localGeoManager,
+           Int_t nSector, Int_t nPlate, Int_t nStrip);
+
+  TOFStrip(TGeoManager *localGeoManager,
+           Int_t nSector, Int_t nPlate, Int_t nStrip,
+           TClonesArray *tofArray);
+  virtual ~TOFStrip();
+
+  static Bool_t    fgStaticInitDone;
+  static void      InitStatics();
+
+  static Reve::FrameBox* fgTOFstripFrameBox;
+
+  static Reve::RGBAPalette* fgTOFstripPalette;
+
+  ClassDef(TOFStrip, 1);
+}; 
+}
+#endif
diff --git a/EVE/Alieve/TOFStripEditor.cxx b/EVE/Alieve/TOFStripEditor.cxx
new file mode 100644 (file)
index 0000000..8d58261
--- /dev/null
@@ -0,0 +1,59 @@
+// $Header$
+
+#include "TOFStripEditor.h"
+#include <Alieve/TOFStrip.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGDoubleSlider.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TOFStripEditor
+//
+
+ClassImp(TOFStripEditor)
+
+TOFStripEditor::TOFStripEditor(const TGWindow *p, Int_t width, Int_t height,
+            UInt_t options, Pixel_t back) :
+  TGedFrame(p, width, height, options | kVerticalFrame, back),
+  fM(0)
+  // Initialize widget pointers to 0
+{
+  MakeTitle("TOFStrip");
+
+  // Create widgets
+  // fXYZZ = new TGSomeWidget(this, ...);
+  // AddFrame(fXYZZ, new TGLayoutHints(...));
+  // fXYZZ->Connect("SignalName()", "Alieve::TOFStripEditor", this, "DoXYZZ()");
+}
+
+TOFStripEditor::~TOFStripEditor()
+{}
+
+/**************************************************************************/
+
+void TOFStripEditor::SetModel(TObject* obj)
+{
+  fM = dynamic_cast<TOFStrip*>(obj);
+
+  // Set values of widgets
+  // fXYZZ->SetValue(fM->GetXYZZ());
+}
+
+/**************************************************************************/
+
+// Implements callback/slot methods
+
+// void TOFStripEditor::DoXYZZ()
+// {
+//   fM->SetXYZZ(fXYZZ->GetValue());
+//   Update();
+// }
diff --git a/EVE/Alieve/TOFStripEditor.h b/EVE/Alieve/TOFStripEditor.h
new file mode 100644 (file)
index 0000000..af9f3d3
--- /dev/null
@@ -0,0 +1,42 @@
+// $Header$
+
+#ifndef ALIEVE_TOFStripEditor_H
+#define ALIEVE_TOFStripEditor_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+
+namespace Alieve {
+
+class TOFStrip;
+
+class TOFStripEditor : public TGedFrame
+{
+private:
+  TOFStripEditor(const TOFStripEditor&);            // Not implemented
+  TOFStripEditor& operator=(const TOFStripEditor&); // Not implemented
+
+protected:
+  TOFStrip* fM; // fModel dynamic-casted to TOFStripEditor
+
+  // Declare widgets
+  // TGSomeWidget*   fXYZZ;
+
+public:
+  TOFStripEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+  virtual ~TOFStripEditor();
+
+  virtual void SetModel(TObject* obj);
+
+  // Declare callback/slot methods
+  // void DoXYZZ();
+
+  ClassDef(TOFStripEditor, 0); // Editor for TOFStrip
+}; // endclass TOFStripEditor
+
+}
+
+#endif