]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONHVSubprocessor.cxx
In AliMUONReconstructor:
[u/mrichter/AliRoot.git] / MUON / AliMUONHVSubprocessor.cxx
... / ...
CommitLineData
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/// \cond CLASSIMP
44ClassImp(AliMUONHVSubprocessor)
45/// \endcond
46
47//_____________________________________________________________________________
48AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master)
49: AliMUONVSubprocessor(master,
50 "HV",
51 "Get MUON Tracker HV values from DCS")
52{
53 /// ctor
54}
55
56//_____________________________________________________________________________
57AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
58{
59 /// dtor
60}
61
62//_____________________________________________________________________________
63UInt_t
64AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
65{
66 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
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.DCSChannelName(detElemId,i)));
93 }
94 }
95 break;
96 case AliMp::kStation345:
97 {
98 aliases.Add(new TObjString(hvNamer.DCSChannelName(detElemId)));
99 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
100 {
101 aliases.Add(new TObjString(hvNamer.DCSSwitchName(detElemId,i)));
102 }
103 }
104 break;
105 default:
106 break;
107 };
108
109 deIt.Next();
110 }
111
112 TIter next(&aliases);
113 TObjString* alias;
114 Bool_t kNoAliases(kTRUE);
115 Int_t aliasNotFound(0);
116 Int_t valueNotFound(0);
117
118 while ( ( alias = static_cast<TObjString*>(next()) ) )
119 {
120 TString aliasName(alias->String());
121 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
122 if (!hvPair)
123 {
124 ++aliasNotFound;
125 }
126 else
127 {
128 kNoAliases = kFALSE;
129 TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
130 if (!values)
131 {
132 ++valueNotFound;
133 }
134 else
135 {
136 RemoveValuesOutsideRun(values);
137
138 hv.Add(new TObjString(aliasName.Data()),values);
139 }
140 }
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));
157 }
158
159 Master()->Log("INFO Aliases successfully read in");
160
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 Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
169
170 return ( result != kTRUE); // return 0 if everything is ok
171}
172