]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerDCSSubprocessor.cxx
Fixing anti-aliasing problem on MacOSX
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerDCSSubprocessor.cxx
CommitLineData
49e110ec 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
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**************************************************************************/
15
16// $Id$
17
18//-----------------------------------------------------------------------------
19/// \class AliMUONTriggerDCSSubprocessor
20///
21/// A subprocessor to read Trigger DCS values for one run
22///
23/// It simply creates a copy of the dcsAliasMap w/o information
24/// from the MUON TRG, and dumps this copy into the CDB
25///
26/// \author Diego Stocco, Subatech
27//-----------------------------------------------------------------------------
28
29#include "AliMUONTriggerDCSSubprocessor.h"
30#include "AliMUONPreprocessor.h"
31
32#include "AliMpDEIterator.h"
33#include "AliMpDEManager.h"
34#include "AliMpConstants.h"
35#include "AliMpDCSNamer.h"
36
37#include "AliCDBMetaData.h"
38#include "AliLog.h"
6a69d972 39#include "AliDCSValue.h"
49e110ec 40
41#include "Riostream.h"
42#include "TMap.h"
43#include "TObjString.h"
44
45/// \cond CLASSIMP
46ClassImp(AliMUONTriggerDCSSubprocessor)
47/// \endcond
48
49//_____________________________________________________________________________
50AliMUONTriggerDCSSubprocessor::AliMUONTriggerDCSSubprocessor(AliMUONPreprocessor* master)
51: AliMUONVSubprocessor(master,
52 "TriggerDCS",
53 "Get MUON Trigger HV and Current values from DCS")
54{
55 /// ctor
56}
57
58//_____________________________________________________________________________
59AliMUONTriggerDCSSubprocessor::~AliMUONTriggerDCSSubprocessor()
60{
61 /// dtor
62}
63
64//_____________________________________________________________________________
65UInt_t
66AliMUONTriggerDCSSubprocessor::Process(TMap* dcsAliasMap)
67{
68 /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
69
70 TMap dcsMap;
71 dcsMap.SetOwner(kTRUE);
72
73 AliMpDCSNamer dcsMapNamer("TRIGGER");
74
75 AliMpDEIterator deIt;
76
77 deIt.First();
78
79 TObjArray aliases;
80 aliases.SetOwner(kTRUE);
81
82 // we first generate a list of expected MTR DCS aliases we'll then look for
83
84 while ( !deIt.IsDone() )
85 {
86 Int_t detElemId = deIt.CurrentDEId();
87
88 if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStationTrigger) {
89
90 for(Int_t iMeas=0; iMeas<AliMpDCSNamer::kNDCSMeas; iMeas++){
1d5cf0f2 91 aliases.Add(new TObjString(dcsMapNamer.DCSAliasName(detElemId, 0, iMeas)));
49e110ec 92 }
93
94 }
95
96 deIt.Next();
97 }
98
99 TIter next(&aliases);
100 TObjString* alias;
101 Bool_t kNoAliases(kTRUE);
102 Int_t aliasNotFound(0);
103 Int_t valueNotFound(0);
104
105 while ( ( alias = static_cast<TObjString*>(next()) ) )
106 {
107 TString aliasName(alias->String());
108 TPair* dcsMapPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
109 if (!dcsMapPair)
110 {
111 ++aliasNotFound;
112 }
113 else
114 {
115 kNoAliases = kFALSE;
116 if (!dcsMapPair->Value())
117 {
118 ++valueNotFound;
119 }
120 else
121 {
122 TObjArray* values = static_cast<TObjArray*>(dcsMapPair->Value()->Clone());
6a69d972 123 RemoveValuesOutsideRun(values);
124
49e110ec 125 dcsMap.Add(new TObjString(aliasName.Data()),values);
126 }
127 }
128 }
129
130 if ( kNoAliases )
131 {
132 Master()->Log("ERROR : no DCS values found");
133 return 1;
134 }
135
136 if ( aliasNotFound )
137 {
138 Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
139 }
140
141 if ( valueNotFound )
142 {
143 Master()->Log(Form("WARNING %d values not found",valueNotFound));
144 }
145
146 Master()->Log("INFO Aliases successfully read in");
147
148 AliCDBMetaData metaData;
149 metaData.SetBeamPeriod(0);
150 metaData.SetResponsible("MUON TRG");
151 metaData.SetComment("Computed by AliMUONTriggerDCSSubprocessor $Id$");
152
153 Bool_t validToInfinity(kFALSE);
154
155 Bool_t result = Master()->Store("Calib","TriggerDCS",&dcsMap,&metaData,0,validToInfinity);
156
157 return ( result != kTRUE); // return 0 if everything is ok
158}
159