1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #if !defined(__CINT__) || defined(__MAKECINT__)
20 // This macro runs the test preprocessor
21 // It uses AliTestShuttle to simulate a full Shuttle process
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
28 // According to SHUTTLE/TestShuttle/TestPreprocessor.C
29 // By Laurent Aphecetche, SUBATECH Nantes
31 #include "AliCDBManager.h"
32 #include "AliShuttleInterface.h"
34 #include "AliTestShuttle.h"
36 #include "Riostream.h"
38 #include "AliMpExMap.h"
41 #include "TObjArray.h"
42 #include "AliMpHelper.h"
43 #include "AliDCSValue.h"
44 #include "TObjString.h"
46 #include "AliMUONPreprocessor.h"
47 #include "AliCDBEntry.h"
50 void TestMUONPreprocessor()
53 gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so");
55 // initialize location of CDB
56 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
58 // create AliTestShuttle instance
59 // The parameters are run, startTime, endTime
60 AliTestShuttle* shuttle = new AliTestShuttle(800, 0, 1);
64 // The shuttle can read DCS data, if the preprocessor should be tested to process DCS data,
65 // some fake data has to be created.
67 // The "fake" input data can be taken using either (a) or (b):
68 // (a) data from a file: Use ReadDCSAliasMap()
69 // the format of the file is explained in ReadDCSAliasMap()
70 // To use it uncomment the following line:
72 // TMap* dcsAliasMap = ReadDCSAliasMap();
74 // (b) generated in this macro: Use CreateDCSAliasMap() and its documentation
75 // To use it uncomment the following line:
77 // TMap* dcsAliasMap = CreateDCSAliasMap();
79 // now give the alias map to the shuttle
80 // shuttle->SetDCSInput(dcsAliasMap);
84 // The shuttle can also process files that originate from DCS, DAQ and HLT.
85 // To test it, we provide some local files and locations where these would be found when
86 // the online machinery would be there.
87 // In real life this functions would be produces by the sub-detectors
88 // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle.
90 // Files are added with the function AliTestShuttle::AddInputFile. The syntax is:
91 // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>)
92 // In this example we add a file originating from the GDC with the id PEDESTALS
93 // Three files originating from different LDCs but with the same id are also added
94 // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "PEDESTALS", "GDC", "file1.root");
95 // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC0", "file2a.root");
96 // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC1", "file2b.root");
97 // shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC2", "file2b.root");
99 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped");
100 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped");
101 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped");
102 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped");
105 // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
106 // AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle);
107 new AliMUONPreprocessor("MUON",shuttle);
111 // Test the preprocessor
115 // In the preprocessor AliShuttleInterface::Store should be called to put the final
116 // data to the CDB. To check if all went fine have a look at the files produced in
117 // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
119 // Check the file which should have been created
120 // AliCDBEntry* entry = AliCDBManager::Instance()->Get("DET/SHUTTLE/Data", 7);
123 // printf("The file is not there. Something went wrong.\n");
127 // AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject());
128 // // If everything went fine, draw the result