]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/tof_digits_strips.C
Coverity
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_digits_strips.C
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          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 void tof_digits_strips(Int_t selectedSector=-1)
11 {
12   TClonesArray *array = 0x0;
13
14   Int_t nDigitsInVolume[3] = {-1, -1, -1};
15   Int_t nStrips=19;
16   TGeoManager *localGeoManager = gEve->GetGeometry("./geometry.root");//  gGeoManager = gEve->GetDefaultGeometry();
17
18   if (!localGeoManager) {
19     printf("ERROR: no TGeo\n");
20   }
21
22   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
23   rl->LoadDigits("TOF");
24   TTree* dt = rl->GetTreeD("TOF", false);
25
26   AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
27   di->SetTree(dt);
28   di->LoadDigits();
29   di->Dump();
30
31   AliTOFGeometry* g = di->GetTOFgeometry();
32
33   gStyle->SetPalette(1, 0);
34   gEve->DisableRedraw();
35
36   TString sPlate;
37   TString bsPlate="Plate";
38
39   Char_t sectorName[100];
40   Char_t sectorTitle[200];
41
42   TEveElementList* ll = new TEveElementList("TOF");
43   ll->SetTitle("TOF detector");
44   ll->SetMainColor(2);
45   gEve->AddElement(ll);
46
47   for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
48     if (selectedSector!=-1 && iSector!=selectedSector) continue;
49     sprintf(sectorName,"Sector%2i",iSector);
50     TEveElementList* l = new TEveElementList(sectorName);
51     l->SetTitle(sectorTitle);
52     l->SetMainColor(2);
53     gEve->AddElement(l, ll);
54
55
56     for(Int_t iPlate=0; iPlate<g->NPlates(); iPlate++) {
57       if ((iSector==13 || iSector==14 || iSector==15) &&
58           (iPlate==2) )continue; // staging TOF geometry with holes
59
60       if(iPlate==2) nStrips=15;
61       else nStrips=19;
62
63       sPlate=bsPlate;
64       sPlate+=iPlate;
65       TEveElementList* relPlate = new TEveElementList(sPlate.Data());
66       relPlate->SetMainColor(2);
67       gEve->AddElement(relPlate, l);
68
69
70       for(Int_t iStrip=0; iStrip<nStrips; iStrip++) {
71
72         array = di->GetDigits(iSector,iPlate, iStrip);
73
74         AliEveTOFStrip* m = new AliEveTOFStrip(localGeoManager,
75                                                iSector,iPlate,iStrip,array);
76         gEve->AddElement(m, relPlate);
77
78       }
79     }
80   }
81
82   gEve->EnableRedraw();
83
84
85 }