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