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