]>
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 | ||
20 | // This macro runs the test preprocessor | |
21 | // It uses AliTestShuttle to simulate a full Shuttle process | |
22 | ||
23 | // The input data is created in the functions | |
24 | // CreateDCSAliasMap() creates input that would in the same way come from DCS | |
25 | // ReadDCSAliasMap() reads from a file | |
26 | // CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle | |
27 | // | |
28 | // According to SHUTTLE/TestShuttle/TestPreprocessor.C | |
29 | // By Laurent Aphecetche, SUBATECH Nantes | |
30 | ||
31 | #include "AliCDBManager.h" | |
32 | #include "AliShuttleInterface.h" | |
33 | #include "AliCDBId.h" | |
34 | #include "AliTestShuttle.h" | |
35 | #include "TMap.h" | |
36 | #include "Riostream.h" | |
37 | #include "TSystem.h" | |
38 | #include "AliMpExMap.h" | |
39 | #include "TMap.h" | |
40 | #include "TString.h" | |
41 | #include "TObjArray.h" | |
42 | #include "AliMpHelper.h" | |
43 | #include "AliDCSValue.h" | |
44 | #include "TObjString.h" | |
45 | #include "TRandom.h" | |
46 | #include "AliMUONPreprocessor.h" | |
47 | #include "AliCDBEntry.h" | |
48 | #endif | |
49 | ||
50 | void TestMUONPreprocessor() | |
51 | { | |
52 | // load library | |
53 | gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so"); | |
038d1637 | 54 | gSystem->Load("libMUONshuttle.so"); |
ea199e33 | 55 | |
56 | // initialize location of CDB | |
57 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB"); | |
58 | ||
59 | // create AliTestShuttle instance | |
60 | // The parameters are run, startTime, endTime | |
61 | AliTestShuttle* shuttle = new AliTestShuttle(800, 0, 1); | |
62 | ||
63 | // TODO(1) | |
64 | // | |
65 | // The shuttle can read DCS data, if the preprocessor should be tested to process DCS data, | |
66 | // some fake data has to be created. | |
67 | // | |
68 | // The "fake" input data can be taken using either (a) or (b): | |
69 | // (a) data from a file: Use ReadDCSAliasMap() | |
70 | // the format of the file is explained in ReadDCSAliasMap() | |
71 | // To use it uncomment the following line: | |
72 | // | |
73 | // TMap* dcsAliasMap = ReadDCSAliasMap(); | |
74 | // | |
75 | // (b) generated in this macro: Use CreateDCSAliasMap() and its documentation | |
76 | // To use it uncomment the following line: | |
77 | // | |
78 | // TMap* dcsAliasMap = CreateDCSAliasMap(); | |
79 | ||
80 | // now give the alias map to the shuttle | |
81 | // shuttle->SetDCSInput(dcsAliasMap); | |
82 | ||
83 | // TODO(2) | |
84 | // | |
85 | // The shuttle can also process files that originate from DCS, DAQ and HLT. | |
86 | // To test it, we provide some local files and locations where these would be found when | |
87 | // the online machinery would be there. | |
88 | // In real life this functions would be produces by the sub-detectors | |
89 | // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle. | |
90 | // | |
91 | // Files are added with the function AliTestShuttle::AddInputFile. The syntax is: | |
92 | // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>) | |
93 | // In this example we add a file originating from the GDC with the id PEDESTALS | |
94 | // Three files originating from different LDCs but with the same id are also added | |
95 | // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "PEDESTALS", "GDC", "file1.root"); | |
96 | // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC0", "file2a.root"); | |
97 | // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC1", "file2b.root"); | |
98 | // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC2", "file2b.root"); | |
99 | ||
038d1637 | 100 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped"); |
101 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped"); | |
102 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped"); | |
103 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped"); | |
ea199e33 | 104 | |
038d1637 | 105 | shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root"); |
106 | ||
ea199e33 | 107 | // TODO(3) |
108 | // Create the preprocessor that should be tested, it registers itself automatically to the shuttle | |
109 | // AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle); | |
038d1637 | 110 | new AliMUONPreprocessor("MCH", shuttle); |
ea199e33 | 111 | |
112 | shuttle->Print(); | |
113 | ||
114 | // Test the preprocessor | |
115 | shuttle->Process(); | |
116 | ||
117 | // TODO(4) | |
118 | // In the preprocessor AliShuttleInterface::Store should be called to put the final | |
119 | // data to the CDB. To check if all went fine have a look at the files produced in | |
120 | // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data | |
121 | // | |
122 | // Check the file which should have been created | |
123 | // AliCDBEntry* entry = AliCDBManager::Instance()->Get("DET/SHUTTLE/Data", 7); | |
124 | // if (!entry) | |
125 | // { | |
126 | // printf("The file is not there. Something went wrong.\n"); | |
127 | // return; | |
128 | // } | |
129 | // | |
130 | // AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject()); | |
131 | // // If everything went fine, draw the result | |
132 | // if (output) | |
133 | // output->Draw(); | |
134 | } |