]>
Commit | Line | Data |
---|---|---|
45824ef1 | 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 | /// \class AliMUONHVSubprocessor | |
18 | /// | |
19 | /// A subprocessor to read HV values for one run | |
20 | /// | |
21 | /// It simply creates a copy of the dcsAliasMap w/o information | |
22 | /// from the MUON TRK, and dumps this copy into the CDB | |
23 | /// | |
78649106 | 24 | /// \author Laurent Aphecetche, Subatech |
45824ef1 | 25 | |
26 | #include "AliMUONHVSubprocessor.h" | |
27 | #include "AliMUONHVNamer.h" | |
28 | #include "AliMUONPreprocessor.h" | |
29 | ||
30 | #include "AliMpDEIterator.h" | |
31 | #include "AliMpDEManager.h" | |
32 | ||
33 | #include "AliCDBMetaData.h" | |
34 | #include "AliLog.h" | |
35 | ||
36 | #include "Riostream.h" | |
37 | #include "TMap.h" | |
38 | #include "TObjString.h" | |
39 | ||
40 | /// \cond CLASSIMP | |
41 | ClassImp(AliMUONHVSubprocessor) | |
42 | /// \endcond | |
43 | ||
44 | //_____________________________________________________________________________ | |
45 | AliMUONHVSubprocessor::AliMUONHVSubprocessor(AliMUONPreprocessor* master) | |
46 | : AliMUONVSubprocessor(master, | |
47 | "HV", | |
48 | "Get MUON Tracker HV values from DCS") | |
49 | { | |
50 | /// ctor | |
51 | } | |
52 | ||
53 | //_____________________________________________________________________________ | |
54 | AliMUONHVSubprocessor::~AliMUONHVSubprocessor() | |
55 | { | |
56 | /// dtor | |
57 | } | |
58 | ||
45824ef1 | 59 | //_____________________________________________________________________________ |
60 | UInt_t | |
61 | AliMUONHVSubprocessor::Process(TMap* dcsAliasMap) | |
62 | { | |
63 | /// Make another alias map from dcsAliasMap, considering only MUON TRK aliases. | |
64 | ||
65 | TMap hv; | |
66 | hv.SetOwner(kTRUE); | |
67 | ||
68 | AliMUONHVNamer hvNamer; | |
69 | ||
70 | AliMpDEIterator deIt; | |
71 | ||
72 | deIt.First(); | |
73 | ||
74 | TObjArray aliases; | |
75 | aliases.SetOwner(kTRUE); | |
76 | ||
77 | // we first generate a list of expected MCH DCS aliases we'll then look for | |
78 | ||
79 | while ( !deIt.IsDone() ) | |
80 | { | |
81 | Int_t detElemId = deIt.CurrentDEId(); | |
82 | ||
83 | switch ( AliMpDEManager::GetStationType(detElemId) ) | |
84 | { | |
85 | case AliMp::kStation1: | |
86 | case AliMp::kStation2: | |
87 | { | |
88 | for ( int i = 0; i <3; ++i) | |
89 | { | |
90 | aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i))); | |
91 | } | |
92 | } | |
93 | break; | |
94 | case AliMp::kStation345: | |
95 | { | |
96 | aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId))); | |
97 | for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i) | |
98 | { | |
99 | aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i))); | |
100 | } | |
101 | } | |
102 | break; | |
103 | default: | |
104 | break; | |
105 | }; | |
106 | ||
107 | deIt.Next(); | |
108 | } | |
109 | ||
110 | TIter next(&aliases); | |
111 | TObjString* alias; | |
c75c6131 | 112 | Bool_t kNoAliases(kTRUE); |
113 | Int_t aliasNotFound(0); | |
114 | Int_t valueNotFound(0); | |
45824ef1 | 115 | |
116 | while ( ( alias = static_cast<TObjString*>(next()) ) ) | |
117 | { | |
118 | TString aliasName(alias->String()); | |
119 | TPair* hvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data())); | |
120 | if (!hvPair) | |
121 | { | |
c75c6131 | 122 | ++aliasNotFound; |
45824ef1 | 123 | } |
124 | else | |
125 | { | |
bec1918d | 126 | kNoAliases = kFALSE; |
45824ef1 | 127 | TObjArray* values = static_cast<TObjArray*>(hvPair->Value()); |
128 | if (!values) | |
129 | { | |
c75c6131 | 130 | ++valueNotFound; |
45824ef1 | 131 | } |
132 | else | |
133 | { | |
134 | //FIXME : should insure here that values are only the ones within run | |
135 | //limits (startTime<timestamp<endTime) | |
136 | hv.Add(new TObjString(aliasName.Data()),values); | |
137 | } | |
138 | } | |
c75c6131 | 139 | } |
140 | ||
141 | if ( kNoAliases ) | |
142 | { | |
143 | Master()->Log("ERROR : no DCS values found"); | |
d489129d | 144 | return 1; |
c75c6131 | 145 | } |
146 | ||
147 | if ( aliasNotFound ) | |
148 | { | |
149 | Master()->Log(Form("WARNING %d aliases not found",aliasNotFound)); | |
150 | } | |
151 | ||
152 | if ( valueNotFound ) | |
153 | { | |
154 | Master()->Log(Form("WARNING %d values not found",valueNotFound)); | |
45824ef1 | 155 | } |
156 | ||
c75c6131 | 157 | Master()->Log("INFO Aliases successfully read in"); |
d3f57575 | 158 | |
45824ef1 | 159 | AliCDBMetaData metaData; |
160 | metaData.SetBeamPeriod(0); | |
161 | metaData.SetResponsible("MUON TRK"); | |
162 | metaData.SetComment("Computed by AliMUONHVSubprocessor $Id$"); | |
163 | ||
164 | Bool_t validToInfinity(kFALSE); | |
165 | ||
d489129d | 166 | Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity); |
45824ef1 | 167 | |
d489129d | 168 | return ( result != kTRUE); // return 0 if everything is ok |
45824ef1 | 169 | } |
170 |