a15e6d7d |
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 "AliEveHOMERSourceMap.h" |
0e21a96f |
11 | #include "AliEveHOMERSourceMapByDet.h" |
12 | #include "AliEveHOMERSourceMapByType.h" |
a15e6d7d |
13 | |
14 | //______________________________________________________________________ |
a15e6d7d |
15 | // |
ca8fb7ae |
16 | // AliEveHOMERSourceMap is an abstract container for HLT HOMER sources, |
17 | // see AliHLTHOMERSourceDesc. |
18 | // |
19 | // The concrete implementations AliEveHOMERSourceMapByDet and |
20 | // AliEveHOMERSourceMapByType allow retrieval of HOMER sources in proper |
21 | // order as required for their display in EVE object browser. |
22 | // |
a15e6d7d |
23 | |
24 | ClassImp(AliEveHOMERSourceMap) |
25 | |
26 | AliEveHOMERSourceMap::AliEveHOMERSourceMap(ESourceGrouping_e grouping) : |
27 | fGrouping(grouping) |
28 | { |
ca8fb7ae |
29 | // Constructor. |
a15e6d7d |
30 | } |
31 | |
32 | AliEveHOMERSourceMap* AliEveHOMERSourceMap::Create(ESourceGrouping_e grouping) |
33 | { |
ca8fb7ae |
34 | // Static constructor - instantiates appropriate sub-class. |
35 | |
a15e6d7d |
36 | switch (grouping) |
37 | { |
38 | case kSG_ByDet: return new AliEveHOMERSourceMapByDet(grouping); |
39 | case kSG_ByType: return new AliEveHOMERSourceMapByType(grouping); |
40 | } |
41 | return 0; |
42 | } |
43 | |
44 | Int_t AliEveHOMERSourceMap::iterator::level() |
45 | { |
ca8fb7ae |
46 | // Returns the depth in iteration: |
47 | // Det / Sub-Det / Sub-Sub-Det / Data-Type. |
48 | |
a15e6d7d |
49 | const AliEveHOMERSource::SourceId& sid = id(); |
50 | |
51 | Int_t lvl = 0; |
52 | if ( ! sid.fDet.IsNull()) ++lvl; |
53 | if ( ! sid.fSDet.IsNull()) ++lvl; |
54 | if ( ! sid.fSSDet.IsNull()) ++lvl; |
55 | if ( ! sid.fType.IsNull()) ++lvl; |
56 | return lvl; |
57 | } |
58 | |
59 | void AliEveHOMERSourceMap::PrintXXX() |
60 | { |
ca8fb7ae |
61 | // Print entries in the map. |
62 | |
a15e6d7d |
63 | for (iterator i = begin(); i != end(); ++i) |
64 | { |
65 | printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*i.level(), "", |
66 | i.description().Data(), i.state().fState, |
67 | (ULong_t) i.state().fHandle, |
68 | i.id().fSSDet.Data()); |
69 | } |
70 | } |