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), |
890cc210 |
50 | fIsValid(kFALSE), |
581ece00 |
51 | fIsApplicable(kTRUE), |
d489129d |
52 | fSubprocessors(new TObjArray()), |
890cc210 |
53 | fProcessDCS(kFALSE) |
ea199e33 |
54 | { |
6c7a0c0f |
55 | /// ctor |
ea199e33 |
56 | } |
57 | |
58 | //_____________________________________________________________________________ |
59 | AliMUONPreprocessor::~AliMUONPreprocessor() |
60 | { |
61 | /// dtor |
62 | delete fSubprocessors; |
63 | } |
64 | |
65 | //_____________________________________________________________________________ |
66 | void |
eca96915 |
67 | AliMUONPreprocessor::ClearSubprocessors() |
6c7a0c0f |
68 | { |
69 | /// Empty our subprocessor list |
eca96915 |
70 | fSubprocessors->Clear(); |
d489129d |
71 | fProcessDCS = kFALSE; |
c41ce74d |
72 | fIsValid = kFALSE; |
581ece00 |
73 | fIsApplicable = kTRUE; |
6c7a0c0f |
74 | } |
75 | |
76 | //_____________________________________________________________________________ |
77 | void |
d489129d |
78 | AliMUONPreprocessor::Add(AliMUONVSubprocessor* sub, Bool_t processDCS) |
6c7a0c0f |
79 | { |
80 | /// Add a subprocessor to our list of workers |
81 | fSubprocessors->Add(sub); |
d489129d |
82 | if ( processDCS == kTRUE ) fProcessDCS = processDCS; |
6c7a0c0f |
83 | } |
84 | |
85 | //_____________________________________________________________________________ |
86 | void |
ea199e33 |
87 | AliMUONPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) |
88 | { |
c41ce74d |
89 | /// Load mapping and initialize subtasks |
ce8e7dbe |
90 | |
91 | // Delete previous mapping |
92 | delete AliMpSegmentation::Instance(false); |
93 | delete AliMpDDLStore::Instance(false); |
94 | |
94a393d9 |
95 | if ( ! IsApplicable() ) { |
96 | Log(Form("WARNING-RunType=%s is not one I should handle.",GetRunType())); |
97 | return; |
98 | } |
c41ce74d |
99 | |
94a393d9 |
100 | // Load mapping from CDB for this run |
2ab3623b |
101 | AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "Mapping"); |
102 | if (!cdbEntry) |
c41ce74d |
103 | { |
104 | Log("Could not get Mapping from OCDB !"); |
105 | fIsValid = kFALSE; |
106 | } |
107 | |
2ab3623b |
108 | cdbEntry = GetFromOCDB("Calib", "DDLStore"); |
109 | if (!cdbEntry) |
c41ce74d |
110 | { |
111 | Log("Could not get DDLStore from OCDB"); |
112 | fIsValid = kFALSE; |
113 | } |
ce8e7dbe |
114 | |
c41ce74d |
115 | if (IsValid()) |
ea199e33 |
116 | { |
c41ce74d |
117 | // loop over subtasks and initialize them |
118 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) |
119 | { |
120 | Subprocessor(i)->Initialize(run,startTime,endTime); |
121 | } |
ea199e33 |
122 | } |
2ab3623b |
123 | Log(Form("Initialize was %s",( IsValid() ? "fine" : "NOT OK"))); |
ea199e33 |
124 | } |
125 | |
126 | //_____________________________________________________________________________ |
127 | UInt_t |
128 | AliMUONPreprocessor::Process(TMap* dcsAliasMap) |
129 | { |
130 | /// loop over subtasks to make them work |
c41ce74d |
131 | |
132 | if (!IsValid()) |
133 | { |
134 | Log("Will not run as not properly initialized"); |
135 | return 99; |
136 | } |
137 | |
581ece00 |
138 | if (!IsApplicable()) |
139 | { |
140 | Log("Nothing to do for me"); |
141 | return 0; |
142 | } |
143 | |
ea199e33 |
144 | UInt_t rv(0); |
145 | |
146 | for ( Int_t i = 0; i <= fSubprocessors->GetLast(); ++i ) |
147 | { |
148 | rv += Subprocessor(i)->Process(dcsAliasMap); |
149 | } |
c41ce74d |
150 | |
ea199e33 |
151 | return rv; |
152 | } |
153 | |
154 | //_____________________________________________________________________________ |
155 | void |
156 | AliMUONPreprocessor::Print(Option_t* opt) const |
157 | { |
158 | /// output to screen |
159 | cout << "<AliMUONPreprocessor> subprocessors :" << endl; |
160 | for ( Int_t i=0; i <= fSubprocessors->GetLast(); ++i ) |
161 | { |
162 | Subprocessor(i)->Print(opt); |
163 | } |
164 | } |
165 | |
166 | //_____________________________________________________________________________ |
167 | AliMUONVSubprocessor* |
168 | AliMUONPreprocessor::Subprocessor(Int_t i) const |
169 | { |
170 | /// return i-th subprocessor |
171 | if ( i >= 0 && i <= fSubprocessors->GetLast() ) |
172 | { |
173 | return static_cast<AliMUONVSubprocessor*>(fSubprocessors->At(i)); |
174 | } |
175 | return 0x0; |
176 | } |