fix coding violation
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERSourceMapByDet.cxx
CommitLineData
f65a2da1 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#include "AliEveHOMERSourceMapByDet.h"
11#include <AliHLTHOMERSourceDesc.h>
12
13#include <TList.h>
14
15//______________________________________________________________________
16//
17// AliEveHOMERSourceMap is an abstract container for HLT HOMER sources,
18// see AliHLTHOMERSourceDesc.
19//
20// The concrete implementations AliEveHOMERSourceMapByDet and
21// AliEveHOMERSourceMapByType allow retrieval of HOMER sources in proper
22// order as required for their display in EVE object browser.
23//
24
25AliEveHOMERSourceMapByDet::AliEveHOMERSourceMapByDet(ESourceGrouping_e grouping) :
26 AliEveHOMERSourceMap(grouping),
27 fMap()
28{}
29
30TString AliEveHOMERSourceMapByDet::iterator_imp::description() const
31{
32 // Return identifier string for current entry.
33
34 const AliEveHOMERSource::SourceId& sid = id();
35
36 if ( ! sid.fType.IsNull()) return sid.fType;
37 if ( ! sid.fSSDet.IsNull()) return sid.fSSDet;
38 if ( ! sid.fSDet.IsNull()) return sid.fSDet;
39 if ( ! sid.fDet.IsNull()) return sid.fDet;
40 return "<empty>";
41}
42
43void AliEveHOMERSourceMapByDet::insert(AliEveHOMERSource::SourceId& sid,
44 AliEveHOMERSource::SourceState& sst,
45 Bool_t def_state)
46{
47 // Insert source-state for given source-id.
48 // Does nothing if the entry already exists.
49
50 Map_i i = fMap.find(sid);
51 if (i == fMap.end())
52 {
53 // Check wildcard, else
54 sst.fState = def_state;
55 fMap.insert(std::make_pair(sid, sst));
56 }
57}
58
59void AliEveHOMERSourceMapByDet::FillMap(const TList* handles, Bool_t def_state)
60{
61 // Fill the map from the list of HOMER source handles.
62
63 TIter next(handles);
64 AliHLTHOMERSourceDesc* h;
65 while ((h = (AliHLTHOMERSourceDesc*) next()))
66 {
67 AliEveHOMERSource::SourceId srcid;
68 AliEveHOMERSource::SourceState srcst;
69
70 srcid.fDet = h->GetDetector();
71 insert(srcid, srcst, def_state);
72
73 srcid.fSDet = h->GetSubDetector();
74 if ( ! srcid.fSDet.IsNull()) insert(srcid, srcst, def_state);
75
76 srcid.fSSDet = h->GetSubSubDetector();
77 if ( ! srcid.fSSDet.IsNull()) insert(srcid, srcst, def_state);
78
79 srcid.fType = h->GetDataType();
80 srcst.fHandle = h;
81 insert(srcid, srcst, def_state);
82 }
83}