]>
Commit | Line | Data |
---|---|---|
ea199e33 | 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 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
19 | ||
608c3123 | 20 | /// This macro runs the test preprocessor for MUON. |
21 | /// It uses AliTestShuttle to simulate a full Shuttle process | |
22 | /// | |
23 | /// The input data has to be created first by other processes (or is created | |
24 | /// here by CreateDCSAliasMap() for tracker HV). | |
25 | /// | |
26 | /// To play with it, you'll have to set/modify several lines, to | |
27 | /// a) select input files, using shuttle->AddInputFile() | |
28 | /// b) select run type, using shuttle->AddInputRunParameter() (the run type | |
29 | /// dictates which task is really performed by the MUONPreprocessor | |
30 | /// | |
31 | /// For more information on usage, please see READMEshuttle. | |
32 | /// | |
ea199e33 | 33 | // By Laurent Aphecetche, SUBATECH Nantes |
34 | ||
608c3123 | 35 | #include "TestMUONPreprocessor.h" |
8a2055e0 | 36 | |
37 | #include "AliMUONTrackerPreprocessor.h" | |
38 | #include "AliMUONHVNamer.h" | |
39 | ||
40 | #include "AliMpExMap.h" | |
41 | #include "AliMpHelper.h" | |
42 | #include "AliMpCDB.h" | |
43 | ||
ea199e33 | 44 | #include "AliCDBManager.h" |
8a2055e0 | 45 | #include "AliCDBEntry.h" |
ea199e33 | 46 | #include "AliCDBId.h" |
8a2055e0 | 47 | #include "AliShuttleInterface.h" |
ea199e33 | 48 | #include "AliTestShuttle.h" |
8a2055e0 | 49 | #include "AliDCSValue.h" |
50 | ||
ea199e33 | 51 | #include "Riostream.h" |
52 | #include "TSystem.h" | |
ea199e33 | 53 | #include "TMap.h" |
ea199e33 | 54 | #include "TObjArray.h" |
ea199e33 | 55 | #include "TObjString.h" |
8a2055e0 | 56 | #include "TString.h" |
ea199e33 | 57 | #include "TRandom.h" |
ea199e33 | 58 | #endif |
59 | ||
f37df338 | 60 | void TestMUONPreprocessor(Int_t runNumber=80, const char* runType="PEDESTAL_RUN") |
ea199e33 | 61 | { |
f37df338 | 62 | // runType can be : |
63 | // | |
64 | // PEDESTAL_RUN -> pedestals | |
65 | // ELECTRONICS_CALIBRATION_RUN -> gains | |
66 | // PHYSICS -> HV | |
67 | // GMS | |
68 | ||
ea199e33 | 69 | // load library |
70 | gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so"); | |
038d1637 | 71 | gSystem->Load("libMUONshuttle.so"); |
ea199e33 | 72 | |
ea199e33 | 73 | // create AliTestShuttle instance |
74 | // The parameters are run, startTime, endTime | |
608c3123 | 75 | AliTestShuttle* shuttle = new AliTestShuttle(runNumber, 0, 1); |
ea199e33 | 76 | |
9e62d05d | 77 | |
78 | AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB"); | |
79 | AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference"); | |
80 | ||
81 | printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir()); | |
82 | printf("Test Shuttle log dir: %s\n", AliShuttleInterface::GetShuttleLogDir()); | |
83 | printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data()); | |
84 | printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data()); | |
85 | ||
608c3123 | 86 | // Create DCS HV aliases |
87 | TMap* dcsAliasMap = CreateDCSAliasMap(); | |
ea199e33 | 88 | |
89 | // now give the alias map to the shuttle | |
608c3123 | 90 | shuttle->SetDCSInput(dcsAliasMap); |
ea199e33 | 91 | |
608c3123 | 92 | // The shuttle can process files that originate from DCS, DAQ and HLT. |
ea199e33 | 93 | // To test it, we provide some local files and locations where these would be found when |
94 | // the online machinery would be there. | |
95 | // In real life this functions would be produces by the sub-detectors | |
96 | // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle. | |
97 | // | |
98 | // Files are added with the function AliTestShuttle::AddInputFile. The syntax is: | |
99 | // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>) | |
608c3123 | 100 | // In this example we add 4 files originating from different LDCs but with the same id (PEDESTALS) |
ea199e33 | 101 | |
038d1637 | 102 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped"); |
103 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped"); | |
104 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped"); | |
105 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped"); | |
ea199e33 | 106 | |
f37df338 | 107 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC0","$ALICE_ROOT/MUON/data/LDC0.gain"); |
108 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC1","$ALICE_ROOT/MUON/data/LDC1.gain"); | |
109 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC2","$ALICE_ROOT/MUON/data/LDC2.gain"); | |
110 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GAINS","LDC3","$ALICE_ROOT/MUON/data/LDC3.gain"); | |
505bc496 | 111 | |
608c3123 | 112 | // and GMS file |
923a4baf | 113 | shuttle->AddInputFile(AliTestShuttle::kDCS,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root"); |
038d1637 | 114 | |
608c3123 | 115 | // The shuttle can read run parameters stored in the DAQ run logbook. |
116 | // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor | |
117 | // using GetRunParameter function. | |
118 | // In real life the parameters will be retrieved automatically from the run logbook; | |
f37df338 | 119 | shuttle->SetInputRunType(runType); |
608c3123 | 120 | |
ea199e33 | 121 | // Create the preprocessor that should be tested, it registers itself automatically to the shuttle |
9e62d05d | 122 | new AliMUONTrackerPreprocessor(shuttle); |
ea199e33 | 123 | |
124 | shuttle->Print(); | |
125 | ||
126 | // Test the preprocessor | |
127 | shuttle->Process(); | |
608c3123 | 128 | } |
ea199e33 | 129 | |
608c3123 | 130 | TMap* CreateDCSAliasMap() |
131 | { | |
132 | /// Creates a DCS structure for MUON Tracker HV | |
133 | /// | |
134 | /// The structure is the following: | |
135 | /// TMap (key --> value) | |
136 | /// <DCSAlias> --> <valueList> | |
137 | /// <DCSAlias> is a string | |
138 | /// <valueList> is a TObjArray of AliDCSValue | |
139 | /// An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue | |
140 | ||
ba55f1e6 | 141 | // Load mapping from CDB |
142 | AliMpCDB::LoadMpSegmentation(); | |
143 | AliMpCDB::LoadDDLStore(); | |
144 | ||
608c3123 | 145 | TMap* aliasMap = new TMap; |
146 | aliasMap->SetOwner(kTRUE); | |
147 | ||
148 | TRandom random(0); | |
149 | ||
150 | AliMUONHVNamer hvNamer; | |
151 | ||
152 | TObjArray* aliases = hvNamer.GenerateAliases(); | |
153 | ||
154 | for ( Int_t i = 0; i < aliases->GetEntries(); ++i ) | |
155 | { | |
156 | TObjString* alias = static_cast<TObjString*>(aliases->At(i)); | |
157 | TString& aliasName = alias->String(); | |
158 | if ( aliasName.Contains("sw") ) | |
159 | { | |
160 | // HV Switch (St345 only) | |
161 | TObjArray* valueSet = new TObjArray; | |
162 | valueSet->SetOwner(kTRUE); | |
163 | Bool_t value = kTRUE; | |
164 | // Float_t r = random.Uniform(); | |
165 | // if ( r < 0.007 ) value = kFALSE; | |
166 | // if ( aliasName.Contains("DE513sw2") ) value = kFALSE; | |
167 | ||
168 | for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 ) | |
169 | { | |
170 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); | |
171 | valueSet->Add(dcsValue); | |
172 | } | |
173 | aliasMap->Add(new TObjString(*alias),valueSet); | |
174 | } | |
175 | else | |
176 | { | |
177 | TObjArray* valueSet = new TObjArray; | |
178 | valueSet->SetOwner(kTRUE); | |
179 | for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 ) | |
180 | { | |
181 | Float_t value = random.Gaus(1750,62.5); | |
59679117 | 182 | if ( aliasName == "MchHvLvLeft/Chamber00Left/Quad2Sect1.actual.vMon") value = 500; |
608c3123 | 183 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); |
184 | valueSet->Add(dcsValue); | |
185 | } | |
59679117 | 186 | if ( aliasName == "MchHvLvLeft/Chamber04Left/Slat06.actual.vMon" ) continue; |
608c3123 | 187 | aliasMap->Add(new TObjString(*alias),valueSet); |
188 | } | |
189 | } | |
190 | ||
191 | delete aliases; | |
192 | ||
193 | return aliasMap; | |
ea199e33 | 194 | } |
608c3123 | 195 |