]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHVSubprocessor.cxx
In QA:
[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
2ab3623b 16// $Id$
3d1463c8 17
18//-----------------------------------------------------------------------------
45824ef1 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///
78649106 26/// \author Laurent Aphecetche, Subatech
3d1463c8 27//-----------------------------------------------------------------------------
45824ef1 28
29#include "AliMUONHVSubprocessor.h"
45824ef1 30#include "AliMUONPreprocessor.h"
31
32#include "AliMpDEIterator.h"
33#include "AliMpDEManager.h"
49e110ec 34#include "AliMpDCSNamer.h"
45824ef1 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
45824ef1 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
49e110ec 71 AliMpDCSNamer hvNamer("TRACKER");
45824ef1 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 {
4e51cfd2 88 case AliMp::kStation12:
45824ef1 89 {
90 for ( int i = 0; i <3; ++i)
91 {
49e110ec 92 aliases.Add(new TObjString(hvNamer.DCSChannelName(detElemId,i)));
45824ef1 93 }
94 }
95 break;
96 case AliMp::kStation345:
97 {
49e110ec 98 aliases.Add(new TObjString(hvNamer.DCSChannelName(detElemId)));
45824ef1 99 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
100 {
49e110ec 101 aliases.Add(new TObjString(hvNamer.DCSSwitchName(detElemId,i)));
45824ef1 102 }
103 }
104 break;
105 default:
106 break;
107 };
108
109 deIt.Next();
110 }
111
112 TIter next(&aliases);
113 TObjString* alias;
c75c6131 114 Bool_t kNoAliases(kTRUE);
115 Int_t aliasNotFound(0);
116 Int_t valueNotFound(0);
45824ef1 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 {
c75c6131 124 ++aliasNotFound;
45824ef1 125 }
126 else
127 {
bec1918d 128 kNoAliases = kFALSE;
37f5fa19 129 TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
45824ef1 130 if (!values)
131 {
c75c6131 132 ++valueNotFound;
45824ef1 133 }
134 else
135 {
136 //FIXME : should insure here that values are only the ones within run
137 //limits (startTime<timestamp<endTime)
138 hv.Add(new TObjString(aliasName.Data()),values);
139 }
140 }
c75c6131 141 }
142
143 if ( kNoAliases )
144 {
145 Master()->Log("ERROR : no DCS values found");
d489129d 146 return 1;
c75c6131 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
d489129d 168 Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
45824ef1 169
d489129d 170 return ( result != kTRUE); // return 0 if everything is ok
45824ef1 171}
172