ROOT logo
// $Id$
// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/**************************************************************************
 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
 * full copyright notice.                                                 *
 **************************************************************************/

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <TClonesArray.h>
#include <TTree.h>
#include <TStyle.h>
#include <TGeoManager.h>
#include <TEveManager.h>
#include <TEveElement.h>

#include <AliRunLoader.h>
#include <AliTOFGeometry.h>
#include <AliEveEventManager.h>
#include <AliEveTOFDigitsInfo.h>
#include <AliEveTOFStrip.h>
#endif

void tof_digits_strips(Int_t selectedSector=-1)
{
  TClonesArray *array = 0x0;

 // Int_t nDigitsInVolume[3] = {-1, -1, -1};
  Int_t nStrips=19;
  TGeoManager *localGeoManager = AliEveEventManager::AssertGeometry();//gEve->GetGeometry("./geometry.root");

  if (!localGeoManager) {
    printf("ERROR: no TGeo\n");
  }

  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
  rl->LoadDigits("TOF");
  TTree* dt = rl->GetTreeD("TOF", false);

  AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
  di->SetTree(dt);
  di->LoadDigits();
  di->Dump();

  AliTOFGeometry* g = di->GetTOFgeometry();

  gStyle->SetPalette(1, 0);
  gEve->DisableRedraw();

  TString sPlate;
  TString bsPlate="Plate";

  Char_t sectorName[100];
  Char_t sectorTitle[200];

  TEveElementList* ll = new TEveElementList("TOF");
  ll->SetTitle("TOF detector");
  ll->SetMainColor(2);
  gEve->AddElement(ll);

  for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
    if (selectedSector!=-1 && iSector!=selectedSector) continue;
    sprintf(sectorName,"Sector%2i",iSector);
    TEveElementList* l = new TEveElementList(sectorName);
    l->SetTitle(sectorTitle);
    l->SetMainColor(2);
    gEve->AddElement(l, ll);


    for(Int_t iPlate=0; iPlate<g->NPlates(); iPlate++) {
      if ((iSector==13 || iSector==14 || iSector==15) &&
	  (iPlate==2) )continue; // staging TOF geometry with holes

      if(iPlate==2) nStrips=15;
      else nStrips=19;

      sPlate=bsPlate;
      sPlate+=iPlate;
      TEveElementList* relPlate = new TEveElementList(sPlate.Data());
      relPlate->SetMainColor(2);
      gEve->AddElement(relPlate, l);


      for(Int_t iStrip=0; iStrip<nStrips; iStrip++) {

	array = di->GetDigits(iSector,iPlate, iStrip);

	AliEveTOFStrip* m = new AliEveTOFStrip(localGeoManager,
					       iSector,iPlate,iStrip,array);
	gEve->AddElement(m, relPlate);

      }
    }
  }

  gEve->EnableRedraw();


}
 tof_digits_strips.C:1
 tof_digits_strips.C:2
 tof_digits_strips.C:3
 tof_digits_strips.C:4
 tof_digits_strips.C:5
 tof_digits_strips.C:6
 tof_digits_strips.C:7
 tof_digits_strips.C:8
 tof_digits_strips.C:9
 tof_digits_strips.C:10
 tof_digits_strips.C:11
 tof_digits_strips.C:12
 tof_digits_strips.C:13
 tof_digits_strips.C:14
 tof_digits_strips.C:15
 tof_digits_strips.C:16
 tof_digits_strips.C:17
 tof_digits_strips.C:18
 tof_digits_strips.C:19
 tof_digits_strips.C:20
 tof_digits_strips.C:21
 tof_digits_strips.C:22
 tof_digits_strips.C:23
 tof_digits_strips.C:24
 tof_digits_strips.C:25
 tof_digits_strips.C:26
 tof_digits_strips.C:27
 tof_digits_strips.C:28
 tof_digits_strips.C:29
 tof_digits_strips.C:30
 tof_digits_strips.C:31
 tof_digits_strips.C:32
 tof_digits_strips.C:33
 tof_digits_strips.C:34
 tof_digits_strips.C:35
 tof_digits_strips.C:36
 tof_digits_strips.C:37
 tof_digits_strips.C:38
 tof_digits_strips.C:39
 tof_digits_strips.C:40
 tof_digits_strips.C:41
 tof_digits_strips.C:42
 tof_digits_strips.C:43
 tof_digits_strips.C:44
 tof_digits_strips.C:45
 tof_digits_strips.C:46
 tof_digits_strips.C:47
 tof_digits_strips.C:48
 tof_digits_strips.C:49
 tof_digits_strips.C:50
 tof_digits_strips.C:51
 tof_digits_strips.C:52
 tof_digits_strips.C:53
 tof_digits_strips.C:54
 tof_digits_strips.C:55
 tof_digits_strips.C:56
 tof_digits_strips.C:57
 tof_digits_strips.C:58
 tof_digits_strips.C:59
 tof_digits_strips.C:60
 tof_digits_strips.C:61
 tof_digits_strips.C:62
 tof_digits_strips.C:63
 tof_digits_strips.C:64
 tof_digits_strips.C:65
 tof_digits_strips.C:66
 tof_digits_strips.C:67
 tof_digits_strips.C:68
 tof_digits_strips.C:69
 tof_digits_strips.C:70
 tof_digits_strips.C:71
 tof_digits_strips.C:72
 tof_digits_strips.C:73
 tof_digits_strips.C:74
 tof_digits_strips.C:75
 tof_digits_strips.C:76
 tof_digits_strips.C:77
 tof_digits_strips.C:78
 tof_digits_strips.C:79
 tof_digits_strips.C:80
 tof_digits_strips.C:81
 tof_digits_strips.C:82
 tof_digits_strips.C:83
 tof_digits_strips.C:84
 tof_digits_strips.C:85
 tof_digits_strips.C:86
 tof_digits_strips.C:87
 tof_digits_strips.C:88
 tof_digits_strips.C:89
 tof_digits_strips.C:90
 tof_digits_strips.C:91
 tof_digits_strips.C:92
 tof_digits_strips.C:93
 tof_digits_strips.C:94
 tof_digits_strips.C:95
 tof_digits_strips.C:96
 tof_digits_strips.C:97
 tof_digits_strips.C:98
 tof_digits_strips.C:99
 tof_digits_strips.C:100
 tof_digits_strips.C:101