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::Initialize(Int_t run,
62 UInt_t startTime, UInt_t endTime)
64 /// Initialisation for a given run
65 AliDebug(1,Form("run %d startTime %ld endtime %ld",run,startTime,endTime));
68 //_____________________________________________________________________________
70 AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
72 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
77 AliMUONHVNamer hvNamer;
84 aliases.SetOwner(kTRUE);
86 // we first generate a list of expected MCH DCS aliases we'll then look for
88 while ( !deIt.IsDone() )
90 Int_t detElemId = deIt.CurrentDEId();
92 switch ( AliMpDEManager::GetStationType(detElemId) )
94 case AliMp::kStation1:
95 case AliMp::kStation2:
97 for ( int i = 0; i <3; ++i)
99 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
103 case AliMp::kStation345:
105 aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
106 for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
108 aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
119 TIter next(&aliases);
122 while ( ( alias = static_cast<TObjString*>(next()) ) )
124 TString aliasName(alias->String());
125 TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
128 AliError(Form("Did not find expected alias (%s)",aliasName.Data()));
132 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
135 AliError(Form("Could not get values for alias (%s)",aliasName.Data()));
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);
146 AliCDBMetaData metaData;
147 metaData.SetBeamPeriod(0);
148 metaData.SetResponsible("MUON TRK");
149 metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$");
151 Bool_t validToInfinity(kFALSE);
153 UInt_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);