Geometry for MFT (Brigitte)
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_digits_strips.C
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
16718cdc 9
ba978640 10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TClonesArray.h>
12#include <TTree.h>
13#include <TStyle.h>
14#include <TGeoManager.h>
15#include <TEveManager.h>
16#include <TEveElement.h>
17
6c49a8e1 18#include <AliRunLoader.h>
19#include <AliTOFGeometry.h>
20#include <AliEveEventManager.h>
21#include <AliEveTOFDigitsInfo.h>
22#include <AliEveTOFStrip.h>
ba978640 23#endif
24
02000333 25void tof_digits_strips(Int_t selectedSector=-1)
61d93123 26{
27 TClonesArray *array = 0x0;
28
ba978640 29 // Int_t nDigitsInVolume[3] = {-1, -1, -1};
61d93123 30 Int_t nStrips=19;
290113e6 31 TGeoManager *localGeoManager = AliEveEventManager::AssertGeometry();//gEve->GetGeometry("./geometry.root");
81515106 32
61d93123 33 if (!localGeoManager) {
34 printf("ERROR: no TGeo\n");
35 }
36
d810d0de 37 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
61d93123 38 rl->LoadDigits("TOF");
39 TTree* dt = rl->GetTreeD("TOF", false);
40
d810d0de 41 AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
61d93123 42 di->SetTree(dt);
43 di->LoadDigits();
44 di->Dump();
45
9537e66c 46 AliTOFGeometry* g = di->GetTOFgeometry();
61d93123 47
48 gStyle->SetPalette(1, 0);
84aff7a4 49 gEve->DisableRedraw();
61d93123 50
51 TString sPlate;
52 TString bsPlate="Plate";
be35e353 53
61d93123 54 Char_t sectorName[100];
55 Char_t sectorTitle[200];
56
84aff7a4 57 TEveElementList* ll = new TEveElementList("TOF");
61d93123 58 ll->SetTitle("TOF detector");
fbc350a3 59 ll->SetMainColor(2);
84aff7a4 60 gEve->AddElement(ll);
61d93123 61
62 for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
02000333 63 if (selectedSector!=-1 && iSector!=selectedSector) continue;
61d93123 64 sprintf(sectorName,"Sector%2i",iSector);
84aff7a4 65 TEveElementList* l = new TEveElementList(sectorName);
61d93123 66 l->SetTitle(sectorTitle);
fbc350a3 67 l->SetMainColor(2);
84aff7a4 68 gEve->AddElement(l, ll);
61d93123 69
70
71 for(Int_t iPlate=0; iPlate<g->NPlates(); iPlate++) {
be35e353 72 if ((iSector==13 || iSector==14 || iSector==15) &&
73 (iPlate==2) )continue; // staging TOF geometry with holes
74
61d93123 75 if(iPlate==2) nStrips=15;
76 else nStrips=19;
77
78 sPlate=bsPlate;
79 sPlate+=iPlate;
84aff7a4 80 TEveElementList* relPlate = new TEveElementList(sPlate.Data());
fbc350a3 81 relPlate->SetMainColor(2);
455b87be 82 gEve->AddElement(relPlate, l);
61d93123 83
84
85 for(Int_t iStrip=0; iStrip<nStrips; iStrip++) {
86
87 array = di->GetDigits(iSector,iPlate, iStrip);
88
02000333 89 AliEveTOFStrip* m = new AliEveTOFStrip(localGeoManager,
90 iSector,iPlate,iStrip,array);
84aff7a4 91 gEve->AddElement(m, relPlate);
61d93123 92
93 }
94 }
95 }
96
84aff7a4 97 gEve->EnableRedraw();
61d93123 98
99
100}