]>
Commit | Line | Data |
---|---|---|
ea199e33 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | #include "AliMUONPreprocessor.h" | |
57e176c0 | 19 | |
ea199e33 | 20 | #include "AliMUONPedestalSubprocessor.h" |
57e176c0 | 21 | #include "AliMUONHVSubprocessor.h" |
fee1d02b | 22 | #include "AliMUONGMSSubprocessor.h" |
23 | ||
ce8e7dbe | 24 | #include "AliMpSegmentation.h" |
25 | #include "AliMpDDLStore.h" | |
26 | ||
fee1d02b | 27 | #include "AliLog.h" |
57e176c0 | 28 | #include "AliShuttleInterface.h" |
ea199e33 | 29 | #include "Riostream.h" |
fee1d02b | 30 | #include "TObjArray.h" |
ea199e33 | 31 | |
3d1463c8 | 32 | //----------------------------------------------------------------------------- |
ea199e33 | 33 | /// \class AliMUONPreprocessor |
34 | /// | |
35 | /// Shuttle preprocessor for MUON subsystems (TRK and TRG) | |
36 | /// | |
37 | /// It's simply a manager class that deals with a list of sub-tasks | |
38 | /// (of type AliMUONVSubprocessor). | |
39 | /// | |
40 | /// \author Laurent Aphecetche | |
3d1463c8 | 41 | //----------------------------------------------------------------------------- |
ea199e33 | 42 | |
43 | /// \cond CLASSIMP | |
44 | ClassImp(AliMUONPreprocessor) | |
45 | /// \endcond | |
46 | ||
47 | //_____________________________________________________________________________ | |
6c7a0c0f | 48 | AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle) |
49 | : AliPreprocessor(detName, shuttle), | |
d489129d | 50 | fSubprocessors(new TObjArray()), |
c41ce74d | 51 | fProcessDCS(kFALSE), |
52 | fIsValid(kFALSE) | |
ea199e33 | 53 | { |
6c7a0c0f | 54 | /// ctor |
ea199e33 | 55 | } |
56 | ||
57 | //_____________________________________________________________________________ | |
58 | AliMUONPreprocessor::~AliMUONPreprocessor() | |
59 | { | |
60 | /// dtor | |
61 | delete fSubprocessors; | |
62 | } | |
63 | ||
6c7a0c0f | 64 | //_____________________________________________________________________________ |
65 | void | |
eca96915 | 66 | AliMUONPreprocessor::ClearSubprocessors() |
6c7a0c0f | 67 | { |
68 | /// Empty our subprocessor list | |
eca96915 | 69 | fSubprocessors->Clear(); |
d489129d | 70 | fProcessDCS = kFALSE; |
c41ce74d | 71 | fIsValid = kFALSE; |
6c7a0c0f | 72 | } |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | void | |
d489129d | 76 | AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS) |
6c7a0c0f | 77 | { |
78 | /// Add a subprocessor to our list of workers | |
79 | fSubprocessors->Add(sub); | |
d489129d | 80 | if ( processDCS == kTRUE ) fProcessDCS = processDCS; |
6c7a0c0f | 81 | } |
82 | ||
ea199e33 | 83 | //_____________________________________________________________________________ |
84 | void | |
85 | AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) | |
86 | { | |
c41ce74d | 87 | /// Load mapping and initialize subtasks |
ce8e7dbe | 88 | |
89 | // Delete previous mapping | |
90 | delete AliMpSegmentation::Instance(false); | |
91 | delete AliMpDDLStore::Instance(false); | |
92 | ||
93 | // Load mapping from CDB for this run | |
c41ce74d | 94 | |
2ab3623b | 95 | AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping"); |
96 | if (!cdbEntry) | |
c41ce74d | 97 | { |
98 | Log("Could not get Mapping from OCDB !"); | |
99 | fIsValid = kFALSE; | |
100 | } | |
101 | ||
2ab3623b | 102 | cdbEntry = GetFromOCDB("Calib", "DDLStore"); |
103 | if (!cdbEntry) | |
c41ce74d | 104 | { |
105 | Log("Could not get DDLStore from OCDB"); | |
106 | fIsValid = kFALSE; | |
107 | } | |
ce8e7dbe | 108 | |
c41ce74d | 109 | if (IsValid()) |
ea199e33 | 110 | { |
c41ce74d | 111 | // loop over subtasks and initialize them |
112 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) | |
113 | { | |
114 | Subprocessor(i)->Initialize(run,startTime,endTime); | |
115 | } | |
ea199e33 | 116 | } |
2ab3623b | 117 | |
118 | Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK"))); | |
ea199e33 | 119 | } |
120 | ||
121 | //_____________________________________________________________________________ | |
122 | UInt_t | |
123 | AliMUONPreprocessor::Process(TMap* dcsAliasMap) | |
124 | { | |
125 | /// loop over subtasks to make them work | |
c41ce74d | 126 | |
127 | if (!IsValid()) | |
128 | { | |
129 | Log("Will not run as not properly initialized"); | |
130 | return 99; | |
131 | } | |
132 | ||
ea199e33 | 133 | UInt_t rv(0); |
134 | ||
135 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) | |
136 | { | |
137 | rv += Subprocessor(i)->Process(dcsAliasMap); | |
138 | } | |
c41ce74d | 139 | |
ea199e33 | 140 | return rv; |
141 | } | |
142 | ||
143 | //_____________________________________________________________________________ | |
144 | void | |
145 | AliMUONPreprocessor::Print(Option_t* opt) const | |
146 | { | |
147 | /// output to screen | |
148 | cout << "<AliMUONPreprocessor> subprocessors :" << endl; | |
149 | for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i ) | |
150 | { | |
151 | Subprocessor(i)->Print(opt); | |
152 | } | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | AliMUONVSubprocessor* | |
157 | AliMUONPreprocessor::Subprocessor(Int_t i) const | |
158 | { | |
159 | /// return i-th subprocessor | |
160 | if ( i >= 0 && i <= fSubprocessors->GetLast() ) | |
161 | { | |
162 | return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i)); | |
163 | } | |
164 | return 0x0; | |
165 | } |