]>
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 | |
2fbe202b | 20 | #include "AliCDBEntry.h" |
21 | #include "AliLog.h" | |
fee1d02b | 22 | #include "AliMUONGMSSubprocessor.h" |
2fbe202b | 23 | #include "AliMUONHVSubprocessor.h" |
24 | #include "AliMUONPedestalSubprocessor.h" | |
25 | #include "AliMpCDB.h" | |
ce8e7dbe | 26 | #include "AliMpDDLStore.h" |
2fbe202b | 27 | #include "AliMpDataMap.h" |
28 | #include "AliMpDataStreams.h" | |
29 | #include "AliMpSegmentation.h" | |
57e176c0 | 30 | #include "AliShuttleInterface.h" |
ea199e33 | 31 | #include "Riostream.h" |
fee1d02b | 32 | #include "TObjArray.h" |
ea199e33 | 33 | |
3d1463c8 | 34 | //----------------------------------------------------------------------------- |
ea199e33 | 35 | /// \class AliMUONPreprocessor |
36 | /// | |
37 | /// Shuttle preprocessor for MUON subsystems (TRK and TRG) | |
38 | /// | |
39 | /// It's simply a manager class that deals with a list of sub-tasks | |
40 | /// (of type AliMUONVSubprocessor). | |
41 | /// | |
42 | /// \author Laurent Aphecetche | |
3d1463c8 | 43 | //----------------------------------------------------------------------------- |
ea199e33 | 44 | |
45 | /// \cond CLASSIMP | |
46 | ClassImp(AliMUONPreprocessor) | |
47 | /// \endcond | |
48 | ||
49 | //_____________________________________________________________________________ | |
6c7a0c0f | 50 | AliMUONPreprocessor::AliMUONPreprocessor(const char* detName, AliShuttleInterface* shuttle) |
51 | : AliPreprocessor(detName, shuttle), | |
890cc210 | 52 | fIsValid(kFALSE), |
581ece00 | 53 | fIsApplicable(kTRUE), |
d489129d | 54 | fSubprocessors(new TObjArray()), |
890cc210 | 55 | fProcessDCS(kFALSE) |
ea199e33 | 56 | { |
6c7a0c0f | 57 | /// ctor |
ea199e33 | 58 | } |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | AliMUONPreprocessor::~AliMUONPreprocessor() | |
62 | { | |
63 | /// dtor | |
64 | delete fSubprocessors; | |
65 | } | |
66 | ||
6c7a0c0f | 67 | //_____________________________________________________________________________ |
68 | void | |
eca96915 | 69 | AliMUONPreprocessor::ClearSubprocessors() |
6c7a0c0f | 70 | { |
71 | /// Empty our subprocessor list | |
eca96915 | 72 | fSubprocessors->Clear(); |
d489129d | 73 | fProcessDCS = kFALSE; |
c41ce74d | 74 | fIsValid = kFALSE; |
581ece00 | 75 | fIsApplicable = kTRUE; |
6c7a0c0f | 76 | } |
77 | ||
78 | //_____________________________________________________________________________ | |
79 | void | |
d489129d | 80 | AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS) |
6c7a0c0f | 81 | { |
82 | /// Add a subprocessor to our list of workers | |
83 | fSubprocessors->Add(sub); | |
d489129d | 84 | if ( processDCS == kTRUE ) fProcessDCS = processDCS; |
6c7a0c0f | 85 | } |
86 | ||
ea199e33 | 87 | //_____________________________________________________________________________ |
88 | void | |
89 | AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) | |
90 | { | |
c41ce74d | 91 | /// Load mapping and initialize subtasks |
ce8e7dbe | 92 | |
93 | // Delete previous mapping | |
2fbe202b | 94 | AliMpCDB::UnloadAll(); |
ce8e7dbe | 95 | |
94a393d9 | 96 | if ( ! IsApplicable() ) { |
97 | Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType())); | |
98 | return; | |
99 | } | |
c41ce74d | 100 | |
94a393d9 | 101 | // Load mapping from CDB for this run |
2fbe202b | 102 | AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "MappingData"); |
2ab3623b | 103 | if (!cdbEntry) |
c41ce74d | 104 | { |
2fbe202b | 105 | Log("Could not get MappingData from OCDB !"); |
c41ce74d | 106 | fIsValid = kFALSE; |
107 | } | |
2fbe202b | 108 | else |
109 | { | |
110 | AliMpDataMap* dataMap = dynamic_cast<AliMpDataMap*>(cdbEntry->GetObject()); | |
111 | if (!dataMap) | |
112 | { | |
113 | Log("DataMap is not of the expected type. That is bad..."); | |
114 | fIsValid = kFALSE; | |
115 | } | |
116 | else | |
117 | { | |
118 | AliMpDataStreams dataStreams(dataMap); | |
119 | AliMpDDLStore::ReadData(dataStreams); | |
120 | } | |
121 | } | |
c41ce74d | 122 | |
6c870207 | 123 | Int_t nok(0); |
124 | ||
c41ce74d | 125 | if (IsValid()) |
ea199e33 | 126 | { |
c41ce74d | 127 | // loop over subtasks and initialize them |
128 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) | |
129 | { | |
6c870207 | 130 | Bool_t ok = Subprocessor(i)->Initialize(run,startTime,endTime); |
131 | if (ok) ++nok; | |
c41ce74d | 132 | } |
6c870207 | 133 | if (nok != fSubprocessors->GetLast()+1) fIsValid = kFALSE; |
ea199e33 | 134 | } |
2ab3623b | 135 | Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK"))); |
ea199e33 | 136 | } |
137 | ||
138 | //_____________________________________________________________________________ | |
139 | UInt_t | |
140 | AliMUONPreprocessor::Process(TMap* dcsAliasMap) | |
141 | { | |
142 | /// loop over subtasks to make them work | |
c41ce74d | 143 | |
144 | if (!IsValid()) | |
145 | { | |
146 | Log("Will not run as not properly initialized"); | |
147 | return 99; | |
148 | } | |
149 | ||
581ece00 | 150 | if (!IsApplicable()) |
151 | { | |
152 | Log("Nothing to do for me"); | |
153 | return 0; | |
154 | } | |
155 | ||
ea199e33 | 156 | UInt_t rv(0); |
157 | ||
158 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) | |
159 | { | |
160 | rv += Subprocessor(i)->Process(dcsAliasMap); | |
161 | } | |
c41ce74d | 162 | |
ea199e33 | 163 | return rv; |
164 | } | |
165 | ||
166 | //_____________________________________________________________________________ | |
167 | void | |
168 | AliMUONPreprocessor::Print(Option_t* opt) const | |
169 | { | |
170 | /// output to screen | |
171 | cout << "<AliMUONPreprocessor> subprocessors :" << endl; | |
172 | for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i ) | |
173 | { | |
174 | Subprocessor(i)->Print(opt); | |
175 | } | |
176 | } | |
177 | ||
178 | //_____________________________________________________________________________ | |
179 | AliMUONVSubprocessor* | |
180 | AliMUONPreprocessor::Subprocessor(Int_t i) const | |
181 | { | |
182 | /// return i-th subprocessor | |
183 | if ( i >= 0 && i <= fSubprocessors->GetLast() ) | |
184 | { | |
185 | return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i)); | |
186 | } | |
187 | return 0x0; | |
188 | } |