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 "AliMpHVNamer.h"
36 #include "AliCDBMetaData.h"
39 #include "Riostream.h"
41 #include "TObjString.h"
44 ClassImp(AliMUONHVSubprocessor)
47 //_____________________________________________________________________________
48 AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master)
49 : AliMUONVSubprocessor(master,
51 "Get MUON Tracker HV values from DCS")
56 //_____________________________________________________________________________
57 AliMUONHVSubprocessor::~AliMUONHVSubprocessor()
62 //_____________________________________________________________________________
64 AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
66 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
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::kStation1:
89 case AliMp::kStation2:
91 for ( int i = 0; i <3; ++i)
93 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
97 case AliMp::kStation345:
99 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
100 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
102 aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
113 TIter next(&aliases);
115 Bool_t kNoAliases(kTRUE);
116 Int_t aliasNotFound(0);
117 Int_t valueNotFound(0);
119 while ( ( alias = static_cast<TObjString*>(next()) ) )
121 TString aliasName(alias->String());
122 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
130 TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
137 //FIXME : should insure here that values are only the ones within run
138 //limits (startTime<timestamp<endTime)
139 hv.Add(new TObjString(aliasName.Data()),values);
146 Master()->Log("ERROR : no DCS values found");
152 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
157 Master()->Log(Form("WARNING %d values not found",valueNotFound));
160 Master()->Log("INFO Aliases successfully read in");
162 AliCDBMetaData metaData;
163 metaData.SetBeamPeriod(0);
164 metaData.SetResponsible("MUON TRK");
165 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
167 Bool_t validToInfinity(kFALSE);
169 Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
171 return ( result != kTRUE); // return 0 if everything is ok