]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHVSubprocessor.cxx
Implementing a clever Print method which allow to select which part of the store...
[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
59//_____________________________________________________________________________
60void
61AliMUONHVSubprocessor::Initialize(Int_t run,
62 UInt_t startTime, UInt_t endTime)
63{
64 /// Initialisation for a given run
65 AliDebug(1,Form("run %d startTime %ld endtime %ld",run,startTime,endTime));
66}
67
68//_____________________________________________________________________________
69UInt_t
70AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
71{
72 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
73
74 TMap hv;
75 hv.SetOwner(kTRUE);
76
77 AliMUONHVNamer hvNamer;
78
79 AliMpDEIterator deIt;
80
81 deIt.First();
82
83 TObjArray aliases;
84 aliases.SetOwner(kTRUE);
85
86 // we first generate a list of expected MCH DCS aliases we'll then look for
87
88 while ( !deIt.IsDone() )
89 {
90 Int_t detElemId = deIt.CurrentDEId();
91
92 switch ( AliMpDEManager::GetStationType(detElemId) )
93 {
94 case AliMp::kStation1:
95 case AliMp::kStation2:
96 {
97 for ( int i = 0; i <3; ++i)
98 {
99 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
100 }
101 }
102 break;
103 case AliMp::kStation345:
104 {
105 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
106 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
107 {
108 aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
109 }
110 }
111 break;
112 default:
113 break;
114 };
115
116 deIt.Next();
117 }
118
119 TIter next(&aliases);
120 TObjString* alias;
121
122 while ( ( alias = static_cast<TObjString*>(next()) ) )
123 {
124 TString aliasName(alias->String());
125 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
126 if (!hvPair)
127 {
128 AliError(Form("Did not find expected alias (%s)",aliasName.Data()));
129 }
130 else
131 {
132 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
133 if (!values)
134 {
135 AliError(Form("Could not get values for alias (%s)",aliasName.Data()));
136 }
137 else
138 {
139 //FIXME : should insure here that values are only the ones within run
140 //limits (startTime<timestamp<endTime)
141 hv.Add(new TObjString(aliasName.Data()),values);
142 }
143 }
144 }
145
146 AliCDBMetaData metaData;
147 metaData.SetBeamPeriod(0);
148 metaData.SetResponsible("MUON TRK");
149 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
150
151 Bool_t validToInfinity(kFALSE);
152
153 UInt_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
154
155 return result;
156}
157