]>
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" |
ea199e33 | 36 | #include "AliCDBManager.h" |
37 | #include "AliShuttleInterface.h" | |
38 | #include "AliCDBId.h" | |
39 | #include "AliTestShuttle.h" | |
40 | #include "TMap.h" | |
41 | #include "Riostream.h" | |
42 | #include "TSystem.h" | |
43 | #include "AliMpExMap.h" | |
44 | #include "TMap.h" | |
45 | #include "TString.h" | |
46 | #include "TObjArray.h" | |
47 | #include "AliMpHelper.h" | |
48 | #include "AliDCSValue.h" | |
49 | #include "TObjString.h" | |
50 | #include "TRandom.h" | |
51 | #include "AliMUONPreprocessor.h" | |
52 | #include "AliCDBEntry.h" | |
608c3123 | 53 | #include "AliMUONHVNamer.h" |
ea199e33 | 54 | #endif |
55 | ||
608c3123 | 56 | void TestMUONPreprocessor(Int_t runNumber=1500) |
ea199e33 | 57 | { |
58 | // load library | |
59 | gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so"); | |
038d1637 | 60 | gSystem->Load("libMUONshuttle.so"); |
ea199e33 | 61 | |
62 | // initialize location of CDB | |
63 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB"); | |
64 | ||
65 | // create AliTestShuttle instance | |
66 | // The parameters are run, startTime, endTime | |
608c3123 | 67 | AliTestShuttle* shuttle = new AliTestShuttle(runNumber, 0, 1); |
ea199e33 | 68 | |
608c3123 | 69 | // Create DCS HV aliases |
70 | TMap* dcsAliasMap = CreateDCSAliasMap(); | |
ea199e33 | 71 | |
72 | // now give the alias map to the shuttle | |
608c3123 | 73 | shuttle->SetDCSInput(dcsAliasMap); |
ea199e33 | 74 | |
608c3123 | 75 | // The shuttle can process files that originate from DCS, DAQ and HLT. |
ea199e33 | 76 | // To test it, we provide some local files and locations where these would be found when |
77 | // the online machinery would be there. | |
78 | // In real life this functions would be produces by the sub-detectors | |
79 | // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle. | |
80 | // | |
81 | // Files are added with the function AliTestShuttle::AddInputFile. The syntax is: | |
82 | // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>) | |
608c3123 | 83 | // In this example we add 4 files originating from different LDCs but with the same id (PEDESTALS) |
ea199e33 | 84 | |
038d1637 | 85 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped"); |
86 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped"); | |
87 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped"); | |
88 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped"); | |
ea199e33 | 89 | |
608c3123 | 90 | // and GMS file |
038d1637 | 91 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root"); |
92 | ||
608c3123 | 93 | // The shuttle can read run parameters stored in the DAQ run logbook. |
94 | // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor | |
95 | // using GetRunParameter function. | |
96 | // In real life the parameters will be retrieved automatically from the run logbook; | |
97 | shuttle->AddInputRunParameter("RunType", "PEDESTAL_RUN"); | |
98 | // shuttle->AddInputRunParameter("RunType", "PHYSICS"); | |
99 | // PEDESTAL_RUN -> pedestals | |
100 | // ELECTRONICS_CALIBRATION_RUN -> gains | |
101 | // PHYSICS ? -> HV | |
102 | ||
ea199e33 | 103 | // Create the preprocessor that should be tested, it registers itself automatically to the shuttle |
038d1637 | 104 | new AliMUONPreprocessor("MCH", shuttle); |
ea199e33 | 105 | |
106 | shuttle->Print(); | |
107 | ||
108 | // Test the preprocessor | |
109 | shuttle->Process(); | |
608c3123 | 110 | } |
ea199e33 | 111 | |
608c3123 | 112 | TMap* CreateDCSAliasMap() |
113 | { | |
114 | /// Creates a DCS structure for MUON Tracker HV | |
115 | /// | |
116 | /// The structure is the following: | |
117 | /// TMap (key --> value) | |
118 | /// <DCSAlias> --> <valueList> | |
119 | /// <DCSAlias> is a string | |
120 | /// <valueList> is a TObjArray of AliDCSValue | |
121 | /// An AliDCSValue consists of timestamp and a value in form of a AliSimpleValue | |
122 | ||
123 | TMap* aliasMap = new TMap; | |
124 | aliasMap->SetOwner(kTRUE); | |
125 | ||
126 | TRandom random(0); | |
127 | ||
128 | AliMUONHVNamer hvNamer; | |
129 | ||
130 | TObjArray* aliases = hvNamer.GenerateAliases(); | |
131 | ||
132 | for ( Int_t i = 0; i < aliases->GetEntries(); ++i ) | |
133 | { | |
134 | TObjString* alias = static_cast<TObjString*>(aliases->At(i)); | |
135 | TString& aliasName = alias->String(); | |
136 | if ( aliasName.Contains("sw") ) | |
137 | { | |
138 | // HV Switch (St345 only) | |
139 | TObjArray* valueSet = new TObjArray; | |
140 | valueSet->SetOwner(kTRUE); | |
141 | Bool_t value = kTRUE; | |
142 | // Float_t r = random.Uniform(); | |
143 | // if ( r < 0.007 ) value = kFALSE; | |
144 | // if ( aliasName.Contains("DE513sw2") ) value = kFALSE; | |
145 | ||
146 | for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 ) | |
147 | { | |
148 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); | |
149 | valueSet->Add(dcsValue); | |
150 | } | |
151 | aliasMap->Add(new TObjString(*alias),valueSet); | |
152 | } | |
153 | else | |
154 | { | |
155 | TObjArray* valueSet = new TObjArray; | |
156 | valueSet->SetOwner(kTRUE); | |
157 | for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 ) | |
158 | { | |
159 | Float_t value = random.Gaus(1750,62.5); | |
160 | if ( aliasName == "MchHvLvLeft/Chamber01Left/Quad3Sect2.actual.vMon") value = 500; | |
161 | // if ( aliasName == "MchHvLvLeft/Chamber05Left/Slat07.actual.vMon") value = 1300; | |
162 | // if ( aliasName == "MchHvLvLeft/Chamber05Left/Slat03.actual.vMon") value = 2500; | |
163 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); | |
164 | valueSet->Add(dcsValue); | |
165 | } | |
166 | aliasMap->Add(new TObjString(*alias),valueSet); | |
167 | } | |
168 | } | |
169 | ||
170 | delete aliases; | |
171 | ||
172 | return aliasMap; | |
ea199e33 | 173 | } |
608c3123 | 174 |