]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/tof_digits.C
b165a5d790fbbcd116acdd15c3b491815d708143
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_digits.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 <AliEveTOFSector.h>
23 #endif
24
25 void tof_digits()
26 {  
27   TClonesArray *array = 0x0;
28
29   TGeoManager *localGeoManager = gEve->GetGeometry("./geometry.root");//  gGeoManager = gEve->GetDefaultGeometry();
30   if (!localGeoManager) {
31     printf("ERROR: no TGeo\n");
32   }
33
34   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
35   rl->LoadDigits("TOF");
36   TTree* dt = rl->GetTreeD("TOF", false);
37
38   AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
39   di->SetTree(dt);
40   di->LoadDigits();
41   di->Dump();
42
43   AliTOFGeometry* g = di->GetTOFgeometry();
44  
45   gStyle->SetPalette(1, 0);
46   gEve->DisableRedraw();
47
48   TEveElementList* ll = new TEveElementList("TOF");
49   ll->SetTitle("TOF detector");
50   ll->SetMainColor(2);
51   gEve->AddElement(ll);
52
53   for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
54     
55     array = di->GetDigits(iSector);
56    
57     AliEveTOFSector* m = new AliEveTOFSector(localGeoManager,iSector,array);
58
59     gEve->AddElement(m, ll);
60
61   }
62
63   gEve->EnableRedraw();
64 }