1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 /// \class AliMUONHVSubprocessor
19 /// A subprocessor to read HV values for one run
21 /// It simply creates a copy of the dcsAliasMap w/o information
22 /// from the MUON TRK, and dumps this copy into the CDB
24 /// \author Laurent Aphecetche, Subatech
26 #include "AliMUONHVSubprocessor.h"
27 #include "AliMUONHVNamer.h"
28 #include "AliMUONPreprocessor.h"
30 #include "AliMpDEIterator.h"
31 #include "AliMpDEManager.h"
33 #include "AliCDBMetaData.h"
36 #include "Riostream.h"
38 #include "TObjString.h"
41 ClassImp(AliMUONHVSubprocessor)
44 //_____________________________________________________________________________
45 AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master)
46 : AliMUONVSubprocessor(master,
48 "Get MUON Tracker HV values from DCS")
53 //_____________________________________________________________________________
54 AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
59 //_____________________________________________________________________________
61 AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
63 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
68 AliMUONHVNamer hvNamer;
75 aliases.SetOwner(kTRUE);
77 // we first generate a list of expected MCH DCS aliases we'll then look for
79 while ( !deIt.IsDone() )
81 Int_t detElemId = deIt.CurrentDEId();
83 switch ( AliMpDEManager::GetStationType(detElemId) )
85 case AliMp::kStation1:
86 case AliMp::kStation2:
88 for ( int i = 0; i <3; ++i)
90 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
94 case AliMp::kStation345:
96 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
97 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
99 aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
110 TIter next(&aliases);
112 Bool_t kNoAliases(kTRUE);
113 Int_t aliasNotFound(0);
114 Int_t valueNotFound(0);
116 while ( ( alias = static_cast<TObjString*>(next()) ) )
118 TString aliasName(alias->String());
119 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
123 // Master()->Log(Form("WARNING Did not find expected alias (%s)",aliasName.Data()));
127 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
131 // Master()->Log(Form("WARNING Could not get values for alias (%s)",aliasName.Data()));
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);
145 Master()->Log("ERROR : no DCS values found");
151 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
156 Master()->Log(Form("WARNING %d values not found",valueNotFound));
159 Master()->Log("INFO Aliases successfully read in");
161 AliCDBMetaData metaData;
162 metaData.SetBeamPeriod(0);
163 metaData.SetResponsible("MUON TRK");
164 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
166 Bool_t validToInfinity(kFALSE);
168 UInt_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);