Moving to standard names
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERSourceList.cxx
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 **************************************************************************/
9
10#include "AliEveHOMERSourceList.h"
a15e6d7d 11#include "AliEveHOMERSourceMap.h"
12#include "AliEveHOMERManager.h"
d810d0de 13
57ffa5fb 14//______________________________________________________________________________
d810d0de 15// AliEveHOMERSourceList
16//
17
18ClassImp(AliEveHOMERSourceList)
19
20AliEveHOMERSourceList::AliEveHOMERSourceList(const Text_t* n, const Text_t* t) :
a15e6d7d 21 TEveElementList(n, t),
22 fManager (0),
23 fSrcMap (0)
d810d0de 24{
25
26}
27
a15e6d7d 28AliEveHOMERSourceList::~AliEveHOMERSourceList()
29{
30 // !!!!! delete maps
31}
32
33/******************************************************************************/
34
35void AliEveHOMERSourceList::CreateByDet()
36{
37 delete fSrcMap;
38 fSrcMap = AliEveHOMERSourceMap::Create(AliEveHOMERSourceMap::kSG_ByDet);
39 RebuildSourceReps();
40}
41
42void AliEveHOMERSourceList::CreateByType()
43{
44 delete fSrcMap;
45 fSrcMap = AliEveHOMERSourceMap::Create(AliEveHOMERSourceMap::kSG_ByType);
46 RebuildSourceReps();
47}
48
49void AliEveHOMERSourceList::RebuildSourceReps()
50{
51 DestroyElements();
52 // !!!! if fManager ?
53 // ???? fManager->CreateHOMERSourcesList();
54 TList* srcList = fManager->GetSourceList();
55 fSrcMap->FillMap(srcList, 1);
56
57 List_t parentStack;
58 parentStack.push_back(this);
59 Int_t parentLvl = 1;
60 for (AliEveHOMERSourceMap::iterator i=fSrcMap->begin(); i!=fSrcMap->end(); ++i)
61 {
62 while (parentLvl > i.level()) { parentStack.pop_back(); --parentLvl; }
63
64 AliEveHOMERSource* src = new AliEveHOMERSource(i.description());
65 src->SetSource(&i.id(), &i.state());
66
67 parentStack.back()->AddElement(src);
68
69 parentStack.push_back(src); ++parentLvl;
46eadbb4 70 /*
a15e6d7d 71 printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*i.level(), "",
72 i.description().Data(), i.state().fState,
73 (ULong_t) i.state().fHandle,
74 i.id().fSSDet.Data());
46eadbb4 75
76 */
77 }
78}
79
80
81Bool_t AliEveHOMERSourceList::GetSelectedSources() {
82 // Set selected source in HOMER sources list, of HOMERManager
83
84 if ( ! fManager ) {
85 printf ( "Error : no ptr to HomerManager!");
86 return kFALSE;
87 }
88
89
90 Bool_t bResult = kFALSE;
91
92 for ( AliEveHOMERSourceMap::iterator iter=fSrcMap->begin(); iter!=fSrcMap->end(); ++iter ) {
93
94 if ( ! iter.state().fHandle )
95 continue;
96
97 fManager->SetSourceState( (AliHLTHOMERSourceDesc*) iter.state().fHandle,iter.state().fState );
98 bResult = kTRUE;
99
100 /*
101 printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*iter.level(), "",
102 iter.description().Data(), iter.state().fState,
103 (ULong_t) iter.state().fHandle,
104 iter.id().fSSDet.Data());
105 */
106
107
108
109
a15e6d7d 110 }
46eadbb4 111
112
113 return bResult;
a15e6d7d 114}
115
46eadbb4 116
a15e6d7d 117/******************************************************************************/
118/*
d810d0de 119void AliEveHOMERSourceList::SelectAll()
120{
121 EnableListElements(kTRUE, kTRUE);
122}
123
124void AliEveHOMERSourceList::DeselectAll()
125{
126 DisableListElements (kFALSE, kFALSE);
127}
a15e6d7d 128*/