AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONHVSubprocessor.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
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 
46 
47 //_____________________________________________________________________________
49 : AliMUONVSubprocessor(master,
50  "HV",
51  "Get MUON Tracker HV values from DCS"), fIncludeHVCurrents(includeHVcurrents)
52 {
54 }
55 
56 //_____________________________________________________________________________
58 {
60 }
61 
62 //_____________________________________________________________________________
63 UInt_t
65 {
67 
68  TMap hv;
69  hv.SetOwner(kTRUE);
70 
71  AliMpDCSNamer hvNamer("TRACKER");
72 
73  AliMpDEIterator deIt;
74 
75  deIt.First();
76 
77  TObjArray aliases;
78  aliases.SetOwner(kTRUE);
79 
80  // we first generate a list of expected MCH DCS aliases we'll then look for
81 
82  while ( !deIt.IsDone() )
83  {
84  Int_t detElemId = deIt.CurrentDEId();
85 
86  switch ( AliMpDEManager::GetStationType(detElemId) )
87  {
88  case AliMp::kStation12:
89  {
90  for ( int i = 0; i <3; ++i)
91  {
92  aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i)));
93  if ( fIncludeHVCurrents )
94  {
95  aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i,AliMpDCSNamer::kDCSI)));
96  }
97  }
98  }
99  break;
100  case AliMp::kStation345:
101  {
102  aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId)));
103  if ( fIncludeHVCurrents )
104  {
105  aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,0,AliMpDCSNamer::kDCSI)));
106  }
107  for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
108  {
109  aliases.Add(new TObjString(hvNamer.DCSSwitchAliasName(detElemId,i)));
110  }
111  }
112  break;
113  default:
114  break;
115  };
116 
117  deIt.Next();
118  }
119 
120  TIter next(&aliases);
121  TObjString* alias;
122  Bool_t kNoAliases(kTRUE);
123  Int_t aliasNotFound(0);
124  Int_t valueNotFound(0);
125 
126  TObjArray temporaryOut; // due to a bug in PVSS some iMon aliases cause problem
127  // we remove them for the moment.
128  temporaryOut.SetOwner(kTRUE);
129 
130  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat10.actual.iMon"));
131  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat11.actual.iMon"));
132  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber06Left/Slat12.actual.iMon"));
133  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat10.actual.iMon"));
134  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat11.actual.iMon"));
135  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber07Left/Slat12.actual.iMon"));
136  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat10.actual.iMon"));
137  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat11.actual.iMon"));
138  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber08Left/Slat12.actual.iMon"));
139  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat10.actual.iMon"));
140  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat11.actual.iMon"));
141  temporaryOut.Add(new TObjString("MchHvLvLeft/Chamber09Left/Slat12.actual.iMon"));
142  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat10.actual.iMon"));
143  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat11.actual.iMon"));
144  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber06Right/Slat12.actual.iMon"));
145  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat10.actual.iMon"));
146  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat11.actual.iMon"));
147  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber07Right/Slat12.actual.iMon"));
148  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat10.actual.iMon"));
149  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat11.actual.iMon"));
150  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber08Right/Slat12.actual.iMon"));
151  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat10.actual.iMon"));
152  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat11.actual.iMon"));
153  temporaryOut.Add(new TObjString("MchHvLvRight/Chamber09Right/Slat12.actual.iMon"));
154 
155  while ( ( alias = static_cast<TObjString*>(next()) ) )
156  {
157  TString aliasName(alias->String());
158 
159  if ( temporaryOut.FindObject(alias->String().Data() ) )
160  {
161  // skip problematic aliases
162  continue;
163  }
164 
165  TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
166  if (!hvPair)
167  {
168  ++aliasNotFound;
169  }
170  else
171  {
172  kNoAliases = kFALSE;
173  TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
174  if (!values)
175  {
176  ++valueNotFound;
177  }
178  else
179  {
180  RemoveValuesOutsideRun(values);
181  hv.Add(new TObjString(aliasName.Data()),values);
182  }
183  }
184  }
185 
186  if ( kNoAliases )
187  {
188  Master()->Log("ERROR : no DCS values found");
189  return 1;
190  }
191 
192  if ( aliasNotFound )
193  {
194  Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
195  }
196 
197  if ( valueNotFound )
198  {
199  Master()->Log(Form("WARNING %d values not found",valueNotFound));
200  }
201 
202  Master()->Log("INFO Aliases successfully read in");
203 
204  AliCDBMetaData metaData;
205  metaData.SetBeamPeriod(0);
206  metaData.SetResponsible("MUON TRK");
207  metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
208 
209  Bool_t validToInfinity(kFALSE);
210 
211  Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
212 
213  return ( result != kTRUE); // return 0 if everything is ok
214 }
215 
A subprocessor to read HV values for one run.
The iterator over detection elements.
station 1,2 (quadrants)
AliMUONPreprocessor * Master() const
Return the pointer to our master.
#define TObjArray
Bool_t IsDone() const
station 3,4,5 (slats)
Collection of methods usefull to DCS handling for MUON TRK and TRG.
Definition: AliMpDCSNamer.h:21
Int_t NumberOfPCBs(Int_t detElemId) const
Int_t CurrentDEId() const
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Bool_t RemoveValuesOutsideRun(TObjArray *values)
Base class for a shuttle sub-task for MUON (either TRK or TRG)
static AliMp::StationType GetStationType(Int_t detElemId)
void Log(const char *message)
Publish AliPreprocessor::Log function.
Bool_t Store(const char *pathLevel2, const char *pathLevel3, TObject *object, AliCDBMetaData *metaData, Int_t validityStart=0, Bool_t validityInfinite=kFALSE)
Publish AliPreprocessor::Store function.
TString DCSSwitchAliasName(Int_t detElemId, Int_t pcbNumber) const
Shuttle preprocessor for MUON subsystems (TRK and TRG)
TString DCSAliasName(Int_t detElemId, Int_t sector=0, Int_t dcsMeasure=0) const
virtual UInt_t Process(TMap *dcsAliasMap)
Process this sub-task.