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");
54 gSystem->Load("libMUONshuttle.so");
56 // initialize location of CDB
57 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
59 // create AliTestShuttle instance
60 // The parameters are run, startTime, endTime
61 AliTestShuttle* shuttle = new AliTestShuttle(800, 0, 1);
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.
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:
73 // TMap* dcsAliasMap = ReadDCSAliasMap();
75 // (b) generated in this macro: Use CreateDCSAliasMap() and its documentation
76 // To use it uncomment the following line:
78 // TMap* dcsAliasMap = CreateDCSAliasMap();
80 // now give the alias map to the shuttle
81 // shuttle->SetDCSInput(dcsAliasMap);
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.
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");
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");
105 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MCH","GMS","GMS","$ALICE_ROOT/MUON/data/GMS.root");
108 // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
109 // AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle);
110 new AliMUONPreprocessor("MCH", shuttle);
114 // Test the preprocessor
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
122 // Check the file which should have been created
123 // AliCDBEntry* entry = AliCDBManager::Instance()->Get("DET/SHUTTLE/Data", 7);
126 // printf("The file is not there. Something went wrong.\n");
130 // AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject());
131 // // If everything went fine, draw the result