Line data Source code
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 : //-----------------------------------------------------------------------------
19 : /// \class AliMUONHVSubprocessor
20 : ///
21 : /// A subprocessor to read HV values for one run
22 : ///
23 : /// It simply creates a copy of the dcsAliasMap w/o information
24 : /// from the MUON TRK, and dumps this copy into the CDB
25 : ///
26 : /// \author Laurent Aphecetche, Subatech
27 : //-----------------------------------------------------------------------------
28 :
29 : #include "AliMUONHVSubprocessor.h"
30 : #include "AliMUONPreprocessor.h"
31 :
32 : #include "AliMpDEIterator.h"
33 : #include "AliMpDEManager.h"
34 : #include "AliMpDCSNamer.h"
35 :
36 : #include "AliCDBMetaData.h"
37 : #include "AliLog.h"
38 :
39 : #include "Riostream.h"
40 : #include "TMap.h"
41 : #include "TObjString.h"
42 :
43 : #include "AliMUONCalibrationData.h"
44 :
45 : /// \cond CLASSIMP
46 12 : ClassImp(AliMUONHVSubprocessor)
47 : /// \endcond
48 :
49 : //_____________________________________________________________________________
50 : AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master, Bool_t includeHVcurrents)
51 0 : : AliMUONVSubprocessor(master,
52 : "HV",
53 0 : "Get MUON Tracker HV values from DCS"), fIncludeHVCurrents(includeHVcurrents)
54 0 : {
55 : /// ctor
56 0 : }
57 :
58 : //_____________________________________________________________________________
59 : AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
60 0 : {
61 : /// dtor
62 0 : }
63 :
64 : //_____________________________________________________________________________
65 : UInt_t
66 : AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
67 : {
68 : /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
69 :
70 0 : TMap hv;
71 0 : hv.SetOwner(kTRUE);
72 :
73 0 : hv.SetUniqueID(AliMUONCalibrationData::PatchHVDCSAliasesSt1WasAppliedMask());
74 :
75 0 : AliMpDCSNamer hvNamer("TRACKER");
76 :
77 0 : AliMpDEIterator deIt;
78 :
79 0 : deIt.First();
80 :
81 0 : TObjArray aliases;
82 0 : aliases.SetOwner(kTRUE);
83 :
84 : // we first generate a list of expected MCH DCS aliases we'll then look for
85 :
86 0 : while ( !deIt.IsDone() )
87 : {
88 0 : Int_t detElemId = deIt.CurrentDEId();
89 :
90 0 : switch ( AliMpDEManager::GetStationType(detElemId) )
91 : {
92 : case AliMp::kStation12:
93 : {
94 0 : for ( int i = 0; i <3; ++i)
95 : {
96 0 : aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i)));
97 0 : if ( fIncludeHVCurrents )
98 : {
99 0 : aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i,AliMpDCSNamer::kDCSI)));
100 0 : }
101 : }
102 : }
103 0 : break;
104 : case AliMp::kStation345:
105 : {
106 0 : aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId)));
107 0 : if ( fIncludeHVCurrents )
108 : {
109 0 : aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,0,AliMpDCSNamer::kDCSI)));
110 0 : }
111 0 : for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
112 : {
113 0 : aliases.Add(new TObjString(hvNamer.DCSSwitchAliasName(detElemId,i)));
114 : }
115 : }
116 0 : break;
117 : default:
118 : break;
119 : };
120 :
121 0 : deIt.Next();
122 : }
123 :
124 0 : TIter next(&aliases);
125 : TObjString* alias;
126 : Bool_t kNoAliases(kTRUE);
127 : Int_t aliasNotFound(0);
128 : Int_t valueNotFound(0);
129 :
130 0 : TObjArray temporaryOut; // due to a bug in PVSS some iMon aliases cause problem
131 : // we remove them for the moment.
132 0 : temporaryOut.SetOwner(kTRUE);
133 :
134 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat10.actual.iMon"));
135 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat11.actual.iMon"));
136 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat12.actual.iMon"));
137 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat10.actual.iMon"));
138 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat11.actual.iMon"));
139 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat12.actual.iMon"));
140 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat10.actual.iMon"));
141 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat11.actual.iMon"));
142 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat12.actual.iMon"));
143 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat10.actual.iMon"));
144 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat11.actual.iMon"));
145 0 : temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat12.actual.iMon"));
146 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat10.actual.iMon"));
147 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat11.actual.iMon"));
148 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat12.actual.iMon"));
149 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat10.actual.iMon"));
150 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat11.actual.iMon"));
151 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat12.actual.iMon"));
152 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat10.actual.iMon"));
153 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat11.actual.iMon"));
154 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat12.actual.iMon"));
155 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat10.actual.iMon"));
156 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat11.actual.iMon"));
157 0 : temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat12.actual.iMon"));
158 :
159 0 : while ( ( alias = static_cast<TObjString*>(next()) ) )
160 : {
161 0 : TString aliasName(alias->String());
162 :
163 0 : if ( temporaryOut.FindObject(alias->String().Data() ) )
164 : {
165 : // skip problematic aliases
166 0 : continue;
167 : }
168 :
169 0 : TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
170 0 : if (!hvPair)
171 : {
172 0 : ++aliasNotFound;
173 0 : }
174 : else
175 : {
176 : kNoAliases = kFALSE;
177 0 : TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
178 0 : if (!values)
179 : {
180 0 : ++valueNotFound;
181 0 : }
182 : else
183 : {
184 0 : RemoveValuesOutsideRun(values);
185 0 : hv.Add(new TObjString(aliasName.Data()),values);
186 : }
187 : }
188 0 : }
189 :
190 0 : if ( kNoAliases )
191 : {
192 0 : Master()->Log("ERROR : no DCS values found");
193 0 : return 1;
194 : }
195 :
196 0 : if ( aliasNotFound )
197 : {
198 0 : Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
199 : }
200 :
201 0 : if ( valueNotFound )
202 : {
203 0 : Master()->Log(Form("WARNING %d values not found",valueNotFound));
204 : }
205 :
206 0 : Master()->Log("INFO Aliases successfully read in");
207 :
208 0 : AliCDBMetaData metaData;
209 0 : metaData.SetBeamPeriod(0);
210 0 : metaData.SetResponsible("MUON TRK");
211 0 : metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
212 :
213 : Bool_t validToInfinity(kFALSE);
214 :
215 0 : Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
216 :
217 0 : return ( result != kTRUE); // return 0 if everything is ok
218 0 : }
219 :
|