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 AliMUONTriggerDCSSubprocessor
21 /// A subprocessor to read Trigger DCS values for one run
23 /// It simply creates a copy of the dcsAliasMap w/o information
24 /// from the MUON TRG, and dumps this copy into the CDB
26 /// \author Diego Stocco, Subatech
27 //-----------------------------------------------------------------------------
29 #include "AliMUONTriggerDCSSubprocessor.h"
30 #include "AliMUONPreprocessor.h"
32 #include "AliMpDEIterator.h"
33 #include "AliMpDEManager.h"
34 #include "AliMpConstants.h"
35 #include "AliMpDCSNamer.h"
37 #include "AliCDBMetaData.h"
40 #include "Riostream.h"
42 #include "TObjString.h"
45 ClassImp(AliMUONTriggerDCSSubprocessor)
48 //_____________________________________________________________________________
49 AliMUONTriggerDCSSubprocessor::AliMUONTriggerDCSSubprocessor(AliMUONPreprocessor* master)
50 : AliMUONVSubprocessor(master,
52 "Get MUON Trigger HV and Current values from DCS")
57 //_____________________________________________________________________________
58 AliMUONTriggerDCSSubprocessor::~AliMUONTriggerDCSSubprocessor()
63 //_____________________________________________________________________________
65 AliMUONTriggerDCSSubprocessor::Process(TMap* dcsAliasMap)
67 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
70 dcsMap.SetOwner(kTRUE);
72 AliMpDCSNamer dcsMapNamer("TRIGGER");
79 aliases.SetOwner(kTRUE);
81 // we first generate a list of expected MTR DCS aliases we'll then look for
83 while ( !deIt.IsDone() )
85 Int_t detElemId = deIt.CurrentDEId();
87 if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStationTrigger) {
89 for(Int_t iMeas=0; iMeas<AliMpDCSNamer::kNDCSMeas; iMeas++){
90 aliases.Add(new TObjString(dcsMapNamer.DCSChannelName(detElemId, 0, iMeas)));
100 Bool_t kNoAliases(kTRUE);
101 Int_t aliasNotFound(0);
102 Int_t valueNotFound(0);
104 while ( ( alias = static_cast<TObjString*>(next()) ) )
106 TString aliasName(alias->String());
107 TPair* dcsMapPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
115 if (!dcsMapPair->Value())
121 TObjArray* values = static_cast<TObjArray*>(dcsMapPair->Value()->Clone());
122 //FIXME : should insure here that values are only the ones within run
123 //limits (startTime<timestamp<endTime)
124 dcsMap.Add(new TObjString(aliasName.Data()),values);
131 Master()->Log("ERROR : no DCS values found");
137 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
142 Master()->Log(Form("WARNING %d values not found",valueNotFound));
145 Master()->Log("INFO Aliases successfully read in");
147 AliCDBMetaData metaData;
148 metaData.SetBeamPeriod(0);
149 metaData.SetResponsible("MUON TRG");
150 metaData.SetComment("Computed by AliMUONTriggerDCSSubprocessor $Id$");
152 Bool_t validToInfinity(kFALSE);
154 Bool_t result = Master()->Store("Calib","TriggerDCS",&dcsMap,&metaData,0,validToInfinity);
156 return ( result != kTRUE); // return 0 if everything is ok