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