Line data Source code
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"
39 : #include "AliDCSValue.h"
40 :
41 : #include "Riostream.h"
42 : #include "TMap.h"
43 : #include "TObjString.h"
44 :
45 : /// \cond CLASSIMP
46 12 : ClassImp(AliMUONTriggerDCSSubprocessor)
47 : /// \endcond
48 :
49 : //_____________________________________________________________________________
50 : AliMUONTriggerDCSSubprocessor::AliMUONTriggerDCSSubprocessor(AliMUONPreprocessor* master)
51 0 : : AliMUONVSubprocessor(master,
52 : "TriggerDCS",
53 : "Get MUON Trigger HV and Current values from DCS")
54 0 : {
55 : /// ctor
56 0 : }
57 :
58 : //_____________________________________________________________________________
59 : AliMUONTriggerDCSSubprocessor::~AliMUONTriggerDCSSubprocessor()
60 0 : {
61 : /// dtor
62 0 : }
63 :
64 : //_____________________________________________________________________________
65 : UInt_t
66 : AliMUONTriggerDCSSubprocessor::Process(TMap* dcsAliasMap)
67 : {
68 : /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases.
69 :
70 0 : TMap dcsMap;
71 0 : dcsMap.SetOwner(kTRUE);
72 :
73 0 : AliMpDCSNamer dcsMapNamer("TRIGGER");
74 :
75 0 : AliMpDEIterator deIt;
76 :
77 0 : deIt.First();
78 :
79 0 : TObjArray aliases;
80 0 : aliases.SetOwner(kTRUE);
81 :
82 : // we first generate a list of expected MTR DCS aliases we'll then look for
83 :
84 0 : while ( !deIt.IsDone() )
85 : {
86 0 : Int_t detElemId = deIt.CurrentDEId();
87 :
88 0 : if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStationTrigger) {
89 :
90 0 : for(Int_t iMeas=0; iMeas<AliMpDCSNamer::kNDCSMeas; iMeas++){
91 0 : aliases.Add(new TObjString(dcsMapNamer.DCSAliasName(detElemId, 0, iMeas)));
92 : }
93 :
94 0 : }
95 :
96 0 : deIt.Next();
97 : }
98 :
99 0 : TIter next(&aliases);
100 : TObjString* alias;
101 : Bool_t kNoAliases(kTRUE);
102 : Int_t aliasNotFound(0);
103 : Int_t valueNotFound(0);
104 :
105 0 : while ( ( alias = static_cast<TObjString*>(next()) ) )
106 : {
107 0 : TString aliasName(alias->String());
108 0 : TPair* dcsMapPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
109 0 : if (!dcsMapPair)
110 : {
111 0 : ++aliasNotFound;
112 0 : }
113 : else
114 : {
115 : kNoAliases = kFALSE;
116 0 : if (!dcsMapPair->Value())
117 : {
118 0 : ++valueNotFound;
119 0 : }
120 : else
121 : {
122 0 : TObjArray* values = static_cast<TObjArray*>(dcsMapPair->Value()->Clone());
123 0 : RemoveValuesOutsideRun(values);
124 :
125 0 : dcsMap.Add(new TObjString(aliasName.Data()),values);
126 : }
127 : }
128 0 : }
129 :
130 0 : if ( kNoAliases )
131 : {
132 0 : Master()->Log("ERROR : no DCS values found");
133 0 : return 1;
134 : }
135 :
136 0 : if ( aliasNotFound )
137 : {
138 0 : Master()->Log(Form("WARNING %d aliases not found",aliasNotFound));
139 : }
140 :
141 0 : if ( valueNotFound )
142 : {
143 0 : Master()->Log(Form("WARNING %d values not found",valueNotFound));
144 : }
145 :
146 0 : Master()->Log("INFO Aliases successfully read in");
147 :
148 0 : AliCDBMetaData metaData;
149 0 : metaData.SetBeamPeriod(0);
150 0 : metaData.SetResponsible("MUON TRG");
151 0 : metaData.SetComment("Computed by AliMUONTriggerDCSSubprocessor $Id$");
152 :
153 : Bool_t validToInfinity(kFALSE);
154 :
155 0 : Bool_t result = Master()->Store("Calib","TriggerDCS",&dcsMap,&metaData,0,validToInfinity);
156 :
157 0 : return ( result != kTRUE); // return 0 if everything is ok
158 0 : }
159 :
|