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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONHVSubprocessor
21 /// A subprocessor to read HV values for one run
23 /// It simply creates a copy of the dcsAliasMap w/o information
24 /// from the MUON TRK, and dumps this copy into the CDB
26 /// \author Laurent Aphecetche, Subatech
27 //-----------------------------------------------------------------------------
29 #include "AliMUONHVSubprocessor.h"
30 #include "AliMUONPreprocessor.h"
32 #include "AliMpDEIterator.h"
33 #include "AliMpDEManager.h"
34 #include "AliMpDCSNamer.h"
36 #include "AliCDBMetaData.h"
39 #include "Riostream.h"
41 #include "TObjString.h"
44 ClassImp(AliMUONHVSubprocessor)
47 //_____________________________________________________________________________
48 AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master, Bool_t includeHVcurrents)
49 : AliMUONVSubprocessor(master,
51 "Get MUON Tracker HV values from DCS"), fIncludeHVCurrents(includeHVcurrents)
56 //_____________________________________________________________________________
57 AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
62 //_____________________________________________________________________________
64 AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
66 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
71 AliMpDCSNamer hvNamer("TRACKER");
78 aliases.SetOwner(kTRUE);
80 // we first generate a list of expected MCH DCS aliases we'll then look for
82 while ( !deIt.IsDone() )
84 Int_t detElemId = deIt.CurrentDEId();
86 switch ( AliMpDEManager::GetStationType(detElemId) )
88 case AliMp::kStation12:
90 for ( int i = 0; i <3; ++i)
92 aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i)));
93 if ( fIncludeHVCurrents )
95 aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,i,AliMpDCSNamer::kDCSI)));
100 case AliMp::kStation345:
102 aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId)));
103 if ( fIncludeHVCurrents )
105 aliases.Add(new TObjString(hvNamer.DCSAliasName(detElemId,0,AliMpDCSNamer::kDCSI)));
107 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
109 aliases.Add(new TObjString(hvNamer.DCSSwitchAliasName(detElemId,i)));
120 TIter next(&aliases);
122 Bool_t kNoAliases(kTRUE);
123 Int_t aliasNotFound(0);
124 Int_t valueNotFound(0);
126 while ( ( alias = static_cast<TObjString*>(next()) ) )
128 TString aliasName(alias->String());
129 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
137 TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
144 RemoveValuesOutsideRun(values);
145 hv.Add(new TObjString(aliasName.Data()),values);
152 Master()->Log("ERROR : no DCS values found");
158 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
163 Master()->Log(Form("WARNING %d values not found",valueNotFound));
166 Master()->Log("INFO Aliases successfully read in");
168 AliCDBMetaData metaData;
169 metaData.SetBeamPeriod(0);
170 metaData.SetResponsible("MUON TRK");
171 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
173 Bool_t validToInfinity(kFALSE);
175 Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
177 return ( result != kTRUE); // return 0 if everything is ok