]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHVSubprocessor.cxx
Adding comment
[u/mrichter/AliRoot.git] / MUON / AliMUONHVSubprocessor.cxx
CommitLineData
45824ef1 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/// \class AliMUONHVSubprocessor
18///
19/// A subprocessor to read HV values for one run
20///
21/// It simply creates a copy of the dcsAliasMap w/o information
22/// from the MUON TRK, and dumps this copy into the CDB
23///
24// Author: Laurent Aphecetche, Subatech
25
26#include "AliMUONHVSubprocessor.h"
27#include "AliMUONHVNamer.h"
28#include "AliMUONPreprocessor.h"
29
30#include "AliMpDEIterator.h"
31#include "AliMpDEManager.h"
32
33#include "AliCDBMetaData.h"
34#include "AliLog.h"
35
36#include "Riostream.h"
37#include "TMap.h"
38#include "TObjString.h"
39
40/// \cond CLASSIMP
41ClassImp(AliMUONHVSubprocessor)
42/// \endcond
43
44//_____________________________________________________________________________
45AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master)
46: AliMUONVSubprocessor(master,
47 "HV",
48 "Get MUON Tracker HV values from DCS")
49{
50 /// ctor
51}
52
53//_____________________________________________________________________________
54AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
55{
56 /// dtor
57}
58
45824ef1 59//_____________________________________________________________________________
60UInt_t
61AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
62{
63 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
64
65 TMap hv;
66 hv.SetOwner(kTRUE);
67
68 AliMUONHVNamer hvNamer;
69
70 AliMpDEIterator deIt;
71
72 deIt.First();
73
74 TObjArray aliases;
75 aliases.SetOwner(kTRUE);
76
77 // we first generate a list of expected MCH DCS aliases we'll then look for
78
79 while ( !deIt.IsDone() )
80 {
81 Int_t detElemId = deIt.CurrentDEId();
82
83 switch ( AliMpDEManager::GetStationType(detElemId) )
84 {
85 case AliMp::kStation1:
86 case AliMp::kStation2:
87 {
88 for ( int i = 0; i <3; ++i)
89 {
90 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
91 }
92 }
93 break;
94 case AliMp::kStation345:
95 {
96 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
97 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
98 {
99 aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
100 }
101 }
102 break;
103 default:
104 break;
105 };
106
107 deIt.Next();
108 }
109
110 TIter next(&aliases);
111 TObjString* alias;
c75c6131 112 Bool_t kNoAliases(kTRUE);
113 Int_t aliasNotFound(0);
114 Int_t valueNotFound(0);
45824ef1 115
116 while ( ( alias = static_cast<TObjString*>(next()) ) )
117 {
118 TString aliasName(alias->String());
119 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
120 if (!hvPair)
121 {
c75c6131 122 ++aliasNotFound;
123// Master()->Log(Form("WARNING Did not find expected alias (%s)",aliasName.Data()));
45824ef1 124 }
125 else
126 {
127 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
128 if (!values)
129 {
c75c6131 130 ++valueNotFound;
131// Master()->Log(Form("WARNING Could not get values for alias (%s)",aliasName.Data()));
45824ef1 132 }
133 else
134 {
135 //FIXME : should insure here that values are only the ones within run
136 //limits (startTime<timestamp<endTime)
137 hv.Add(new TObjString(aliasName.Data()),values);
138 }
139 }
c75c6131 140 kNoAliases = kFALSE;
141 }
142
143 if ( kNoAliases )
144 {
145 Master()->Log("ERROR : no DCS values found");
146 return 1;
147 }
148
149 if ( aliasNotFound )
150 {
151 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
152 }
153
154 if ( valueNotFound )
155 {
156 Master()->Log(Form("WARNING %d values not found",valueNotFound));
45824ef1 157 }
158
c75c6131 159 Master()->Log("INFO Aliases successfully read in");
d3f57575 160
45824ef1 161 AliCDBMetaData metaData;
162 metaData.SetBeamPeriod(0);
163 metaData.SetResponsible("MUON TRK");
164 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
165
166 Bool_t validToInfinity(kFALSE);
167
168 UInt_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
169
170 return result;
171}
172