]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveHLT/AliEveHOMERSourceMapByType.cxx
Add option to run on some local files with test mode using the alien plugin
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERSourceMapByType.cxx
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 "AliEveHOMERSourceMapByType.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
25 AliEveHOMERSourceMapByType::AliEveHOMERSourceMapByType(ESourceGrouping_e grouping) :
26   AliEveHOMERSourceMap(grouping),
27   fMap()
28 {
29   // Constructor.
30 }
31
32 TString AliEveHOMERSourceMapByType::iterator_imp::description() const
33 {
34   // Return identifier string for current entry.
35
36   const AliEveHOMERSource::SourceId& sid = id();
37
38   if ( ! sid.fSSDet.IsNull()) return sid.fSSDet;
39   if ( ! sid.fSDet.IsNull())  return sid.fSDet;
40   if ( ! sid.fDet.IsNull())   return sid.fDet;
41   if ( ! sid.fType.IsNull())  return sid.fType;
42   return "<empty>";
43 }
44
45 void AliEveHOMERSourceMapByType::insert(AliEveHOMERSource::SourceId& sid,
46                                         AliEveHOMERSource::SourceState& sst,
47                                         Bool_t def_state)
48 {
49   // Insert source-state for given source-id.
50   // Does nothing if the entry already exists.
51
52   Map_i i = fMap.find(sid);
53   if (i == fMap.end())
54   {
55     // Check wildcard, else
56     sst.fState = def_state;
57     fMap.insert(std::make_pair(sid, sst));
58   }
59 }
60
61 void AliEveHOMERSourceMapByType::FillMap(const TList* handles, Bool_t def_state)
62 {
63   // Fill the map from the list of HOMER source handles.
64
65   TIter next(handles);
66   AliHLTHOMERSourceDesc* h;
67   while ((h = (AliHLTHOMERSourceDesc*) next()))
68   {
69     AliEveHOMERSource::SourceId    srcid;
70     AliEveHOMERSource::SourceState srcst;
71
72     srcid.fType   = h->GetDataType();
73     insert(srcid, srcst, def_state);
74
75     srcid.fDet = h->GetDetector();
76     if (h->GetSubDetector() == 0)
77     {
78       srcst.fHandle = h;
79       insert(srcid, srcst, def_state);
80       continue;
81     }
82     insert(srcid, srcst, def_state);
83
84     srcid.fSDet = h->GetSubDetector();
85     if (h->GetSubSubDetector() == 0)
86     {
87       srcst.fHandle = h;
88       insert(srcid, srcst, def_state);
89       continue;
90     }
91     insert(srcid, srcst, def_state);
92
93     srcid.fSSDet  = h->GetSubSubDetector();
94     srcst.fHandle = h;
95     insert(srcid, srcst, def_state);
96   }
97 }